Add common I_GetSysName function

Replaces the OS defines in Command_Version_f() with a common function to fetch the system name the game is currently running on.
This commit is contained in:
SteelT 2024-02-11 23:31:34 -05:00
parent c16791bc11
commit ddfb59d185
4 changed files with 16 additions and 12 deletions

View file

@ -206,5 +206,10 @@ void I_GetCursorPosition(INT32 *x, INT32 *y)
(void)y; (void)y;
} }
const char *I_GetSysName(void)
{
return NULL;
}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"

View file

@ -335,4 +335,8 @@ void I_GetCursorPosition(INT32 *x, INT32 *y);
*/ */
void I_SetMouseGrab(boolean grab); void I_SetMouseGrab(boolean grab);
/** \brief Returns the system name.
*/
const char *I_GetSysName(void);
#endif #endif

View file

@ -3812,18 +3812,7 @@ static void Command_Version_f(void)
#endif #endif
// OS // OS
// Would be nice to use SDL_GetPlatform for this CONS_Printf("%s ", I_GetSysName());
#if defined (_WIN32) || defined (_WIN64)
CONS_Printf("Windows ");
#elif defined(__linux__)
CONS_Printf("Linux ");
#elif defined(MACOSX)
CONS_Printf("macOS ");
#elif defined(UNIXCOMMON)
CONS_Printf("Unix (Common) ");
#else
CONS_Printf("Other OS ");
#endif
// Bitness // Bitness
if (sizeof(void*) == 4) if (sizeof(void*) == 4)

View file

@ -3256,4 +3256,10 @@ const CPUInfoFlags *I_CPUInfo(void)
// note CPUAFFINITY code used to reside here // note CPUAFFINITY code used to reside here
void I_RegisterSysCommands(void) {} void I_RegisterSysCommands(void) {}
const char *I_GetSysName(void)
{
return SDL_GetPlatform();
}
#endif #endif