Further cleanup of i_main.mm

This commit is contained in:
alexey.lysiuk 2014-12-29 12:10:18 +02:00
parent e3f92db395
commit 21d557ee11

View file

@ -51,7 +51,6 @@
#include "i_common.h" #include "i_common.h"
#include "i_osversion.h" #include "i_osversion.h"
#include "i_rbopts.h"
#undef Class #undef Class
@ -71,17 +70,15 @@ EXTERN_CVAR(Bool, fullscreen )
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
DArgs* Args; // command line arguments
namespace namespace
{ {
// The maximum number of functions that can be registered with atterm. // The maximum number of functions that can be registered with atterm.
static const size_t MAX_TERMS = 64; const size_t MAX_TERMS = 64;
static void (*TermFuncs[MAX_TERMS])(); void (*TermFuncs[MAX_TERMS])();
static const char *TermNames[MAX_TERMS]; const char *TermNames[MAX_TERMS];
static size_t NumTerms; size_t NumTerms;
void call_terms() void call_terms()
{ {
@ -146,6 +143,9 @@ void Mac_I_FatalError(const char* const message)
} }
DArgs* Args; // command line arguments
namespace namespace
{ {
@ -207,23 +207,12 @@ int OriginalMain(int argc, char** argv)
left in an unstable state. left in an unstable state.
*/ */
atexit (call_terms); atexit(call_terms);
atterm (I_Quit); atterm(I_Quit);
// Should we even be doing anything with progdir on Unix systems? NSString* exePath = [[NSBundle mainBundle] executablePath];
char program[PATH_MAX]; progdir = [[exePath stringByDeletingLastPathComponent] UTF8String];
if (realpath (argv[0], program) == NULL) progdir += "/";
strcpy (program, argv[0]);
char *slash = strrchr (program, '/');
if (slash != NULL)
{
*(slash + 1) = '\0';
progdir = program;
}
else
{
progdir = "./";
}
I_StartupJoysticks(); I_StartupJoysticks();
atterm(I_ShutdownJoysticks); atterm(I_ShutdownJoysticks);