diff --git a/pcsx2/Config.h b/pcsx2/Config.h index fe23dea6b8..99b66c4cd4 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -18,7 +18,6 @@ #include "common/emitter/tools.h" #include "common/General.h" #include "common/Path.h" -#include #include class IniInterface; @@ -514,8 +513,9 @@ struct Pcsx2Config // ------------------------------------------------------------------------ struct FilenameOptions { - wxFileName Bios; + std::string Bios; + FilenameOptions(); void LoadSave(IniInterface& conf); bool operator==(const FilenameOptions& right) const @@ -534,7 +534,7 @@ struct Pcsx2Config // struct McdOptions { - wxFileName Filename; // user-configured location of this memory card + std::string Filename; // user-configured location of this memory card bool Enabled; // memory card enabled (if false, memcard will not show up in-game) MemoryCardType Type; // the memory card implementation that should be used }; @@ -608,6 +608,7 @@ struct Pcsx2Config void Save( const wxString& dstfile ); void Save( const wxOutputStream& deststream ); + // TODO: Make these std::string when we remove wxFile... wxString FullpathToBios() const; wxString FullpathToMcd(uint slot) const; diff --git a/pcsx2/MemoryCardFile.cpp b/pcsx2/MemoryCardFile.cpp index 12d0cb7178..f715e5dde8 100644 --- a/pcsx2/MemoryCardFile.cpp +++ b/pcsx2/MemoryCardFile.cpp @@ -15,6 +15,7 @@ #include "PrecompiledHeader.h" #include "common/SafeArray.inl" +#include "common/StringUtil.h" #include #include #include @@ -254,12 +255,12 @@ wxFileName FileMcd_GetSimpleName(uint slot) return g_Conf->Folders.MemoryCards + wxsFormat( L"Mcd%03u.ps2", slot+1 ); } */ -wxString FileMcd_GetDefaultName(uint slot) +std::string FileMcd_GetDefaultName(uint slot) { if (FileMcd_IsMultitapSlot(slot)) - return wxsFormat(L"Mcd-Multitap%u-Slot%02u.ps2", FileMcd_GetMtapPort(slot) + 1, FileMcd_GetMtapSlot(slot) + 1); + return StringUtil::StdStringFromFormat("Mcd-Multitap%u-Slot%02u.ps2", FileMcd_GetMtapPort(slot) + 1, FileMcd_GetMtapSlot(slot) + 1); else - return wxsFormat(L"Mcd%03u.ps2", slot + 1); + return StringUtil::StdStringFromFormat("Mcd%03u.ps2", slot + 1); } FileMemoryCard::FileMemoryCard() diff --git a/pcsx2/MemoryCardFile.h b/pcsx2/MemoryCardFile.h index 343b5638f5..c2cd11c8b5 100644 --- a/pcsx2/MemoryCardFile.h +++ b/pcsx2/MemoryCardFile.h @@ -27,7 +27,7 @@ extern uint FileMcd_GetMtapPort(uint slot); extern uint FileMcd_GetMtapSlot(uint slot); extern bool FileMcd_IsMultitapSlot(uint slot); //extern wxFileName FileMcd_GetSimpleName(uint slot); -extern wxString FileMcd_GetDefaultName(uint slot); +extern std::string FileMcd_GetDefaultName(uint slot); extern bool isValidNewFilename(wxString filenameStringToTest, wxDirName atBasePath, wxString& out_errorMessage, uint minNumCharacters = 5); diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 67b02da613..ce6d936b6c 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -435,28 +435,15 @@ void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini ) IniBitfield( MemoryViewBytesPerRow ); } +Pcsx2Config::FilenameOptions::FilenameOptions() +{ +} + void Pcsx2Config::FilenameOptions::LoadSave(IniInterface& ini) { ScopedIniGroup path(ini, L"Filenames"); - static const wxFileName pc(L"Please Configure"); - - //when saving in portable mode, we just save the non-full-path filename - // --> on load they'll be initialized with default (relative) paths (works for bios) - //note: this will break if converting from install to portable, and custom folders are used. We can live with that. -#ifndef PCSX2_CORE - bool needRelativeName = ini.IsSaving() && IsPortable(); -#else - bool needRelativeName = ini.IsSaving(); -#endif - - if (needRelativeName) - { - wxFileName bios_filename = wxFileName(Bios.GetFullName()); - ini.Entry(L"BIOS", bios_filename, pc); - } - else - ini.Entry(L"BIOS", Bios, pc); + ini.Entry(L"BIOS", Bios, Bios); } Pcsx2Config::FolderOptions::FolderOptions() @@ -620,12 +607,12 @@ void Pcsx2Config::Save( const wxString& dstfile ) wxString Pcsx2Config::FullpathToBios() const { - return Path::Combine(Folders.Bios, BaseFilenames.Bios); + return Path::Combine(Folders.Bios, wxString(BaseFilenames.Bios)); } wxString Pcsx2Config::FullpathToMcd(uint slot) const { - return Path::Combine(Folders.MemoryCards, Mcd[slot].Filename); + return Path::Combine(Folders.MemoryCards, wxString(Mcd[slot].Filename)); } void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg) diff --git a/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp b/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp index cc63132833..c5abba653d 100644 --- a/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp +++ b/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp @@ -35,7 +35,7 @@ enum MemoryCardConversionType { Dialogs::ConvertMemoryCardDialog::ConvertMemoryCardDialog( wxWindow* parent, const wxDirName& mcdPath, const Pcsx2Config::McdOptions& mcdSourceConfig ) : wxDialogWithHelpers( parent, _( "Convert a memory card to a different format" ) ) , m_mcdPath( mcdPath ) - , m_mcdSourceFilename( mcdSourceConfig.Filename.GetFullName() ) + , m_mcdSourceFilename( mcdSourceConfig.Filename ) { SetMinWidth( 472 * MSW_GetDPIScale()); diff --git a/pcsx2/gui/Panels/MemoryCardListPanel.cpp b/pcsx2/gui/Panels/MemoryCardListPanel.cpp index 790016fadc..ea3d6ad843 100644 --- a/pcsx2/gui/Panels/MemoryCardListPanel.cpp +++ b/pcsx2/gui/Panels/MemoryCardListPanel.cpp @@ -549,14 +549,14 @@ void Panels::MemoryCardListPanel_Simple::Apply() g_Conf->EmuOptions.Mcd[slot].Type = m_Cards[slot].Type; g_Conf->EmuOptions.Mcd[slot].Enabled = m_Cards[slot].IsEnabled && m_Cards[slot].IsPresent; if (m_Cards[slot].IsPresent) - g_Conf->EmuOptions.Mcd[slot].Filename = m_Cards[slot].Filename; + g_Conf->EmuOptions.Mcd[slot].Filename = m_Cards[slot].Filename.GetFullName(); else - g_Conf->EmuOptions.Mcd[slot].Filename = L""; + g_Conf->EmuOptions.Mcd[slot].Filename.clear(); if (g_Conf->EmuOptions.Mcd[slot].Enabled) { used++; - Console.WriteLn(L"slot[%d]='%s'", slot, WX_STR(g_Conf->EmuOptions.Mcd[slot].Filename.GetFullName())); + Console.WriteLn("slot[%d]='%s'", slot, g_Conf->EmuOptions.Mcd[slot].Filename.c_str()); } } if (!used) diff --git a/pcsx2/ps2/BiosTools.cpp b/pcsx2/ps2/BiosTools.cpp index 851963c964..2033ab085c 100644 --- a/pcsx2/ps2/BiosTools.cpp +++ b/pcsx2/ps2/BiosTools.cpp @@ -258,7 +258,7 @@ void LoadBIOS() try { wxString Bios( EmuConfig.FullpathToBios() ); - if( !EmuConfig.BaseFilenames.Bios.IsOk() || EmuConfig.BaseFilenames.Bios.IsDir() ) + if( EmuConfig.BaseFilenames.Bios.empty() ) throw Exception::FileNotFound( Bios ) .SetDiagMsg(L"BIOS has not been configured, or the configuration has been corrupted.") .SetUserMsg(_("The PS2 BIOS could not be loaded. The BIOS has not been configured, or the configuration has been corrupted. Please re-configure."));