- and a lil bit more work

This commit is contained in:
Rachael Alexanderson 2020-01-11 08:12:26 -05:00
parent e86e830407
commit 965c2fd789
2 changed files with 10 additions and 80 deletions

View file

@ -46,6 +46,7 @@
#include "version.h" #include "version.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "i_system.h" #include "i_system.h"
#include "common/gamecontrol.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -80,65 +81,6 @@ FArgs *Args;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
static int DoomSpecificInfo (char *buffer, char *end)
{
const char *arg;
int size = end-buffer-2;
int i, p;
p = 0;
p += snprintf (buffer+p, size-p, GAMENAME" version %s (%s)\n", GetVersionString(), GetGitHash());
#ifdef __VERSION__
p += snprintf (buffer+p, size-p, "Compiler version: %s\n", __VERSION__);
#endif
// If Args is nullptr, then execution is at either
// * early stage of initialization, additional info contains only default values
// * late stage of shutdown, most likely main() was done, and accessing global variables is no longer safe
if (Args)
{
p += snprintf(buffer + p, size - p, "\nCommand line:");
for (i = 0; i < Args->NumArgs(); ++i)
{
p += snprintf(buffer + p, size - p, " %s", Args->GetArg(i));
}
p += snprintf(buffer + p, size - p, "\n");
for (i = 0; (arg = Wads.GetWadName(i)) != NULL; ++i)
{
p += snprintf(buffer + p, size - p, "\nWad %d: %s", i, arg);
}
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
{
p += snprintf(buffer + p, size - p, "\n\nNot in a level.");
}
else
{
p += snprintf(buffer + p, size - p, "\n\nCurrent map: %s", primaryLevel->MapName.GetChars());
if (!viewactive)
{
p += snprintf(buffer + p, size - p, "\n\nView not active.");
}
else
{
auto& vp = r_viewpoint;
p += snprintf(buffer + p, size - p, "\n\nviewx = %f", vp.Pos.X);
p += snprintf(buffer + p, size - p, "\nviewy = %f", vp.Pos.Y);
p += snprintf(buffer + p, size - p, "\nviewz = %f", vp.Pos.Z);
p += snprintf(buffer + p, size - p, "\nviewangle = %f", vp.Angles.Yaw.Degrees);
}
}
}
buffer[p++] = '\n';
buffer[p++] = '\0';
return p;
}
void I_DetectOS() void I_DetectOS()
{ {
// The POSIX version never implemented this. // The POSIX version never implemented this.
@ -150,8 +92,10 @@ int main (int argc, char **argv)
{ {
#if !defined (__APPLE__) #if !defined (__APPLE__)
{ {
#if 0 // TODO: Crash handling
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS }; int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo); cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo);
#endif
} }
#endif // !__APPLE__ #endif // !__APPLE__
@ -193,7 +137,7 @@ int main (int argc, char **argv)
I_StartupJoysticks(); I_StartupJoysticks();
const int result = D_DoomMain(); const int result = GameMain();
SDL_Quit(); SDL_Quit();

View file

@ -49,23 +49,13 @@
#include <SDL.h> #include <SDL.h>
#include "doomerrors.h"
#include "doomtype.h"
#include "doomstat.h"
#include "version.h" #include "version.h"
#include "doomdef.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "m_argv.h" #include "m_argv.h"
#include "m_misc.h"
#include "i_sound.h" #include "i_sound.h"
#include "x86.h"
#include "d_main.h"
#include "d_net.h"
#include "g_game.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "gamecontrol.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
extern "C" extern "C"
@ -84,12 +74,6 @@ int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad
double PerfToSec, PerfToMillisec; double PerfToSec, PerfToMillisec;
ticcmd_t emptycmd;
ticcmd_t *I_BaseTiccmd(void)
{
return &emptycmd;
}
void I_BeginRead(void) void I_BeginRead(void)
{ {
} }
@ -104,8 +88,10 @@ void I_EndRead(void)
// //
void I_Init (void) void I_Init (void)
{ {
#if 0 // do we need this?
CheckCPUID (&CPU); CheckCPUID (&CPU);
DumpCPUInfo (&CPU); DumpCPUInfo (&CPU);
#endif
} }
// //
@ -127,7 +113,7 @@ void Linux_I_FatalError(const char* errortext)
if((str=getenv("KDE_FULL_SESSION")) && strcmp(str, "true") == 0) if((str=getenv("KDE_FULL_SESSION")) && strcmp(str, "true") == 0)
{ {
FString cmd; FString cmd;
cmd << "kdialog --title \"" GAMESIG " " << GetVersionString() cmd << "kdialog --title \"" GAMENAME " " << GetVersionString()
<< "\" --msgbox \"" << errortext << "\""; << "\" --msgbox \"" << errortext << "\"";
popen(cmd, "r"); popen(cmd, "r");
} }
@ -140,7 +126,7 @@ void Linux_I_FatalError(const char* errortext)
else else
{ {
FString title; FString title;
title << GAMESIG " " << GetVersionString(); title << GAMENAME " " << GetVersionString();
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, errortext, NULL) < 0) if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, errortext, NULL) < 0)
{ {
@ -210,7 +196,7 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
const char *str; const char *str;
if((str=getenv("KDE_FULL_SESSION")) && strcmp(str, "true") == 0) if((str=getenv("KDE_FULL_SESSION")) && strcmp(str, "true") == 0)
{ {
FString cmd("kdialog --title \"" GAMESIG " "); FString cmd("kdialog --title \"" GAMENAME " ");
cmd << GetVersionString() << ": Select an IWAD to use\"" cmd << GetVersionString() << ": Select an IWAD to use\""
" --menu \"" GAMENAME " found more than one IWAD\n" " --menu \"" GAMENAME " found more than one IWAD\n"
"Select from the list below to determine which one to use:\""; "Select from the list below to determine which one to use:\"";