Config: Move Folders/BaseFilenames to base config

This commit is contained in:
Connor McLaughlin 2021-09-16 20:14:42 +10:00 committed by Kojin
parent 3f265b3f1c
commit 77a890ff4a
38 changed files with 277 additions and 210 deletions

View File

@ -15,7 +15,6 @@
#include "PrecompiledHeader.h"
#include "IopCommon.h"
#include "gui/AppConfig.h"
#include <memory>
#include <ctype.h>
@ -94,7 +93,7 @@ static int mg_BIToffset(u8* buffer)
static void cdvdGetMechaVer(u8* ver)
{
wxFileName mecfile(EmuConfig.BiosFilename);
wxFileName mecfile(EmuConfig.FullpathToBios());
mecfile.SetExt(L"mec");
const wxString fname(mecfile.GetFullPath());
@ -168,7 +167,7 @@ static void cdvdCreateNewNVM(const wxString& filename)
// be created for some reason.
static void cdvdNVM(u8* buffer, int offset, size_t bytes, bool read)
{
wxFileName nvmfile(EmuConfig.BiosFilename);
wxFileName nvmfile(EmuConfig.FullpathToBios());
nvmfile.SetExt(L"nvm");
const wxString fname(nvmfile.GetFullPath());
@ -587,7 +586,6 @@ s32 cdvdCtrlTrayClose()
cdvd.TrayTimeout = 0; // Reset so it can't get closed twice by cdvdVsync()
cdvdDetectDisk();
GetCoreThread().ApplySettings(g_Conf->EmuOptions);
return 0; // needs to be 0 for success according to homebrew test "CDVD"
}

View File

@ -34,7 +34,7 @@
#include "CDVDisoReader.h"
#include "DebugTools/SymbolMap.h"
#include "gui/AppConfig.h"
#include "Config.h"
CDVD_API* CDVD = NULL;
@ -388,10 +388,10 @@ bool DoCDVDopen()
else if (somepick.IsEmpty())
somepick = L"Untitled";
if (g_Conf->CurrentBlockdump.IsEmpty())
g_Conf->CurrentBlockdump = wxGetCwd();
if (EmuConfig.CurrentBlockdump.IsEmpty())
EmuConfig.CurrentBlockdump = wxGetCwd();
wxString temp(Path::Combine(g_Conf->CurrentBlockdump, somepick));
wxString temp(Path::Combine(EmuConfig.CurrentBlockdump, somepick));
#ifdef ENABLE_TIMESTAMPS
wxDateTime curtime(wxDateTime::GetTimeNow());

View File

@ -15,8 +15,7 @@
#include "PrecompiledHeader.h"
#include "CDVDdiscReader.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include <condition_variable>
@ -184,9 +183,9 @@ void StopKeepAliveThread()
s32 CALLBACK DISCopen(const char* pTitle)
{
#if defined(_WIN32)
std::wstring drive = g_Conf->Folders.RunDisc.ToStdWstring();
std::wstring drive = EmuConfig.CurrentDiscDrive.ToStdWstring();
#else
std::string drive = g_Conf->Folders.RunDisc.ToStdString();
std::string drive = EmuConfig.CurrentDiscDrive.ToStdString();
#endif
GetValidDrive(drive);
if (drive.empty())

View File

@ -17,10 +17,13 @@
#include "common/emitter/tools.h"
#include "common/General.h"
#include "common/Path.h"
#include <wx/filename.h>
class IniInterface;
enum class CDVD_SourceType : uint8_t;
enum GamefixId
{
GamefixId_FIRST = 0,
@ -459,6 +462,43 @@ struct Pcsx2Config
}
};
// ------------------------------------------------------------------------
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
{
wxFileName Bios;
void LoadSave(IniInterface& conf);
bool operator==(const FilenameOptions& right) const
{
return OpEqu(Bios);
}
bool operator!=(const FilenameOptions& right) const
{
return !this->operator==(right);
}
};
BITFIELD32()
bool
CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console
@ -495,7 +535,17 @@ struct Pcsx2Config
TraceLogFilters Trace;
wxFileName BiosFilename;
FolderOptions Folders;
FilenameOptions BaseFilenames;
// Set at runtime, not loaded from config.
CDVD_SourceType CdvdSource;
wxString CurrentIso;
wxString CurrentDiscDrive;
wxString CurrentBlockdump;
wxString CurrentELF;
wxString CurrentIRX;
wxString CurrentGameArgs;
Pcsx2Config();
void LoadSave( IniInterface& ini );
@ -505,6 +555,8 @@ struct Pcsx2Config
void Save( const wxString& dstfile );
void Save( const wxOutputStream& deststream );
wxString FullpathToBios() const;
bool MultitapEnabled( uint port ) const;
bool operator ==( const Pcsx2Config& right ) const
@ -517,13 +569,17 @@ struct Pcsx2Config
OpEqu( Gamefixes ) &&
OpEqu( Profiler ) &&
OpEqu( Trace ) &&
OpEqu( BiosFilename );
OpEqu( BaseFilenames );
}
bool operator !=( const Pcsx2Config& right ) const
{
return !this->operator ==( right );
}
// You shouldn't assign to this class, because it'll mess with the runtime variables (Current...).
// But you can still use this to copy config. Only needed until we drop wx.
void CopyConfig(const Pcsx2Config& cfg);
};
extern Pcsx2Config EmuConfig;

View File

@ -36,7 +36,6 @@
#include "DEV9.h"
#undef EXTERN
#include "Config.h"
#include "gui/AppConfig.h"
#include "smap.h"
@ -204,7 +203,7 @@ s32 DEV9open(void* pDsp)
if (hddPath.is_relative())
{
ghc::filesystem::path path(GetSettingsFolder().ToString().wx_str());
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
hddPath = path / hddPath;
}
@ -1093,7 +1092,7 @@ void ApplyConfigIfRunning(ConfigDEV9 oldConfig)
if (hddPath.is_relative())
{
//GHC uses UTF8 on all platforms
ghc::filesystem::path path(GetSettingsFolder().ToString().wx_str());
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
hddPath = path / hddPath;
}

View File

@ -30,7 +30,7 @@
void SaveDnsHosts()
{
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(GetSettingsFolder().Combine(wxString("DEV9Hosts.ini")).GetFullPath()));
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(EmuConfig.Folders.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 = GetSettingsFolder().Combine(wxString("DEV9Hosts.ini"));
wxFileName iniPath = EmuConfig.Folders.Settings.Combine(wxString("DEV9Hosts.ini"));
config.EthHosts.clear();
//If no file exists, create one to provice an example config
if (!iniPath.FileExists())

View File

@ -19,8 +19,8 @@
#include <arpa/inet.h>
#include "DEV9/DEV9.h"
#include "gui/AppConfig.h"
#include "DEV9/Config.h"
#include "Config.h"
#include <unistd.h>
#include <sys/types.h>
@ -113,7 +113,7 @@ void SaveConf()
*/
const std::string file(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
const std::string file(EmuConfig.Folders.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(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
const std::string file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
if (-1 == access(file.c_str(), F_OK))
return;

View File

@ -36,6 +36,7 @@
#include "DEV9/pcap_io.h"
#include "DEV9/net.h"
#include "DEV9/PacketReader/IP/IP_Address.h"
#include "Config.h"
#include "gui/AppCoreThread.h"
#include "DEV9/ATA/HddCreate.h"
@ -199,11 +200,11 @@ void OnInitDialog()
void OnBrowse(GtkButton* button, gpointer usr_data)
{
ghc::filesystem::path inis(GetSettingsFolder().ToString().ToStdString());
ghc::filesystem::path inis(EmuConfig.Folders.Settings.ToString().ToStdString());
static const wxChar* hddFilterType = L"HDD|*.raw;*.RAW";
wxFileDialog ctrl(nullptr, _("HDD Image File"), GetSettingsFolder().ToString(), HDD_DEF,
wxFileDialog ctrl(nullptr, _("HDD Image File"), EmuConfig.Folders.Settings.ToString(), HDD_DEF,
(wxString)hddFilterType + L"|" + _("All Files (*.*)") + L"|*.*", wxFD_SAVE);
if (ctrl.ShowModal() != wxID_CANCEL)
@ -279,7 +280,7 @@ void OnOk()
if (hddPath.is_relative())
{
ghc::filesystem::path path(GetSettingsFolder().ToString().wx_str());
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToString().wx_str());
hddPath = path / hddPath;
}

View File

@ -20,8 +20,8 @@
#include <fstream>
#include "DEV9/DEV9.h"
#include "gui/AppConfig.h"
#include "DEV9/Config.h"
#include "Config.h"
#include "ws2tcpip.h"
@ -38,7 +38,7 @@ bool FileExists(std::wstring szPath)
void SaveConf()
{
const std::wstring file(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
const std::wstring file(EmuConfig.Folders.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(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
const std::wstring file(EmuConfig.Folders.Settings.Combine(wxString("DEV9.cfg")).GetFullPath());
if (FileExists(file.c_str()) == false)
{
LoadDnsHosts();

View File

@ -219,7 +219,7 @@ void OnBrowse(HWND hW)
wchar_t wbuff[4096] = {0};
memcpy(wbuff, HDD_DEF, sizeof(HDD_DEF));
ghc::filesystem::path inis(GetSettingsFolder().ToString().wx_str());
ghc::filesystem::path inis(EmuConfig.Folders.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(GetSettingsFolder().ToUTF8().data());
ghc::filesystem::path path(EmuConfig.Folders.Settings.ToUTF8().data());
hddPath = path / hddPath;
}

View File

@ -21,8 +21,8 @@
#include "iR5900.h"
#include "IPU/IPU.h"
#include "DebugTools/SymbolMap.h"
#include "Config.h"
#include "gui/AppConfig.h"
#include "Utilities/AsciiFile.h"
using namespace R5900;
@ -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 );
g_Conf->Folders.Logs.Mkdir();
wxString dump_filename = Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump_%.8X:%.8X.txt", ee_pc, ee_end) );
EmuConfig.Folders.Logs.Mkdir();
wxString dump_filename = Path::Combine( EmuConfig.Folders.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
@ -272,9 +272,9 @@ void iDumpBlock( int startpc, u8 * ptr )
DbgCon.WriteLn( Color_Gray, "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle );
g_Conf->Folders.Logs.Mkdir();
EmuConfig.Folders.Logs.Mkdir();
AsciiFile eff(
Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
Path::Combine( EmuConfig.Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w"
);
if (!symbolMap.GetLabelString(startpc).empty())

View File

@ -23,7 +23,7 @@
#include "Renderers/OpenGL/GSRendererOGL.h"
#include "GSLzma.h"
#include "gui/AppConfig.h" // GetSettingsFolder()
#include "Config.h"
#include "common/pxStreams.h"
#ifdef _WIN32
@ -1787,7 +1787,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 = GetSettingsFolder().Combine(iniName).GetFullPath();
m_ini = EmuConfig.Folders.Settings.Combine(iniName).GetFullPath();
}
std::string GSApp::GetConfigS(const char* entry)

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "gui/AppConfig.h"
#include "pcsx2/Config.h"
#include "Global.h"
#include "Device.h"
#include "keyboard.h"
@ -61,7 +61,7 @@ void PADSaveConfig()
FILE* f;
wxString iniName(L"PAD.ini");
const std::string iniFile = std::string(GetSettingsFolder().Combine(iniName).GetFullPath()); // default path, just in case
const std::string iniFile = std::string(EmuConfig.Folders.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(GetSettingsFolder().Combine(iniName).GetFullPath()); // default path, just in case
const std::string iniFile = std::string(EmuConfig.Folders.Settings.Combine(iniName).GetFullPath()); // default path, just in case
f = fopen(iniFile.c_str(), "r");
if (f == nullptr)
{

View File

@ -30,7 +30,7 @@
// Needed to know if raw input is available. It requires XP or higher.
#include "PADRawInput.h"
#include "gui/AppConfig.h"
#include "Config.h"
//max len 24 wchar_t
const wchar_t* padTypes[] = {
@ -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(GetSettingsFolder().Combine(iniName).GetFullPath()).c_str(), -1, iniFileUSB, MAX_PATH * 2);
MultiByteToWideChar(CP_UTF8, 0, std::string(EmuConfig.Folders.Settings.Combine(iniName).GetFullPath()).c_str(), -1, iniFileUSB, MAX_PATH * 2);
createIniDir = false;

View File

@ -19,6 +19,7 @@
#include "IopCommon.h"
#include "Patch.h"
#include "Config.h"
#include <memory>
#include <vector>
@ -247,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(GetCheatsFolder().ToString()) && numberFoundPatchFiles == 0)
if (folderName.ToString().IsSameAs(EmuConfig.Folders.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));

View File

@ -407,8 +407,30 @@ void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
IniBitfield( MemoryViewBytesPerRow );
}
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.
bool needRelativeName = ini.IsSaving() && IsPortable();
if (needRelativeName)
{
wxFileName bios_filename = wxFileName(Bios.GetFullName());
ini.Entry(L"BIOS", bios_filename, pc);
}
else
ini.Entry(L"BIOS", Bios, pc);
}
Pcsx2Config::FolderOptions::FolderOptions()
{
}
Pcsx2Config::Pcsx2Config()
{
@ -418,6 +440,8 @@ Pcsx2Config::Pcsx2Config()
McdFolderAutoManage = true;
EnablePatches = true;
BackupSavestate = true;
CdvdSource = CDVD_SourceType::Iso;
}
void Pcsx2Config::LoadSave( IniInterface& ini )
@ -455,6 +479,9 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
Debugger .LoadSave( ini );
Trace .LoadSave( ini );
// For now, this in the derived config for backwards ini compatibility.
//BaseFilenames.LoadSave(ini);
ini.Flush();
}
@ -481,3 +508,40 @@ void Pcsx2Config::Save( const wxString& dstfile )
IniSaver saver( cfg );
LoadSave( saver );
}
wxString Pcsx2Config::FullpathToBios() const
{
return Path::Combine(Folders.Bios, BaseFilenames.Bios);
}
void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg)
{
Cpu = cfg.Cpu;
GS = cfg.GS;
Speedhacks = cfg.Speedhacks;
Gamefixes = cfg.Gamefixes;
Profiler = cfg.Profiler;
Debugger = cfg.Debugger;
Trace = cfg.Trace;
BaseFilenames = cfg.BaseFilenames;
CdvdVerboseReads = cfg.CdvdVerboseReads;
CdvdDumpBlocks = cfg.CdvdDumpBlocks;
CdvdShareWrite = cfg.CdvdShareWrite;
EnablePatches = cfg.EnablePatches;
EnableCheats = cfg.EnableCheats;
EnableIPC = cfg.EnableIPC;
EnableWideScreenPatches = cfg.EnableWideScreenPatches;
#ifndef DISABLE_RECORDING
EnableRecordingTools = cfg.EnableRecordingTools;
#endif
UseBOOT2Injection = cfg.UseBOOT2Injection;
BackupSavestate = cfg.BackupSavestate;
McdEnableEjection = cfg.McdEnableEjection;
McdFolderAutoManage = cfg.McdFolderAutoManage;
MultitapPort0_Enabled = cfg.MultitapPort0_Enabled;
MultitapPort1_Enabled = cfg.MultitapPort1_Enabled;
ConsoleToStdio = cfg.ConsoleToStdio;
HostFs = cfg.HostFs;
FullBootConfig = cfg.FullBootConfig;
}

View File

@ -16,7 +16,8 @@
#include "PrecompiledHeader.h"
#include "IopCommon.h"
#include "gui/App.h" // For host irx injection hack
#include "Config.h"
#include "gui/AppCoreThread.h"
#include "R5900OpcodeTables.h"
#include "DebugTools/Breakpoints.h"
@ -223,7 +224,7 @@ static __fi void execI()
#endif
// Inject IRX hack
if (psxRegs.pc == 0x1630 && g_Conf->CurrentIRX.Length() > 3) {
if (psxRegs.pc == 0x1630 && EmuConfig.CurrentIRX.Length() > 3) {
if (iopMemRead32(0x20018) == 0x1F) {
// FIXME do I need to increase the module count (0x1F -> 0x20)
iopMemWrite32(0x20094, 0xbffc0000);

View File

@ -633,9 +633,9 @@ void __fastcall eeloadHook()
// mode). Then EELOAD is called with the argument "rom0:PS2LOGO". At this point, we do not need any additional tricks
// because EELOAD is now ready to accept launch arguments. So in full-boot mode, we simply wait for PS2LOGO to be called,
// then we add the desired launch arguments. PS2LOGO passes those on to the game itself as it calls EELOAD a third time.
if (!g_Conf->CurrentGameArgs.empty() && !strcmp(elfname.c_str(), "rom0:PS2LOGO"))
if (!EmuConfig.CurrentGameArgs.empty() && !strcmp(elfname.c_str(), "rom0:PS2LOGO"))
{
const char *argString = g_Conf->CurrentGameArgs.c_str();
const char *argString = EmuConfig.CurrentGameArgs.c_str();
Console.WriteLn("eeloadHook: Supplying launch argument(s) '%s' to module '%s'...", argString, elfname.c_str());
// Join all arguments by space characters so they can be processed as one string by ParseArgumentString(), then add the
@ -648,7 +648,7 @@ void __fastcall eeloadHook()
arg_len = strlen((char *)PSM(arg_ptr));
memset(PSM(arg_ptr + arg_len), 0x20, 1);
}
strcpy((char *)PSM(arg_ptr + arg_len + 1), g_Conf->CurrentGameArgs.c_str());
strcpy((char *)PSM(arg_ptr + arg_len + 1), EmuConfig.CurrentGameArgs.c_str());
u32 first_arg_ptr = memRead32(cpuRegs.GPR.n.a1.UD[0]);
#if DEBUG_LAUNCHARG
Console.WriteLn("eeloadHook: arg block is '%s'.", (char *)PSM(first_arg_ptr));
@ -720,7 +720,7 @@ void __fastcall eeloadHook()
// Only called if g_SkipBiosHack is true
void __fastcall eeloadHook2()
{
if (g_Conf->CurrentGameArgs.empty())
if (EmuConfig.CurrentGameArgs.empty())
return;
if (!g_osdsys_str)
@ -729,14 +729,14 @@ void __fastcall eeloadHook2()
return;
}
const char *argString = g_Conf->CurrentGameArgs.c_str();
const char *argString = EmuConfig.CurrentGameArgs.c_str();
Console.WriteLn("eeloadHook2: Supplying launch argument(s) '%s' to ELF '%s'.", argString, (char *)PSM(g_osdsys_str));
// Add args string after game's ELF name that was written over "rom0:OSDSYS" by eeloadHook(). In between the ELF name and args
// string we insert a space character so that ParseArgumentString() has one continuous string to process.
int game_len = strlen((char *)PSM(g_osdsys_str));
memset(PSM(g_osdsys_str + game_len), 0x20, 1);
strcpy((char *)PSM(g_osdsys_str + game_len + 1), g_Conf->CurrentGameArgs.c_str());
strcpy((char *)PSM(g_osdsys_str + game_len + 1), EmuConfig.CurrentGameArgs.c_str());
#if DEBUG_LAUNCHARG
Console.WriteLn("eeloadHook2: arg block is '%s'.", (char *)PSM(g_osdsys_str));
#endif

View File

@ -292,7 +292,7 @@ void InputRecording::SetupInitialState(u32 newStartingFrame)
else
{
// Check if the current game matches with the one used to make the original recording
if (!g_Conf->CurrentIso.IsEmpty())
if (!EmuConfig.CurrentIso.IsEmpty())
if (resolveGameName() != inputRecordingData.GetHeader().gameName)
inputRec::consoleLog("Input recording was possibly constructed for a different game.");
@ -350,7 +350,7 @@ bool InputRecording::Create(wxString fileName, const bool fromSaveState, wxStrin
StateCopy_SaveToFile(savestate);
}
else
sApp.SysExecute(g_Conf->CdvdSource);
sApp.SysExecute(EmuConfig.CdvdSource);
// Set emulator version
inputRecordingData.GetHeader().SetEmulatorVersion();
@ -405,7 +405,7 @@ bool InputRecording::Play(wxWindow* parent, wxString filename)
{
state = InputRecordingMode::Replaying;
initialLoad = true;
sApp.SysExecute(g_Conf->CdvdSource);
sApp.SysExecute(EmuConfig.CdvdSource);
}
return true;
}
@ -439,7 +439,7 @@ void InputRecording::GoToFirstFrame(wxWindow* parent)
StateCopy_LoadFromFile(savestate);
}
else
sApp.SysExecute(g_Conf->CdvdSource);
sApp.SysExecute(EmuConfig.CdvdSource);
if (IsRecording())
SetToReplayMode();
@ -462,7 +462,7 @@ wxString InputRecording::resolveGameName()
}
}
}
return !gameName.IsEmpty() ? gameName : (wxString)Path::GetFilename(g_Conf->CurrentIso);
return !gameName.IsEmpty() ? gameName : (wxString)Path::GetFilename(EmuConfig.CurrentIso);
}
#endif

View File

@ -14,7 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include "Dialogs.h"
#include <wx/fileconf.h>
@ -26,7 +26,7 @@ void initIni()
{
if (!pathSet)
{
path = GetSettingsFolder().Combine(path).GetFullPath();
path = EmuConfig.Folders.Settings.Combine(path).GetFullPath();
pathSet = true;
}
if (spuConfig == nullptr)

View File

@ -14,7 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include "SPU2/Global.h"
#include "Dialogs.h"
@ -58,7 +58,7 @@ void initIni()
{
if (!pathSet)
{
CfgFile = GetSettingsFolder().Combine(CfgFile).GetFullPath();
CfgFile = EmuConfig.Folders.Settings.Combine(CfgFile).GetFullPath();
pathSet = true;
}
}

View File

@ -23,7 +23,7 @@
#include "VUmicro.h"
#include "MTVU.h"
#include "Cache.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include "Elfheader.h"
#include "Counters.h"
@ -58,7 +58,7 @@ wxString SaveStateBase::GetFilename( int slot )
wxString serialName( DiscSerial );
if (serialName.IsEmpty()) serialName = L"BIOS";
return (g_Conf->Folders.Savestates +
return (EmuConfig.Folders.Savestates +
pxsFmt( L"%s (%08X).%02d.p2s", WX_STR(serialName), ElfCRC, slot )).GetFullPath();
//return (g_Conf->Folders.Savestates +

View File

@ -182,7 +182,7 @@ void SysCoreThread::ApplySettings(const Pcsx2Config& src)
m_resetProfilers = (src.Profiler != EmuConfig.Profiler);
m_resetVsyncTimers = (src.GS != EmuConfig.GS);
const_cast<Pcsx2Config&>(EmuConfig) = src;
EmuConfig.CopyConfig(src);
}
// --------------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
#include "configuration.h"
#include "shared/inifile_usb.h"
#include "platcompat.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include <map>
#include <vector>
@ -36,9 +36,9 @@ void USBsetSettingsDir()
if(!USBpathSet)
{
#ifdef _WIN32
IniPath = GetSettingsFolder().Combine( iniFileUSB ).GetFullPath(); // default path, just in case
IniPath = EmuConfig.Folders.Settings.Combine( iniFileUSB ).GetFullPath(); // default path, just in case
#else
IniPath = std::string(GetSettingsFolder().Combine( iniFileUSB ).GetFullPath()); // default path, just in case
IniPath = std::string(EmuConfig.Folders.Settings.Combine( iniFileUSB ).GetFullPath()); // default path, just in case
#endif
USBpathSet = true;
}

View File

@ -362,7 +362,6 @@ enum GsWindowMode_t
class CommandlineOverrides
{
public:
AppConfig::FilenameOptions Filenames;
wxDirName SettingsFolder;
wxFileName VmSettingsFile;

View File

@ -410,27 +410,7 @@ namespace FilenameDefs
}
};
static wxDirName GetResolvedFolder(FoldersEnum_t id)
{
return g_Conf->Folders.IsDefault(id) ? PathDefs::Get(id) : g_Conf->Folders[id];
}
wxDirName GetLogFolder()
{
return GetResolvedFolder(FolderId_Logs);
}
wxDirName GetCheatsFolder()
{
return GetResolvedFolder(FolderId_Cheats);
}
wxDirName GetCheatsWsFolder()
{
return GetResolvedFolder(FolderId_CheatsWS);
}
wxDirName GetSettingsFolder()
static wxDirName GetSettingsFolder()
{
if (wxGetApp().Overrides.SettingsFolder.IsOk())
return wxGetApp().Overrides.SettingsFolder;
@ -456,8 +436,6 @@ wxString GetUiKeysFilename()
return GetSettingsFolder().Combine( fname ).GetFullPath();
}
wxString AppConfig::FullpathToBios() const { return Path::Combine( Folders.Bios, BaseFilenames.Bios ); }
wxString AppConfig::FullpathToMcd( uint slot ) const
{
return Path::Combine( Folders.MemoryCards, Mcd[slot].Filename );
@ -492,8 +470,6 @@ AppConfig::AppConfig()
EnablePresets = true;
PresetIndex = 1;
CdvdSource = CDVD_SourceType::Iso;
// To be moved to FileMemoryCard pluign (someday)
for( uint slot=0; slot<8; ++slot )
{
@ -595,13 +571,15 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( Toolbar_ImageSize );
IniEntry( Toolbar_ShowLabels );
wxFileName res(CurrentIso);
ini.Entry( L"CurrentIso", res, res, ini.IsLoading() || IsPortable() );
CurrentIso = res.GetFullPath();
ini.EnumEntry(L"CdvdSource", EmuConfig.CdvdSource, CDVD_SourceLabels, EmuConfig.CdvdSource);
IniEntry( CurrentBlockdump );
IniEntry( CurrentELF );
IniEntry( CurrentIRX );
wxFileName res(EmuConfig.CurrentIso);
ini.Entry(L"CurrentIso", res, res, ini.IsLoading() || IsPortable());
EmuConfig.CurrentIso = res.GetFullPath();
ini.Entry(wxT("CurrentBlockdump"), EmuConfig.CurrentBlockdump, EmuConfig.CurrentBlockdump);
ini.Entry(wxT("CurrentELF"), EmuConfig.CurrentELF, EmuConfig.CurrentELF);
ini.Entry(wxT("CurrentIRX"), EmuConfig.CurrentIRX, EmuConfig.CurrentIRX);
IniEntry( EnableSpeedHacks );
IniEntry( EnableGameFixes );
@ -614,8 +592,6 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
#ifdef __WXMSW__
IniEntry( McdCompressNTFS );
#endif
ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, CdvdSource );
}
// ------------------------------------------------------------------------
@ -628,7 +604,12 @@ void AppConfig::LoadSave( IniInterface& ini )
ProgLogBox .LoadSave( ini, L"ProgramLog" );
Folders .LoadSave( ini );
BaseFilenames .LoadSave( ini );
// sync the EmuOptions folders with what we loaded. what a mess this is....
if (ini.IsLoading())
EmuOptions.Folders = EmuConfig.Folders;
EmuOptions.BaseFilenames.LoadSave( ini );
GSWindow .LoadSave( ini );
Framerate .LoadSave( ini );
#ifndef DISABLE_RECORDING
@ -734,28 +715,20 @@ 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;
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;
}
}
// ------------------------------------------------------------------------
void AppConfig::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.
bool needRelativeName = ini.IsSaving() && IsPortable();
if( needRelativeName ) {
wxFileName bios_filename = wxFileName( Bios.GetFullName() );
ini.Entry( L"BIOS", bios_filename, pc );
} else
ini.Entry( L"BIOS", Bios, pc );
}
// ------------------------------------------------------------------------
AppConfig::GSWindowOptions::GSWindowOptions()
{
@ -1221,9 +1194,9 @@ static void LoadUiSettings()
g_Conf = std::make_unique<AppConfig>();
g_Conf->LoadSave( loader );
if( !wxFile::Exists( g_Conf->CurrentIso ) )
if( !wxFile::Exists( EmuConfig.CurrentIso ) )
{
g_Conf->CurrentIso.clear();
EmuConfig.CurrentIso.clear();
}
sApp.DispatchUiSettingsEvent( loader );
@ -1256,12 +1229,12 @@ void AppLoadSettings()
static void SaveUiSettings()
{
if( !wxFile::Exists( g_Conf->CurrentIso ) )
if( !wxFile::Exists(EmuConfig.CurrentIso ) )
{
g_Conf->CurrentIso.clear();
EmuConfig.CurrentIso.clear();
}
sApp.GetRecentIsoManager().Add( g_Conf->CurrentIso );
sApp.GetRecentIsoManager().Add( EmuConfig.CurrentIso );
AppIniSaver saver;
g_Conf->LoadSave( saver );

View File

@ -63,15 +63,10 @@ extern wxDirName SettingsFolder; // dictates where the settings folder comes
extern wxDirName InstallFolder;
extern wxDirName GetSettingsFolder();
extern wxString GetVmSettingsFilename();
extern wxString GetUiSettingsFilename();
extern wxString GetUiKeysFilename();
extern wxDirName GetLogFolder();
extern wxDirName GetCheatsFolder();
extern wxDirName GetCheatsWsFolder();
enum InstallationModeType
{
// Use the user defined folder selections. These can be anywhere on a user's hard drive,
@ -158,14 +153,6 @@ public:
bool IsDefault( FoldersEnum_t folderidx ) const;
};
// ------------------------------------------------------------------------
struct FilenameOptions
{
wxFileName Bios;
void LoadSave( IniInterface& conf );
};
// ------------------------------------------------------------------------
// Options struct for each memory card.
//
@ -317,13 +304,6 @@ public:
bool AskOnBoot;
wxString CurrentIso;
wxString CurrentBlockdump;
wxString CurrentELF;
wxString CurrentIRX;
CDVD_SourceType CdvdSource;
wxString CurrentGameArgs;
// Memorycard options - first 2 are default slots, last 6 are multitap 1 and 2
// slots (3 each)
McdOptions Mcd[8];
@ -331,7 +311,6 @@ public:
ConsoleLogOptions ProgLogBox;
FolderOptions Folders;
FilenameOptions BaseFilenames;
GSWindowOptions GSWindow;
FramerateOptions Framerate;
#ifndef DISABLE_RECORDING
@ -349,7 +328,6 @@ public:
public:
AppConfig();
wxString FullpathToBios() const;
wxString FullpathToMcd( uint slot ) const;
void LoadSave( IniInterface& ini );

View File

@ -196,7 +196,7 @@ void AppCoreThread::ChangeCdvdSource()
return;
}
CDVD_SourceType cdvdsrc(g_Conf->CdvdSource);
CDVD_SourceType cdvdsrc(EmuConfig.CdvdSource);
if (cdvdsrc == CDVDsys_GetSourceType())
return;
@ -215,13 +215,13 @@ void Pcsx2App::SysApplySettings()
return;
CoreThread.ApplySettings(g_Conf->EmuOptions);
CDVD_SourceType cdvdsrc(g_Conf->CdvdSource);
if (cdvdsrc != CDVDsys_GetSourceType() || (cdvdsrc == CDVD_SourceType::Iso && (CDVDsys_GetFile(cdvdsrc) != g_Conf->CurrentIso)))
CDVD_SourceType cdvdsrc(EmuConfig.CdvdSource);
if (cdvdsrc != CDVDsys_GetSourceType() || (cdvdsrc == CDVD_SourceType::Iso && (CDVDsys_GetFile(cdvdsrc) != EmuConfig.CurrentIso)))
{
CoreThread.ResetCdvd();
}
CDVDsys_SetFile(CDVD_SourceType::Iso, g_Conf->CurrentIso);
CDVDsys_SetFile(CDVD_SourceType::Iso, EmuConfig.CurrentIso);
}
void AppCoreThread::OnResumeReady()
@ -392,7 +392,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
// Note: It's important that we apply the commandline overrides *before* database fixes.
// The database takes precedence (if enabled).
fixup = src;
fixup.CopyConfig(src);
const CommandlineOverrides& overrides(wxGetApp().Overrides);
if (overrides.DisableSpeedhacks || !g_Conf->EnableSpeedHacks)
@ -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, GetCheatsFolder(), L"Cheats"));
gameCheats.Printf(L" [%d Cheats]", LoadPatchesFromDir(GameInfo::gameCRC, EmuConfig.Folders.Cheats, L"Cheats"));
// wide screen patches
if (fixup.EnableWideScreenPatches)
{
if (int numberLoadedWideScreenPatches = LoadPatchesFromDir(GameInfo::gameCRC, GetCheatsWsFolder(), L"Widescreen hacks"))
if (int numberLoadedWideScreenPatches = LoadPatchesFromDir(GameInfo::gameCRC, EmuConfig.Folders.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");
@ -590,7 +590,7 @@ void AppCoreThread::OnResumeInThread(SystemsMask systemsToReinstate)
{
if (m_resetCdvd)
{
CDVDsys_ChangeSource(g_Conf->CdvdSource);
CDVDsys_ChangeSource(EmuConfig.CdvdSource);
cdvdCtrlTrayOpen();
DoCDVDopen();
m_resetCdvd = false;

View File

@ -458,16 +458,16 @@ bool Pcsx2App::OnInit()
(new GameDatabaseLoaderThread())->Start();
// By default no IRX injection
g_Conf->CurrentIRX = "";
EmuConfig.CurrentIRX = "";
if (Startup.SysAutoRun)
{
g_Conf->EmuOptions.UseBOOT2Injection = !Startup.NoFastBoot;
g_Conf->CdvdSource = Startup.CdvdSource;
EmuConfig.CdvdSource = Startup.CdvdSource;
if (Startup.CdvdSource == CDVD_SourceType::Iso)
SysUpdateIsoSrcFile(Startup.IsoFile);
sApp.SysExecute(Startup.CdvdSource);
g_Conf->CurrentGameArgs = Startup.GameLaunchArgs;
EmuConfig.CurrentGameArgs = Startup.GameLaunchArgs;
}
else if (Startup.SysAutoRunElf)
{
@ -495,7 +495,7 @@ bool Pcsx2App::OnInit()
{
g_Conf->EmuOptions.UseBOOT2Injection = true;
g_Conf->CurrentIRX = Startup.ElfFile;
EmuConfig.CurrentIRX = Startup.ElfFile;
// FIXME: ElfFile is an irx it will crash
sApp.SysExecute(Startup.CdvdSource, Startup.ElfFile);

View File

@ -722,8 +722,6 @@ void AppApplySettings( const AppConfig* oldconf )
g_Conf->Folders.Cheats.Mkdir();
g_Conf->Folders.CheatsWS.Mkdir();
g_Conf->EmuOptions.BiosFilename = g_Conf->FullpathToBios();
RelocateLogfile();
if( (oldconf == NULL) || (oldconf->LanguageCode.CmpNoCase(g_Conf->LanguageCode)) )
@ -1004,7 +1002,7 @@ protected:
// This function below gets called again from AppCoreThread.cpp and will pass the current ISO regardless if we
// are starting an ELF. In terms of symbol loading this doesn't matter because AppCoreThread.cpp doesn't clear the symbol map
// and we _only_ read symbols if the map is empty
CDVDsys_SetFile(CDVD_SourceType::Iso, m_UseELFOverride ? m_elf_override : g_Conf->CurrentIso );
CDVDsys_SetFile(CDVD_SourceType::Iso, m_UseELFOverride ? m_elf_override : EmuConfig.CurrentIso );
if( m_UseCDVDsrc )
CDVDsys_ChangeSource( m_cdvdsrc_type );
else if( CDVD == NULL )
@ -1060,7 +1058,7 @@ void SysStatus( const wxString& text )
// Applies a new active iso source file
void SysUpdateIsoSrcFile( const wxString& newIsoFile )
{
g_Conf->CurrentIso = newIsoFile;
EmuConfig.CurrentIso = newIsoFile;
sMainFrame.UpdateStatusBar();
sMainFrame.UpdateCdvdSrcSelection();
}
@ -1068,6 +1066,7 @@ void SysUpdateIsoSrcFile( const wxString& newIsoFile )
void SysUpdateDiscSrcDrive( const wxString& newDiscDrive )
{
g_Conf->Folders.RunDisc = newDiscDrive;
EmuConfig.CurrentDiscDrive = newDiscDrive;
AppSaveSettings();
sMainFrame.UpdateCdvdSrcSelection();
}

View File

@ -88,7 +88,7 @@ protected:
dialog += dialog.Heading(AddAppName(_("You have dropped the following ELF binary into %s:\n\n")));
dialog += dialog.GetCharHeight();
dialog += dialog.Text( g_Conf->CurrentELF );
dialog += dialog.Text( EmuConfig.CurrentELF );
dialog += dialog.GetCharHeight();
dialog += dialog.Heading(GetMsg_ConfirmSysReset());
@ -98,7 +98,7 @@ protected:
if( confirmed )
{
g_Conf->EmuOptions.UseBOOT2Injection = true;
sApp.SysExecute( g_Conf->CdvdSource, g_Conf->CurrentELF );
sApp.SysExecute( EmuConfig.CdvdSource, EmuConfig.CurrentELF );
}
else
stopped_core.AllowResume();
@ -175,7 +175,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen
{
Console.WriteLn( L"(Drag&Drop) Found ELF file type!" );
g_Conf->CurrentELF = filenames[0];
EmuConfig.CurrentELF = filenames[0];
wxGetApp().PostEvent( DroppedElf(m_WindowBound) );
return true;

View File

@ -82,12 +82,12 @@ void MainEmuFrame::UpdateStatusBar()
if (g_Conf->EnableFastBoot)
temp += "Fast Boot - ";
if (g_Conf->CdvdSource == CDVD_SourceType::Iso)
temp += "Load: '" + wxFileName(g_Conf->CurrentIso).GetFullName() + "' ";
if (EmuConfig.CdvdSource == CDVD_SourceType::Iso)
temp += "Load: '" + wxFileName(EmuConfig.CurrentIso).GetFullName() + "' ";
}
m_statusbar.SetStatusText(temp, 0);
m_statusbar.SetStatusText(CDVD_SourceLabels[enum_cast(g_Conf->CdvdSource)], 1);
m_statusbar.SetStatusText(CDVD_SourceLabels[enum_cast(EmuConfig.CdvdSource)], 1);
#ifdef __M_X86_64
m_statusbar.SetStatusText("x64", 2);
@ -100,7 +100,7 @@ void MainEmuFrame::UpdateCdvdSrcSelection()
{
MenuIdentifiers cdsrc = MenuId_Src_Iso;
switch (g_Conf->CdvdSource)
switch (EmuConfig.CdvdSource)
{
case CDVD_SourceType::Iso:
cdsrc = MenuId_Src_Iso;
@ -772,7 +772,7 @@ void MainEmuFrame::ApplySuspendStatus()
void MainEmuFrame::ApplyCDVDStatus()
{
const CDVD_SourceType Source = g_Conf->CdvdSource;
const CDVD_SourceType Source = EmuConfig.CdvdSource;
wxMenuItem* cdvd_menu = GetMenuBar()->FindItem(MenuId_Boot_CDVD);

View File

@ -196,7 +196,7 @@ wxWindowID SwapOrReset_Iso(wxWindow* owner, IScopedCoreThread& core_control, con
}
wxWindowID result = wxID_CANCEL;
if ((g_Conf->CdvdSource == CDVD_SourceType::Iso) && (isoFilename == g_Conf->CurrentIso))
if ((EmuConfig.CdvdSource == CDVD_SourceType::Iso) && (isoFilename == EmuConfig.CurrentIso))
{
core_control.AllowResume();
return result;
@ -226,7 +226,7 @@ wxWindowID SwapOrReset_Iso(wxWindow* owner, IScopedCoreThread& core_control, con
}
g_CDVDReset = true;
g_Conf->CdvdSource = CDVD_SourceType::Iso;
EmuConfig.CdvdSource = CDVD_SourceType::Iso;
SysUpdateIsoSrcFile(isoFilename);
if (result == wxID_RESET)
@ -258,7 +258,7 @@ wxWindowID SwapOrReset_Disc(wxWindow* owner, IScopedCoreThread& core, const wxSt
}
wxWindowID result = wxID_CANCEL;
if ((g_Conf->CdvdSource == CDVD_SourceType::Disc) && (driveLetter == g_Conf->Folders.RunDisc))
if ((EmuConfig.CdvdSource == CDVD_SourceType::Disc) && (driveLetter == EmuConfig.CurrentDiscDrive))
{
core.AllowResume();
return result;
@ -286,7 +286,7 @@ wxWindowID SwapOrReset_Disc(wxWindow* owner, IScopedCoreThread& core, const wxSt
}
}
g_Conf->CdvdSource = CDVD_SourceType::Disc;
EmuConfig.CdvdSource = CDVD_SourceType::Disc;
SysUpdateDiscSrcDrive(driveLetter);
if (result == wxID_RESET)
{
@ -309,7 +309,7 @@ wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
wxMessageBox("Please close the GS debugger first before playing a game", _("GS Debugger"), wxICON_ERROR);
return wxID_CANCEL;
}
if (newsrc == g_Conf->CdvdSource)
if (newsrc == EmuConfig.CdvdSource)
return wxID_CANCEL;
wxWindowID result = wxID_CANCEL;
ScopedCoreThreadPopup core;
@ -320,7 +320,7 @@ wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
wxString changeMsg;
changeMsg.Printf(_("You've selected to switch the CDVD source from %s to %s."),
CDVD_SourceLabels[enum_cast(g_Conf->CdvdSource)], CDVD_SourceLabels[enum_cast(newsrc)]);
CDVD_SourceLabels[enum_cast(EmuConfig.CdvdSource)], CDVD_SourceLabels[enum_cast(newsrc)]);
dialog += dialog.Heading(changeMsg + L"\n\n" +
_("Do you want to swap discs or boot the new image (system reset)?"));
@ -341,8 +341,8 @@ wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
}
g_CDVDReset = true;
CDVD_SourceType oldsrc = g_Conf->CdvdSource;
g_Conf->CdvdSource = newsrc;
CDVD_SourceType oldsrc = EmuConfig.CdvdSource;
EmuConfig.CdvdSource = newsrc;
if (result != wxID_RESET)
{
@ -356,7 +356,7 @@ wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
else
{
core.DisallowResume();
sApp.SysExecute(g_Conf->CdvdSource);
sApp.SysExecute(EmuConfig.CdvdSource);
}
return result;
@ -436,7 +436,7 @@ bool MainEmuFrame::_DoSelectELFBrowser()
if (ctrl.ShowModal() != wxID_CANCEL)
{
g_Conf->Folders.RunELF = wxFileName(ctrl.GetPath()).GetPath();
g_Conf->CurrentELF = ctrl.GetPath();
EmuConfig.CurrentELF = ctrl.GetPath();
return true;
}
@ -452,18 +452,18 @@ void MainEmuFrame::_DoBootCdvd()
}
ScopedCoreThreadPause paused_core;
if (g_Conf->CdvdSource == CDVD_SourceType::Iso)
if (EmuConfig.CdvdSource == CDVD_SourceType::Iso)
{
bool selector = g_Conf->CurrentIso.IsEmpty();
bool selector = EmuConfig.CurrentIso.IsEmpty();
if (!selector && !wxFileExists(g_Conf->CurrentIso))
if (!selector && !wxFileExists(EmuConfig.CurrentIso))
{
// User has an iso selected from a previous run, but it doesn't exist anymore.
// Issue a courtesy popup and then an Iso Selector to choose a new one.
wxDialogWithHelpers dialog(this, _("ISO file not found!"));
dialog += dialog.Heading(
_("An error occurred while trying to open the file:") + wxString(L"\n\n") + g_Conf->CurrentIso + L"\n\n" +
_("An error occurred while trying to open the file:") + wxString(L"\n\n") + EmuConfig.CurrentIso + L"\n\n" +
_("Error: The configured ISO file does not exist. Click OK to select a new ISO source for CDVD."));
pxIssueConfirmation(dialog, MsgButtons().OK());
@ -497,7 +497,7 @@ void MainEmuFrame::_DoBootCdvd()
}
}
sApp.SysExecute(g_Conf->CdvdSource);
sApp.SysExecute(EmuConfig.CdvdSource);
}
void MainEmuFrame::Menu_CdvdSource_Click(wxCommandEvent& event)
@ -576,7 +576,7 @@ void MainEmuFrame::Menu_IsoClear_Click(wxCommandEvent& event)
if (confirmed)
{
// If the CDVD mode is not ISO, or the system isn't running, wipe the CurrentIso field in INI file
if (g_Conf->CdvdSource != CDVD_SourceType::Iso || !SysHasValidState())
if (EmuConfig.CdvdSource != CDVD_SourceType::Iso || !SysHasValidState())
SysUpdateIsoSrcFile("");
wxGetApp().GetRecentIsoManager().Clear();
AppSaveSettings();
@ -730,7 +730,7 @@ void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent&)
if (_DoSelectELFBrowser())
{
g_Conf->EmuOptions.UseBOOT2Injection = true;
sApp.SysExecute(g_Conf->CdvdSource, g_Conf->CurrentELF);
sApp.SysExecute(EmuConfig.CdvdSource, EmuConfig.CurrentELF);
}
stopped_core.AllowResume();

View File

@ -137,7 +137,7 @@ void Panels::BiosSelectorPanel::Apply()
.SetUserMsg(pxE(L"Please select a valid BIOS. If you are unable to make a valid selection then press Cancel to close the Configuration panel."));
}
g_Conf->BaseFilenames.Bios = (*m_BiosList)[(sptr)m_ComboBox->GetClientData(sel)];
g_Conf->EmuOptions.BaseFilenames.Bios = (*m_BiosList)[(sptr)m_ComboBox->GetClientData(sel)];
}
void Panels::BiosSelectorPanel::AppStatusEvent_OnSettingsApplied()
@ -203,7 +203,7 @@ void Panels::BiosSelectorPanel::OnEnumComplete(wxCommandEvent& evt)
if (m_EnumeratorThread.get() != enumThread || m_BiosList->size() < enumThread->Result.size())
return;
const wxFileName& currentBios = g_Conf->FullpathToBios();
const wxFileName& currentBios = g_Conf->EmuOptions.FullpathToBios();
m_ComboBox->Clear(); // Clear the "Enumerating BIOSes..."
for (const std::pair<wxString, u32>& result : enumThread->Result)

View File

@ -68,7 +68,7 @@ void RecentIsoManager::OnChangedSelection( wxCommandEvent& evt )
// Actually there is no change on the selection so the event can be skip
// Note: It also avoids a deadlock which appears when the core thread is already paused
// and ScopedCoreThreadPopup try to stop the thread (GSOpen1 code path)
if( (g_Conf->CdvdSource == CDVD_SourceType::Iso) && (m_Items[i].Filename == g_Conf->CurrentIso) )
if( (EmuConfig.CdvdSource == CDVD_SourceType::Iso) && (m_Items[i].Filename == EmuConfig.CurrentIso) )
{
evt.Skip();
return;
@ -224,7 +224,7 @@ void RecentIsoManager::LoadListFrom( IniInterface& ini )
ini.Entry( pxsFmt( L"Filename%02d", i ), loadtmp, loadtmp, true );
if( loadtmp.GetFullName()!=L"" ) Add( loadtmp.GetFullPath() );
}
Add( g_Conf->CurrentIso );
Add(EmuConfig.CurrentIso );
ini.GetConfig().SetRecordDefaults( true );
}

View File

@ -20,9 +20,7 @@
#include "common/pxStreams.h"
#include "wx/ffile.h"
// FIXME: Temporary hack until we remove dependence on Pcsx2App.
#include "gui/AppConfig.h"
#include "Config.h"
#include "wx/mstream.h"
#include "wx/wfstream.h"
@ -189,7 +187,7 @@ static void LoadExtraRom( const wxChar* ext, u8 (&dest)[_size] )
s64 filesize = 0;
// Try first a basic extension concatenation (normally results in something like name.bin.rom1)
const wxString Bios( g_Conf->FullpathToBios() );
const wxString Bios( EmuConfig.FullpathToBios() );
Bios1.Printf( L"%s.%s", WX_STR(Bios), ext);
try
@ -259,8 +257,8 @@ void LoadBIOS()
try
{
wxString Bios( g_Conf->FullpathToBios() );
if( !g_Conf->BaseFilenames.Bios.IsOk() || g_Conf->BaseFilenames.Bios.IsDir() )
wxString Bios( EmuConfig.FullpathToBios() );
if( !EmuConfig.BaseFilenames.Bios.IsOk() || EmuConfig.BaseFilenames.Bios.IsDir() )
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."));
@ -301,8 +299,8 @@ void LoadBIOS()
LoadExtraRom( L"rom2", eeMem->ROM2 );
LoadExtraRom( L"erom", eeMem->EROM );
if (g_Conf->CurrentIRX.Length() > 3)
LoadIrx(g_Conf->CurrentIRX, &eeMem->ROM[0x3C0000]);
if (EmuConfig.CurrentIRX.Length() > 3)
LoadIrx(EmuConfig.CurrentIRX, &eeMem->ROM[0x3C0000]);
CurrentBiosInformation.threadListAddr = 0;
}
@ -318,7 +316,7 @@ void LoadBIOS()
bool IsBIOS(const wxString& filename, wxString& description)
{
wxFileName Bios( g_Conf->Folders.Bios + filename );
wxFileName Bios( EmuConfig.Folders.Bios + filename );
pxInputStream inway( filename, new wxFFileInputStream( filename ) );
if (!inway.IsOk()) return false;

View File

@ -35,7 +35,7 @@
#include "IopCommon.h"
#include "iCore.h"
#include "gui/AppConfig.h"
#include "Config.h"
#include "common/Perf.h"
#include "DebugTools/Breakpoints.h"
@ -229,9 +229,9 @@ static void iIopDumpBlock(int startpc, u8* ptr)
int numused, count;
Console.WriteLn("dump1 %x:%x, %x", startpc, psxpc, psxRegs.cycle);
g_Conf->Folders.Logs.Mkdir();
EmuConfig.Folders.Logs.Mkdir();
wxString filename(Path::Combine(g_Conf->Folders.Logs, wxsFormat(L"psxdump%.8X.txt", startpc)));
wxString filename(Path::Combine(EmuConfig.Folders.Logs, wxsFormat(L"psxdump%.8X.txt", startpc)));
AsciiFile f(filename, L"w");
f.Printf("Dump PSX register data: 0x%x\n\n", (uptr)&psxRegs);
@ -1300,7 +1300,7 @@ static void __fastcall iopRecRecompile(const u32 startpc)
u32 willbranch3 = 0;
// Inject IRX hack
if (startpc == 0x1630 && g_Conf->CurrentIRX.Length() > 3)
if (startpc == 0x1630 && EmuConfig.CurrentIRX.Length() > 3)
{
if (iopMemRead32(0x20018) == 0x1F)
{

View File

@ -16,6 +16,7 @@
#pragma once
#include "Utilities/AsciiFile.h"
#include "Config.h"
// writes text directly to mVU.logFile, no newlines appended.
_mVUt void __mVULog(const char* fmt, ...)
@ -58,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(g_Conf->Folders.Logs, logname), L"w"));
mVU.logFile = std::unique_ptr<AsciiFile>(new AsciiFile(Path::Combine(EmuConfig.Folders.Logs, logname), L"w"));
mVUlog("<html>\n");
mVUlog("<title>microVU%d MicroProgram Log</title>\n", mVU.index);