From f4e9f86ca651905456b116d2eff99d43b5b9312e Mon Sep 17 00:00:00 2001 From: superp00t Date: Tue, 1 Apr 2025 11:08:45 -0400 Subject: [PATCH] refactor(client): wow launch flags should have the CMDOPT type --- src/client/CmdLine.cpp | 41 ++++++++++++++++++++-------------------- src/client/CmdLine.hpp | 43 ++++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/src/client/CmdLine.cpp b/src/client/CmdLine.cpp index c64316b..9b86ce2 100644 --- a/src/client/CmdLine.cpp +++ b/src/client/CmdLine.cpp @@ -1,5 +1,4 @@ #include "client/CmdLine.hpp" - #include int32_t CmdLineProcess() { @@ -32,23 +31,23 @@ int32_t CmdLineProcess() { void ProcessCommandLine() { static ARGLIST s_wowArgList[] = { - { 0x0, WOWCMD_RES_800x600, "800x600", nullptr }, - { 0x0, WOWCMD_RES_1024x768, "1024x768", nullptr }, - { 0x0, WOWCMD_RES_1280x960, "1280x960", nullptr }, - { 0x0, WOWCMD_RES_1280x1024, "1280x1024", nullptr }, - { 0x0, WOWCMD_RES_1600x1200, "1600x1200", nullptr }, - { 0x0, WOWCMD_16_BIT, "16bit", nullptr }, - { 0x0, WOWCMD_UP_TO_DATE, "uptodate", nullptr }, - { 0x0, WOWCMD_NO_SOUND, "nosound", nullptr }, - { 0x0, WOWCMD_SOUND_CHAOS, "soundchaos", nullptr }, - { 0x0, WOWCMD_NO_FIX_LAG, "nofixlag", nullptr }, - { 0x0, WOWCMD_DEPTH_16, "d16", nullptr }, - { 0x0, WOWCMD_DEPTH_24, "d24", nullptr }, - { 0x0, WOWCMD_DEPTH_32, "d32", nullptr }, - { 0x0, WOWCMD_WINDOWED, "windowed", nullptr }, - { 0x0, WOWCMD_HW_DETECT, "hwdetect", nullptr }, - { 0x0, WOWCMD_CONSOLE, "console", nullptr }, - { STORM_COMMAND_TYPE_STRING, WOWCMD_GX_OVERRIDE, "gxoverride", nullptr } + { 0x0, CMD_RES_800x600, "800x600", nullptr }, + { 0x0, CMD_RES_1024x768, "1024x768", nullptr }, + { 0x0, CMD_RES_1280x960, "1280x960", nullptr }, + { 0x0, CMD_RES_1280x1024, "1280x1024", nullptr }, + { 0x0, CMD_RES_1600x1200, "1600x1200", nullptr }, + { 0x0, CMD_16_BIT, "16bit", nullptr }, + { 0x0, CMD_UP_TO_DATE, "uptodate", nullptr }, + { 0x0, CMD_NO_SOUND, "nosound", nullptr }, + { 0x0, CMD_SOUND_CHAOS, "soundchaos", nullptr }, + { 0x0, CMD_NO_FIX_LAG, "nofixlag", nullptr }, + { 0x0, CMD_DEPTH_16, "d16", nullptr }, + { 0x0, CMD_DEPTH_24, "d24", nullptr }, + { 0x0, CMD_DEPTH_32, "d32", nullptr }, + { 0x0, CMD_WINDOWED, "windowed", nullptr }, + { 0x0, CMD_HW_DETECT, "hwdetect", nullptr }, + { 0x0, CMD_CONSOLE, "console", nullptr }, + { STORM_COMMAND_TYPE_STRING, CMD_GX_OVERRIDE, "gxoverride", nullptr } }; // Load wow-specific launch flags @@ -57,7 +56,7 @@ void ProcessCommandLine() { CmdLineProcess(); } -const char* CmdLineGetString(uint32_t opt) { +const char* CmdLineGetString(CMDOPT opt) { static char buffer[260] = {0}; SCmdGetString(opt, buffer, 260); @@ -65,10 +64,10 @@ const char* CmdLineGetString(uint32_t opt) { return buffer; } -uint32_t CmdLineGetUint(uint32_t opt) { +uint32_t CmdLineGetUint(CMDOPT opt) { return SCmdGetNum(opt); } -int32_t CmdLineGetBool(uint32_t opt) { +int32_t CmdLineGetBool(CMDOPT opt) { return SCmdGetBool(opt); } diff --git a/src/client/CmdLine.hpp b/src/client/CmdLine.hpp index 12827a5..fbf6a6b 100644 --- a/src/client/CmdLine.hpp +++ b/src/client/CmdLine.hpp @@ -23,35 +23,32 @@ enum CMDOPT { CMDOPTS }; -enum WOWCMDOPT { - WOWCMD_RES_800x600 = 16, - WOWCMD_RES_1024x768 = 17, - WOWCMD_RES_1280x960 = 18, - WOWCMD_RES_1280x1024 = 19, - WOWCMD_RES_1600x1200 = 20, - WOWCMD_UP_TO_DATE = 21, - WOWCMD_16_BIT = 22, - WOWCMD_NO_FIX_LAG = 24, - WOWCMD_NO_SOUND = 26, - WOWCMD_SOUND_CHAOS = 27, - WOWCMD_DEPTH_16 = 29, - WOWCMD_DEPTH_24 = 30, - WOWCMD_DEPTH_32 = 31, - WOWCMD_WINDOWED = 32, - WOWCMD_CONSOLE = 35, - WOWCMD_HW_DETECT = 36, - WOWCMD_GX_OVERRIDE = 39, - WOWCMD_OPTS -}; +#define CMD_RES_800x600 static_cast(16) +#define CMD_RES_1024x768 static_cast(17) +#define CMD_RES_1280x960 static_cast(18) +#define CMD_RES_1280x1024 static_cast(19) +#define CMD_RES_1600x1200 static_cast(20) +#define CMD_UP_TO_DATE static_cast(21) +#define CMD_16_BIT static_cast(22) +#define CMD_NO_FIX_LAG static_cast(24) +#define CMD_NO_SOUND static_cast(26) +#define CMD_SOUND_CHAOS static_cast(27) +#define CMD_DEPTH_16 static_cast(29) +#define CMD_DEPTH_24 static_cast(30) +#define CMD_DEPTH_32 static_cast(31) +#define CMD_WINDOWED static_cast(32) +#define CMD_CONSOLE static_cast(35) +#define CMD_HW_DETECT static_cast(36) +#define CMD_GX_OVERRIDE static_cast(39) int32_t CmdLineProcess(); void ProcessCommandLine(); -const char* CmdLineGetString(uint32_t opt); +const char* CmdLineGetString(CMDOPT opt); -uint32_t CmdLineGetUint(uint32_t opt); +uint32_t CmdLineGetUint(CMDOPT opt); -int32_t CmdLineGetBool(uint32_t opt); +int32_t CmdLineGetBool(CMDOPT opt); #endif