From 4de1b432c1a7c827bdfb85b0f15a9974dad8ab1b Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Mon, 17 May 2010 05:37:32 +0000 Subject: [PATCH] - Add "Enable Cheats" menu item. Enable Cheats means enabling support from the files in "cheats\*.pnach" Enable Patches means enabling support for the gamefixes/patches inside the game database... git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3033 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Config.h | 1 + pcsx2/Patch.cpp | 4 ++-- pcsx2/Pcsx2Config.cpp | 1 + pcsx2/R5900.cpp | 3 +-- pcsx2/System/SysCoreThread.cpp | 2 +- pcsx2/gui/App.h | 1 + pcsx2/gui/MainFrame.cpp | 7 ++++++- pcsx2/gui/MainFrame.h | 1 + pcsx2/gui/MainMenuClicks.cpp | 6 ++++++ 9 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pcsx2/Config.h b/pcsx2/Config.h index df4af0dbe3..132a0474b9 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -483,6 +483,7 @@ struct Pcsx2Config CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console CdvdDumpBlocks :1, // enables cdvd block dumping EnablePatches :1, // enables patch detection and application + EnableCheats :1, // enables cheat detection and application // when enabled uses BOOT2 injection, skipping sony bios splashes UseBOOT2Injection :1, diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 1ebcd0ec5b..0bea234787 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -25,8 +25,8 @@ IniPatch Patch[ MAX_PATCH ]; IniPatch Cheat[ MAX_CHEAT ]; -int patchnumber; -int cheatnumber; +int patchnumber = 0; +int cheatnumber = 0; wxString strgametitle; diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 33394215f5..98f89ef29a 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -273,6 +273,7 @@ void Pcsx2Config::LoadSave( IniInterface& ini ) IniBitBool( CdvdVerboseReads ); IniBitBool( CdvdDumpBlocks ); IniBitBool( EnablePatches ); + IniBitBool( EnableCheats ); IniBitBool( ConsoleToStdio ); IniBitBool( McdEnableEjection ); diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index 9679d2fde7..0d277efc6e 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -600,8 +600,7 @@ void __fastcall eeGameStarting() loadGameSettings(GameDB); } - // ToDo: EmuConfig.EnableCheats option... - if (EmuConfig.EnablePatches) { + if (EmuConfig.EnableCheats) { int cheats = InitCheats(gameCRC); if (cheats) { wxString cString( wxsFormat( L"%d", cheats ) ); diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index c9a00d2ddb..be3ea2d878 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -199,7 +199,7 @@ void SysCoreThread::VsyncInThread() { PostVsyncToUI(); if (EmuConfig.EnablePatches) ApplyPatch(); - if (EmuConfig.EnablePatches) ApplyCheat(); // ToDo: EnableCheats Option... + if (EmuConfig.EnableCheats) ApplyCheat(); } void SysCoreThread::StateCheckInThread() diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 1783cdf29b..84ec55575e 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -96,6 +96,7 @@ enum MenuIdentifiers MenuId_Sys_LoadStates, // Opens load states submenu MenuId_Sys_SaveStates, // Opens save states submenu MenuId_EnablePatches, + MenuId_EnableCheats, MenuId_State_Load, MenuId_State_LoadOther, diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 83749086af..d0d9f15717 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -170,6 +170,7 @@ void MainEmuFrame::ConnectMenus() ConnectMenu( MenuId_Boot_ELF, Menu_OpenELF_Click ); ConnectMenu( MenuId_IsoBrowse, Menu_IsoBrowse_Click ); ConnectMenu( MenuId_EnablePatches, Menu_EnablePatches_Click ); + ConnectMenu( MenuId_EnableCheats, Menu_EnableCheats_Click ); ConnectMenu( MenuId_Exit, Menu_Exit_Click ); ConnectMenu( MenuId_Sys_SuspendResume, Menu_SuspendResume_Click ); @@ -379,6 +380,9 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) m_menuSys.Append(MenuId_EnablePatches, _("Enable Patches"), wxEmptyString, wxITEM_CHECK); + m_menuSys.Append(MenuId_EnableCheats, _("Enable Cheats"), + wxEmptyString, wxITEM_CHECK); + m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_Shutdown, _("Shutdown"), @@ -602,7 +606,8 @@ void MainEmuFrame::ApplySettings() wxMenuBar& menubar( *GetMenuBar() ); menubar.Check( MenuId_EnablePatches, g_Conf->EmuOptions.EnablePatches ); - menubar.Check( MenuId_CDVD_Info, g_Conf->EmuOptions.CdvdVerboseReads ); + menubar.Check( MenuId_EnableCheats, g_Conf->EmuOptions.EnableCheats ); + menubar.Check( MenuId_CDVD_Info, g_Conf->EmuOptions.CdvdVerboseReads ); #ifdef __LINUX__ menubar.Check( MenuId_Console_Stdio, g_Conf->EmuOptions.ConsoleToStdio ); #endif diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index f4e4dbbce0..e1555f7a27 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -169,6 +169,7 @@ protected: void Menu_IsoBrowse_Click(wxCommandEvent &event); void Menu_EnablePatches_Click(wxCommandEvent &event); + void Menu_EnableCheats_Click(wxCommandEvent &event); void Menu_BootCdvd_Click(wxCommandEvent &event); void Menu_BootCdvd2_Click(wxCommandEvent &event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index cd59f8de0c..490568fd3a 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -360,6 +360,12 @@ void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent& ) SaveEmuOptions(); } +void MainEmuFrame::Menu_EnableCheats_Click( wxCommandEvent& ) +{ + g_Conf->EmuOptions.EnableCheats = GetMenuBar()->IsChecked( MenuId_EnableCheats ); + SaveEmuOptions(); +} + void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent&) { ScopedCoreThreadClose stopped_core;