mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 03:51:11 +00:00
- the big cleanup of the exit cleanup is done!
atterm is gone and only a few system-side functions use atexit. All game side cleanup is performed in D_DoomMain now.
This commit is contained in:
parent
6f821a9198
commit
2e7af1338c
37 changed files with 82 additions and 344 deletions
|
@ -1136,7 +1136,6 @@ set (PCH_SOURCES
|
||||||
utility/nodebuilder/nodebuild_utility.cpp
|
utility/nodebuilder/nodebuild_utility.cpp
|
||||||
utility/sc_man.cpp
|
utility/sc_man.cpp
|
||||||
utility/stats.cpp
|
utility/stats.cpp
|
||||||
utility/atterm.cpp
|
|
||||||
utility/cmdlib.cpp
|
utility/cmdlib.cpp
|
||||||
utility/configfile.cpp
|
utility/configfile.cpp
|
||||||
utility/i_time.cpp
|
utility/i_time.cpp
|
||||||
|
|
|
@ -101,8 +101,8 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "g_cvars.h"
|
#include "g_cvars.h"
|
||||||
#include "r_data/r_vanillatrans.h"
|
#include "r_data/r_vanillatrans.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
|
#include "swrenderer/r_swcolormaps.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, hud_althud)
|
EXTERN_CVAR(Bool, hud_althud)
|
||||||
EXTERN_CVAR(Int, vr_mode)
|
EXTERN_CVAR(Int, vr_mode)
|
||||||
|
@ -123,6 +123,12 @@ extern void M_SetDefaultMode ();
|
||||||
extern void G_NewInit ();
|
extern void G_NewInit ();
|
||||||
extern void SetupPlayerClasses ();
|
extern void SetupPlayerClasses ();
|
||||||
void DeinitMenus();
|
void DeinitMenus();
|
||||||
|
void CloseNetwork();
|
||||||
|
void P_Shutdown();
|
||||||
|
void M_SaveDefaultsFinal();
|
||||||
|
void R_Shutdown();
|
||||||
|
void I_ShutdownInput();
|
||||||
|
|
||||||
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
|
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
@ -136,6 +142,7 @@ void D_LoadWadSettings ();
|
||||||
void ParseGLDefs();
|
void ParseGLDefs();
|
||||||
void DrawFullscreenSubtitle(const char *text);
|
void DrawFullscreenSubtitle(const char *text);
|
||||||
void D_Cleanup();
|
void D_Cleanup();
|
||||||
|
void FreeSBarInfoScript();
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
|
@ -1985,23 +1992,6 @@ static void SetMapxxFlag()
|
||||||
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
|
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// FinalGC
|
|
||||||
//
|
|
||||||
// If this doesn't free everything, the debug CRT will let us know.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static void FinalGC()
|
|
||||||
{
|
|
||||||
delete Args;
|
|
||||||
Args = nullptr;
|
|
||||||
GC::FinalGC = true;
|
|
||||||
GC::FullGC();
|
|
||||||
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Initialize
|
// Initialize
|
||||||
|
@ -2030,8 +2020,6 @@ static void D_DoomInit()
|
||||||
// Check response files before coalescing file parameters.
|
// Check response files before coalescing file parameters.
|
||||||
M_FindResponseFile ();
|
M_FindResponseFile ();
|
||||||
|
|
||||||
atterm(FinalGC);
|
|
||||||
|
|
||||||
// Combine different file parameters with their pre-switch bits.
|
// Combine different file parameters with their pre-switch bits.
|
||||||
Args->CollectFiles("-deh", ".deh");
|
Args->CollectFiles("-deh", ".deh");
|
||||||
Args->CollectFiles("-bex", ".bex");
|
Args->CollectFiles("-bex", ".bex");
|
||||||
|
@ -2331,22 +2319,6 @@ static void NewFailure ()
|
||||||
I_FatalError ("Failed to allocate memory from system heap");
|
I_FatalError ("Failed to allocate memory from system heap");
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// I_Quit
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void I_Quit()
|
|
||||||
{
|
|
||||||
if (demorecording)
|
|
||||||
{
|
|
||||||
G_CheckDemoStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
C_DeinitConsole();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D_DoomMain
|
// D_DoomMain
|
||||||
|
@ -2368,7 +2340,6 @@ static int D_DoomMain_Internal (void)
|
||||||
|
|
||||||
C_InitConsole(80*8, 25*8, false);
|
C_InitConsole(80*8, 25*8, false);
|
||||||
I_DetectOS();
|
I_DetectOS();
|
||||||
atterm(I_Quit);
|
|
||||||
|
|
||||||
// +logfile gets checked too late to catch the full startup log in the logfile so do some extra check for it here.
|
// +logfile gets checked too late to catch the full startup log in the logfile so do some extra check for it here.
|
||||||
FString logfile = Args->TakeValue("+logfile");
|
FString logfile = Args->TakeValue("+logfile");
|
||||||
|
@ -2811,8 +2782,6 @@ static int D_DoomMain_Internal (void)
|
||||||
{
|
{
|
||||||
G_BeginRecording(NULL);
|
G_BeginRecording(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
atterm(D_QuitNetGame); // killough
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2860,6 +2829,20 @@ int D_DoomMain()
|
||||||
// Unless something really bad happened, the game should only exit through this single point in the code.
|
// Unless something really bad happened, the game should only exit through this single point in the code.
|
||||||
// No more 'exit', please.
|
// No more 'exit', please.
|
||||||
// Todo: Move all engine cleanup here instead of using exit handlers and replace the scattered 'exit' calls with a special exception.
|
// Todo: Move all engine cleanup here instead of using exit handlers and replace the scattered 'exit' calls with a special exception.
|
||||||
|
D_Cleanup();
|
||||||
|
CloseNetwork();
|
||||||
|
GC::FinalGC = true;
|
||||||
|
GC::FullGC();
|
||||||
|
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
|
||||||
|
C_DeinitConsole();
|
||||||
|
R_DeinitColormaps();
|
||||||
|
R_Shutdown();
|
||||||
|
I_ShutdownGraphics();
|
||||||
|
I_ShutdownInput();
|
||||||
|
M_SaveDefaultsFinal();
|
||||||
|
DeleteStartupScreen();
|
||||||
|
delete Args;
|
||||||
|
Args = nullptr;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2871,23 +2854,28 @@ int D_DoomMain()
|
||||||
|
|
||||||
void D_Cleanup()
|
void D_Cleanup()
|
||||||
{
|
{
|
||||||
|
if (demorecording)
|
||||||
|
{
|
||||||
|
G_CheckDemoStatus();
|
||||||
|
}
|
||||||
|
|
||||||
// Music and sound should be stopped first
|
// Music and sound should be stopped first
|
||||||
S_StopMusic(true);
|
S_StopMusic(true);
|
||||||
S_StopAllChannels ();
|
S_StopAllChannels ();
|
||||||
|
S_ClearSoundData();
|
||||||
|
S_UnloadReverbDef();
|
||||||
|
G_ClearMapinfo();
|
||||||
|
|
||||||
M_ClearMenus(); // close menu if open
|
M_ClearMenus(); // close menu if open
|
||||||
F_EndFinale(); // If an intermission is active, end it now
|
F_EndFinale(); // If an intermission is active, end it now
|
||||||
AM_ClearColorsets();
|
AM_ClearColorsets();
|
||||||
|
DeinitSWColorMaps();
|
||||||
|
FreeSBarInfoScript();
|
||||||
|
|
||||||
// clean up game state
|
// clean up game state
|
||||||
ST_Clear();
|
ST_Clear();
|
||||||
D_ErrorCleanup ();
|
D_ErrorCleanup ();
|
||||||
for (auto Level : AllLevels())
|
P_Shutdown();
|
||||||
{
|
|
||||||
Level->Thinkers.DestroyThinkersInList(STAT_STATIC);
|
|
||||||
}
|
|
||||||
staticEventManager.Shutdown();
|
|
||||||
P_FreeLevelData();
|
|
||||||
|
|
||||||
M_SaveDefaults(NULL); // save config before the restart
|
M_SaveDefaults(NULL); // save config before the restart
|
||||||
|
|
||||||
|
@ -3012,6 +3000,24 @@ void FStartupScreen::AppendStatusLine(const char *status)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// DeleteStartupScreen
|
||||||
|
//
|
||||||
|
// Makes sure the startup screen has been deleted before quitting.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
void DeleteStartupScreen()
|
||||||
|
{
|
||||||
|
if (StartScreen != nullptr)
|
||||||
|
{
|
||||||
|
delete StartScreen;
|
||||||
|
StartScreen = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FStartupScreen::Progress(void) {}
|
void FStartupScreen::Progress(void) {}
|
||||||
void FStartupScreen::NetInit(char const *,int) {}
|
void FStartupScreen::NetInit(char const *,int) {}
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "scriptutil.h"
|
#include "scriptutil.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -209,8 +208,6 @@ static int cregcmp (const void *a, const void *b) NO_SANITIZE
|
||||||
|
|
||||||
void PClass::StaticInit ()
|
void PClass::StaticInit ()
|
||||||
{
|
{
|
||||||
atterm(StaticShutdown);
|
|
||||||
|
|
||||||
Namespaces.GlobalNamespace = Namespaces.NewNamespace(0);
|
Namespaces.GlobalNamespace = Namespaces.NewNamespace(0);
|
||||||
|
|
||||||
FAutoSegIterator probe(CRegHead, CRegTail);
|
FAutoSegIterator probe(CRegHead, CRegTail);
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
|
#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
|
||||||
enum
|
enum
|
||||||
|
@ -425,7 +424,7 @@ static const char *StatusBars[] =
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void FreeSBarInfoScript()
|
void FreeSBarInfoScript()
|
||||||
{
|
{
|
||||||
for(int i = 0;i < 2;i++)
|
for(int i = 0;i < 2;i++)
|
||||||
{
|
{
|
||||||
|
@ -439,9 +438,6 @@ static void FreeSBarInfoScript()
|
||||||
|
|
||||||
void SBarInfo::Load()
|
void SBarInfo::Load()
|
||||||
{
|
{
|
||||||
FreeSBarInfoScript();
|
|
||||||
MugShotStates.Clear();
|
|
||||||
|
|
||||||
if(gameinfo.statusbar.IsNotEmpty())
|
if(gameinfo.statusbar.IsNotEmpty())
|
||||||
{
|
{
|
||||||
int lump = Wads.CheckNumForFullName(gameinfo.statusbar, true);
|
int lump = Wads.CheckNumForFullName(gameinfo.statusbar, true);
|
||||||
|
@ -468,7 +464,6 @@ void SBarInfo::Load()
|
||||||
SBarInfoScript[SCRIPT_CUSTOM]->ParseSBarInfo(lump);
|
SBarInfoScript[SCRIPT_CUSTOM]->ParseSBarInfo(lump);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
atterm(FreeSBarInfoScript);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//SBarInfo Script Reader
|
//SBarInfo Script Reader
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
static TArray<cluster_info_t> wadclusterinfos;
|
static TArray<cluster_info_t> wadclusterinfos;
|
||||||
TArray<level_info_t> wadlevelinfos;
|
TArray<level_info_t> wadlevelinfos;
|
||||||
|
@ -2376,7 +2375,7 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
|
||||||
|
|
||||||
void DeinitIntermissions();
|
void DeinitIntermissions();
|
||||||
|
|
||||||
static void ClearMapinfo()
|
void G_ClearMapinfo()
|
||||||
{
|
{
|
||||||
wadclusterinfos.Clear();
|
wadclusterinfos.Clear();
|
||||||
wadlevelinfos.Clear();
|
wadlevelinfos.Clear();
|
||||||
|
@ -2402,9 +2401,6 @@ void G_ParseMapInfo (FString basemapinfo)
|
||||||
int lump, lastlump = 0;
|
int lump, lastlump = 0;
|
||||||
level_info_t gamedefaults;
|
level_info_t gamedefaults;
|
||||||
|
|
||||||
ClearMapinfo();
|
|
||||||
atterm(ClearMapinfo);
|
|
||||||
|
|
||||||
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
|
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
|
||||||
if (basemapinfo.IsNotEmpty())
|
if (basemapinfo.IsNotEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,6 +454,7 @@ level_info_t *CheckLevelRedirect (level_info_t *info);
|
||||||
|
|
||||||
FString CalcMapName (int episode, int level);
|
FString CalcMapName (int episode, int level);
|
||||||
|
|
||||||
|
void G_ClearMapinfo();
|
||||||
void G_ParseMapInfo (FString basemapinfo);
|
void G_ParseMapInfo (FString basemapinfo);
|
||||||
|
|
||||||
enum ESkillProperty
|
enum ESkillProperty
|
||||||
|
|
|
@ -62,7 +62,6 @@
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
|
||||||
#include "i_net.h"
|
#include "i_net.h"
|
||||||
|
@ -435,8 +434,6 @@ void StartNetwork (bool autoPort)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
atterm(CloseNetwork);
|
|
||||||
|
|
||||||
netgame = true;
|
netgame = true;
|
||||||
multiplayer = true;
|
multiplayer = true;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
|
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
FGameConfigFile *GameConfig;
|
FGameConfigFile *GameConfig;
|
||||||
|
|
||||||
|
@ -271,7 +270,8 @@ bool M_SaveDefaults (const char *filename)
|
||||||
FString oldpath;
|
FString oldpath;
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
if (filename != NULL)
|
if (GameConfig == nullptr) return true;
|
||||||
|
if (filename != nullptr)
|
||||||
{
|
{
|
||||||
oldpath = GameConfig->GetPathName();
|
oldpath = GameConfig->GetPathName();
|
||||||
GameConfig->ChangePathName (filename);
|
GameConfig->ChangePathName (filename);
|
||||||
|
@ -282,7 +282,7 @@ bool M_SaveDefaults (const char *filename)
|
||||||
GameConfig->ArchiveGameData (gameinfo.ConfigName);
|
GameConfig->ArchiveGameData (gameinfo.ConfigName);
|
||||||
}
|
}
|
||||||
success = GameConfig->WriteConfigFile ();
|
success = GameConfig->WriteConfigFile ();
|
||||||
if (filename != NULL)
|
if (filename != nullptr)
|
||||||
{
|
{
|
||||||
GameConfig->ChangePathName (filename);
|
GameConfig->ChangePathName (filename);
|
||||||
}
|
}
|
||||||
|
@ -291,12 +291,13 @@ bool M_SaveDefaults (const char *filename)
|
||||||
|
|
||||||
void M_SaveDefaultsFinal ()
|
void M_SaveDefaultsFinal ()
|
||||||
{
|
{
|
||||||
while (!M_SaveDefaults (NULL) && I_WriteIniFailed ())
|
if (GameConfig == nullptr) return;
|
||||||
|
while (!M_SaveDefaults (nullptr) && I_WriteIniFailed ())
|
||||||
{
|
{
|
||||||
/* Loop until the config saves or I_WriteIniFailed() returns false */
|
/* Loop until the config saves or I_WriteIniFailed() returns false */
|
||||||
}
|
}
|
||||||
delete GameConfig;
|
delete GameConfig;
|
||||||
GameConfig = NULL;
|
GameConfig = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_CCMD (writeini)
|
UNSAFE_CCMD (writeini)
|
||||||
|
@ -320,7 +321,6 @@ void M_LoadDefaults ()
|
||||||
{
|
{
|
||||||
GameConfig = new FGameConfigFile;
|
GameConfig = new FGameConfigFile;
|
||||||
GameConfig->DoGlobalSetup ();
|
GameConfig->DoGlobalSetup ();
|
||||||
atterm(M_SaveDefaultsFinal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "teaminfo.h"
|
#include "teaminfo.h"
|
||||||
#include "r_data/sprites.h"
|
#include "r_data/sprites.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "zmusic/zmusic.h"
|
#include "zmusic/zmusic.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1011,9 +1010,6 @@ void M_ParseMenuDefs()
|
||||||
DefaultListMenuSettings->Reset();
|
DefaultListMenuSettings->Reset();
|
||||||
DefaultOptionMenuSettings->Reset();
|
DefaultOptionMenuSettings->Reset();
|
||||||
|
|
||||||
atterm( DeinitMenus);
|
|
||||||
DeinitMenus();
|
|
||||||
|
|
||||||
int IWADMenu = Wads.CheckNumForName("MENUDEF", ns_global, Wads.GetIwadNum());
|
int IWADMenu = Wads.CheckNumForName("MENUDEF", ns_global, Wads.GetIwadNum());
|
||||||
|
|
||||||
while ((lump = Wads.FindLump ("MENUDEF", &lastlump)) != -1)
|
while ((lump = Wads.FindLump ("MENUDEF", &lastlump)) != -1)
|
||||||
|
|
|
@ -75,14 +75,12 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "fragglescript/t_script.h"
|
#include "fragglescript/t_script.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
|
|
||||||
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
||||||
|
|
||||||
extern unsigned int R_OldBlend;
|
extern unsigned int R_OldBlend;
|
||||||
|
|
||||||
static void P_Shutdown ();
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -572,15 +570,13 @@ void P_SetupLevel(FLevelLocals *Level, int position, bool newGame)
|
||||||
//
|
//
|
||||||
void P_Init ()
|
void P_Init ()
|
||||||
{
|
{
|
||||||
atterm(P_Shutdown);
|
|
||||||
|
|
||||||
P_InitEffects (); // [RH]
|
P_InitEffects (); // [RH]
|
||||||
P_InitTerrainTypes ();
|
P_InitTerrainTypes ();
|
||||||
P_InitKeyMessages ();
|
P_InitKeyMessages ();
|
||||||
R_InitSprites ();
|
R_InitSprites ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_Shutdown ()
|
void P_Shutdown ()
|
||||||
{
|
{
|
||||||
for (auto Level : AllLevels())
|
for (auto Level : AllLevels())
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "m_joy.h"
|
#include "m_joy.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, joy_axespolling)
|
EXTERN_CVAR(Bool, joy_axespolling)
|
||||||
|
@ -1175,13 +1174,7 @@ void IOKitJoystickManager::OnDeviceRemoved(void* const refcon, io_service_t, con
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void I_ShutdownJoysticks()
|
void I_ShutdownInput()
|
||||||
{
|
|
||||||
// Needed in order to support existing interface
|
|
||||||
// Left empty intentionally
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ShutdownJoysticks()
|
|
||||||
{
|
{
|
||||||
delete s_joystickManager;
|
delete s_joystickManager;
|
||||||
s_joystickManager = NULL;
|
s_joystickManager = NULL;
|
||||||
|
@ -1198,7 +1191,6 @@ void I_GetJoysticks(TArray<IJoystickConfig*>& sticks)
|
||||||
if (NULL == s_joystickManager && !Args->CheckParm("-nojoy"))
|
if (NULL == s_joystickManager && !Args->CheckParm("-nojoy"))
|
||||||
{
|
{
|
||||||
s_joystickManager = new IOKitJoystickManager;
|
s_joystickManager = new IOKitJoystickManager;
|
||||||
atterm(ShutdownJoysticks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != s_joystickManager)
|
if (NULL != s_joystickManager)
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
#include "i_common.h"
|
#include "i_common.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
@ -145,13 +144,14 @@ int OriginalMainTry(int argc, char** argv)
|
||||||
{
|
{
|
||||||
Args = new FArgs(argc, argv);
|
Args = new FArgs(argc, argv);
|
||||||
|
|
||||||
atexit(call_terms);
|
|
||||||
|
|
||||||
NSString* exePath = [[NSBundle mainBundle] executablePath];
|
NSString* exePath = [[NSBundle mainBundle] executablePath];
|
||||||
progdir = [[exePath stringByDeletingLastPathComponent] UTF8String];
|
progdir = [[exePath stringByDeletingLastPathComponent] UTF8String];
|
||||||
progdir += "/";
|
progdir += "/";
|
||||||
|
|
||||||
return D_DoomMain();
|
auto ret = D_DoomMain();
|
||||||
|
ShutdownJoysticks();
|
||||||
|
FConsoleWindow::DeleteInstance();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -266,7 +266,6 @@ extern bool AppActive;
|
||||||
forMode:NSDefaultRunLoopMode];
|
forMode:NSDefaultRunLoopMode];
|
||||||
|
|
||||||
FConsoleWindow::CreateInstance();
|
FConsoleWindow::CreateInstance();
|
||||||
atterm(FConsoleWindow::DeleteInstance);
|
|
||||||
|
|
||||||
const size_t argc = s_argv.Size();
|
const size_t argc = s_argv.Size();
|
||||||
TArray<char*> argv(argc + 1, true);
|
TArray<char*> argv(argc + 1, true);
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
** i_main_except.cpp
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 2012-2015 Alexey Lysiuk
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
// Workaround for GCC Objective-C++ with C++ exceptions bug.
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "doomerrors.h"
|
|
||||||
#include "vm.h"
|
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// Import some functions from i_main.mm
|
|
||||||
|
|
||||||
void OriginalMainTry(int argc, char** argv);
|
|
||||||
|
|
||||||
void OriginalMainExcept(int argc, char** argv)
|
|
||||||
{
|
|
||||||
OriginalMainTry(argc, argv);
|
|
||||||
}
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "x86.h"
|
#include "x86.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
|
|
||||||
void I_Tactile(int /*on*/, int /*off*/, int /*total*/)
|
void I_Tactile(int /*on*/, int /*off*/, int /*total*/)
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
#include "vulkan/system/vk_framebuffer.h"
|
#include "vulkan/system/vk_framebuffer.h"
|
||||||
|
@ -751,7 +750,6 @@ void I_ShutdownGraphics()
|
||||||
void I_InitGraphics()
|
void I_InitGraphics()
|
||||||
{
|
{
|
||||||
Video = new CocoaVideo;
|
Video = new CocoaVideo;
|
||||||
atterm(I_ShutdownGraphics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -172,8 +172,5 @@ FStartupScreen *FStartupScreen::CreateInstance(const int maxProgress)
|
||||||
|
|
||||||
void ST_Endoom()
|
void ST_Endoom()
|
||||||
{
|
{
|
||||||
extern void I_ShutdownJoysticks();
|
|
||||||
I_ShutdownJoysticks();
|
|
||||||
|
|
||||||
throw CExitEvent(0);
|
throw CExitEvent(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "swrenderer/r_swrenderer.h"
|
#include "swrenderer/r_swrenderer.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
IVideo *Video;
|
IVideo *Video;
|
||||||
|
|
||||||
|
@ -83,6 +82,4 @@ void I_InitGraphics ()
|
||||||
|
|
||||||
if (Video == NULL)
|
if (Video == NULL)
|
||||||
I_FatalError ("Failed to initialize display");
|
I_FatalError ("Failed to initialize display");
|
||||||
|
|
||||||
atterm(I_ShutdownGraphics);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,7 @@ void I_StartupJoysticks()
|
||||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
||||||
JoystickManager = new SDLInputJoystickManager();
|
JoystickManager = new SDLInputJoystickManager();
|
||||||
}
|
}
|
||||||
void I_ShutdownJoysticks()
|
void I_ShutdownInput()
|
||||||
{
|
{
|
||||||
if(JoystickManager)
|
if(JoystickManager)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,13 +56,9 @@
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
// The maximum number of functions that can be registered with atterm.
|
|
||||||
#define MAX_TERMS 64
|
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
@ -151,7 +147,6 @@ void I_DetectOS()
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StartupJoysticks();
|
void I_StartupJoysticks();
|
||||||
void I_ShutdownJoysticks();
|
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -71,12 +70,8 @@ class FTTYStartupScreen : public FStartupScreen
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
|
||||||
void I_ShutdownJoysticks();
|
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
static void DeleteStartupScreen();
|
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
@ -106,27 +101,9 @@ static const char SpinnyProgressChars[4] = { '|', '/', '-', '\\' };
|
||||||
|
|
||||||
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
||||||
{
|
{
|
||||||
atterm(DeleteStartupScreen);
|
|
||||||
return new FTTYStartupScreen(max_progress);
|
return new FTTYStartupScreen(max_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// DeleteStartupScreen
|
|
||||||
//
|
|
||||||
// Makes sure the startup screen has been deleted before quitting.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
void DeleteStartupScreen()
|
|
||||||
{
|
|
||||||
if (StartScreen != NULL)
|
|
||||||
{
|
|
||||||
delete StartScreen;
|
|
||||||
StartScreen = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// FTTYStartupScreen Constructor
|
// FTTYStartupScreen Constructor
|
||||||
|
@ -349,6 +326,5 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
||||||
|
|
||||||
void ST_Endoom()
|
void ST_Endoom()
|
||||||
{
|
{
|
||||||
I_ShutdownJoysticks();
|
|
||||||
throw CExitEvent(0);
|
throw CExitEvent(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
#include "actorinlines.h"
|
#include "actorinlines.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
|
||||||
|
@ -154,7 +153,6 @@ DAngle viewpitch;
|
||||||
DEFINE_GLOBAL(LocalViewPitch);
|
DEFINE_GLOBAL(LocalViewPitch);
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
static void R_Shutdown ();
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -380,8 +378,6 @@ FRenderer *CreateSWRenderer();
|
||||||
|
|
||||||
void R_Init ()
|
void R_Init ()
|
||||||
{
|
{
|
||||||
atterm(R_Shutdown);
|
|
||||||
|
|
||||||
StartScreen->Progress();
|
StartScreen->Progress();
|
||||||
R_InitTranslationTables ();
|
R_InitTranslationTables ();
|
||||||
R_SetViewSize (screenblocks);
|
R_SetViewSize (screenblocks);
|
||||||
|
@ -400,12 +396,10 @@ void R_Init ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void R_Shutdown ()
|
void R_Shutdown ()
|
||||||
{
|
{
|
||||||
if (SWRenderer != nullptr) delete SWRenderer;
|
if (SWRenderer != nullptr) delete SWRenderer;
|
||||||
SWRenderer = nullptr;
|
SWRenderer = nullptr;
|
||||||
R_DeinitTranslationTables();
|
|
||||||
R_DeinitColormaps ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "swrenderer/r_renderer.h"
|
#include "swrenderer/r_renderer.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
FDynamicColormap NormalLight;
|
FDynamicColormap NormalLight;
|
||||||
|
@ -452,7 +451,7 @@ static void InitBoomColormaps ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void DeinitSWColorMaps()
|
void DeinitSWColorMaps()
|
||||||
{
|
{
|
||||||
FreeSpecialLights();
|
FreeSpecialLights();
|
||||||
if (realcolormaps.Maps != nullptr)
|
if (realcolormaps.Maps != nullptr)
|
||||||
|
@ -475,8 +474,6 @@ static void DeinitSWColorMaps()
|
||||||
|
|
||||||
void InitSWColorMaps()
|
void InitSWColorMaps()
|
||||||
{
|
{
|
||||||
DeinitSWColorMaps();
|
|
||||||
atterm(DeinitSWColorMaps);
|
|
||||||
InitBoomColormaps();
|
InitBoomColormaps();
|
||||||
NormalLight.Color = PalEntry (255, 255, 255);
|
NormalLight.Color = PalEntry (255, 255, 255);
|
||||||
NormalLight.Fade = 0;
|
NormalLight.Fade = 0;
|
||||||
|
|
|
@ -30,6 +30,7 @@ extern FDynamicColormap FullNormalLight;
|
||||||
extern bool NormalLightHasFixedLights;
|
extern bool NormalLightHasFixedLights;
|
||||||
extern TArray<FSWColormap> SpecialSWColormaps;
|
extern TArray<FSWColormap> SpecialSWColormaps;
|
||||||
|
|
||||||
|
void DeinitSWColorMaps();
|
||||||
void InitSWColorMaps();
|
void InitSWColorMaps();
|
||||||
FDynamicColormap *GetSpecialLights (PalEntry lightcolor, PalEntry fadecolor, int desaturate);
|
FDynamicColormap *GetSpecialLights (PalEntry lightcolor, PalEntry fadecolor, int desaturate);
|
||||||
void SetDefaultColormap (const char *name);
|
void SetDefaultColormap (const char *name);
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "am_map.h"
|
#include "am_map.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
EXTERN_CVAR(Int, menu_resolution_custom_width)
|
EXTERN_CVAR(Int, menu_resolution_custom_width)
|
||||||
EXTERN_CVAR(Int, menu_resolution_custom_height)
|
EXTERN_CVAR(Int, menu_resolution_custom_height)
|
||||||
|
@ -563,9 +562,6 @@ void V_InitScreenSize ()
|
||||||
const char *i;
|
const char *i;
|
||||||
int width, height, bits;
|
int width, height, bits;
|
||||||
|
|
||||||
atterm(V_Shutdown);
|
|
||||||
|
|
||||||
|
|
||||||
width = height = bits = 0;
|
width = height = bits = 0;
|
||||||
|
|
||||||
if ( (i = Args->CheckValue ("-width")) )
|
if ( (i = Args->CheckValue ("-width")) )
|
||||||
|
@ -632,17 +628,6 @@ void V_Init2()
|
||||||
setsizeneeded = true;
|
setsizeneeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_Shutdown()
|
|
||||||
{
|
|
||||||
if (screen)
|
|
||||||
{
|
|
||||||
DFrameBuffer *s = screen;
|
|
||||||
screen = NULL;
|
|
||||||
delete s;
|
|
||||||
}
|
|
||||||
V_ClearFonts();
|
|
||||||
}
|
|
||||||
|
|
||||||
CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
||||||
{
|
{
|
||||||
setsizeneeded = true;
|
setsizeneeded = true;
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "r_data/sprites.h"
|
#include "r_data/sprites.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "mididevices/mididevice.h"
|
#include "mididevices/mididevice.h"
|
||||||
|
|
||||||
|
@ -943,7 +942,7 @@ void FPlayerSoundHashTable::MarkUsed()
|
||||||
// be cleared for each level
|
// be cleared for each level
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void S_ClearSoundData()
|
void S_ClearSoundData()
|
||||||
{
|
{
|
||||||
S_StopAllChannels();
|
S_StopAllChannels();
|
||||||
S_UnloadAllSounds();
|
S_UnloadAllSounds();
|
||||||
|
@ -981,7 +980,6 @@ void S_ParseSndInfo (bool redefine)
|
||||||
int lump;
|
int lump;
|
||||||
|
|
||||||
if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
|
if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
|
||||||
atterm(S_ClearSoundData);
|
|
||||||
S_ClearSoundData(); // remove old sound data first!
|
S_ClearSoundData(); // remove old sound data first!
|
||||||
|
|
||||||
CurrentPitchMask = 0;
|
CurrentPitchMask = 0;
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -643,9 +642,6 @@ void S_ParseReverbDef ()
|
||||||
{
|
{
|
||||||
int lump, lastlump = 0;
|
int lump, lastlump = 0;
|
||||||
|
|
||||||
atterm(S_UnloadReverbDef);
|
|
||||||
S_UnloadReverbDef ();
|
|
||||||
|
|
||||||
while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1)
|
while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1)
|
||||||
{
|
{
|
||||||
ReadReverbDef (lump);
|
ReadReverbDef (lump);
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "filereadermusicinterface.h"
|
#include "filereadermusicinterface.h"
|
||||||
#include "zmusic/musinfo.h"
|
#include "zmusic/musinfo.h"
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
@ -306,8 +305,6 @@ void S_Init ()
|
||||||
{
|
{
|
||||||
int curvelump;
|
int curvelump;
|
||||||
|
|
||||||
atterm(S_Shutdown);
|
|
||||||
|
|
||||||
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
||||||
I_InitSound();
|
I_InitSound();
|
||||||
curvelump = Wads.CheckNumForName ("SNDCURVE");
|
curvelump = Wads.CheckNumForName ("SNDCURVE");
|
||||||
|
|
|
@ -334,6 +334,7 @@ void S_UpdateSounds (AActor *listener);
|
||||||
void S_RestoreEvictedChannels();
|
void S_RestoreEvictedChannels();
|
||||||
|
|
||||||
// [RH] S_sfx "maintenance" routines
|
// [RH] S_sfx "maintenance" routines
|
||||||
|
void S_ClearSoundData();
|
||||||
void S_ParseSndInfo (bool redefine);
|
void S_ParseSndInfo (bool redefine);
|
||||||
void S_ParseReverbDef ();
|
void S_ParseReverbDef ();
|
||||||
void S_UnloadReverbDef ();
|
void S_UnloadReverbDef ();
|
||||||
|
|
|
@ -130,6 +130,7 @@ protected:
|
||||||
|
|
||||||
extern FStartupScreen *StartScreen;
|
extern FStartupScreen *StartScreen;
|
||||||
|
|
||||||
|
void DeleteStartupScreen();
|
||||||
extern void ST_Endoom();
|
extern void ST_Endoom();
|
||||||
|
|
||||||
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
** attern.cpp
|
|
||||||
** Termination handling
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 1998-2007 Randy Heit
|
|
||||||
** Copyright 2019 Christoph Oelckers
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include "tarray.h"
|
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
static TArray<std::pair<void (*)(void), const char *>> TermFuncs;
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// atterm
|
|
||||||
//
|
|
||||||
// Our own atexit because atexit can be problematic under Linux, though I
|
|
||||||
// forget the circumstances that cause trouble.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void addterm(void (*func)(), const char *name)
|
|
||||||
{
|
|
||||||
// Make sure this function wasn't already registered.
|
|
||||||
|
|
||||||
for (auto &term : TermFuncs)
|
|
||||||
{
|
|
||||||
if (term.first == func)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TermFuncs.Push(std::make_pair(func, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// call_terms
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void call_terms()
|
|
||||||
{
|
|
||||||
for(int i = TermFuncs.Size()-1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
TermFuncs[i].first();
|
|
||||||
}
|
|
||||||
TermFuncs.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// popterm
|
|
||||||
//
|
|
||||||
// Removes the most recently register atterm function.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void popterm()
|
|
||||||
{
|
|
||||||
if (TermFuncs.Size() > 0)
|
|
||||||
{
|
|
||||||
TermFuncs.Pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
void addterm (void (*func)(void), const char *name);
|
|
||||||
#define atterm(t) addterm (t, #t)
|
|
||||||
void popterm ();
|
|
||||||
void call_terms();
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "swrenderer/r_swrenderer.h"
|
#include "swrenderer/r_swrenderer.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
EXTERN_CVAR(Int, vid_enablevulkan)
|
EXTERN_CVAR(Int, vid_enablevulkan)
|
||||||
|
|
||||||
|
@ -152,5 +151,4 @@ void I_InitGraphics ()
|
||||||
if (Video == NULL)
|
if (Video == NULL)
|
||||||
I_FatalError ("Failed to initialize display");
|
I_FatalError ("Failed to initialize display");
|
||||||
|
|
||||||
atterm(I_ShutdownGraphics);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Compensate for w32api's lack
|
// Compensate for w32api's lack
|
||||||
|
@ -613,7 +612,6 @@ bool I_InitInput (void *hwnd)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
Printf ("I_InitInput\n");
|
Printf ("I_InitInput\n");
|
||||||
atterm(I_ShutdownInput);
|
|
||||||
|
|
||||||
noidle = !!Args->CheckParm ("-noidle");
|
noidle = !!Args->CheckParm ("-noidle");
|
||||||
g_pdi = NULL;
|
g_pdi = NULL;
|
||||||
|
|
|
@ -73,7 +73,6 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "atterm.h"
|
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
|
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
@ -88,9 +87,6 @@
|
||||||
#define X64 ""
|
#define X64 ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The maximum number of functions that can be registered with atterm.
|
|
||||||
#define MAX_TERMS 64
|
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
@ -99,6 +95,7 @@ LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
|
void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
|
||||||
void DisplayCrashLog ();
|
void DisplayCrashLog ();
|
||||||
void I_FlushBufferedConsoleStuff();
|
void I_FlushBufferedConsoleStuff();
|
||||||
|
void DestroyCustomCursor();
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
|
||||||
|
@ -149,7 +146,7 @@ static HMODULE hwtsapi32; // handle to wtsapi32.dll
|
||||||
//
|
//
|
||||||
// UnCOM
|
// UnCOM
|
||||||
//
|
//
|
||||||
// Called by atterm if CoInitialize() succeeded.
|
// Called by atexit if CoInitialize() succeeded.
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
@ -162,7 +159,7 @@ static void UnCOM (void)
|
||||||
//
|
//
|
||||||
// UnWTS
|
// UnWTS
|
||||||
//
|
//
|
||||||
// Called by atterm if RegisterSessionNotification() succeeded.
|
// Called by atexit if RegisterSessionNotification() succeeded.
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
@ -617,11 +614,7 @@ void RestoreConView()
|
||||||
ShowWindow (GameTitleWindow, SW_SHOW);
|
ShowWindow (GameTitleWindow, SW_SHOW);
|
||||||
I_ShutdownInput (); // Make sure the mouse pointer is available.
|
I_ShutdownInput (); // Make sure the mouse pointer is available.
|
||||||
// Make sure the progress bar isn't visible.
|
// Make sure the progress bar isn't visible.
|
||||||
if (StartScreen != NULL)
|
DeleteStartupScreen();
|
||||||
{
|
|
||||||
delete StartScreen;
|
|
||||||
StartScreen = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -847,8 +840,6 @@ int DoMain (HINSTANCE hInstance)
|
||||||
timeBeginPeriod (TimerPeriod);
|
timeBeginPeriod (TimerPeriod);
|
||||||
atexit(UnTbp);
|
atexit(UnTbp);
|
||||||
|
|
||||||
atexit (call_terms);
|
|
||||||
|
|
||||||
// Figure out what directory the program resides in.
|
// Figure out what directory the program resides in.
|
||||||
WCHAR progbuff[1024];
|
WCHAR progbuff[1024];
|
||||||
if (GetModuleFileNameW(nullptr, progbuff, sizeof progbuff) == 0)
|
if (GetModuleFileNameW(nullptr, progbuff, sizeof progbuff) == 0)
|
||||||
|
@ -960,10 +951,9 @@ int DoMain (HINSTANCE hInstance)
|
||||||
atexit (UnCOM);
|
atexit (UnCOM);
|
||||||
|
|
||||||
int ret = D_DoomMain ();
|
int ret = D_DoomMain ();
|
||||||
|
DestroyCustomCursor();
|
||||||
if (ret == 1337) // special exit code for 'norun'.
|
if (ret == 1337) // special exit code for 'norun'.
|
||||||
{
|
{
|
||||||
// The only way D_DoomMain can exit regularly is by executing a -norun startup, which was previously handled via exception.
|
|
||||||
I_ShutdownGraphics();
|
|
||||||
if (!batchrun)
|
if (!batchrun)
|
||||||
{
|
{
|
||||||
if (FancyStdOut && !AttachedStdOut)
|
if (FancyStdOut && !AttachedStdOut)
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "textures/bitmap.h"
|
#include "textures/bitmap.h"
|
||||||
#include "atterm.h"
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -103,6 +102,8 @@ extern void LayoutMainWindow(HWND hWnd, HWND pane);
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
|
||||||
|
void DestroyCustomCursor();
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
static void CalculateCPUSpeed();
|
static void CalculateCPUSpeed();
|
||||||
|
@ -110,7 +111,6 @@ static void CalculateCPUSpeed();
|
||||||
static HCURSOR CreateCompatibleCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
static HCURSOR CreateCompatibleCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
||||||
static HCURSOR CreateAlphaCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
static HCURSOR CreateAlphaCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
||||||
static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP color_mask);
|
static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP color_mask);
|
||||||
static void DestroyCustomCursor();
|
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
|
||||||
|
@ -718,7 +718,6 @@ bool I_SetCursor(FTexture *cursorpic)
|
||||||
// Replace the existing cursor with the new one.
|
// Replace the existing cursor with the new one.
|
||||||
DestroyCustomCursor();
|
DestroyCustomCursor();
|
||||||
CustomCursor = cursor;
|
CustomCursor = cursor;
|
||||||
atterm(DestroyCustomCursor);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -921,7 +920,7 @@ static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void DestroyCustomCursor()
|
void DestroyCustomCursor()
|
||||||
{
|
{
|
||||||
if (CustomCursor != NULL)
|
if (CustomCursor != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue