Here is patch.  Works on windows.  Going to reset to linux to test. 
 Should work now for both.

I added  resetConfig() routine, but I am not sure of default case 
should be?   




Index: lib/framework/configfile.c
===================================================================
--- lib/framework/configfile.c  (revision 862)
+++ lib/framework/configfile.c  (working copy)
@@ -186,12 +186,17 @@
                }
        } else {
                // Registry does not exist. Caller will write a new one.
+               debug(LOG_ERROR, "Registry file %s is not here! Recreating 
Defaults.", filename);
+               resetConfig();
+               registry_save("config");
                return FALSE;
        }
 
        debug(LOG_WZ, "Parsing the registry from %s", filename);
        if (filesize == 0 || strlen(bptr) == 0) {
-               debug(LOG_ERROR, "Registry file %s is empty!", filename);
+               debug(LOG_ERROR, "Registry file %s is empty!  Recreating 
defaults.", filename);
+               resetConfig();
+               registry_save("config");
                return FALSE;
        }
        bufstart = bptr;
Index: src/configuration.c
===================================================================
--- src/configuration.c (revision 862)
+++ src/configuration.c (working copy)
@@ -591,7 +591,65 @@
 
        return closeWarzoneKey();
 }
+void resetConfig(void)
+{
+       // //////////////////////////
+       // voicevol, fxvol and cdvol
+       setWarzoneKeyNumeric("voicevol", mixer_GetWavVolume());
+       setWarzoneKeyNumeric("fxvol", mixer_Get3dWavVolume());
+       setWarzoneKeyNumeric("cdvol", mixer_GetCDVolume());
+       setWarzoneKeyNumeric("playaudiocds", war_GetPlayAudioCDs());
 
+       setWarzoneKeyNumeric("width", pie_GetVideoBufferWidth());
+       setWarzoneKeyNumeric("height", pie_GetVideoBufferHeight());
+       setWarzoneKeyNumeric("bpp", pie_GetVideoBufferDepth());
+       setWarzoneKeyNumeric("fullscreen", war_getFullscreen());
+
+       // dont save out the cheat mode.
+       setDifficultyLevel(DL_NORMAL);
+
+       setWarzoneKeyNumeric("allowSubtitles", war_GetAllowSubtitles());
+       setWarzoneKeyNumeric("framerate", 30);
+       setWarzoneKeyNumeric("gamma", (SDWORD)gammaValue);
+       setWarzoneKeyNumeric("scroll",(SDWORD)scroll_speed_accel);              
// 
scroll
+       setWarzoneKeyNumeric("difficulty", getDifficultyLevel());               
// 
level
+       setWarzoneKeyNumeric("barmode",(SDWORD)barMode);                        
//energybars
+       setWarzoneKeyNumeric("visfog",(SDWORD)(!war_GetFog()));                 
// 
fogtype
+       setWarzoneKeyNumeric("shake",(SDWORD)(getShakeStatus()));               
// 
screenshake
+       
setWarzoneKeyNumeric("mouseflip",(SDWORD)(getInvertMouseStatus()));     
// flipmouse
+       setWarzoneKeyNumeric("shadows",(SDWORD)(getDrawShadows()));     // 
shadows
+       setWarzoneKeyNumeric("sound", (SDWORD)war_getSoundEnabled());
+       setWarzoneKeyNumeric("sequences",(SDWORD)(war_GetSeqMode()));           
// 
sequences
+       setWarzoneKeyNumeric("subtitles",(SDWORD)(seq_GetSubtitles()));         
// subtitles
+       
setWarzoneKeyNumeric("reopenBuild",(SDWORD)(intGetReopenBuild()));      
// build menu
+//     setWarzoneKeyNumeric("maxRoute",(SDWORD)(fpathGetMaxRoute()));          
        // maximum routing
+
+       
setWarzoneKeyNumeric("radarObjectMode",(SDWORD)bEnemyAllyRadarColor)
;    // enemy/allies radar view
+       setWarzoneKeyNumeric("radarTerrainMode",(SDWORD)radarDrawMode);
+
+
+               setWarzoneKeyNumeric("colour",(SDWORD)getPlayerColour(0));      
                // 
favourite colour.
+               memcpy(game.name,"Sk-Rush",sizeof("Sk-Rush"));
+               setWarzoneKeyString("mapName", game.name);                      
        //  map name
+               setWarzoneKeyString("gameName","Game name");
+               setWarzoneKeyNumeric("power", game.power);                      
// power
+               setWarzoneKeyNumeric("type", game.type);                        
        // game type
+               setWarzoneKeyNumeric("base", game.base);                        
        // size of base
+               setWarzoneKeyNumeric("fog", game.fog);                          
// fog 'o war
+               setWarzoneKeyNumeric("limit", game.limit);                      
// limits
+               setWarzoneKeyNumeric("maxPlay", game.maxPlayers);               
// max no of 
players
+               setWarzoneKeyNumeric("compPlay", game.bComputerPlayers);        
// 
allow pc players
+               setWarzoneKeyNumeric("alliance", game.alliance);                
        // allow 
alliances
+               setWarzoneKeyString("forceName", sForceName);                   
// force
+               setWarzoneKeyString("playerName",(char*)sPlayer);               
// player name
+               setWarzoneKeyString("phrase0", ingame.phrases[0]);      // 
phrases
+               setWarzoneKeyString("phrase1", ingame.phrases[1]);
+               setWarzoneKeyString("phrase2", ingame.phrases[2]);
+               setWarzoneKeyString("phrase3", ingame.phrases[3]);
+               setWarzoneKeyString("phrase4", ingame.phrases[4]);
+       
+
+}
 void closeConfig( void )
 {
        registry_clear();
Index: src/configuration.h
===================================================================
--- src/configuration.h (revision 862)
+++ src/configuration.h (working copy)
@@ -26,3 +26,4 @@
 extern BOOL loadRenderMode(void);
 extern BOOL saveConfig(void);
 extern void closeConfig( void );
+extern void resetConfig(void);
\ No newline at end of file

--
Click for military loan, fast & no lender fee, approval today
http://tagline.hushmail.com/fc/CAaCXv1QZIg6RtNqmnxpjBHvHGdjkHWk/



_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to