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;
}
const char *I_GetSysName(void)
{
return NULL;
}
#include "../sdl/dosstr.c"

View file

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

View file

@ -3812,18 +3812,7 @@ static void Command_Version_f(void)
#endif
// OS
// Would be nice to use SDL_GetPlatform for this
#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
CONS_Printf("%s ", I_GetSysName());
// Bitness
if (sizeof(void*) == 4)

View file

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