From 307feefa87b35949019046dbbcc8e5f1cb72c48a Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 17 Sep 2021 18:25:52 +1000 Subject: [PATCH] Config: Move gzip index template to base config --- pcsx2/CDVD/GzippedFileReader.cpp | 4 ++-- pcsx2/Config.h | 2 ++ pcsx2/Pcsx2Config.cpp | 16 +++++++++++++++- pcsx2/gui/AppConfig.cpp | 4 +--- pcsx2/gui/AppConfig.h | 1 - 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pcsx2/CDVD/GzippedFileReader.cpp b/pcsx2/CDVD/GzippedFileReader.cpp index 9fff424e05..5bc4c44ea0 100644 --- a/pcsx2/CDVD/GzippedFileReader.cpp +++ b/pcsx2/CDVD/GzippedFileReader.cpp @@ -16,7 +16,7 @@ #include "PrecompiledHeader.h" #include #include -#include "gui/AppConfig.h" +#include "Config.h" #include "ChunksCache.h" #include "CompressedFileReaderUtils.h" #include "GzippedFileReader.h" @@ -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)(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath()); //TestTemplate(appRoot, isoname, false); - return ApplyTemplate(L"gzip index", appRoot, g_Conf->GzipIsoIndexTemplate, isoname, false); + return ApplyTemplate(L"gzip index", appRoot, EmuConfig.GzipIsoIndexTemplate, isoname, false); } GzippedFileReader::GzippedFileReader(void) diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 0c592dfe13..1dc7810fff 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -567,6 +567,8 @@ struct Pcsx2Config FolderOptions Folders; FilenameOptions BaseFilenames; + wxString GzipIsoIndexTemplate; // for quick-access index with gzipped ISO + // Set at runtime, not loaded from config. CDVD_SourceType CdvdSource; wxString CurrentIso; diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 87dcf91ddf..6a19d0e4ed 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -20,7 +20,11 @@ #include "common/IniInterface.h" #include "Config.h" #include "GS.h" -#include "gui/GSFrame.h" +#include "CDVD/CDVDaccess.h" + +#ifndef PCSX2_CORE +#include "gui/AppConfig.h" +#endif void TraceLogFilters::LoadSave( IniInterface& ini ) { @@ -439,7 +443,11 @@ void Pcsx2Config::FilenameOptions::LoadSave(IniInterface& ini) //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) { @@ -485,6 +493,8 @@ Pcsx2Config::Pcsx2Config() EnablePatches = true; BackupSavestate = true; + GzipIsoIndexTemplate = L"$(f).pindex.tmp"; + CdvdSource = CDVD_SourceType::Iso; } @@ -522,6 +532,8 @@ void Pcsx2Config::LoadSave( IniInterface& ini ) Debugger .LoadSave( ini ); Trace .LoadSave( ini ); + IniEntry(GzipIsoIndexTemplate); + // For now, this in the derived config for backwards ini compatibility. #ifdef PCSX2_CORE BaseFilenames.LoadSave(ini); @@ -577,6 +589,8 @@ void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg) BaseFilenames = cfg.BaseFilenames; Framerate = cfg.Framerate; + GzipIsoIndexTemplate = cfg.GzipIsoIndexTemplate; + CdvdVerboseReads = cfg.CdvdVerboseReads; CdvdDumpBlocks = cfg.CdvdDumpBlocks; CdvdShareWrite = cfg.CdvdShareWrite; diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 6bff5dc35f..55616e0cc3 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -479,8 +479,6 @@ AppConfig::AppConfig() // Folder memory card is autodetected later. Mcd[slot].Type = MemoryCardType::MemoryCard_File; } - - GzipIsoIndexTemplate = L"$(f).pindex.tmp"; } // ------------------------------------------------------------------------ @@ -566,7 +564,7 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini ) ini.EnumEntry( L"LanguageId", LanguageId, NULL, LanguageId ); IniEntry( LanguageCode ); IniEntry( RecentIsoCount ); - IniEntry( GzipIsoIndexTemplate ); + ini.Entry(wxT("GzipIsoIndexTemplate"), EmuConfig.GzipIsoIndexTemplate, EmuConfig.GzipIsoIndexTemplate); IniEntry( Listbook_ImageSize ); IniEntry( Toolbar_ImageSize ); IniEntry( Toolbar_ShowLabels ); diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index ae13f3cb63..ada274f2c9 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -286,7 +286,6 @@ public: // Memorycard options - first 2 are default slots, last 6 are multitap 1 and 2 // slots (3 each) McdOptions Mcd[8]; - wxString GzipIsoIndexTemplate; // for quick-access index with gzipped ISO ConsoleLogOptions ProgLogBox; FolderOptions Folders;