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.
This commit is contained in:
Avi Halachmi (:avih) 2016-07-31 16:27:07 +03:00
parent 92ae8a5be7
commit 2aac8d875a
3 changed files with 28 additions and 17 deletions

View File

@ -121,6 +121,9 @@ extern void ForgetLoadedPatches();
extern const IConsoleWriter *PatchesCon; 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? // The following prototypes seem unused in PCSX2, but maybe part of the cheats browser?
// regardless, they don't seem to have an implementation anywhere. // regardless, they don't seem to have an implementation anywhere.
// extern int AddPatch(int Mode, int Place, int Address, int Size, u64 data); // extern int AddPatch(int Mode, int Place, int Address, int Size, u64 data);

View File

@ -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 // 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). // 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 // 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 // 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, // 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"]"; if (ingame && !DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]";
const wxString newGameKey(ingame ? SysGetDiscID() : SysGetBiosDiscID()); 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); SetupPatchesCon(verbose);
curGameKey = newGameKey; curGameKey = newGameKey;
@ -469,6 +476,7 @@ static void _ApplySettings( const Pcsx2Config& src, Pcsx2Config& fixup )
void LoadAllPatchesAndStuff(const Pcsx2Config& cfg) void LoadAllPatchesAndStuff(const Pcsx2Config& cfg)
{ {
Pcsx2Config dummy; Pcsx2Config dummy;
PatchesVerboseReset();
_ApplySettings(cfg, dummy); _ApplySettings(cfg, dummy);
} }
@ -547,10 +555,6 @@ void AppCoreThread::VsyncInThread()
void AppCoreThread::GameStartingInThread() 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 // Simulate a Close/Resume, so that settings get re-applied and the database
// lookups and other game-based detections are done. // lookups and other game-based detections are done.

View File

@ -27,6 +27,8 @@
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <memory> #include <memory>
#include "Patch.h"
// Used to hold the current state backup (fullcopy of PS2 memory and plugin states). // Used to hold the current state backup (fullcopy of PS2 memory and plugin states).
//static VmStateBuffer state_buffer( L"Public Savestate Buffer" ); //static VmStateBuffer state_buffer( L"Public Savestate Buffer" );
@ -318,7 +320,7 @@ public:
bool IsCriticalEvent() const { return true; } bool IsCriticalEvent() const { return true; }
bool AllowCancelOnExit() const { return false; } bool AllowCancelOnExit() const { return false; }
protected: protected:
void InvokeEvent() void InvokeEvent()
{ {
@ -374,7 +376,7 @@ public:
virtual ~VmStateCompressThread() throw() virtual ~VmStateCompressThread() throw()
{ {
} }
protected: protected:
void OnStartInThread() void OnStartInThread()
{ {
@ -453,7 +455,7 @@ protected:
} }
std::unique_ptr<wxImage> m_screenshot; std::unique_ptr<wxImage> m_screenshot;
if (m_screenshot) if (m_screenshot)
{ {
wxZipEntry* vent = new wxZipEntry(EntryFilename_Screenshot); wxZipEntry* vent = new wxZipEntry(EntryFilename_Screenshot);
@ -469,11 +471,11 @@ protected:
.SetFinishedPath(m_filename) .SetFinishedPath(m_filename)
.Start(); .Start();
// No errors? Release cleanup handlers: // No errors? Release cleanup handlers:
elist.release(); elist.release();
out.release(); out.release();
} }
void CleanupEvent() void CleanupEvent()
{ {
} }
@ -490,10 +492,10 @@ class SysExecEvent_UnzipFromDisk : public SysExecEvent
{ {
protected: protected:
wxString m_filename; wxString m_filename;
public: public:
wxString GetEventName() const { return L"VM_UnzipFromDisk"; } wxString GetEventName() const { return L"VM_UnzipFromDisk"; }
virtual ~SysExecEvent_UnzipFromDisk() throw() {} virtual ~SysExecEvent_UnzipFromDisk() throw() {}
SysExecEvent_UnzipFromDisk* Clone() const { return new SysExecEvent_UnzipFromDisk( *this ); } SysExecEvent_UnzipFromDisk* Clone() const { return new SysExecEvent_UnzipFromDisk( *this ); }
SysExecEvent_UnzipFromDisk( const wxString& filename ) SysExecEvent_UnzipFromDisk( const wxString& filename )
@ -588,7 +590,7 @@ protected:
for (uint i=0; i<ArraySize(SavestateEntries); ++i) for (uint i=0; i<ArraySize(SavestateEntries); ++i)
{ {
if (foundEntry[i]) continue; if (foundEntry[i]) continue;
if (SavestateEntries[i]->IsRequired()) if (SavestateEntries[i]->IsRequired())
{ {
throwIt = true; throwIt = true;
@ -604,6 +606,8 @@ protected:
// We use direct Suspend/Resume control here, since it's desirable that emulation // We use direct Suspend/Resume control here, since it's desirable that emulation
// *ALWAYS* start execution after the new savestate is loaded. // *ALWAYS* start execution after the new savestate is loaded.
PatchesVerboseReset();
GetCoreThread().Pause(); GetCoreThread().Pause();
SysClearExecutionCache(); SysClearExecutionCache();
@ -638,10 +642,10 @@ void StateCopy_SaveToFile( const wxString& file )
UI_DisableStateActions(); UI_DisableStateActions();
std::unique_ptr<ArchiveEntryList> ziplist(new ArchiveEntryList(new VmStateBuffer(L"Zippable Savestate"))); std::unique_ptr<ArchiveEntryList> ziplist(new ArchiveEntryList(new VmStateBuffer(L"Zippable Savestate")));
GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState(ziplist.get())); GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState(ziplist.get()));
GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk(ziplist.get(), file)); GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk(ziplist.get(), file));
ziplist.release(); ziplist.release();
} }
@ -663,7 +667,7 @@ void StateCopy_SaveToSlot( uint num )
if( wxFileExists( file ) && EmuConfig.BackupSavestate ) if( wxFileExists( file ) && EmuConfig.BackupSavestate )
{ {
const wxString copy( SaveStateBase::GetFilename( num ) + pxsFmt( L".backup") ); const wxString copy( SaveStateBase::GetFilename( num ) + pxsFmt( L".backup") );
Console.Indent().WriteLn( Color_StrongGreen, L"Backing up existing state in slot %d.", num); Console.Indent().WriteLn( Color_StrongGreen, L"Backing up existing state in slot %d.", num);
wxRenameFile( file, copy ); wxRenameFile( file, copy );
} }