mirror of https://github.com/PCSX2/pcsx2.git
Config: Use std::string instead of wxFileName
This commit is contained in:
parent
171a395369
commit
817524bd1c
|
@ -18,7 +18,6 @@
|
|||
#include "common/emitter/tools.h"
|
||||
#include "common/General.h"
|
||||
#include "common/Path.h"
|
||||
#include <wx/filename.h>
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "common/SafeArray.inl"
|
||||
#include "common/StringUtil.h"
|
||||
#include <wx/file.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/stopwatch.h>
|
||||
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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."));
|
||||
|
|
Loading…
Reference in New Issue