From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from felloff.net ([216.126.196.34]) by ur; Thu Jul 30 14:31:02 EDT 2015 Message-ID: List-ID: <9front.9front.org> X-Glyph: ➈ X-Bullshit: realtime-java-scale lifecycle rich-client optimizer Date: Thu, 30 Jul 2015 20:30:52 +0200 From: cinap_lenrek@felloff.net To: 9front@9front.org Subject: Re: [9front] games/doom: fix config file never being loaded or saved In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit this can be done better in IdentifyVersion(), where it even used to set basedefault[]. diff -r b357d5b16135 sys/src/games/doom/d_main.c --- a/sys/src/games/doom/d_main.c Thu Jul 30 20:02:23 2015 +0200 +++ b/sys/src/games/doom/d_main.c Thu Jul 30 20:28:13 2015 +0200 @@ -563,7 +563,7 @@ // void IdentifyVersion (void) { - char *wadfile; + char *wadfile, *slash; if (M_CheckParm ("-shdev")) { @@ -615,35 +615,35 @@ language = french; printf("French version\n"); D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("doom2.wad")) ) { gamemode = commercial; D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("plutonia.wad")) ) { gamemode = commercial; D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("tnt.wad")) ) { gamemode = commercial; D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("doomu.wad")) ) { gamemode = retail; D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("doom.wad")) ) { gamemode = registered; D_AddFile (wadfile); - return; } else if ( (wadfile = I_IdentifyWAD("doom1.wad")) ) { gamemode = shareware; D_AddFile (wadfile); - return; } else { printf("Game mode indeterminate.\n"); gamemode = indetermined; + return; } + strncpy(basedefault, wadfile, sizeof(basedefault)-5); + basedefault[sizeof(basedefault)-5] = '\0'; + slash = strrchr(basedefault, '/'); + if (slash++ == 0) + slash = basedefault; + strcpy(slash, "cfg"); } // -- cinap