Get rid of wxChar in EnumToString

This commit is contained in:
Connor McLaughlin 2021-12-10 21:12:15 +10:00 committed by refractionpcsx2
parent 112238fbd7
commit 120ee6c673
5 changed files with 35 additions and 37 deletions

View File

@ -102,7 +102,7 @@
pxAssert(EnumIsValid(id)); \ pxAssert(EnumIsValid(id)); \
} \ } \
\ \
extern const wxChar* EnumToString(enumName id) extern const char* EnumToString(enumName id)
class pxEnumEnd_t class pxEnumEnd_t
{ {

View File

@ -21,23 +21,21 @@
// AND'ing this mask against an MXCSR prior to LDMXCSR. // AND'ing this mask against an MXCSR prior to LDMXCSR.
SSE_MXCSR MXCSR_Mask; SSE_MXCSR MXCSR_Mask;
const wxChar* EnumToString(SSE_RoundMode sse) const char* EnumToString(SSE_RoundMode sse)
{ {
switch (sse) switch (sse)
{ {
case SSEround_Nearest: case SSEround_Nearest:
return L"Nearest"; return "Nearest";
case SSEround_NegInf: case SSEround_NegInf:
return L"NegativeInfinity"; return "NegativeInfinity";
case SSEround_PosInf: case SSEround_PosInf:
return L"PositiveInfinity"; return "PositiveInfinity";
case SSEround_Chop: case SSEround_Chop:
return L"Chop"; return "Chop";
default: default:
return L"Invalid"; return "Invalid";
} }
return L"Invalid";
} }
SSE_RoundMode SSE_MXCSR::GetRoundMode() const SSE_RoundMode SSE_MXCSR::GetRoundMode() const

View File

@ -103,7 +103,7 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str
bool fixValidated = false; bool fixValidated = false;
for (GamefixId id = GamefixId_FIRST; id < pxEnumEnd; id++) 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) if (validFix == fix)
{ {
fixValidated = true; fixValidated = true;
@ -129,7 +129,7 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str
bool speedHackValidated = false; bool speedHackValidated = false;
for (SpeedhackId id = SpeedhackId_FIRST; id < pxEnumEnd; id++) 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) if (validSpeedHack == speedHack)
{ {
speedHackValidated = true; speedHackValidated = true;

View File

@ -57,12 +57,12 @@ void TraceLogFilters::LoadSave(SettingsWrapper& wrap)
SettingsWrapEntry(IOP.bitset); SettingsWrapEntry(IOP.bitset);
} }
const wxChar* const tbl_SpeedhackNames[] = const char* const tbl_SpeedhackNames[] =
{ {
L"mvuFlag", "mvuFlag",
L"InstantVU1"}; "InstantVU1"};
const __fi wxChar* EnumToString(SpeedhackId id) const char* EnumToString(SpeedhackId id)
{ {
return tbl_SpeedhackNames[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", "FpuMul",
L"FpuNegDiv", "FpuNegDiv",
L"GoemonTlb", "GoemonTlb",
L"SkipMPEG", "SkipMPEG",
L"OPHFlag", "OPHFlag",
L"EETiming", "EETiming",
L"DMABusy", "DMABusy",
L"GIFFIFO", "GIFFIFO",
L"VIFFIFO", "VIFFIFO",
L"VIF1Stall", "VIF1Stall",
L"VuAddSub", "VuAddSub",
L"Ibit", "Ibit",
L"VUKickstart", "VUKickstart",
L"VUOverflow", "VUOverflow",
L"XGKick"}; "XGKick"};
const __fi wxChar* EnumToString(GamefixId id) const char* EnumToString(GamefixId id)
{ {
return tbl_GamefixNames[id]; return tbl_GamefixNames[id];
} }

View File

@ -274,7 +274,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
SSE_RoundMode eeRM = (SSE_RoundMode)enum_cast(game.eeRoundMode); SSE_RoundMode eeRM = (SSE_RoundMode)enum_cast(game.eeRoundMode);
if (EnumIsValid(eeRM)) 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); dest.Cpu.sseMXCSR.SetRoundMode(eeRM);
gf++; gf++;
} }
@ -285,7 +285,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
SSE_RoundMode vuRM = (SSE_RoundMode)enum_cast(game.vuRoundMode); SSE_RoundMode vuRM = (SSE_RoundMode)enum_cast(game.vuRoundMode);
if (EnumIsValid(vuRM)) 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); dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM);
gf++; gf++;
} }
@ -294,7 +294,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
if (game.eeClampMode != GameDatabaseSchema::ClampMode::Undefined) if (game.eeClampMode != GameDatabaseSchema::ClampMode::Undefined)
{ {
int clampMode = enum_cast(game.eeClampMode); 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.fpuOverflow = (clampMode >= 1);
dest.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2);
dest.Cpu.Recompiler.fpuFullMode = (clampMode >= 3); 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 // TODO - config - this could be simplified with maps instead of bitfields and enums
for (SpeedhackId id = SpeedhackId_FIRST; id < pxEnumEnd; id++) 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 // Gamefixes are already guaranteed to be valid, any invalid ones are dropped
if (game.speedHacks.count(key) == 1) 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 // TODO - config - this could be simplified with maps instead of bitfields and enums
for (GamefixId id = GamefixId_FIRST; id < pxEnumEnd; id++) 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 // 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()) if (std::find(game.gameFixes.begin(), game.gameFixes.end(), key) != game.gameFixes.end())