- Moved autoload initialization to a separate function so that the rest of the ini can be loaded as before. Some platforms do indeed place zdoom.pk3 elsewhere.

This commit is contained in:
Braden Obrzut 2015-04-27 14:15:03 -04:00
parent 98029a12ec
commit 9ba5e30bed
5 changed files with 34 additions and 26 deletions

View file

@ -1981,6 +1981,9 @@ static void D_DoomInit()
} }
FRandom::StaticClearRandom (); FRandom::StaticClearRandom ();
Printf ("M_LoadDefaults: Load system defaults.\n");
M_LoadDefaults (); // load before initing other systems
} }
//========================================================================== //==========================================================================
@ -2247,8 +2250,8 @@ void D_DoomMain (void)
iwad_man = new FIWadManager; iwad_man = new FIWadManager;
iwad_man->ParseIWadInfos(basewad); iwad_man->ParseIWadInfos(basewad);
Printf ("M_LoadDefaults: Load system defaults.\n"); // Now that we have the IWADINFO, initialize the autoload ini sections.
M_LoadDefaults (iwad_man); // load before initing other systems GameConfig->DoAutoloadSetup(iwad_man);
PClass::StaticInit (); PClass::StaticInit ();
atterm(FinalGC); atterm(FinalGC);

View file

@ -76,7 +76,7 @@ EXTERN_CVAR (Color, am_cdwallcolor)
EXTERN_CVAR (Float, spc_amp) EXTERN_CVAR (Float, spc_amp)
EXTERN_CVAR (Bool, wi_percents) EXTERN_CVAR (Bool, wi_percents)
FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man) FGameConfigFile::FGameConfigFile ()
{ {
#ifdef __APPLE__ #ifdef __APPLE__
FString user_docs, user_app_support, local_app_support; FString user_docs, user_app_support, local_app_support;
@ -161,6 +161,27 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man)
SetValueForKey ("Path", "$DOOMWADDIR", true); SetValueForKey ("Path", "$DOOMWADDIR", true);
} }
// Add some self-documentation.
SetSectionNote("IWADSearch.Directories",
"# These are the directories to automatically search for IWADs.\n"
"# Each directory should be on a separate line, preceded by Path=\n");
SetSectionNote("FileSearch.Directories",
"# These are the directories to search for wads added with the -file\n"
"# command line parameter, if they cannot be found with the path\n"
"# as-is. Layout is the same as for IWADSearch.Directories\n");
}
FGameConfigFile::~FGameConfigFile ()
{
}
void FGameConfigFile::WriteCommentHeader (FILE *file) const
{
fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime());
}
void FGameConfigFile::DoAutoloadSetup (FIWadManager *iwad_man)
{
// Create auto-load sections, so users know what's available. // Create auto-load sections, so users know what's available.
// Note that this totem pole is the reverse of the order that // Note that this totem pole is the reverse of the order that
// they will appear in the file. // they will appear in the file.
@ -220,14 +241,6 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man)
MoveSectionToStart("FileSearch.Directories"); MoveSectionToStart("FileSearch.Directories");
MoveSectionToStart("IWADSearch.Directories"); MoveSectionToStart("IWADSearch.Directories");
// Add some self-documentation.
SetSectionNote("IWADSearch.Directories",
"# These are the directories to automatically search for IWADs.\n"
"# Each directory should be on a separate line, preceded by Path=\n");
SetSectionNote("FileSearch.Directories",
"# These are the directories to search for wads added with the -file\n"
"# command line parameter, if they cannot be found with the path\n"
"# as-is. Layout is the same as for IWADSearch.Directories\n");
SetSectionNote("Doom.AutoExec", SetSectionNote("Doom.AutoExec",
"# Files to automatically execute when running the corresponding game.\n" "# Files to automatically execute when running the corresponding game.\n"
"# Each file should be on its own line, preceded by Path=\n\n"); "# Each file should be on its own line, preceded by Path=\n\n");
@ -245,15 +258,6 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man)
"# 'doom.doom2.commercial.Autoload' only when playing doom2.wad.\n\n"); "# 'doom.doom2.commercial.Autoload' only when playing doom2.wad.\n\n");
} }
FGameConfigFile::~FGameConfigFile ()
{
}
void FGameConfigFile::WriteCommentHeader (FILE *file) const
{
fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime());
}
void FGameConfigFile::DoGlobalSetup () void FGameConfigFile::DoGlobalSetup ()
{ {
if (SetSection ("GlobalSettings.Unknown")) if (SetSection ("GlobalSettings.Unknown"))

View file

@ -43,9 +43,10 @@ class FIWadManager;
class FGameConfigFile : public FConfigFile class FGameConfigFile : public FConfigFile
{ {
public: public:
FGameConfigFile (FIWadManager *iwad_man); FGameConfigFile ();
~FGameConfigFile (); ~FGameConfigFile ();
void DoAutoloadSetup (FIWadManager *iwad_man);
void DoGlobalSetup (); void DoGlobalSetup ();
void DoGameSetup (const char *gamename); void DoGameSetup (const char *gamename);
void DoKeySetup (const char *gamename); void DoKeySetup (const char *gamename);

View file

@ -410,9 +410,9 @@ CCMD (writeini)
// M_LoadDefaults // M_LoadDefaults
// //
void M_LoadDefaults (FIWadManager *iwad_man) void M_LoadDefaults ()
{ {
GameConfig = new FGameConfigFile(iwad_man); GameConfig = new FGameConfigFile;
GameConfig->DoGlobalSetup (); GameConfig->DoGlobalSetup ();
atterm (M_SaveDefaultsFinal); atterm (M_SaveDefaultsFinal);
} }

View file

@ -41,7 +41,7 @@ void M_FindResponseFile (void);
// Pass a NULL to get the original behavior. // Pass a NULL to get the original behavior.
void M_ScreenShot (const char *filename); void M_ScreenShot (const char *filename);
void M_LoadDefaults (FIWadManager *iwad_man); void M_LoadDefaults ();
bool M_SaveDefaults (const char *filename); bool M_SaveDefaults (const char *filename);
void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, size_t sublen); void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, size_t sublen);