- read the global settings before presenting the game selection dialog

- deinit the menu in GameMain instead of using atexit.
- gi == null check must include the call to FreeGameData.
This commit is contained in:
Christoph Oelckers 2019-12-24 20:06:55 +01:00
parent 055b310d60
commit 49c49b2672
4 changed files with 11 additions and 10 deletions

View file

@ -509,11 +509,11 @@ static FString GameName;
void G_LoadConfig() void G_LoadConfig()
{ {
GameConfig = new FGameConfigFile(); GameConfig = new FGameConfigFile();
GameConfig->DoGlobalSetup();
} }
void G_ReadConfig(const char* game) void G_ReadConfig(const char* game)
{ {
GameConfig->DoGlobalSetup();
GameConfig->DoGameSetup(game); GameConfig->DoGameSetup(game);
GameConfig->DoKeySetup(game); GameConfig->DoKeySetup(game);
FBaseCVar::EnableCallbacks(); FBaseCVar::EnableCallbacks();

View file

@ -322,9 +322,14 @@ int GameMain()
TileFiles.CloseAll(); // do this before shutting down graphics. TileFiles.CloseAll(); // do this before shutting down graphics.
GLInterface.Deinit(); GLInterface.Deinit();
I_ShutdownGraphics(); I_ShutdownGraphics();
M_DeinitMenus();
paletteFreeColorTables(); paletteFreeColorTables();
gi->FreeGameData(); if (gi)
if (gi) delete gi; {
gi->FreeGameData();
delete gi;
gi = nullptr;
}
#ifndef NETCODE_DISABLE #ifndef NETCODE_DISABLE
if (gHaveNetworking) enet_deinitialize(); if (gHaveNetworking) enet_deinitialize();
#endif #endif
@ -521,10 +526,6 @@ int RunGame()
userConfig.ProcessOptions(); userConfig.ProcessOptions();
G_LoadConfig(); G_LoadConfig();
//I_StartupJoysticks();
//mouseInit();
#ifndef NETCODE_DISABLE #ifndef NETCODE_DISABLE
gHaveNetworking = !enet_initialize(); gHaveNetworking = !enet_initialize();
if (!gHaveNetworking) if (!gHaveNetworking)

View file

@ -781,6 +781,7 @@ void M_UnhideCustomMenu(int menu, int itemmask);
void M_MenuSound(EMenuSounds snd); void M_MenuSound(EMenuSounds snd);
void M_Autosave(); void M_Autosave();
bool M_Active(); bool M_Active();
void M_DeinitMenus();
void I_SetMouseCapture(); void I_SetMouseCapture();

View file

@ -67,7 +67,7 @@ void I_BuildMIDIMenuList(FOptionValues* opt);
void I_BuildALDeviceList(FOptionValues *opt); void I_BuildALDeviceList(FOptionValues *opt);
void I_BuildALResamplersList(FOptionValues* opt); void I_BuildALResamplersList(FOptionValues* opt);
static void DeinitMenus() void M_DeinitMenus()
{ {
{ {
MenuDescriptorList::Iterator it(MenuDescriptors); MenuDescriptorList::Iterator it(MenuDescriptors);
@ -1143,8 +1143,7 @@ void M_ParseMenuDefs()
DefaultListMenuSettings.Reset(); DefaultListMenuSettings.Reset();
DefaultOptionMenuSettings.Reset(); DefaultOptionMenuSettings.Reset();
atexit(DeinitMenus); M_DeinitMenus();
DeinitMenus();
while ((lump = fileSystem.Iterate("demolition/menudef.txt", &lastlump)) != -1) while ((lump = fileSystem.Iterate("demolition/menudef.txt", &lastlump)) != -1)
{ {
FScanner sc(lump); FScanner sc(lump);