From 2aac8d875a7335b920e8674d949cfba6223a0d8e Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sun, 31 Jul 2016 16:27:07 +0300 Subject: [PATCH] patches: more consistency with console messages If the dev/verbose console source is enabled then there's no change. If it's not enabled (i.e. most users), then: - Don't show patch info messages twice on boot (regression from 27e7ecce). - Show patch info messages when loading a saved state (never worked). - Don't show patch info messages for the bios. It still doesn't print the info when patches/fixes/etc are enabled or disabled while a game is running, because such actions while a game is running can have unexpected effects regardless (for instance, it's technically impossible to unapply a patch). If one really wants to follow the exact timing and info about patch loading, just enable the dev/verbose console source at the console menu. --- pcsx2/Patch.h | 3 +++ pcsx2/gui/AppCoreThread.cpp | 16 ++++++++++------ pcsx2/gui/SysState.cpp | 26 +++++++++++++++----------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index 0155b265b0..d763aa25c6 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -121,6 +121,9 @@ extern void ForgetLoadedPatches(); extern const IConsoleWriter *PatchesCon; +// Patch loading is verbose only once after the crc changes, this makes it think that the crc changed. +extern void PatchesVerboseReset(); + // The following prototypes seem unused in PCSX2, but maybe part of the cheats browser? // regardless, they don't seem to have an implementation anywhere. // extern int AddPatch(int Mode, int Place, int Address, int Size, u64 data); diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index f5c93e5c04..2a4a263bfe 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -295,7 +295,13 @@ static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) { // applied patches if the game info hasn't changed. (avoids spam when suspending/resuming // or using TAB or other things), but gets verbose again when booting (even if the same game). // File scope since it gets reset externally when rebooting -static wxString curGameKey; +#define _UNKNOWN_GAME_KEY (L"_UNKNOWN_GAME_KEY") +static wxString curGameKey = _UNKNOWN_GAME_KEY; + +void PatchesVerboseReset() +{ + curGameKey = _UNKNOWN_GAME_KEY; +} // PatchesCon points to either Console or ConsoleWriter_Null, such that if we're in Devel mode // or the user enabled the devel/verbose console it prints all patching info whenever it's applied, @@ -368,7 +374,8 @@ static void _ApplySettings( const Pcsx2Config& src, Pcsx2Config& fixup ) if (ingame && !DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]"; const wxString newGameKey(ingame ? SysGetDiscID() : SysGetBiosDiscID()); - const bool verbose( newGameKey != curGameKey ); + const bool verbose( newGameKey != curGameKey && ingame ); + //Console.WriteLn(L"------> patches verbose: %d prev: '%s' new: '%s'", (int)verbose, WX_STR(curGameKey), WX_STR(newGameKey)); SetupPatchesCon(verbose); curGameKey = newGameKey; @@ -469,6 +476,7 @@ static void _ApplySettings( const Pcsx2Config& src, Pcsx2Config& fixup ) void LoadAllPatchesAndStuff(const Pcsx2Config& cfg) { Pcsx2Config dummy; + PatchesVerboseReset(); _ApplySettings(cfg, dummy); } @@ -547,10 +555,6 @@ void AppCoreThread::VsyncInThread() void AppCoreThread::GameStartingInThread() { - // Make AppCoreThread::ApplySettings get verbose again even if we're booting - // the same game, by making it think that the current CRC is a new one. - curGameKey = L""; - // Simulate a Close/Resume, so that settings get re-applied and the database // lookups and other game-based detections are done. diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index ac1717de3c..3a5b1fbfec 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -27,6 +27,8 @@ #include #include +#include "Patch.h" + // Used to hold the current state backup (fullcopy of PS2 memory and plugin states). //static VmStateBuffer state_buffer( L"Public Savestate Buffer" ); @@ -318,7 +320,7 @@ public: bool IsCriticalEvent() const { return true; } bool AllowCancelOnExit() const { return false; } - + protected: void InvokeEvent() { @@ -374,7 +376,7 @@ public: virtual ~VmStateCompressThread() throw() { } - + protected: void OnStartInThread() { @@ -453,7 +455,7 @@ protected: } std::unique_ptr m_screenshot; - + if (m_screenshot) { wxZipEntry* vent = new wxZipEntry(EntryFilename_Screenshot); @@ -469,11 +471,11 @@ protected: .SetFinishedPath(m_filename) .Start(); - // No errors? Release cleanup handlers: + // No errors? Release cleanup handlers: elist.release(); out.release(); } - + void CleanupEvent() { } @@ -490,10 +492,10 @@ class SysExecEvent_UnzipFromDisk : public SysExecEvent { protected: wxString m_filename; - + public: wxString GetEventName() const { return L"VM_UnzipFromDisk"; } - + virtual ~SysExecEvent_UnzipFromDisk() throw() {} SysExecEvent_UnzipFromDisk* Clone() const { return new SysExecEvent_UnzipFromDisk( *this ); } SysExecEvent_UnzipFromDisk( const wxString& filename ) @@ -588,7 +590,7 @@ protected: for (uint i=0; iIsRequired()) { throwIt = true; @@ -604,6 +606,8 @@ protected: // We use direct Suspend/Resume control here, since it's desirable that emulation // *ALWAYS* start execution after the new savestate is loaded. + PatchesVerboseReset(); + GetCoreThread().Pause(); SysClearExecutionCache(); @@ -638,10 +642,10 @@ void StateCopy_SaveToFile( const wxString& file ) UI_DisableStateActions(); std::unique_ptr ziplist(new ArchiveEntryList(new VmStateBuffer(L"Zippable Savestate"))); - + GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState(ziplist.get())); GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk(ziplist.get(), file)); - + ziplist.release(); } @@ -663,7 +667,7 @@ void StateCopy_SaveToSlot( uint num ) if( wxFileExists( file ) && EmuConfig.BackupSavestate ) { const wxString copy( SaveStateBase::GetFilename( num ) + pxsFmt( L".backup") ); - + Console.Indent().WriteLn( Color_StrongGreen, L"Backing up existing state in slot %d.", num); wxRenameFile( file, copy ); }