sdl/i_main.c: while we're here, split all the logging initialisation code into a separate function, to make main function more clean

This commit is contained in:
Monster Iestyn 2020-05-28 19:08:53 +01:00
parent 8f776b9318
commit d6ef2625f5

View file

@ -103,39 +103,10 @@ static inline VOID MakeCodeWritable(VOID)
}
#endif
/** \brief The main function
\param argc number of arg
\param *argv string table
\return int
*/
#if defined (__GNUC__) && (__GNUC__ >= 4)
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif
#ifdef FORCESDLMAIN
int SDL_main(int argc, char **argv)
#else
int main(int argc, char **argv)
#endif
#ifdef LOGMESSAGES
static VOID InitLogging(VOID)
{
const char *logdir = NULL;
myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string
#ifdef HAVE_TTF
#ifdef _WIN32
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
#else
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
#endif
#endif
#ifdef LOGMESSAGES
if (!M_CheckParm("-nolog"))
{
time_t my_time;
struct tm * timeinfo;
const char *format;
@ -216,7 +187,41 @@ int main(int argc, char **argv)
#else/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
logstream = fopen("latest-log.txt", "wt+");
#endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
}
}
#endif
/** \brief The main function
\param argc number of arg
\param *argv string table
\return int
*/
#if defined (__GNUC__) && (__GNUC__ >= 4)
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif
#ifdef FORCESDLMAIN
int SDL_main(int argc, char **argv)
#else
int main(int argc, char **argv)
#endif
{
myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string
#ifdef HAVE_TTF
#ifdef _WIN32
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
#else
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
#endif
#endif
#ifdef LOGMESSAGES
if (!M_CheckParm("-nolog"))
InitLogging();
#endif/*LOGMESSAGES*/
//I_OutputMsg("I_StartupSystem() ...\n");