From 120ee6c673a292e7548a91f37f15675776164f96 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 10 Dec 2021 21:12:15 +1000 Subject: [PATCH] Get rid of wxChar in EnumToString --- common/Dependencies.h | 2 +- common/emitter/simd.cpp | 14 ++++++------- pcsx2/GameDatabase.cpp | 4 ++-- pcsx2/Pcsx2Config.cpp | 42 ++++++++++++++++++------------------- pcsx2/gui/AppCoreThread.cpp | 10 ++++----- 5 files changed, 35 insertions(+), 37 deletions(-) diff --git a/common/Dependencies.h b/common/Dependencies.h index 19576b4fd0..350486ea26 100644 --- a/common/Dependencies.h +++ b/common/Dependencies.h @@ -102,7 +102,7 @@ pxAssert(EnumIsValid(id)); \ } \ \ - extern const wxChar* EnumToString(enumName id) + extern const char* EnumToString(enumName id) class pxEnumEnd_t { diff --git a/common/emitter/simd.cpp b/common/emitter/simd.cpp index 197ca352b5..f05e66ac12 100644 --- a/common/emitter/simd.cpp +++ b/common/emitter/simd.cpp @@ -21,23 +21,21 @@ // AND'ing this mask against an MXCSR prior to LDMXCSR. SSE_MXCSR MXCSR_Mask; -const wxChar* EnumToString(SSE_RoundMode sse) +const char* EnumToString(SSE_RoundMode sse) { switch (sse) { case SSEround_Nearest: - return L"Nearest"; + return "Nearest"; case SSEround_NegInf: - return L"NegativeInfinity"; + return "NegativeInfinity"; case SSEround_PosInf: - return L"PositiveInfinity"; + return "PositiveInfinity"; case SSEround_Chop: - return L"Chop"; + return "Chop"; default: - return L"Invalid"; + return "Invalid"; } - - return L"Invalid"; } SSE_RoundMode SSE_MXCSR::GetRoundMode() const diff --git a/pcsx2/GameDatabase.cpp b/pcsx2/GameDatabase.cpp index b3a2814d72..c24927579e 100644 --- a/pcsx2/GameDatabase.cpp +++ b/pcsx2/GameDatabase.cpp @@ -103,7 +103,7 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str bool fixValidated = false; for (GamefixId id = GamefixId_FIRST; id < pxEnumEnd; id++) { - std::string validFix = fmt::format("{}Hack", wxString(EnumToString(id)).ToUTF8()); + std::string validFix = fmt::format("{}Hack", EnumToString(id)); if (validFix == fix) { fixValidated = true; @@ -129,7 +129,7 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str bool speedHackValidated = false; for (SpeedhackId id = SpeedhackId_FIRST; id < pxEnumEnd; id++) { - std::string validSpeedHack = fmt::format("{}SpeedHack", wxString(EnumToString(id)).ToUTF8()); + std::string validSpeedHack = fmt::format("{}SpeedHack", EnumToString(id)); if (validSpeedHack == speedHack) { speedHackValidated = true; diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index eae5e29ea5..b1a3224df9 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -57,12 +57,12 @@ void TraceLogFilters::LoadSave(SettingsWrapper& wrap) SettingsWrapEntry(IOP.bitset); } -const wxChar* const tbl_SpeedhackNames[] = +const char* const tbl_SpeedhackNames[] = { - L"mvuFlag", - L"InstantVU1"}; + "mvuFlag", + "InstantVU1"}; -const __fi wxChar* EnumToString(SpeedhackId id) +const char* EnumToString(SpeedhackId id) { return tbl_SpeedhackNames[id]; } @@ -306,25 +306,25 @@ int Pcsx2Config::GSOptions::GetVsync() const } } -const wxChar* const tbl_GamefixNames[] = +const char* const tbl_GamefixNames[] = { - L"FpuMul", - L"FpuNegDiv", - L"GoemonTlb", - L"SkipMPEG", - L"OPHFlag", - L"EETiming", - L"DMABusy", - L"GIFFIFO", - L"VIFFIFO", - L"VIF1Stall", - L"VuAddSub", - L"Ibit", - L"VUKickstart", - L"VUOverflow", - L"XGKick"}; + "FpuMul", + "FpuNegDiv", + "GoemonTlb", + "SkipMPEG", + "OPHFlag", + "EETiming", + "DMABusy", + "GIFFIFO", + "VIFFIFO", + "VIF1Stall", + "VuAddSub", + "Ibit", + "VUKickstart", + "VUOverflow", + "XGKick"}; -const __fi wxChar* EnumToString(GamefixId id) +const char* EnumToString(GamefixId id) { return tbl_GamefixNames[id]; } diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index 1512ba5381..3f0df893fc 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -274,7 +274,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt SSE_RoundMode eeRM = (SSE_RoundMode)enum_cast(game.eeRoundMode); if (EnumIsValid(eeRM)) { - PatchesCon->WriteLn(L"(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM)); + PatchesCon->WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM)); dest.Cpu.sseMXCSR.SetRoundMode(eeRM); gf++; } @@ -285,7 +285,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt SSE_RoundMode vuRM = (SSE_RoundMode)enum_cast(game.vuRoundMode); if (EnumIsValid(vuRM)) { - PatchesCon->WriteLn(L"(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM)); + PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM)); dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM); gf++; } @@ -294,7 +294,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt if (game.eeClampMode != GameDatabaseSchema::ClampMode::Undefined) { int clampMode = enum_cast(game.eeClampMode); - PatchesCon->WriteLn(L"(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode); + PatchesCon->WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode); dest.Cpu.Recompiler.fpuOverflow = (clampMode >= 1); dest.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.fpuFullMode = (clampMode >= 3); @@ -314,7 +314,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt // TODO - config - this could be simplified with maps instead of bitfields and enums for (SpeedhackId id = SpeedhackId_FIRST; id < pxEnumEnd; id++) { - std::string key = fmt::format("{}SpeedHack", wxString(EnumToString(id)).ToUTF8()); + std::string key = fmt::format("{}SpeedHack", EnumToString(id)); // Gamefixes are already guaranteed to be valid, any invalid ones are dropped if (game.speedHacks.count(key) == 1) @@ -331,7 +331,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt // TODO - config - this could be simplified with maps instead of bitfields and enums for (GamefixId id = GamefixId_FIRST; id < pxEnumEnd; id++) { - std::string key = fmt::format("{}Hack", wxString(EnumToString(id)).ToUTF8()); + std::string key = fmt::format("{}Hack", EnumToString(id)); // Gamefixes are already guaranteed to be valid, any invalid ones are dropped if (std::find(game.gameFixes.begin(), game.gameFixes.end(), key) != game.gameFixes.end())