mirror of https://github.com/PCSX2/pcsx2.git
Config: Move folders to their own namespace
Don't duplicate in EmuOptions.
This commit is contained in:
parent
43dfbe3f29
commit
ca523edf0e
|
@ -492,25 +492,6 @@ struct Pcsx2Config
|
|||
void SanityCheck();
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
struct FolderOptions
|
||||
{
|
||||
wxDirName
|
||||
Settings,
|
||||
Bios,
|
||||
Snapshots,
|
||||
Savestates,
|
||||
MemoryCards,
|
||||
Langs,
|
||||
Logs,
|
||||
Cheats,
|
||||
CheatsWS;
|
||||
|
||||
// FolderOptions is expected to be initialized by the frontend, not
|
||||
// loaded in the base config class.
|
||||
FolderOptions();
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
struct FilenameOptions
|
||||
{
|
||||
|
@ -581,7 +562,6 @@ struct Pcsx2Config
|
|||
|
||||
TraceLogFilters Trace;
|
||||
|
||||
FolderOptions Folders;
|
||||
FilenameOptions BaseFilenames;
|
||||
|
||||
// Memorycard options - first 2 are default slots, last 6 are multitap 1 and 2
|
||||
|
@ -635,6 +615,19 @@ struct Pcsx2Config
|
|||
|
||||
extern Pcsx2Config EmuConfig;
|
||||
|
||||
namespace EmuFolders
|
||||
{
|
||||
extern wxDirName Settings;
|
||||
extern wxDirName Bios;
|
||||
extern wxDirName Snapshots;
|
||||
extern wxDirName Savestates;
|
||||
extern wxDirName MemoryCards;
|
||||
extern wxDirName Langs;
|
||||
extern wxDirName Logs;
|
||||
extern wxDirName Cheats;
|
||||
extern wxDirName CheatsWS;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper Macros for Reading Emu Configurations.
|
||||
//
|
||||
|
|
|
@ -203,7 +203,7 @@ s32 DEV9open(void* pDsp)
|
|||
|
||||
if (hddPath.is_relative())
|
||||
{
|
||||
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
|
||||
ghc::filesystem::path path(EmuFolders::Settings.ToString().wx_str());
|
||||
hddPath = path / hddPath;
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1092,7 @@ void ApplyConfigIfRunning(ConfigDEV9 oldConfig)
|
|||
if (hddPath.is_relative())
|
||||
{
|
||||
//GHC uses UTF8 on all platforms
|
||||
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
|
||||
ghc::filesystem::path path(EmuFolders::Settings.ToString().wx_str());
|
||||
hddPath = path / hddPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
void SaveDnsHosts()
|
||||
{
|
||||
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(EmuConfig.Folders.Settings.Combine(wxString("DEV9Hosts.ini")).GetFullPath()));
|
||||
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(EmuFolders::Settings.Combine(wxString("DEV9Hosts.ini")).GetFullPath()));
|
||||
IniSaver ini((wxConfigBase*)hini.get());
|
||||
|
||||
for (size_t i = 0; i < config.EthHosts.size(); i++)
|
||||
|
@ -57,7 +57,7 @@ void SaveDnsHosts()
|
|||
|
||||
void LoadDnsHosts()
|
||||
{
|
||||
wxFileName iniPath = EmuConfig.Folders.Settings.Combine(wxString("DEV9Hosts.ini"));
|
||||
wxFileName iniPath = EmuFolders::Settings.Combine(wxString("DEV9Hosts.ini"));
|
||||
config.EthHosts.clear();
|
||||
//If no file exists, create one to provice an example config
|
||||
if (!iniPath.FileExists())
|
||||
|
|
|
@ -113,7 +113,7 @@ void SaveConf()
|
|||
*/
|
||||
|
||||
|
||||
const std::string file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
const std::string file(EmuFolders::Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
|
||||
Console.WriteLn("DEV9: CONF: %s", file.c_str());
|
||||
|
||||
|
@ -134,7 +134,7 @@ void SaveConf()
|
|||
|
||||
void LoadConf()
|
||||
{
|
||||
const std::string file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
const std::string file(EmuFolders::Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
if (-1 == access(file.c_str(), F_OK))
|
||||
return;
|
||||
|
||||
|
|
|
@ -200,11 +200,11 @@ void OnInitDialog()
|
|||
|
||||
void OnBrowse(GtkButton* button, gpointer usr_data)
|
||||
{
|
||||
ghc::filesystem::path inis(EmuConfig.Folders.Settings.ToString().ToStdString());
|
||||
ghc::filesystem::path inis(EmuFolders::Settings.ToString().ToStdString());
|
||||
|
||||
static const wxChar* hddFilterType = L"HDD|*.raw;*.RAW";
|
||||
|
||||
wxFileDialog ctrl(nullptr, _("HDD Image File"), EmuConfig.Folders.Settings.ToString(), HDD_DEF,
|
||||
wxFileDialog ctrl(nullptr, _("HDD Image File"), EmuFolders::Settings.ToString(), HDD_DEF,
|
||||
(wxString)hddFilterType + L"|" + _("All Files (*.*)") + L"|*.*", wxFD_SAVE);
|
||||
|
||||
if (ctrl.ShowModal() != wxID_CANCEL)
|
||||
|
@ -280,7 +280,7 @@ void OnOk()
|
|||
|
||||
if (hddPath.is_relative())
|
||||
{
|
||||
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
|
||||
ghc::filesystem::path path(EmuFolders::Settings.ToString().wx_str());
|
||||
hddPath = path / hddPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ bool FileExists(std::wstring szPath)
|
|||
|
||||
void SaveConf()
|
||||
{
|
||||
const std::wstring file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
const std::wstring file(EmuFolders::Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
DeleteFile(file.c_str());
|
||||
|
||||
//Create file with UT16 BOM to allow PrivateProfile to save unicode data
|
||||
|
@ -89,7 +89,7 @@ void SaveConf()
|
|||
|
||||
void LoadConf()
|
||||
{
|
||||
const std::wstring file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
const std::wstring file(EmuFolders::Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
if (FileExists(file.c_str()) == false)
|
||||
{
|
||||
LoadDnsHosts();
|
||||
|
|
|
@ -219,7 +219,7 @@ void OnBrowse(HWND hW)
|
|||
wchar_t wbuff[4096] = {0};
|
||||
memcpy(wbuff, HDD_DEF, sizeof(HDD_DEF));
|
||||
|
||||
ghc::filesystem::path inis(EmuConfig.Folders.Settings.ToString().wx_str());
|
||||
ghc::filesystem::path inis(EmuFolders::Settings.ToString().wx_str());
|
||||
wstring w_inis = inis.wstring();
|
||||
|
||||
OPENFILENAMEW ofn;
|
||||
|
@ -336,7 +336,7 @@ void OnOk(HWND hW)
|
|||
if (hddPath.is_relative())
|
||||
{
|
||||
//GHC uses UTF8 on all platforms
|
||||
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToUTF8().data());
|
||||
ghc::filesystem::path path(EmuFolders::Settings.ToUTF8().data());
|
||||
hddPath = path / hddPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,8 @@ void iDumpBlock(u32 ee_pc, u32 ee_size, uptr x86_pc, u32 x86_size)
|
|||
|
||||
DbgCon.WriteLn( Color_Gray, "dump block %x:%x (x86:0x%x)", ee_pc, ee_end, x86_pc );
|
||||
|
||||
EmuConfig.Folders.Logs.Mkdir();
|
||||
wxString dump_filename = Path::Combine( EmuConfig.Folders.Logs, wxsFormat(L"R5900dump_%.8X:%.8X.txt", ee_pc, ee_end) );
|
||||
EmuFolders::Logs.Mkdir();
|
||||
wxString dump_filename = Path::Combine(EmuFolders::Logs, wxsFormat(L"R5900dump_%.8X:%.8X.txt", ee_pc, ee_end) );
|
||||
AsciiFile eff( dump_filename, L"w" );
|
||||
|
||||
// Print register content to detect the memory access type. Warning value are taken
|
||||
|
@ -247,7 +247,7 @@ void iDumpBlock(u32 ee_pc, u32 ee_size, uptr x86_pc, u32 x86_size)
|
|||
|
||||
// handy but slow solution (system call)
|
||||
#ifdef __linux__
|
||||
wxString obj_filename = Path::Combine(EmuConfig.Folders.Logs, wxString(L"objdump_tmp.o"));
|
||||
wxString obj_filename = Path::Combine(EmuFolders::Logs, wxString(L"objdump_tmp.o"));
|
||||
wxFFile objdump(obj_filename , L"wb");
|
||||
objdump.Write(x86, x86_size);
|
||||
objdump.Close();
|
||||
|
@ -272,9 +272,9 @@ void iDumpBlock( int startpc, u8 * ptr )
|
|||
|
||||
DbgCon.WriteLn( Color_Gray, "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle );
|
||||
|
||||
EmuConfig.Folders.Logs.Mkdir();
|
||||
EmuFolders::Logs.Mkdir();
|
||||
AsciiFile eff(
|
||||
Path::Combine( EmuConfig.Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
|
||||
Path::Combine( EmuFolders::Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
|
||||
);
|
||||
|
||||
if (!symbolMap.GetLabelString(startpc).empty())
|
||||
|
|
|
@ -1774,7 +1774,7 @@ void GSApp::SetConfigDir()
|
|||
// core settings aren't populated yet, thus we do populate it if needed either when
|
||||
// opening GS settings or init -- govanify
|
||||
wxString iniName(L"GS.ini");
|
||||
m_ini = EmuConfig.Folders.Settings.Combine(iniName).GetFullPath();
|
||||
m_ini = EmuFolders::Settings.Combine(iniName).GetFullPath();
|
||||
}
|
||||
|
||||
std::string GSApp::GetConfigS(const char* entry)
|
||||
|
|
|
@ -61,7 +61,7 @@ void PADSaveConfig()
|
|||
FILE* f;
|
||||
|
||||
wxString iniName(L"PAD.ini");
|
||||
const std::string iniFile = std::string(EmuConfig.Folders.Settings.Combine(iniName).GetFullPath()); // default path, just in case
|
||||
const std::string iniFile = std::string(EmuFolders::Settings.Combine(iniName).GetFullPath()); // default path, just in case
|
||||
f = fopen(iniFile.c_str(), "w");
|
||||
if (f == NULL)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ void PADLoadConfig()
|
|||
|
||||
|
||||
wxString iniName(L"PAD.ini");
|
||||
const std::string iniFile = std::string(EmuConfig.Folders.Settings.Combine(iniName).GetFullPath()); // default path, just in case
|
||||
const std::string iniFile = std::string(EmuFolders::Settings.Combine(iniName).GetFullPath()); // default path, just in case
|
||||
f = fopen(iniFile.c_str(), "r");
|
||||
if (f == nullptr)
|
||||
{
|
||||
|
|
|
@ -337,7 +337,7 @@ void PADsetSettingsDir(const char* dir)
|
|||
|
||||
//uint targlen = MultiByteToWideChar(CP_ACP, 0, dir, -1, NULL, 0);
|
||||
wxString iniName = "PAD.ini";
|
||||
MultiByteToWideChar(CP_UTF8, 0, std::string(EmuConfig.Folders.Settings.Combine(iniName).GetFullPath()).c_str(), -1, iniFileUSB, MAX_PATH * 2);
|
||||
MultiByteToWideChar(CP_UTF8, 0, std::string(EmuFolders::Settings.Combine(iniName).GetFullPath()).c_str(), -1, iniFileUSB, MAX_PATH * 2);
|
||||
|
||||
createIniDir = false;
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ int LoadPatchesFromDir(wxString name, const wxDirName& folderName, const wxStrin
|
|||
wxString filespec = name + L"*.pnach";
|
||||
loaded += _LoadPatchFiles(folderName, filespec, friendlyName, numberFoundPatchFiles);
|
||||
|
||||
if (folderName.ToString().IsSameAs(EmuConfig.Folders.Cheats.ToString()) && numberFoundPatchFiles == 0)
|
||||
if (folderName.ToString().IsSameAs(EmuFolders::Cheats.ToString()) && numberFoundPatchFiles == 0)
|
||||
{
|
||||
wxString pathName = Path::Combine(folderName, name.MakeUpper() + L".pnach");
|
||||
PatchesCon->WriteLn(Color_Gray, L"Not found %s file: %s", WX_STR(friendlyName), WX_STR(pathName));
|
||||
|
|
|
@ -29,6 +29,19 @@
|
|||
#include "gui/AppConfig.h"
|
||||
#endif
|
||||
|
||||
namespace EmuFolders
|
||||
{
|
||||
wxDirName Settings;
|
||||
wxDirName Bios;
|
||||
wxDirName Snapshots;
|
||||
wxDirName Savestates;
|
||||
wxDirName MemoryCards;
|
||||
wxDirName Langs;
|
||||
wxDirName Logs;
|
||||
wxDirName Cheats;
|
||||
wxDirName CheatsWS;
|
||||
} // namespace EmuFolders
|
||||
|
||||
void TraceLogFilters::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/TraceLog");
|
||||
|
@ -457,10 +470,6 @@ void Pcsx2Config::FilenameOptions::LoadSave(SettingsWrapper& wrap)
|
|||
wrap.Entry(CURRENT_SETTINGS_SECTION, "BIOS", Bios, Bios);
|
||||
}
|
||||
|
||||
Pcsx2Config::FolderOptions::FolderOptions()
|
||||
{
|
||||
}
|
||||
|
||||
void Pcsx2Config::FramerateOptions::SanityCheck()
|
||||
{
|
||||
// Ensure Conformation of various options...
|
||||
|
@ -595,12 +604,12 @@ bool Pcsx2Config::MultitapEnabled(uint port) const
|
|||
|
||||
wxString Pcsx2Config::FullpathToBios() const
|
||||
{
|
||||
return Path::Combine(Folders.Bios, wxString(BaseFilenames.Bios));
|
||||
return Path::Combine(EmuFolders::Bios, wxString(BaseFilenames.Bios));
|
||||
}
|
||||
|
||||
wxString Pcsx2Config::FullpathToMcd(uint slot) const
|
||||
{
|
||||
return Path::Combine(Folders.MemoryCards, wxString(Mcd[slot].Filename));
|
||||
return Path::Combine(EmuFolders::MemoryCards, wxString(Mcd[slot].Filename));
|
||||
}
|
||||
|
||||
void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg)
|
||||
|
|
|
@ -26,7 +26,7 @@ void initIni()
|
|||
{
|
||||
if (!pathSet)
|
||||
{
|
||||
path = EmuConfig.Folders.Settings.Combine(path).GetFullPath();
|
||||
path = EmuFolders::Settings.Combine(path).GetFullPath();
|
||||
pathSet = true;
|
||||
}
|
||||
if (spuConfig == nullptr)
|
||||
|
|
|
@ -58,7 +58,7 @@ void initIni()
|
|||
{
|
||||
if (!pathSet)
|
||||
{
|
||||
CfgFile = EmuConfig.Folders.Settings.Combine(CfgFile).GetFullPath();
|
||||
CfgFile = EmuFolders::Settings.Combine(CfgFile).GetFullPath();
|
||||
pathSet = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ wxString SaveStateBase::GetFilename( int slot )
|
|||
wxString serialName( DiscSerial );
|
||||
if (serialName.IsEmpty()) serialName = L"BIOS";
|
||||
|
||||
return (EmuConfig.Folders.Savestates +
|
||||
return (EmuFolders::Savestates +
|
||||
pxsFmt( L"%s (%08X).%02d.p2s", WX_STR(serialName), ElfCRC, slot )).GetFullPath();
|
||||
|
||||
//return (g_Conf->Folders.Savestates +
|
||||
|
|
|
@ -36,9 +36,9 @@ void USBsetSettingsDir()
|
|||
if(!USBpathSet)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
IniPath = EmuConfig.Folders.Settings.Combine( iniFileUSB ).GetFullPath(); // default path, just in case
|
||||
IniPath = EmuFolders::Settings.Combine( iniFileUSB ).GetFullPath(); // default path, just in case
|
||||
#else
|
||||
IniPath = std::string(EmuConfig.Folders.Settings.Combine( iniFileUSB ).GetFullPath()); // default path, just in case
|
||||
IniPath = std::string(EmuFolders::Settings.Combine( iniFileUSB ).GetFullPath()); // default path, just in case
|
||||
#endif
|
||||
USBpathSet = true;
|
||||
}
|
||||
|
|
|
@ -558,10 +558,6 @@ void AppConfig::LoadSave(IniInterface& ini, SettingsWrapper& wrap)
|
|||
ProgLogBox.LoadSave(ini, L"ProgramLog");
|
||||
Folders.LoadSave(ini);
|
||||
|
||||
// sync the EmuOptions folders with what we loaded. what a mess this is....
|
||||
if (ini.IsLoading())
|
||||
EmuOptions.Folders = EmuConfig.Folders;
|
||||
|
||||
GSWindow.LoadSave(ini);
|
||||
#ifndef DISABLE_RECORDING
|
||||
inputRecording.loadSave(ini);
|
||||
|
@ -672,16 +668,16 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
|
|||
for( int i=0; i<FolderId_COUNT; ++i )
|
||||
operator[]( (FoldersEnum_t)i ).Normalize();
|
||||
|
||||
EmuConfig.Folders.Settings = GetSettingsFolder();
|
||||
EmuConfig.CurrentDiscDrive = RunDisc.ToStdString();
|
||||
EmuConfig.Folders.Bios = Bios;
|
||||
EmuConfig.Folders.Snapshots = Snapshots;
|
||||
EmuConfig.Folders.Savestates = Savestates;
|
||||
EmuConfig.Folders.MemoryCards = MemoryCards;
|
||||
EmuConfig.Folders.Logs = Logs;
|
||||
EmuConfig.Folders.Langs = Langs;
|
||||
EmuConfig.Folders.Cheats = Cheats;
|
||||
EmuConfig.Folders.CheatsWS = CheatsWS;
|
||||
EmuFolders::Settings = GetSettingsFolder();
|
||||
EmuFolders::Bios = Bios;
|
||||
EmuFolders::Snapshots = Snapshots;
|
||||
EmuFolders::Savestates = Savestates;
|
||||
EmuFolders::MemoryCards = MemoryCards;
|
||||
EmuFolders::Logs = Logs;
|
||||
EmuFolders::Langs = Langs;
|
||||
EmuFolders::Cheats = Cheats;
|
||||
EmuFolders::CheatsWS = CheatsWS;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -491,12 +491,12 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
|
|||
|
||||
// regular cheat patches
|
||||
if (fixup.EnableCheats)
|
||||
gameCheats.Printf(L" [%d Cheats]", LoadPatchesFromDir(GameInfo::gameCRC, EmuConfig.Folders.Cheats, L"Cheats"));
|
||||
gameCheats.Printf(L" [%d Cheats]", LoadPatchesFromDir(GameInfo::gameCRC, EmuFolders::Cheats, L"Cheats"));
|
||||
|
||||
// wide screen patches
|
||||
if (fixup.EnableWideScreenPatches)
|
||||
{
|
||||
if (int numberLoadedWideScreenPatches = LoadPatchesFromDir(GameInfo::gameCRC, EmuConfig.Folders.CheatsWS, L"Widescreen hacks"))
|
||||
if (int numberLoadedWideScreenPatches = LoadPatchesFromDir(GameInfo::gameCRC, EmuFolders::CheatsWS, L"Widescreen hacks"))
|
||||
{
|
||||
gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches);
|
||||
Console.WriteLn(Color_Gray, "Found widescreen patches in the cheats_ws folder --> skipping cheats_ws.zip");
|
||||
|
|
|
@ -316,7 +316,7 @@ void LoadBIOS()
|
|||
|
||||
bool IsBIOS(const wxString& filename, wxString& description)
|
||||
{
|
||||
wxFileName Bios( EmuConfig.Folders.Bios + filename );
|
||||
wxFileName Bios( EmuFolders::Bios + filename );
|
||||
pxInputStream inway( filename, new wxFFileInputStream( filename ) );
|
||||
|
||||
if (!inway.IsOk()) return false;
|
||||
|
|
|
@ -229,9 +229,9 @@ static void iIopDumpBlock(int startpc, u8* ptr)
|
|||
int numused, count;
|
||||
|
||||
Console.WriteLn("dump1 %x:%x, %x", startpc, psxpc, psxRegs.cycle);
|
||||
EmuConfig.Folders.Logs.Mkdir();
|
||||
EmuFolders::Logs.Mkdir();
|
||||
|
||||
wxString filename(Path::Combine(EmuConfig.Folders.Logs, wxsFormat(L"psxdump%.8X.txt", startpc)));
|
||||
wxString filename(Path::Combine(EmuFolders::Logs, wxsFormat(L"psxdump%.8X.txt", startpc)));
|
||||
AsciiFile f(filename, L"w");
|
||||
|
||||
f.Printf("Dump PSX register data: 0x%x\n\n", (uptr)&psxRegs);
|
||||
|
|
|
@ -59,7 +59,7 @@ void __mVUdumpProgram(microVU& mVU, microProgram& prog)
|
|||
mVUbranch = 0;
|
||||
|
||||
const wxString logname(wxsFormat(L"microVU%d prog - %02d.html", mVU.index, prog.idx));
|
||||
mVU.logFile = std::unique_ptr<AsciiFile>(new AsciiFile(Path::Combine(EmuConfig.Folders.Logs, logname), L"w"));
|
||||
mVU.logFile = std::unique_ptr<AsciiFile>(new AsciiFile(Path::Combine(EmuFolders::Logs, logname), L"w"));
|
||||
|
||||
mVUlog("<html>\n");
|
||||
mVUlog("<title>microVU%d MicroProgram Log</title>\n", mVU.index);
|
||||
|
|
Loading…
Reference in New Issue