summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/doom/m_misc.c21
-rw-r--r--apps/plugins/doom/rockmacros.h9
2 files changed, 29 insertions, 1 deletions
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c
index 43e2a3888b..d3e6098b5d 100644
--- a/apps/plugins/doom/m_misc.c
+++ b/apps/plugins/doom/m_misc.c
@@ -797,11 +797,16 @@ int numdefaults;
797void M_SaveDefaults (void) 797void M_SaveDefaults (void)
798{ 798{
799 int i,fd; 799 int i,fd;
800 uint32_t magic = DOOM_CONFIG_MAGIC;
801 uint32_t ver = DOOM_CONFIG_VERSION;
800 802
801 fd = open (GAMEBASE"default.dfg", O_WRONLY|O_CREAT|O_TRUNC); 803 fd = open (GAMEBASE"default.dfg", O_WRONLY|O_CREAT|O_TRUNC);
802 if (fd<0) 804 if (fd<0)
803 return; // can't write the file, but don't complain 805 return; // can't write the file, but don't complain
804 806
807 write(fd,&magic,sizeof(magic));
808 write(fd,&ver,sizeof(ver));
809
805 for (i=0 ; i<numdefaults ; i++) 810 for (i=0 ; i<numdefaults ; i++)
806 if(defaults[i].location.pi) 811 if(defaults[i].location.pi)
807 write(fd,defaults[i].location.pi, sizeof(int)); 812 write(fd,defaults[i].location.pi, sizeof(int));
@@ -833,7 +838,9 @@ struct default_s *M_LookupDefault(const char *name)
833 838
834void M_LoadDefaults (void) 839void M_LoadDefaults (void)
835{ 840{
836 int i; 841 int i;
842 uint32_t magic = 0;
843 uint32_t ver;
837 int fd; 844 int fd;
838 // set everything to base values 845 // set everything to base values
839 846
@@ -849,6 +856,18 @@ void M_LoadDefaults (void)
849 if (fd<0) 856 if (fd<0)
850 return; // don't have anything to read 857 return; // don't have anything to read
851 858
859 read(fd,&magic,sizeof(magic));
860 if (magic != DOOM_CONFIG_MAGIC) {
861 close(fd);
862 return;
863 }
864
865 read(fd,&ver,sizeof(ver));
866 if (ver != DOOM_CONFIG_VERSION) {
867 close(fd);
868 return;
869 }
870
852 for (i=0 ; i<numdefaults ; i++) 871 for (i=0 ; i<numdefaults ; i++)
853 if(defaults[i].location.pi) 872 if(defaults[i].location.pi)
854 read(fd,defaults[i].location.pi, sizeof(int)); 873 read(fd,defaults[i].location.pi, sizeof(int));
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 8f028d4893..047fa24bf9 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -91,4 +91,13 @@ inline void* memcpy(void* dst, const void* src, size_t size);
91#define NO_PREDEFINED_LUMPS 91#define NO_PREDEFINED_LUMPS
92#define TABLES_AS_LUMPS // This frees up alot of space in the plugin buffer 92#define TABLES_AS_LUMPS // This frees up alot of space in the plugin buffer
93//#define FANCY_MENU // This is a call to allow load_main_backdrop to run in doom 93//#define FANCY_MENU // This is a call to allow load_main_backdrop to run in doom
94
95#define MAKE_FOURCC(a,b,c,d) (uint32_t)((((a)<<24)|((b)<<16)|((c)<<8)|(d)))
96
97/* Config file magic - increment the version number whenever the settings
98 structure changes.
99 */
100#define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
101#define DOOM_CONFIG_VERSION 1
102
94#endif 103#endif