wx: Remove wxString implicit constructor from std::string

On windows, it uses the current system's character encoding instead of utf-8, which breaks a lot of things.  We should avoid it.
This commit is contained in:
TellowKrinkle 2021-01-14 01:13:33 -06:00 committed by tellowkrinkle
parent 162a0bbe46
commit cbcd9b5004
26 changed files with 100 additions and 55 deletions

View File

@ -1319,7 +1319,7 @@ public:
wxString(const wxStdWideString& str) wxString(const wxStdWideString& str)
{ assign(str.c_str(), str.length()); } { assign(str.c_str(), str.length()); }
#endif #endif
#ifndef _WIN32 // PCSX2: We don't want to accidentally interpret utf-8 std::strings as something else!
#if !wxUSE_UNICODE // ANSI build #if !wxUSE_UNICODE // ANSI build
// FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too
wxString(const std::string& str) : m_impl(str) {} wxString(const std::string& str) : m_impl(str) {}
@ -1327,6 +1327,7 @@ public:
wxString(const std::string& str) wxString(const std::string& str)
{ assign(str.c_str(), str.length()); } { assign(str.c_str(), str.length()); }
#endif #endif
#endif
#endif // wxUSE_STD_STRING #endif // wxUSE_STD_STRING
// Also always provide explicit conversions to std::[w]string in any case, // Also always provide explicit conversions to std::[w]string in any case,

View File

@ -230,6 +230,7 @@ public:
wxString GetString() const; wxString GetString() const;
#if wxUSE_STD_STRING #if wxUSE_STD_STRING
#ifndef _WIN32 // PCSX2: std::string conversion removal
wxVariant(const std::string& val, const wxString& name = wxEmptyString); wxVariant(const std::string& val, const wxString& name = wxEmptyString);
bool operator==(const std::string& value) const bool operator==(const std::string& value) const
{ return operator==(wxString(value)); } { return operator==(wxString(value)); }
@ -238,6 +239,7 @@ public:
wxVariant& operator=(const std::string& value) wxVariant& operator=(const std::string& value)
{ return operator=(wxString(value)); } { return operator=(wxString(value)); }
operator std::string() const { return (operator wxString()).ToStdString(); } operator std::string() const { return (operator wxString()).ToStdString(); }
#endif
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString); wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
bool operator==(const wxStdWideString& value) const bool operator==(const wxStdWideString& value) const

View File

@ -981,11 +981,13 @@ wxVariant::wxVariant(const wxScopedWCharBuffer& val, const wxString& name)
} }
#if wxUSE_STD_STRING #if wxUSE_STD_STRING
#ifndef _WIN32 // PCSX2: std::string conversion removal
wxVariant::wxVariant(const std::string& val, const wxString& name) wxVariant::wxVariant(const std::string& val, const wxString& name)
{ {
m_refData = new wxVariantDataString(wxString(val)); m_refData = new wxVariantDataString(wxString(val));
m_name = name; m_name = name;
} }
#endif
wxVariant::wxVariant(const wxStdWideString& val, const wxString& name) wxVariant::wxVariant(const wxStdWideString& val, const wxString& name)
{ {

View File

@ -470,6 +470,28 @@ bool IConsoleWriter::Warning(const wxString fmt, ...) const
return false; return false;
} }
bool IConsoleWriter::WriteLn(ConsoleColors color, const std::string& str) const
{
ConsoleColorScope cs(color);
return WriteLn(str);
}
bool IConsoleWriter::WriteLn(const std::string& str) const
{
DoWriteLn(_addIndentation(fromUTF8(str), conlog_Indent));
return false;
}
bool IConsoleWriter::Error(const std::string& str) const
{
return WriteLn(Color_StrongRed, str);
}
bool IConsoleWriter::Warning(const std::string& str) const
{
return WriteLn(Color_StrongOrange, str);
}
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// ConsoleColorScope / ConsoleIndentScope // ConsoleColorScope / ConsoleIndentScope

View File

@ -125,6 +125,11 @@ struct IConsoleWriter
bool WriteLn(const wxString fmt, ...) const; bool WriteLn(const wxString fmt, ...) const;
bool Error(const wxString fmt, ...) const; bool Error(const wxString fmt, ...) const;
bool Warning(const wxString fmt, ...) const; bool Warning(const wxString fmt, ...) const;
bool WriteLn(ConsoleColors color, const std::string& str) const;
bool WriteLn(const std::string& str) const;
bool Error(const std::string& str) const;
bool Warning(const std::string& str) const;
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -270,6 +270,7 @@ extern const wxChar* __fastcall pxExpandMsg(const wxChar* message);
extern const wxChar* __fastcall pxGetTranslation(const wxChar* message); extern const wxChar* __fastcall pxGetTranslation(const wxChar* message);
extern bool pxIsEnglish(int id); extern bool pxIsEnglish(int id);
extern wxString fromUTF8(const std::string& str);
extern wxString fromUTF8(const char* src); extern wxString fromUTF8(const char* src);
extern wxString fromAscii(const char* src); extern wxString fromAscii(const char* src);

View File

@ -274,7 +274,7 @@ void IniLoader::Entry(const wxString& var, std::string& value, const std::string
if (m_Config) if (m_Config)
{ {
wxString temp; wxString temp;
m_Config->Read(var, &temp, wxString(default_value)); m_Config->Read(var, &temp, fromUTF8(default_value));
value = temp.ToStdString(); value = temp.ToStdString();
} }
else if (&value != &default_value) else if (&value != &default_value)
@ -443,5 +443,5 @@ void IniSaver::Entry(const wxString& var, std::string& value, const std::string&
{ {
if (!m_Config) if (!m_Config)
return; return;
m_Config->Write(var, wxString(value)); m_Config->Write(var, fromUTF8(value));
} }

View File

@ -31,6 +31,11 @@ __fi wxString fromUTF8(const char* src)
return wxString(src, wxMBConvUTF8()); return wxString(src, wxMBConvUTF8());
} }
__fi wxString fromUTF8(const std::string& str)
{
return wxString(str.data(), wxMBConvUTF8(), str.size());
}
__fi wxString fromAscii(const char* src) __fi wxString fromAscii(const char* src)
{ {
return wxString::FromAscii(src); return wxString::FromAscii(src);

View File

@ -376,7 +376,7 @@ bool DoCDVDopen()
return true; return true;
} }
wxString somepick(Path::GetFilenameWithoutExt(m_SourceFilename[CurrentSourceType])); wxString somepick(Path::GetFilenameWithoutExt(fromUTF8(m_SourceFilename[CurrentSourceType])));
//FWIW Disc serial availability doesn't seem reliable enough, sometimes it's there and sometime it's just null //FWIW Disc serial availability doesn't seem reliable enough, sometimes it's there and sometime it's just null
//Shouldn't the serial be available all time? Potentially need to look into Elfreloadinfo() reliability //Shouldn't the serial be available all time? Potentially need to look into Elfreloadinfo() reliability
//TODO: Add extra fallback case for CRC. //TODO: Add extra fallback case for CRC.

View File

@ -185,7 +185,7 @@ static wxString iso2indexname(const wxString& isoname)
wxDirName appRoot = // TODO: have only one of this in PCSX2. Right now have few... wxDirName appRoot = // TODO: have only one of this in PCSX2. Right now have few...
(wxDirName)(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath()); (wxDirName)(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath());
//TestTemplate(appRoot, isoname, false); //TestTemplate(appRoot, isoname, false);
return ApplyTemplate(L"gzip index", appRoot, EmuConfig.GzipIsoIndexTemplate, isoname, false); return ApplyTemplate(L"gzip index", appRoot, fromUTF8(EmuConfig.GzipIsoIndexTemplate), isoname, false);
} }
GzippedFileReader::GzippedFileReader(void) GzippedFileReader::GzippedFileReader(void)

View File

@ -43,10 +43,10 @@ void SaveDnsHosts()
ScopedIniGroup iniEntry(ini, groupName); ScopedIniGroup iniEntry(ini, groupName);
ConfigHost entry = config.EthHosts[i]; ConfigHost entry = config.EthHosts[i];
wxString url(entry.Url); wxString url(fromUTF8(entry.Url));
ini.Entry(L"Url", url); ini.Entry(L"Url", url);
//TODO UTF8(?) //TODO UTF8(?)
wxString desc(entry.Desc); wxString desc(fromUTF8(entry.Desc));
ini.Entry(L"Desc", desc); ini.Entry(L"Desc", desc);
char addrBuff[INET_ADDRSTRLEN]; char addrBuff[INET_ADDRSTRLEN];

View File

@ -242,6 +242,11 @@ public:
return false; return false;
} }
bool Write(const std::string& msg) const
{
return Write(fromUTF8(msg));
}
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -36,9 +36,9 @@ namespace
for (const GSSetting& setting : s) for (const GSSetting& setting : s)
{ {
if (!setting.note.empty()) if (!setting.note.empty())
arr.Add(setting.name + " (" + setting.note + ")"); arr.Add(fromUTF8(setting.name + " (" + setting.note + ")"));
else else
arr.Add(setting.name); arr.Add(fromUTF8(setting.name));
} }
} }
@ -204,8 +204,8 @@ void GSUIElementHolder::Load()
case UIElem::Type::Directory: case UIElem::Type::Directory:
{ {
auto* picker = static_cast<wxFileDirPickerCtrlBase*>(elem.control); auto* picker = static_cast<wxFileDirPickerCtrlBase*>(elem.control);
picker->SetInitialDirectory(theApp.GetConfigS(elem.config)); picker->SetInitialDirectory(fromUTF8(theApp.GetConfigS(elem.config)));
picker->SetPath(theApp.GetConfigS(elem.config)); picker->SetPath(fromUTF8(theApp.GetConfigS(elem.config)));
break; break;
} }
} }

View File

@ -43,16 +43,29 @@ static YAML::Node LoadYAMLFromFile(const wxString& fileName)
if (result) if (result)
{ {
wxString fileContents; size_t len = indexFile.Length();
if (indexFile.ReadAll(&fileContents)) std::string fileContents(len, '\0');
if (indexFile.Read(fileContents.data(), len) == len)
{ {
index = YAML::Load(fileContents.mbc_str()); index = YAML::Load(fileContents);
} }
} }
return index; return index;
} }
/// A helper function to write a YAML file
static void SaveYAMLToFile(const wxString& filename, const YAML::Node& node)
{
wxFFile file;
if (file.Open(filename, L"w"))
{
// Make sure WX doesn't do anything funny with encoding
std::string yaml = YAML::Dump(node);
file.Write(yaml.data(), yaml.length());
}
}
FolderMemoryCard::FolderMemoryCard() FolderMemoryCard::FolderMemoryCard()
{ {
m_slot = 0; m_slot = 0;
@ -1249,11 +1262,7 @@ void FolderMemoryCard::FlushFileEntries(const u32 dirCluster, const u32 remainin
entryNode["timeModified"] = entry->entry.data.timeModified.ToTime(); entryNode["timeModified"] = entry->entry.data.timeModified.ToTime();
// Write out the changes // Write out the changes
wxFFile indexFile; SaveYAMLToFile(metaFileName.GetFullPath(), index);
if (indexFile.Open(metaFileName.GetFullPath(), L"w"))
{
indexFile.Write(YAML::Dump(index));
}
} }
MemoryCardFileMetadataReference* dirRef = AddDirEntryToMetadataQuickAccess(entry, parent); MemoryCardFileMetadataReference* dirRef = AddDirEntryToMetadataQuickAccess(entry, parent);
@ -1745,11 +1754,7 @@ void FolderMemoryCard::DeleteFromIndex(const wxString& filePath, const wxString&
index.remove(entryUTF8.data()); index.remove(entryUTF8.data());
// Write out the changes // Write out the changes
wxFFile indexFile; SaveYAMLToFile(indexName, index);
if (indexFile.Open(indexName, L"w"))
{
indexFile.Write(YAML::Dump(index));
}
} }
// from http://www.oocities.org/siliconvalley/station/8269/sma02/sma02.html#ECC // from http://www.oocities.org/siliconvalley/station/8269/sma02/sma02.html#ECC
@ -1935,11 +1940,7 @@ void FileAccessHelper::WriteIndex(wxFileName folderName, MemoryCardFileEntry* co
entryNode["timeModified"] = e->timeModified.ToTime(); entryNode["timeModified"] = e->timeModified.ToTime();
// Write out the changes // Write out the changes
wxFFile indexFile; SaveYAMLToFile(folderName.GetFullPath(), index);
if (indexFile.Open(folderName.GetFullPath(), L"w"))
{
indexFile.Write(YAML::Dump(index));
}
} }
wxFFile* FileAccessHelper::ReOpen(const wxFileName& folderName, MemoryCardFileMetadataReference* fileRef, bool writeMetadata) wxFFile* FileAccessHelper::ReOpen(const wxFileName& folderName, MemoryCardFileMetadataReference* fileRef, bool writeMetadata)

View File

@ -139,7 +139,7 @@ int LoadPatchesFromGamesDB(const wxString& crc, const GameDatabaseSchema::GameEn
{ {
for (auto line : patch.patchLines) for (auto line : patch.patchLines)
{ {
inifile_command(line); inifile_command(fromUTF8(line));
} }
} }
} }

View File

@ -715,7 +715,7 @@ void __fastcall eeloadHook()
} }
} }
if (!g_GameStarted && (disctype == 2 || disctype == 1) && elfname == discelf) if (!g_GameStarted && (disctype == 2 || disctype == 1) && fromUTF8(elfname) == discelf)
g_GameLoading = true; g_GameLoading = true;
} }

View File

@ -457,8 +457,8 @@ wxString InputRecording::resolveGameName()
GameDatabaseSchema::GameEntry game = gameDB->findGame(std::string(gameKey)); GameDatabaseSchema::GameEntry game = gameDB->findGame(std::string(gameKey));
if (game.isValid) if (game.isValid)
{ {
gameName = game.name; gameName = fromUTF8(game.name);
gameName += L" (" + game.region + L")"; gameName += L" (" + fromUTF8(game.region) + L")";
} }
} }
} }

View File

@ -323,7 +323,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
// are effectively booleans like the gamefixes // are effectively booleans like the gamefixes
bool mode = game.speedHacks.at(key) ? 1 : 0; bool mode = game.speedHacks.at(key) ? 1 : 0;
dest.Speedhacks.Set(id, mode); dest.Speedhacks.Set(id, mode);
PatchesCon->WriteLn(L"(GameDB) Setting Speedhack '" + key + "' to [mode=%d]", mode); PatchesCon->WriteLn(fmt::format("(GameDB) Setting Speedhack '{}' to [mode={}]", key, (int)mode));
gf++; gf++;
} }
} }
@ -338,7 +338,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
{ {
// if the fix is present, it is said to be enabled // if the fix is present, it is said to be enabled
dest.Gamefixes.Set(id, true); dest.Gamefixes.Set(id, true);
PatchesCon->WriteLn(L"(GameDB) Enabled Gamefix: " + key); PatchesCon->WriteLn("(GameDB) Enabled Gamefix: " + key);
gf++; gf++;
// The LUT is only used for 1 game so we allocate it only when the gamefix is enabled (save 4MB) // The LUT is only used for 1 game so we allocate it only when the gamefix is enabled (save 4MB)
@ -455,10 +455,10 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
GameDatabaseSchema::GameEntry game = GameDB->findGame(std::string(curGameKey)); GameDatabaseSchema::GameEntry game = GameDB->findGame(std::string(curGameKey));
if (game.isValid) if (game.isValid)
{ {
GameInfo::gameName = game.name; GameInfo::gameName = fromUTF8(game.name);
GameInfo::gameName += L" (" + game.region + L")"; GameInfo::gameName += L" (" + fromUTF8(game.region) + L")";
gameCompat = L" [Status = " + compatToStringWX(game.compat) + L"]"; gameCompat = L" [Status = " + compatToStringWX(game.compat) + L"]";
gameMemCardFilter = game.memcardFiltersAsString(); gameMemCardFilter = fromUTF8(game.memcardFiltersAsString());
} }
if (fixup.EnablePatches) if (fixup.EnablePatches)

View File

@ -1019,7 +1019,7 @@ void Pcsx2App::SysExecute()
// sources. // sources.
void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc, const wxString& elf_override ) void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc, const wxString& elf_override )
{ {
SysExecutorThread.PostEvent( new SysExecEvent_Execute(cdvdsrc, elf_override.ToStdString()) ); SysExecutorThread.PostEvent( new SysExecEvent_Execute(cdvdsrc, elf_override) );
#ifndef DISABLE_RECORDING #ifndef DISABLE_RECORDING
if (g_Conf->EmuOptions.EnableRecordingTools) if (g_Conf->EmuOptions.EnableRecordingTools)
{ {

View File

@ -1273,6 +1273,6 @@ void OSDlog(ConsoleColors color, bool console, const std::string& str)
} }
void OSDmonitor(ConsoleColors color, const std::string key, const std::string value) { void OSDmonitor(ConsoleColors color, const std::string key, const std::string value) {
GSosdMonitor(wxString(key).utf8_str(), wxString(value).utf8_str(), wxGetApp().GetProgramLog()->GetRGBA(color)); GSosdMonitor(key.c_str(), value.c_str(), wxGetApp().GetProgramLog()->GetRGBA(color));
} }

View File

@ -55,8 +55,8 @@ void DriveListManager::RefreshList()
for (auto i : drives) for (auto i : drives)
{ {
std::unique_ptr<DriveListItem> dli = std::unique_ptr<DriveListItem>(new DriveListItem()); std::unique_ptr<DriveListItem> dli = std::unique_ptr<DriveListItem>(new DriveListItem());
dli->driveLetter = wxString(i); dli->driveLetter = fromUTF8(i);
dli->itemPtr = m_Menu->AppendRadioItem(wxID_ANY, i); dli->itemPtr = m_Menu->AppendRadioItem(wxID_ANY, dli->driveLetter);
// Check the last used drive item // Check the last used drive item
if (g_Conf->Folders.RunDisc == dli->driveLetter) if (g_Conf->Folders.RunDisc == dli->driveLetter)

View File

@ -62,9 +62,9 @@ wxMenu* MainEmuFrame::MakeStatesSubMenu(int baseid, int loadBackupId) const
// For safety i also made them inactive aka grayed out to signify that's it's only for informational purposes // For safety i also made them inactive aka grayed out to signify that's it's only for informational purposes
// Fixme: In the future this can still be expanded to actually cycle savestates in the GUI. // Fixme: In the future this can still be expanded to actually cycle savestates in the GUI.
mnuSubstates->Append(baseid - 1, _("File...")); mnuSubstates->Append(baseid - 1, _("File..."));
wxMenuItem* CycleNext = mnuSubstates->Append(baseid - 2, _("Cycle to next slot") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotForward").toTitleizedString())); wxMenuItem* CycleNext = mnuSubstates->Append(baseid - 2, _("Cycle to next slot") + wxString("\t") + wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotForward").toTitleizedString());
CycleNext->Enable(false); CycleNext->Enable(false);
wxMenuItem* CycleBack = mnuSubstates->Append(baseid - 3, _("Cycle to previous slot") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotBackward").toTitleizedString())); wxMenuItem* CycleBack = mnuSubstates->Append(baseid - 3, _("Cycle to previous slot") + wxString("\t") + wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotBackward").toTitleizedString());
CycleBack->Enable(false); CycleBack->Enable(false);
return mnuSubstates; return mnuSubstates;
} }
@ -89,7 +89,7 @@ void MainEmuFrame::UpdateStatusBar()
m_statusbar.SetStatusText(temp, 0); m_statusbar.SetStatusText(temp, 0);
if (g_Conf->EnablePresets) if (g_Conf->EnablePresets)
m_statusbar.SetStatusText(fmt::format("P:{}", g_Conf->PresetIndex + 1), 1); m_statusbar.SetStatusText(wxString::Format(L"P:%d", g_Conf->PresetIndex + 1), 1);
else else
m_statusbar.SetStatusText("---", 1); m_statusbar.SetStatusText("---", 1);
@ -524,7 +524,7 @@ void MainEmuFrame::CreateInputRecordingMenu()
m_menuRecording.Append(MenuId_Recording_Settings, _("Settings"), &m_submenu_recording_settings); m_menuRecording.Append(MenuId_Recording_Settings, _("Settings"), &m_submenu_recording_settings);
wxString frame_advance_label = wxString(_("Configure Frame Advance")); wxString frame_advance_label = wxString(_("Configure Frame Advance"));
frame_advance_label.Append(fmt::format(" ({})", g_Conf->inputRecording.m_frame_advance_amount)); frame_advance_label.Append(wxString::Format(" (%d)", g_Conf->inputRecording.m_frame_advance_amount));
m_submenu_recording_settings.Append(MenuId_Recording_Config_FrameAdvance, frame_advance_label, _("Change the amount of frames advanced each time")); m_submenu_recording_settings.Append(MenuId_Recording_Config_FrameAdvance, frame_advance_label, _("Change the amount of frames advanced each time"));
m_menuRecording.AppendSeparator(); m_menuRecording.AppendSeparator();
@ -836,7 +836,7 @@ void MainEmuFrame::ApplyConfigToGui(AppConfig& configToApply, int flags)
#ifndef DISABLE_RECORDING #ifndef DISABLE_RECORDING
menubar.Check(MenuId_EnableInputRecording, configToApply.EmuOptions.EnableRecordingTools); menubar.Check(MenuId_EnableInputRecording, configToApply.EmuOptions.EnableRecordingTools);
wxString frame_advance_label = wxString(_("Configure Frame Advance")); wxString frame_advance_label = wxString(_("Configure Frame Advance"));
frame_advance_label.Append(fmt::format(" ({})", configToApply.inputRecording.m_frame_advance_amount)); frame_advance_label.Append(wxString::Format(" (%d)", configToApply.inputRecording.m_frame_advance_amount));
m_submenu_recording_settings.SetLabel(MenuId_Recording_Config_FrameAdvance, frame_advance_label); m_submenu_recording_settings.SetLabel(MenuId_Recording_Config_FrameAdvance, frame_advance_label);
g_InputRecordingControls.setFrameAdvanceAmount(configToApply.inputRecording.m_frame_advance_amount); g_InputRecordingControls.setFrameAdvanceAmount(configToApply.inputRecording.m_frame_advance_amount);
#endif #endif

View File

@ -1114,7 +1114,7 @@ void MainEmuFrame::Menu_Recording_Config_FrameAdvance(wxCommandEvent& event)
g_Conf->inputRecording.m_frame_advance_amount = result; g_Conf->inputRecording.m_frame_advance_amount = result;
g_InputRecordingControls.setFrameAdvanceAmount(result); g_InputRecordingControls.setFrameAdvanceAmount(result);
wxString frame_advance_label = wxString(_("Configure Frame Advance")); wxString frame_advance_label = wxString(_("Configure Frame Advance"));
frame_advance_label.Append(fmt::format(" ({})", result)); frame_advance_label.Append(wxString::Format(" (%ld)", result));
m_submenu_recording_settings.SetLabel(MenuId_Recording_Config_FrameAdvance, frame_advance_label); m_submenu_recording_settings.SetLabel(MenuId_Recording_Config_FrameAdvance, frame_advance_label);
} }
} }

View File

@ -107,7 +107,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
s_AspectRatio.AddGrowableCol(1); s_AspectRatio.AddGrowableCol(1);
// Implement custom hotkeys (F6) with translatable string intact + not blank in GUI. // Implement custom hotkeys (F6) with translatable string intact + not blank in GUI.
s_AspectRatio += Label(_("Aspect Ratio:") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("GSwindow_CycleAspectRatio").toTitleizedString())) | pxMiddle; s_AspectRatio += Label(_("Aspect Ratio:") + wxString("\t") + wxGetApp().GlobalAccels->findKeycodeWithCommandId("GSwindow_CycleAspectRatio").toTitleizedString()) | pxMiddle;
s_AspectRatio += m_combo_AspectRatio | pxAlignRight; s_AspectRatio += m_combo_AspectRatio | pxAlignRight;
s_AspectRatio += Label(_("FMV Aspect Ratio Override:")) | pxMiddle; s_AspectRatio += Label(_("FMV Aspect Ratio Override:")) | pxMiddle;
s_AspectRatio += m_combo_FMVAspectRatioSwitch | pxAlignRight; s_AspectRatio += m_combo_FMVAspectRatioSwitch | pxAlignRight;

View File

@ -65,7 +65,7 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
// Implement custom hotkeys (Shift + Tab) with translatable string intact + not blank in GUI. // Implement custom hotkeys (Shift + Tab) with translatable string intact + not blank in GUI.
s_spins += Label(_("Slow Motion Adjust:") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_SlomoToggle").toTitleizedString())) | StdExpand(); s_spins += Label(_("Slow Motion Adjust:") + wxString::Format(" (%s)", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_SlomoToggle").toTitleizedString())) | StdExpand();
s_spins += 5; s_spins += 5;
s_spins += m_spin_SlomoPct | pxBorder(wxTOP, 3); s_spins += m_spin_SlomoPct | pxBorder(wxTOP, 3);
s_spins += Label(L"%") | StdExpand(); s_spins += Label(L"%") | StdExpand();
@ -73,7 +73,7 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
// Implement custom hotkeys (Tab) with translatable string intact + not blank in GUI. // Implement custom hotkeys (Tab) with translatable string intact + not blank in GUI.
s_spins += Label(_("Turbo Adjust:") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_TurboToggle").toTitleizedString())) | StdExpand(); s_spins += Label(_("Turbo Adjust:") + wxString::Format(" (%s)", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_TurboToggle").toTitleizedString())) | StdExpand();
s_spins += 5; s_spins += 5;
s_spins += m_spin_TurboPct | pxBorder(wxTOP, 3); s_spins += m_spin_TurboPct | pxBorder(wxTOP, 3);
s_spins += Label(L"%") | StdExpand(); s_spins += Label(L"%") | StdExpand();
@ -176,11 +176,11 @@ Panels::FrameSkipPanel::FrameSkipPanel( wxWindow* parent )
), ),
// Implement custom hotkeys (Tab) with translatable string intact + not blank in GUI. // Implement custom hotkeys (Tab) with translatable string intact + not blank in GUI.
RadioPanelItem( RadioPanelItem(
_("Skip only on Turbo, to enable press") + fmt::format("{} ({})", " ", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_TurboToggle").toTitleizedString()) _("Skip only on Turbo, to enable press") + wxString::Format(" (%s)", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Framelimiter_TurboToggle").toTitleizedString())
), ),
// Implement custom hotkeys (Shift + F4) with translatable string intact + not blank in GUI. // Implement custom hotkeys (Shift + F4) with translatable string intact + not blank in GUI.
RadioPanelItem( RadioPanelItem(
_("Constant skipping") + fmt::format("{} ({})", " ", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Frameskip_Toggle").toTitleizedString()), _("Constant skipping") + wxString::Format(" (%s)", wxGetApp().GlobalAccels->findKeycodeWithCommandId("Frameskip_Toggle").toTitleizedString()),
wxEmptyString, wxEmptyString,
_("Normal and Turbo limit rates skip frames. Slow motion mode will still disable frameskipping.") _("Normal and Turbo limit rates skip frames. Slow motion mode will still disable frameskipping.")
), ),

View File

@ -228,8 +228,9 @@ static void LoadIrx( const std::string& filename, u8* dest )
s64 filesize = 0; s64 filesize = 0;
try try
{ {
wxFile irx(filename); wxString wname = fromUTF8(filename);
if( (filesize=Path::GetFileSize( filename ) ) <= 0 ) { wxFile irx(wname);
if( (filesize=Path::GetFileSize( wname ) ) <= 0 ) {
Console.Warning("IRX Warning: %s could not be read", filename.c_str()); Console.Warning("IRX Warning: %s could not be read", filename.c_str());
return; return;
} }