mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
sdl/i_system.cpp: fix compiler errors
This commit is contained in:
parent
68a8f2b274
commit
bca2c8cb19
1 changed files with 43 additions and 50 deletions
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
@ -369,61 +371,52 @@ static void I_ShowErrorMessageBox(const char *messagefordevelopers, boolean dump
|
||||||
static void I_ReportSignal(int num, int coredumped)
|
static void I_ReportSignal(int num, int coredumped)
|
||||||
{
|
{
|
||||||
//static char msg[] = "oh no! back to reality!\r\n";
|
//static char msg[] = "oh no! back to reality!\r\n";
|
||||||
const char * sigmsg;
|
auto report = [coredumped](std::string sigmsg)
|
||||||
char msg[128];
|
{
|
||||||
|
if (coredumped)
|
||||||
|
{
|
||||||
|
sigmsg += " (core dumped)";
|
||||||
|
}
|
||||||
|
|
||||||
|
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg.c_str());
|
||||||
|
|
||||||
|
I_ShowErrorMessageBox(sigmsg.c_str(),
|
||||||
|
#if defined (UNIXBACKTRACE)
|
||||||
|
true
|
||||||
|
#elif defined (_WIN32)
|
||||||
|
!M_CheckParm("-noexchndl")
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
// case SIGINT:
|
// case SIGINT:
|
||||||
// sigmsg = "SIGINT - interrupted";
|
// report("SIGINT - interrupted");
|
||||||
// break;
|
// break;
|
||||||
case SIGILL:
|
case SIGILL:
|
||||||
sigmsg = "SIGILL - illegal instruction - invalid function image";
|
report("SIGILL - illegal instruction - invalid function image");
|
||||||
break;
|
break;
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
sigmsg = "SIGFPE - mathematical exception";
|
report("SIGFPE - mathematical exception");
|
||||||
break;
|
break;
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
sigmsg = "SIGSEGV - segment violation";
|
report("SIGSEGV - segment violation");
|
||||||
break;
|
break;
|
||||||
// case SIGTERM:
|
// case SIGTERM:
|
||||||
// sigmsg = "SIGTERM - Software termination signal from kill";
|
// report("SIGTERM - Software termination signal from kill");
|
||||||
// break;
|
// break;
|
||||||
// case SIGBREAK:
|
// case SIGBREAK:
|
||||||
// sigmsg = "SIGBREAK - Ctrl-Break sequence";
|
// report("SIGBREAK - Ctrl-Break sequence");
|
||||||
// break;
|
// break;
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
|
report("SIGABRT - abnormal termination triggered by abort call");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(msg,"signal number %d", num);
|
report(fmt::format("signal number {}", num));
|
||||||
if (coredumped)
|
|
||||||
sigmsg = 0;
|
|
||||||
else
|
|
||||||
sigmsg = msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coredumped)
|
|
||||||
{
|
|
||||||
if (sigmsg)
|
|
||||||
sprintf(msg, "%s (core dumped)", sigmsg);
|
|
||||||
else
|
|
||||||
strcat(msg, " (core dumped)");
|
|
||||||
|
|
||||||
sigmsg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
|
||||||
|
|
||||||
I_ShowErrorMessageBox(sigmsg,
|
|
||||||
#if defined (UNIXBACKTRACE)
|
|
||||||
true
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
!M_CheckParm("-noexchndl")
|
|
||||||
#else
|
|
||||||
false
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifndef NEWSIGNALHANDLER
|
||||||
|
|
@ -581,8 +574,8 @@ static void I_StartupConsole(void)
|
||||||
signal(SIGTTIN, SIG_IGN);
|
signal(SIGTTIN, SIG_IGN);
|
||||||
signal(SIGTTOU, SIG_IGN);
|
signal(SIGTTOU, SIG_IGN);
|
||||||
|
|
||||||
consolevent = !M_CheckParm("-noconsole");
|
consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole"));
|
||||||
framebuffer = M_CheckParm("-framebuffer");
|
framebuffer = static_cast<SDL_bool>(M_CheckParm("-framebuffer"));
|
||||||
|
|
||||||
if (framebuffer)
|
if (framebuffer)
|
||||||
consolevent = SDL_FALSE;
|
consolevent = SDL_FALSE;
|
||||||
|
|
@ -622,7 +615,7 @@ static void I_StartupConsole(void)
|
||||||
void I_GetConsoleEvents(void)
|
void I_GetConsoleEvents(void)
|
||||||
{
|
{
|
||||||
// we use this when sending back commands
|
// we use this when sending back commands
|
||||||
event_t ev = {0};
|
event_t ev = {};
|
||||||
char key = 0;
|
char key = 0;
|
||||||
ssize_t d;
|
ssize_t d;
|
||||||
|
|
||||||
|
|
@ -2199,43 +2192,43 @@ static const char *locateWad(void)
|
||||||
|
|
||||||
// examine default dirs
|
// examine default dirs
|
||||||
#ifdef DEFAULTWADLOCATION1
|
#ifdef DEFAULTWADLOCATION1
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION1);
|
I_OutputMsg("," DEFAULTWADLOCATION1);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION1);
|
strcpy(returnWadPath, DEFAULTWADLOCATION1);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION2
|
#ifdef DEFAULTWADLOCATION2
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION2);
|
I_OutputMsg("," DEFAULTWADLOCATION2);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION2);
|
strcpy(returnWadPath, DEFAULTWADLOCATION2);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION3
|
#ifdef DEFAULTWADLOCATION3
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION3);
|
I_OutputMsg("," DEFAULTWADLOCATION3);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION3);
|
strcpy(returnWadPath, DEFAULTWADLOCATION3);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION4
|
#ifdef DEFAULTWADLOCATION4
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION4);
|
I_OutputMsg("," DEFAULTWADLOCATION4);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION4);
|
strcpy(returnWadPath, DEFAULTWADLOCATION4);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION5
|
#ifdef DEFAULTWADLOCATION5
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION5);
|
I_OutputMsg("," DEFAULTWADLOCATION5);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION5);
|
strcpy(returnWadPath, DEFAULTWADLOCATION5);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION6
|
#ifdef DEFAULTWADLOCATION6
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION6);
|
I_OutputMsg("," DEFAULTWADLOCATION6);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION6);
|
strcpy(returnWadPath, DEFAULTWADLOCATION6);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTWADLOCATION7
|
#ifdef DEFAULTWADLOCATION7
|
||||||
I_OutputMsg(","DEFAULTWADLOCATION7);
|
I_OutputMsg("," DEFAULTWADLOCATION7);
|
||||||
strcpy(returnWadPath, DEFAULTWADLOCATION7);
|
strcpy(returnWadPath, DEFAULTWADLOCATION7);
|
||||||
if (isWadPathOk(returnWadPath))
|
if (isWadPathOk(returnWadPath))
|
||||||
return returnWadPath;
|
return returnWadPath;
|
||||||
|
|
@ -2252,21 +2245,21 @@ static const char *locateWad(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTSEARCHPATH1
|
#ifdef DEFAULTSEARCHPATH1
|
||||||
// find in /usr/local
|
// find in /usr/local
|
||||||
I_OutputMsg(", in:"DEFAULTSEARCHPATH1);
|
I_OutputMsg(", in:" DEFAULTSEARCHPATH1);
|
||||||
WadPath = searchWad(DEFAULTSEARCHPATH1);
|
WadPath = searchWad(DEFAULTSEARCHPATH1);
|
||||||
if (WadPath)
|
if (WadPath)
|
||||||
return WadPath;
|
return WadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTSEARCHPATH2
|
#ifdef DEFAULTSEARCHPATH2
|
||||||
// find in /usr/games
|
// find in /usr/games
|
||||||
I_OutputMsg(", in:"DEFAULTSEARCHPATH2);
|
I_OutputMsg(", in:" DEFAULTSEARCHPATH2);
|
||||||
WadPath = searchWad(DEFAULTSEARCHPATH2);
|
WadPath = searchWad(DEFAULTSEARCHPATH2);
|
||||||
if (WadPath)
|
if (WadPath)
|
||||||
return WadPath;
|
return WadPath;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEFAULTSEARCHPATH3
|
#ifdef DEFAULTSEARCHPATH3
|
||||||
// find in ???
|
// find in ???
|
||||||
I_OutputMsg(", in:"DEFAULTSEARCHPATH3);
|
I_OutputMsg(", in:" DEFAULTSEARCHPATH3);
|
||||||
WadPath = searchWad(DEFAULTSEARCHPATH3);
|
WadPath = searchWad(DEFAULTSEARCHPATH3);
|
||||||
if (WadPath)
|
if (WadPath)
|
||||||
return WadPath;
|
return WadPath;
|
||||||
|
|
@ -2310,7 +2303,7 @@ const char *I_LocateWad(void)
|
||||||
static long get_entry(const char* name, const char* buf)
|
static long get_entry(const char* name, const char* buf)
|
||||||
{
|
{
|
||||||
long val;
|
long val;
|
||||||
char* hit = strstr(buf, name);
|
char* hit = strstr(const_cast<char*>(buf), name);
|
||||||
if (hit == NULL) {
|
if (hit == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue