- 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()
{
GameConfig = new FGameConfigFile();
GameConfig->DoGlobalSetup();
}
void G_ReadConfig(const char* game)
{
GameConfig->DoGlobalSetup();
GameConfig->DoGameSetup(game);
GameConfig->DoKeySetup(game);
FBaseCVar::EnableCallbacks();

View file

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

View file

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

View file

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