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)); \
} \
\
extern const wxChar* EnumToString(enumName id)
extern const char* EnumToString(enumName id)
class pxEnumEnd_t
{

View File

@ -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

View File

@ -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;

View File

@ -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];
}

View File

@ -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())