apply the non-amigaos4 specific parts of the AmigaOS4 patch (#1369)

* apply the non-amigaos4 specific parts of the AmigaOS4 patch

* move SDL_Quit() to the end of StartGame()

* replace atexit() with I_AtExit()
This commit is contained in:
Fabian Greffrath 2024-01-04 17:41:55 +01:00 committed by GitHub
parent 9d1570c019
commit 5de216d785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 8 deletions

View File

@ -245,6 +245,8 @@ static void StartGame(int multiplayer)
ExecuteDoom(exec);
SDL_Quit();
exit(0);
}

View File

@ -459,7 +459,7 @@ static void AddIWADPath(const char *path, const char *suffix)
free(dup_path);
}
#ifndef _WIN32
#if !defined(_WIN32)
// Add standard directories where IWADs are located on Unix systems.
// To respect the freedesktop.org specification we support overriding
// using standard environment variables. See the XDG Base Directory
@ -521,7 +521,7 @@ static void AddXdgDirs(void)
AddIWADPath(env, "/games/doom3bfg/base/wads");
}
#ifndef __MACOSX__
#if !defined(__MACOSX__)
// Steam on Linux allows installing some select Windows games,
// including the classic Doom series (running DOSBox via Wine). We
// could parse *.vdf files to more accurately detect installation
@ -589,7 +589,7 @@ void BuildIWADDirList(void)
AddIWADDir(env);
}
#ifdef WOOFDATADIR
#if defined(WOOFDATADIR)
// [FG] Add a build-time configurable data directory
AddIWADDir(WOOFDATADIR);
#endif
@ -605,7 +605,7 @@ void BuildIWADDirList(void)
#else
AddXdgDirs();
#ifndef __MACOSX__
#if !defined(__MACOSX__)
AddSteamDirs();
#endif
#endif

View File

@ -765,7 +765,7 @@ static struct {
char *(*func)(void);
boolean createdir;
} autoload_basedirs[] = {
#ifndef WIN32
#if !defined(WIN32)
{"../share/" PROJECT_SHORTNAME, D_DoomExeDir, false},
#endif
{NULL, D_DoomPrefDir, true},

View File

@ -439,6 +439,9 @@ static boolean OpenFile(sndfile_t *file, void *data, sf_count_t size)
// libsndfile do the conversion.
sample_format = Int16;
break;
default:
I_Printf(VB_DEBUG, "SndFile: Unknown sfinfo.format %d", (int)file->sfinfo.format);
break;
}
frame_size = 1;

View File

@ -116,8 +116,23 @@ static int I_GetFracTime_FastDemo(void)
int (*I_GetFracTime)(void) = I_GetFracTime_Scaled;
void I_ShutdownTimer(void)
{
SDL_QuitSubSystem(SDL_INIT_TIMER);
}
void I_InitTimer(void)
{
if (SDL_Init(SDL_INIT_TIMER) < 0)
{
I_Error("I_InitTimer: Failed to initialize timer: %s",
SDL_GetError());
}
else
{
I_AtExit(I_ShutdownTimer, true);
}
basefreq = SDL_GetPerformanceFrequency();
I_GetTime = I_GetTime_Scaled;

View File

@ -156,6 +156,7 @@ static void NET_SDL_FreeAddress(net_addr_t *addr)
static boolean NET_SDL_InitClient(void)
{
int p;
int ret;
if (initted)
return true;
@ -172,7 +173,10 @@ static boolean NET_SDL_InitClient(void)
if (p > 0)
port = M_ParmArgToInt(p);
SDLNet_Init();
ret = SDLNet_Init();
if (!ret)
I_AtExit(SDLNet_Quit, true);
udpsocket = SDLNet_UDP_Open(0);
@ -195,6 +199,7 @@ static boolean NET_SDL_InitClient(void)
static boolean NET_SDL_InitServer(void)
{
int p;
int ret;
if (initted)
return true;
@ -203,7 +208,10 @@ static boolean NET_SDL_InitServer(void)
if (p > 0)
port = atoi(myargv[p+1]);
SDLNet_Init();
ret = SDLNet_Init();
if (!ret)
I_AtExit(SDLNet_Quit, true);
udpsocket = SDLNet_UDP_Open(port);

View File

@ -40,7 +40,7 @@ struct txt_fileselect_s {
const char *TXT_DIRECTORY[] = { "__directory__", NULL };
#ifndef _WIN32
#if !defined(_WIN32)
#include <fcntl.h>
#include <unistd.h>