[Project64] Split cheat class between UI and code

This commit is contained in:
zilmar 2015-11-07 14:32:23 +11:00
parent 45a8598290
commit 9f87dbf30d
16 changed files with 2776 additions and 2667 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,79 +13,36 @@
class CCheats
{
public:
CCheats ( const CN64Rom * Rom = NULL );
~CCheats ( void );
CCheats();
~CCheats(void);
bool IsCheatMessage ( MSG * msg );
void ApplyCheats ( CMipsMemory * MMU );
void ApplyGSButton ( CMipsMemory * MMU );
void LoadCheats ( bool DisableSelected, CPlugins * Plugins );
void SelectCheats ( HWND hParent, bool BlockExecution );
inline bool CheatsSlectionChanged ( void ) const { return m_CheatSelectionChanged; }
enum
{
MaxCheats = 50000,
MaxGSEntries = 100,
};
void ApplyCheats(CMipsMemory * MMU);
void ApplyGSButton(CMipsMemory * MMU);
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
static bool IsValid16BitCode(const char * CheatString);
private:
struct GAMESHARK_CODE {
DWORD Command;
WORD Value;
};
struct GAMESHARK_CODE
{
uint32_t Command;
uint16_t Value;
};
typedef std::vector<GAMESHARK_CODE> CODES;
typedef std::vector<CODES> CODES_ARRAY;
typedef std::vector<GAMESHARK_CODE> CODES;
typedef std::vector<CODES> CODES_ARRAY;
enum { MaxCheats = 50000 };
void LoadPermCheats ( CPlugins * Plugins );
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 );
static int CALLBACK CheatsCodeExProc ( HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam);
static int CALLBACK CheatsCodeQuantProc ( HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam);
const CN64Rom * m_Rom;
CODES_ARRAY m_Codes;
//information about the gui for selecting cheats
HWND m_Window, m_hSelectCheat, m_AddCheat, m_hCheatTree, m_hSelectedItem;
const CN64Rom * m_Rom;
void * const m_rcList, * const m_rcAdd;
int m_MinSizeDlg, m_MaxSizeDlg;
int m_EditCheat;
bool m_DeleteingEntries;
CODES_ARRAY m_Codes;
bool m_CheatSelectionChanged;
//Information about the current cheat we are editing
stdstr m_EditName;
stdstr m_EditCode;
stdstr m_EditOptions;
stdstr m_EditNotes;
enum Dialog_State { CONTRACTED, EXPANDED } m_DialogState;
enum TV_CHECK_STATE { TV_STATE_UNKNOWN, TV_STATE_CLEAR, TV_STATE_CHECKED, TV_STATE_INDETERMINATE };
enum { MaxGSEntries = 100, IDC_MYTREE = 0x500 };
bool LoadCode ( int CheatNo, LPCSTR CheatString );
void AddCodeLayers ( int CheatNumber, const stdstr &CheatName, HWND hParent, bool CheatActive );
//Reload the cheats from the ini file to the select gui
void RefreshCheatManager ();
void ChangeChildrenStatus ( HWND hParent, bool Checked );
void CheckParentStatus ( HWND hParent );
static stdstr ReadCodeString ( HWND hDlg, bool &validcodes, bool &validoption, bool &nooptions, int &codeformat );
static stdstr ReadOptionsString( HWND hDlg, bool &validcodes, bool &validoptions, bool &nooptions, int &codeformat );
int ApplyCheatEntry (CMipsMemory * MMU,const CODES & CodeEntry, int CurrentEntry, bool Execute );
void RecordCheatValues ( HWND hDlg );
bool CheatChanged ( HWND hDlg );
bool IsValid16BitCode ( LPCSTR CheatString ) const;
void DeleteCheat(int Index);
//Get Information about the Cheat
stdstr GetCheatName ( int CheatNo, bool AddExtension ) const;
static bool CheatUsesCodeExtensions ( const stdstr &LineEntry );
//Working with treeview
static bool TV_SetCheckState(HWND hwndTreeView, HWND hItem, TV_CHECK_STATE state);
static int TV_GetCheckState(HWND hwndTreeView, HWND hItem);
static DWORD AsciiToHex ( const char * HexValue );
static void MenuSetText ( HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut );
//UI Functions
static stdstr GetDlgItemStr (HWND hDlg, int nIDDlgItem);
bool LoadCode(int32_t CheatNo, const char * CheatString);
int32_t ApplyCheatEntry(CMipsMemory * MMU, const CODES & CodeEntry, int32_t CurrentEntry, bool Execute);
};

View File

@ -55,7 +55,7 @@ void CSystemEvents::ExecuteEvents()
}
bool bPause = false, bLoadedSave = false;
for (EventList::const_iterator iter = Events.begin(); !bLoadedSave && iter != Events.end(); iter++ )
for (EventList::const_iterator iter = Events.begin(); !bLoadedSave && iter != Events.end(); iter++)
{
switch (*iter)
{
@ -66,10 +66,10 @@ void CSystemEvents::ExecuteEvents()
m_System->GameReset();
break;
case SysEvent_ResetCPU_SoftDone:
m_System->Reset(true,false);
m_System->Reset(true, false);
break;
case SysEvent_ResetCPU_Hard:
m_System->Reset(true,true);
m_System->Reset(true, true);
break;
case SysEvent_Profile_GenerateLogs:
m_System->m_Profile.GenerateLog();
@ -125,8 +125,9 @@ void CSystemEvents::ExecuteEvents()
Notify().ChangeFullScreen();
break;
case SysEvent_GSButtonPressed:
if (m_System->m_Cheats.CheatsSlectionChanged())
if (m_System->HasCheatsSlectionChanged())
{
m_System->SetCheatsSlectionChanged(false);
m_System->m_Cheats.LoadCheats(false, m_Plugins);
}
m_System->m_Cheats.ApplyGSButton(g_MMU);
@ -134,7 +135,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_FromMenu:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_FromMenu);
bPause = true;
}
@ -142,7 +143,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_AppLostFocus:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostFocus);
bPause = true;
}
@ -150,7 +151,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_AppLostActive:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostActive);
bPause = true;
}
@ -158,7 +159,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_SaveGame:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SaveGame);
bPause = true;
}
@ -166,7 +167,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_LoadGame:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_LoadGame);
bPause = true;
}
@ -174,7 +175,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_DumpMemory:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_DumpMemory);
bPause = true;
}
@ -182,7 +183,7 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_SearchMemory:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SearchMemory);
bPause = true;
}
@ -190,13 +191,21 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_Settings:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_Settings);
bPause = true;
}
break;
case SysEvent_PauseCPU_Cheats:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_Cheats);
bPause = true;
}
break;
default:
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__, __LINE__);
break;
}
}
@ -209,6 +218,6 @@ void CSystemEvents::ExecuteEvents()
void CSystemEvents::ChangePluginFunc()
{
g_Notify->DisplayMessage(0,MSG_PLUGIN_INIT);
g_Notify->DisplayMessage(0, MSG_PLUGIN_INIT);
m_System->PluginReset();
}

View File

@ -12,42 +12,44 @@
enum SystemEvent
{
SysEvent_ExecuteInterrupt,
SysEvent_GSButtonPressed,
SysEvent_ResetCPU_Soft,
SysEvent_ResetCPU_SoftDone,
SysEvent_ResetCPU_Hard,
SysEvent_CloseCPU,
SysEvent_PauseCPU_FromMenu,
SysEvent_PauseCPU_AppLostActive,
SysEvent_PauseCPU_AppLostActiveDelay,
SysEvent_PauseCPU_AppLostFocus,
SysEvent_PauseCPU_SaveGame,
SysEvent_PauseCPU_LoadGame,
SysEvent_PauseCPU_DumpMemory,
SysEvent_PauseCPU_SearchMemory,
SysEvent_PauseCPU_Settings,
SysEvent_ResumeCPU_FromMenu,
SysEvent_ResumeCPU_AppGainedActive,
SysEvent_ResumeCPU_AppGainedFocus,
SysEvent_ResumeCPU_SaveGame,
SysEvent_ResumeCPU_LoadGame,
SysEvent_ResumeCPU_DumpMemory,
SysEvent_ResumeCPU_SearchMemory,
SysEvent_ResumeCPU_Settings,
SysEvent_ChangingFullScreen,
SysEvent_ChangePlugins,
SysEvent_SaveMachineState,
SysEvent_LoadMachineState,
SysEvent_Interrupt_SP,
SysEvent_Interrupt_SI,
SysEvent_Interrupt_AI,
SysEvent_Interrupt_VI,
SysEvent_Interrupt_PI,
SysEvent_Interrupt_DP,
SysEvent_Profile_StartStop,
SysEvent_Profile_ResetLogs,
SysEvent_Profile_GenerateLogs,
SysEvent_ExecuteInterrupt,
SysEvent_GSButtonPressed,
SysEvent_ResetCPU_Soft,
SysEvent_ResetCPU_SoftDone,
SysEvent_ResetCPU_Hard,
SysEvent_CloseCPU,
SysEvent_PauseCPU_FromMenu,
SysEvent_PauseCPU_AppLostActive,
SysEvent_PauseCPU_AppLostActiveDelay,
SysEvent_PauseCPU_AppLostFocus,
SysEvent_PauseCPU_SaveGame,
SysEvent_PauseCPU_LoadGame,
SysEvent_PauseCPU_DumpMemory,
SysEvent_PauseCPU_SearchMemory,
SysEvent_PauseCPU_Settings,
SysEvent_PauseCPU_Cheats,
SysEvent_ResumeCPU_FromMenu,
SysEvent_ResumeCPU_AppGainedActive,
SysEvent_ResumeCPU_AppGainedFocus,
SysEvent_ResumeCPU_SaveGame,
SysEvent_ResumeCPU_LoadGame,
SysEvent_ResumeCPU_DumpMemory,
SysEvent_ResumeCPU_SearchMemory,
SysEvent_ResumeCPU_Settings,
SysEvent_ResumeCPU_Cheats,
SysEvent_ChangingFullScreen,
SysEvent_ChangePlugins,
SysEvent_SaveMachineState,
SysEvent_LoadMachineState,
SysEvent_Interrupt_SP,
SysEvent_Interrupt_SI,
SysEvent_Interrupt_AI,
SysEvent_Interrupt_VI,
SysEvent_Interrupt_PI,
SysEvent_Interrupt_DP,
SysEvent_Profile_StartStop,
SysEvent_Profile_ResetLogs,
SysEvent_Profile_GenerateLogs,
};
class CSystemEvents

View File

@ -15,34 +15,34 @@
#include <windows.h>
#include <commdlg.h>
CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
CSystemEvents(this, Plugins),
m_Cheats(NULL),
m_EndEmulation(false),
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
m_Plugins(Plugins),
m_SyncCPU(NULL),
m_SyncPlugins(NULL),
m_SyncWindow(NULL),
m_MMU_VM(this,SavesReadOnly),
m_TLB(this),
m_Reg(this,this),
m_Recomp(NULL),
m_InReset(false),
m_NextTimer(0),
m_SystemTimer(m_NextTimer),
m_bCleanFrameBox(true),
m_bInitialized(false),
m_RspBroke(true),
m_DMAUsed(false),
m_TestTimer(false),
m_NextInstruction(0),
m_JumpToLocation(0),
m_TLBLoadAddress(0),
m_TLBStoreAddress(0),
m_SyncCount(0),
m_CPU_Handle(NULL),
m_CPU_ThreadID(0)
CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly) :
CSystemEvents(this, Plugins),
m_EndEmulation(false),
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
m_Plugins(Plugins),
m_SyncCPU(NULL),
m_SyncPlugins(NULL),
m_SyncWindow(NULL),
m_MMU_VM(this, SavesReadOnly),
m_TLB(this),
m_Reg(this, this),
m_Recomp(NULL),
m_InReset(false),
m_NextTimer(0),
m_SystemTimer(m_NextTimer),
m_bCleanFrameBox(true),
m_bInitialized(false),
m_RspBroke(true),
m_DMAUsed(false),
m_TestTimer(false),
m_NextInstruction(0),
m_JumpToLocation(0),
m_TLBLoadAddress(0),
m_TLBStoreAddress(0),
m_SyncCount(0),
m_CPU_Handle(NULL),
m_CPU_ThreadID(0),
m_CheatsSlectionChanged(false)
{
DWORD gameHertz = g_Settings->LoadDword(Game_ScreenHertz);
if (gameHertz == 0)
@ -115,6 +115,7 @@ void CN64System::ExternalEvent ( SystemEvent action )
case SysEvent_PauseCPU_DumpMemory:
case SysEvent_PauseCPU_SearchMemory:
case SysEvent_PauseCPU_Settings:
case SysEvent_PauseCPU_Cheats:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
QueueEvent(action);
@ -166,9 +167,15 @@ void CN64System::ExternalEvent ( SystemEvent action )
SetEvent(m_hPauseEvent);
}
break;
case SysEvent_ResumeCPU_Cheats:
if (g_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_Cheats)
{
SetEvent(m_hPauseEvent);
}
break;
default:
WriteTraceF(TraceError,__FUNCTION__ ": Unknown event %d",action);
g_Notify->BreakPoint(__FILEW__,__LINE__);
WriteTraceF(TraceError, __FUNCTION__ ": Unknown event %d", action);
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
}
@ -453,11 +460,6 @@ void CN64System::CloseCpu()
CpuStopped();
}
void CN64System::SelectCheats ( HWND hParent )
{
m_Cheats.SelectCheats(hParent,false);
}
void CN64System::DisplayRomInfo ( HWND hParent )
{
if (!g_Rom) { return; }
@ -508,15 +510,6 @@ stdstr CN64System::ChooseFileToOpen ( HWND hParent )
return stdstr("");
}
bool CN64System::IsDialogMsg( MSG * msg )
{
if (m_Cheats.IsCheatMessage(msg))
{
return true;
}
return false;
}
void CN64System::GameReset()
{
m_SystemTimer.SetTimer(CSystemTimer::SoftResetTimer,0x3000000,false);
@ -2051,19 +2044,20 @@ void CN64System::RefreshScreen()
m_CPU_Usage.ShowCPU_Usage();
m_CPU_Usage.StartTimer(CPU_UsageAddr != Timer_None ? CPU_UsageAddr : Timer_R4300 );
}
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0 )
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0)
{
if (g_BaseSystem == NULL)
if (HasCheatsSlectionChanged())
{
return;
if (this == g_BaseSystem && g_SyncSystem != NULL)
{
g_SyncSystem->SetCheatsSlectionChanged(true);
}
SetCheatsSlectionChanged(false);
m_Cheats.LoadCheats(false, g_BaseSystem->m_Plugins);
}
if (g_BaseSystem->m_Cheats.CheatsSlectionChanged())
{
g_BaseSystem->m_Cheats.LoadCheats(false, g_BaseSystem->m_Plugins);
}
g_BaseSystem->m_Cheats.ApplyCheats(g_MMU);
m_Cheats.ApplyCheats(g_MMU);
}
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
}
bool CN64System::WriteToProtectedMemory (DWORD Address, int length)

View File

@ -50,10 +50,8 @@ public:
void ExternalEvent ( SystemEvent action ); //covers gui interacting and timers etc..
stdstr ChooseFileToOpen ( HWND hParent );
void DisplayRomInfo ( HWND hParent );
void SelectCheats ( HWND hParent );
void StartEmulation ( bool NewThread );
void SyncToAudio ();
bool IsDialogMsg ( MSG * msg );
void IncreaseSpeed () { m_Limitor.IncreaseSpeed(); }
void DecreaseSpeed () { m_Limitor.DecreaseSpeed(); }
void Reset ( bool bInitReg, bool ClearMenory );
@ -68,6 +66,8 @@ public:
bool DmaUsed() const { return m_DMAUsed; }
void SetDmaUsed(bool DMAUsed) { m_DMAUsed = DMAUsed; }
void SetCheatsSlectionChanged(bool changed) { m_CheatsSlectionChanged = changed; }
bool HasCheatsSlectionChanged(void) const { return m_CheatsSlectionChanged; }
DWORD GetButtons(int Control) const { return m_Buttons[Control]; }
//Variable used to track that the SP is being handled and stays the same as the real SP in sync core
@ -144,6 +144,7 @@ private:
DWORD m_TLBLoadAddress;
DWORD m_TLBStoreAddress;
DWORD m_SyncCount;
bool m_CheatsSlectionChanged;
//When Syncing cores this is the PC where it last Sync'ed correctly
DWORD m_LastSuccessSyncPC[10];

View File

@ -26,17 +26,21 @@ enum PauseType
PauseType_DumpMemory,
PauseType_SearchMemory,
PauseType_Settings,
PauseType_Cheats,
};
enum CPU_TYPE {
enum CPU_TYPE
{
CPU_Default = -1, CPU_Interpreter = 1, CPU_Recompiler = 2, CPU_SyncCores = 3
};
enum FRAMERATE_TYPE {
enum FRAMERATE_TYPE
{
FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2,
};
enum SAVE_CHIP_TYPE {
enum SAVE_CHIP_TYPE
{
SaveChip_Auto = -1, SaveChip_Eeprom_4K, SaveChip_Eeprom_16K, SaveChip_Sram, SaveChip_FlashRam
};
@ -45,42 +49,48 @@ enum FUNC_LOOKUP_METHOD
FuncFind_Default = -1, FuncFind_PhysicalLookup = 1, FuncFind_VirtualLookup = 2, FuncFind_ChangeMemory = 3,
};
enum SYSTEM_TYPE {
enum SYSTEM_TYPE
{
SYSTEM_NTSC = 0, SYSTEM_PAL = 1, SYSTEM_MPAL = 2
};
enum CICChip {
CIC_UNKNOWN = -1, CIC_NUS_6101 = 1, CIC_NUS_6102 = 2, CIC_NUS_6103 = 3,
CIC_NUS_6104 = 4, CIC_NUS_6105 = 5, CIC_NUS_6106 = 6, CIC_NUS_5167 = 7,
enum CICChip
{
CIC_UNKNOWN = -1, CIC_NUS_6101 = 1, CIC_NUS_6102 = 2, CIC_NUS_6103 = 3,
CIC_NUS_6104 = 4, CIC_NUS_6105 = 5, CIC_NUS_6106 = 6, CIC_NUS_5167 = 7,
CIC_NUS_8303 = 8
};
enum Country {
NTSC_BETA = 0x37, X_NTSC = 0x41, Germany = 0x44, USA = 0x45, french = 0x46, Italian = 0x49,
Japan = 0x4A, Europe = 0x50, Spanish = 0x53, Australia = 0x55, X_PAL = 0x58, Y_PAL = 0x59,
enum Country
{
NTSC_BETA = 0x37, X_NTSC = 0x41, Germany = 0x44, USA = 0x45, french = 0x46, Italian = 0x49,
Japan = 0x4A, Europe = 0x50, Spanish = 0x53, Australia = 0x55, X_PAL = 0x58, Y_PAL = 0x59,
UnknownCountry = 0
};
enum SPECIAL_TIMERS {
Timer_None = 0, Timer_R4300 = -1, Timer_RSP_Dlist = -2,
Timer_RSP_Alist = -3, Timer_RSP_Unknown = -5, Timer_RefreshScreen = -6,
Timer_UpdateScreen = -7, Timer_UpdateFPS = -9, Timer_Idel = -10,
Timer_FuncLookup = -11,Timer_Done = -13,Timer_GetBlockInfo = -14,
Timer_AnalyseBlock = -15,Timer_CompileBlock = -17, Timer_CompileDone = -18,
enum SPECIAL_TIMERS
{
Timer_None = 0, Timer_R4300 = -1, Timer_RSP_Dlist = -2,
Timer_RSP_Alist = -3, Timer_RSP_Unknown = -5, Timer_RefreshScreen = -6,
Timer_UpdateScreen = -7, Timer_UpdateFPS = -9, Timer_Idel = -10,
Timer_FuncLookup = -11, Timer_Done = -13, Timer_GetBlockInfo = -14,
Timer_AnalyseBlock = -15, Timer_CompileBlock = -17, Timer_CompileDone = -18,
Timer_InheritParentInfo = -19, Timer_AddX86Code = -20,
};
enum STEP_TYPE {
NORMAL = 0,
DO_DELAY_SLOT = 1,
DO_END_DELAY_SLOT = 2,
DELAY_SLOT = 3,
END_DELAY_SLOT = 4,
LIKELY_DELAY_SLOT = 5,
JUMP = 6,
DELAY_SLOT_DONE = 7,
LIKELY_DELAY_SLOT_DONE= 8,
END_BLOCK = 9,
PERMLOOP_DO_DELAY = 10,
PERMLOOP_DELAY_DONE = 11,
enum STEP_TYPE
{
NORMAL = 0,
DO_DELAY_SLOT = 1,
DO_END_DELAY_SLOT = 2,
DELAY_SLOT = 3,
END_DELAY_SLOT = 4,
LIKELY_DELAY_SLOT = 5,
JUMP = 6,
DELAY_SLOT_DONE = 7,
LIKELY_DELAY_SLOT_DONE = 8,
END_BLOCK = 9,
PERMLOOP_DO_DELAY = 10,
PERMLOOP_DELAY_DONE = 11,
};

View File

@ -284,6 +284,10 @@
<Filter
Name="User Interface Source"
>
<File
RelativePath=".\User Interface\Cheat Class UI.cpp"
>
</File>
<File
RelativePath="User Interface\Frame Per Second Class.cpp"
>
@ -936,6 +940,10 @@
<Filter
Name="User Interface Headers"
>
<File
RelativePath=".\User Interface\Cheat Class UI.h"
>
</File>
<File
RelativePath="User Interface\Frame Per Second Class.h"
>

View File

@ -74,6 +74,7 @@
<ClCompile Include="Settings\SettingType\SettingsType-TempBool.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-TempNumber.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-TempString.cpp" />
<ClCompile Include="User Interface\Cheat Class UI.cpp" />
<ClCompile Include="User Interface\Frame Per Second Class.cpp" />
<ClCompile Include="User Interface\Gui Class.cpp" />
<ClCompile Include="User Interface\Main Menu Class.cpp" />
@ -186,6 +187,7 @@
<ClInclude Include="Settings.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="User Interface.h" />
<ClInclude Include="User Interface\Cheat Class UI.h" />
<ClInclude Include="Version.h" />
<ClInclude Include="WTL App.h" />
<ClInclude Include="Settings\Debug Settings.h" />

View File

@ -417,6 +417,9 @@
<ClCompile Include="Multilanguage\LanguageSelector.cpp">
<Filter>Source Files\Multilanguage Source</Filter>
</ClCompile>
<ClCompile Include="User Interface\Cheat Class UI.cpp">
<Filter>Source Files\User Interface Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="User Interface\Bitmaps\AboutScreenBottom.bmp">
@ -842,5 +845,8 @@
<ClInclude Include="Multilanguage\LanguageSelector.h">
<Filter>Header Files\Multilanguage Headers</Filter>
</ClInclude>
<ClInclude Include="User Interface\Cheat Class UI.h">
<Filter>Header Files\User Interface Headers</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -61,3 +61,4 @@ class CN64System;
#include ".\\User Interface\\Frame Per Second Class.h"
#include ".\\User Interface\\resource.h"
#include ".\\User Interface\\Settings Config.h"
#include ".\\User Interface\\Cheat Class UI.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
/****************************************************************************
* *
* Project 64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
class CCheatsUI
{
public:
CCheatsUI(void);
~CCheatsUI(void);
bool IsCheatMessage(MSG * msg);
void SelectCheats(HWND hParent, bool BlockExecution);
private:
static int CALLBACK CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
static int CALLBACK CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
static int CALLBACK ManageCheatsProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
static int CALLBACK CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
static int CALLBACK CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
//information about the gui for selecting cheats
HWND m_Window, m_hSelectCheat, m_AddCheat, m_hCheatTree, m_hSelectedItem;
void * const m_rcList, *const m_rcAdd;
int m_MinSizeDlg, m_MaxSizeDlg;
int m_EditCheat;
bool m_DeleteingEntries;
//Information about the current cheat we are editing
stdstr m_EditName;
stdstr m_EditCode;
stdstr m_EditOptions;
stdstr m_EditNotes;
enum Dialog_State { CONTRACTED, EXPANDED } m_DialogState;
enum TV_CHECK_STATE { TV_STATE_UNKNOWN, TV_STATE_CLEAR, TV_STATE_CHECKED, TV_STATE_INDETERMINATE };
enum { IDC_MYTREE = 0x500 };
void AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hParent, bool CheatActive);
//Reload the cheats from the ini file to the select gui
void RefreshCheatManager();
void ChangeChildrenStatus(HWND hParent, bool Checked);
void CheckParentStatus(HWND hParent);
static stdstr ReadCodeString(HWND hDlg, bool &validcodes, bool &validoption, bool &nooptions, int &codeformat);
static stdstr ReadOptionsString(HWND hDlg, bool &validcodes, bool &validoptions, bool &nooptions, int &codeformat);
void RecordCheatValues(HWND hDlg);
bool CheatChanged(HWND hDlg);
void DeleteCheat(int Index);
//Get Information about the Cheat
stdstr GetCheatName(int CheatNo, bool AddExtension) const;
static bool CheatUsesCodeExtensions(const stdstr &LineEntry);
//Working with treeview
static bool TV_SetCheckState(HWND hwndTreeView, HWND hItem, TV_CHECK_STATE state);
static int TV_GetCheckState(HWND hwndTreeView, HWND hItem);
static void MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut);
//UI Functions
static stdstr GetDlgItemStr(HWND hDlg, int nIDDlgItem);
};
extern CCheatsUI * g_cheatUI;

File diff suppressed because it is too large Load Diff

View File

@ -32,102 +32,101 @@ class CMainGui :
public CDebuggerUI,
private CGuiSettings
{
enum { StatusBarID = 400 };
enum { StatusBarID = 400 };
enum { Timer_SetWindowPos = 1 };
enum { Timer_SetWindowPos = 1 };
struct RESET_PLUGIN
{
CN64System * system;
CPlugins * plugins;
HANDLE hEvent;
bool res;
};
struct RESET_PLUGIN
{
CN64System * system;
CPlugins * plugins;
HANDLE hEvent;
bool res;
};
public:
CMainGui ( bool bMainWindow, const char * WindowTitle = "" );
~CMainGui ( void );
CMainGui(bool bMainWindow, const char * WindowTitle = "");
~CMainGui(void);
//Message Processing
WPARAM ProcessAllMessages ( void );
bool ProcessGuiMessages ( void );
//Message Processing
WPARAM ProcessAllMessages(void);
bool ProcessGuiMessages(void);
//debugging functions
void EnterLogOptions ( void );
//debugging functions
void EnterLogOptions(void);
//Get Information about the window
int Height ( void ); //Get the Height of the window
int Width ( void ); //Get the Width of the window
//Get Information about the window
int Height(void); //Get the Height of the window
int Width(void); //Get the Width of the window
//Manipulate the state of the window
void SetPos ( int X, int Y ); //Move the window to this screen location
void Show ( bool ShowWindow ); //Show or Hide the current window
void MakeWindowOnTop ( bool OnTop );
void BringToTop ( void );
void Caption ( LPCWSTR Caption ); //Set the caption of the window
void SaveWindowLoc ( void );
//Manipulate the state of the window
void SetPos(int X, int Y); //Move the window to this screen location
void Show(bool ShowWindow); //Show or Hide the current window
void MakeWindowOnTop(bool OnTop);
void BringToTop(void);
void Caption(LPCWSTR Caption); //Set the caption of the window
void SaveWindowLoc(void);
//Menu Function
void SetWindowMenu ( CBaseMenu * Menu );
void RefreshMenu ( void );
CBaseMenu * GetMenuClass ( void ) { return m_Menu; }
//Menu Function
void SetWindowMenu(CBaseMenu * Menu);
void RefreshMenu(void);
CBaseMenu * GetMenuClass(void) { return m_Menu; }
// Status bar
void SetStatusText ( int Panel,const wchar_t * Text );
void ShowStatusBar ( bool ShowBar );
// Status bar
void SetStatusText(int Panel, const wchar_t * Text);
void ShowStatusBar(bool ShowBar);
//About Window
void AboutIniBox ( void );
void AboutBox ( void );
//About Window
void AboutIniBox(void);
void AboutBox(void);
//Plugins
//Plugins
bool ResetPlugins ( CPlugins * plugins, CN64System * System );
//Get Window Handle
//Get Window Handle
inline HWND GetHandle ( void ) const { return m_hMainWindow; }
private:
CMainGui(void); // Disable default constructor
CMainGui(const CMainGui&); // Disable copy constructor
CMainGui& operator=(const CMainGui&); // Disable assignment
CMainGui(void); // Disable default constructor
CMainGui(const CMainGui&); // Disable copy constructor
CMainGui& operator=(const CMainGui&); // Disable assignment
friend CGfxPlugin;
friend CAudioPlugin;
friend CControl_Plugin;
friend CGfxPlugin;
friend CAudioPlugin;
friend CControl_Plugin;
bool RegisterWinClass ( void );
void ChangeWinSize ( long width, long height );
void Create ( const char * WindowTitle );
void CreateStatusBar ( void );
void Resize ( DWORD fwSizeType, WORD nWidth, WORD nHeight ); //responding to WM_SIZE
bool RegisterWinClass(void);
void ChangeWinSize(long width, long height);
void Create(const char * WindowTitle);
void CreateStatusBar(void);
void Resize(DWORD fwSizeType, WORD nWidth, WORD nHeight); //responding to WM_SIZE
friend DWORD CALLBACK AboutBoxProc ( HWND, DWORD, DWORD, DWORD );
friend DWORD CALLBACK AboutIniBoxProc ( HWND, DWORD, DWORD, DWORD );
static LRESULT CALLBACK MainGui_Proc ( HWND, DWORD, DWORD, DWORD );
friend DWORD CALLBACK AboutBoxProc(HWND, DWORD, DWORD, DWORD);
friend DWORD CALLBACK AboutIniBoxProc(HWND, DWORD, DWORD, DWORD);
static LRESULT CALLBACK MainGui_Proc(HWND, DWORD, DWORD, DWORD);
friend void RomBowserEnabledChanged (CMainGui * Gui);
friend void RomBowserColoumnsChanged (CMainGui * Gui);
friend void RomBrowserRecursiveChanged (CMainGui * Gui);
friend void RomBowserEnabledChanged(CMainGui * Gui);
friend void RomBowserColoumnsChanged(CMainGui * Gui);
friend void RomBrowserRecursiveChanged(CMainGui * Gui);
CBaseMenu * m_Menu;
CBaseMenu * m_Menu;
HWND m_hMainWindow, m_hStatusWnd;
DWORD m_ThreadId;
HWND m_hMainWindow, m_hStatusWnd;
DWORD m_ThreadId;
const bool m_bMainWindow;
bool m_Created;
bool m_AttachingMenu;
bool m_MakingVisible;
bool m_ResetPlugins;
RESET_PLUGIN * m_ResetInfo;
const bool m_bMainWindow;
bool m_Created;
bool m_AttachingMenu;
bool m_MakingVisible;
bool m_ResetPlugins;
RESET_PLUGIN * m_ResetInfo;
CriticalSection m_CS;
CriticalSection m_CS;
bool m_SaveMainWindowPos;
LONG m_SaveMainWindowTop;
LONG m_SaveMainWindowLeft;
bool m_SaveRomBrowserPos;
LONG m_SaveRomBrowserTop;
LONG m_SaveRomBrowserLeft;
bool m_SaveMainWindowPos;
LONG m_SaveMainWindowTop;
LONG m_SaveMainWindowLeft;
bool m_SaveRomBrowserPos;
LONG m_SaveRomBrowserTop;
LONG m_SaveRomBrowserLeft;
};

View File

@ -214,10 +214,12 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
}
break;
case ID_SYSTEM_CHEAT:
{
g_BaseSystem->SelectCheats(hWnd);
}
break;
{
CCheatsUI * cheatUI = new CCheatsUI;
g_cheatUI = cheatUI;
cheatUI->SelectCheats(hWnd, false);
}
break;
case ID_SYSTEM_GSBUTTON:
g_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
break;