Fix load perm cheats

This commit is contained in:
zilmar 2015-03-12 17:58:41 +11:00
parent 4956da099e
commit 2a528562bf
5 changed files with 19 additions and 17 deletions

View File

@ -99,11 +99,6 @@ void CCheats::LoadPermCheats (CPlugins * Plugins)
}
for (int CheatNo = 0; CheatNo < MaxCheats; CheatNo ++ )
{
//(((*(CPlugin*)(&*((*Plugins).m_Gfx)))).m_PluginInfo).Name
//+ (((*(CPlugin*)(&*((*Plugins).m_Gfx)))).m_PluginInfo).Name 0x038830dc "Jabo's Direct3D8 1.7.0.57-ver5" char [100]
// + Name 0x02d66d2c "Glide64 For PJ64 (Debug): 2.0.0.3" char [100]
stdstr LineEntry;
if (!g_Settings->LoadStringIndex(Rdb_GameCheatFix,CheatNo,LineEntry) || LineEntry.empty())
{
@ -150,10 +145,11 @@ void CCheats::LoadPermCheats (CPlugins * Plugins)
}
}
void CCheats::LoadCheats(bool DisableSelected)
void CCheats::LoadCheats(bool DisableSelected, CPlugins * Plugins)
{
m_CheatSelectionChanged = false;
m_Codes.clear();
LoadPermCheats(Plugins);
for (int CheatNo = 0; CheatNo < MaxCheats; CheatNo ++ )
{

View File

@ -19,9 +19,8 @@ public:
bool IsCheatMessage ( MSG * msg );
void ApplyCheats ( CMipsMemory * MMU );
void ApplyGSButton ( CMipsMemory * MMU );
void LoadCheats ( bool DisableSelected );
void LoadCheats ( bool DisableSelected, CPlugins * Plugins );
void SelectCheats ( HWND hParent, bool BlockExecution );
void LoadPermCheats ( CPlugins * Plugins );
inline bool CheatsSlectionChanged ( void ) const { return m_CheatSelectionChanged; }
private:
@ -34,8 +33,8 @@ private:
typedef std::vector<CODES> CODES_ARRAY;
enum { MaxCheats = 50000 };
void LoadPermCheats ( CPlugins * Plugins );
static int CALLBACK CheatAddProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );
static int CALLBACK CheatListProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );
static int CALLBACK ManageCheatsProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );

View File

@ -10,9 +10,10 @@
****************************************************************************/
#include "stdafx.h"
CSystemEvents::CSystemEvents(CN64System * System) :
CSystemEvents::CSystemEvents(CN64System * System, CPlugins * Plugins) :
m_bDoSomething(false),
m_System(System)
m_System(System),
m_Plugins(Plugins)
{
}
@ -123,7 +124,9 @@ void CSystemEvents::ExecuteEvents ( void )
break;
case SysEvent_GSButtonPressed:
if (m_System->m_Cheats.CheatsSlectionChanged())
m_System->m_Cheats.LoadCheats(false);
{
m_System->m_Cheats.LoadCheats(false, m_Plugins);
}
m_System->m_Cheats.ApplyGSButton(g_MMU);
break;
case SysEvent_PauseCPU_FromMenu:

View File

@ -54,7 +54,7 @@ class CSystemEvents
typedef std::vector<SystemEvent> EventList;
protected:
CSystemEvents(CN64System * System);
CSystemEvents(CN64System * System, CPlugins * Plugins);
virtual ~CSystemEvents();
public:
@ -71,6 +71,7 @@ private:
void ChangePluginFunc( void );
CN64System * m_System;
CPlugins * m_Plugins;
EventList m_Events;
BOOL m_bDoSomething;
CriticalSection m_CS;

View File

@ -15,7 +15,7 @@
#include <windows.h>
CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
CSystemEvents(this),
CSystemEvents(this, Plugins),
m_SyncPlugins(NULL),
m_SyncWindow(NULL),
m_Reg(this,this),
@ -51,8 +51,7 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
m_Limitor.SetHertz(gameHertz);
g_Settings->SaveDword(GameRunning_ScreenHertz,gameHertz);
m_Cheats.LoadPermCheats(Plugins);
m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats));
m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats), Plugins);
}
CN64System::~CN64System ( void )
@ -1881,9 +1880,13 @@ void CN64System::RefreshScreen ( void ) {
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0 )
{
if (g_BaseSystem == NULL)
{
return;
}
if (g_BaseSystem->m_Cheats.CheatsSlectionChanged())
g_BaseSystem->m_Cheats.LoadCheats(false);
{
g_BaseSystem->m_Cheats.LoadCheats(false, g_BaseSystem->m_Plugins);
}
g_BaseSystem->m_Cheats.ApplyCheats(g_MMU);
}
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }