2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
2015-11-10 05:21:49 +00:00
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
2012-12-19 09:30:18 +00:00
|
|
|
* 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
|
2015-12-06 09:59:58 +00:00
|
|
|
#include "N64RomClass.h"
|
2015-12-21 07:35:22 +00:00
|
|
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
2015-12-06 09:59:58 +00:00
|
|
|
#include <Project64-core/Plugins/PluginClass.h>
|
2012-12-19 09:30:18 +00:00
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
class CCheats
|
2015-02-26 10:57:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-06-30 11:11:56 +00:00
|
|
|
CCheats(CMipsMemoryVM & MMU);
|
2015-11-07 03:32:23 +00:00
|
|
|
~CCheats(void);
|
2015-02-26 10:57:51 +00:00
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MaxCheats = 50000,
|
|
|
|
MaxGSEntries = 100,
|
|
|
|
};
|
2015-02-26 10:57:51 +00:00
|
|
|
|
2017-06-30 11:11:56 +00:00
|
|
|
void ApplyCheats();
|
|
|
|
void ApplyGSButton();
|
2015-11-07 03:32:23 +00:00
|
|
|
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
static bool IsValid16BitCode(const char * CheatString);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
private:
|
|
|
|
struct GAMESHARK_CODE
|
|
|
|
{
|
|
|
|
uint32_t Command;
|
|
|
|
uint16_t Value;
|
|
|
|
};
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2017-06-30 11:11:56 +00:00
|
|
|
struct MEM_VALUE16
|
|
|
|
{
|
|
|
|
uint16_t Original;
|
|
|
|
uint16_t Changed;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MEM_VALUE8
|
|
|
|
{
|
|
|
|
uint8_t Original;
|
|
|
|
uint8_t Changed;
|
|
|
|
};
|
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
typedef std::vector<GAMESHARK_CODE> CODES;
|
2017-06-30 11:11:56 +00:00
|
|
|
typedef std::vector<CODES> CODES_ARRAY;
|
|
|
|
typedef std::map<uint32_t, MEM_VALUE16> ORIGINAL_VALUES16;
|
|
|
|
typedef std::map<uint32_t, MEM_VALUE8> ORIGINAL_VALUES8;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-07 03:32:23 +00:00
|
|
|
void LoadPermCheats(CPlugins * Plugins);
|
2017-06-30 11:11:56 +00:00
|
|
|
int32_t EntrySize(const CODES & CodeEntry, int32_t CurrentEntry);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2017-06-30 11:11:56 +00:00
|
|
|
CMipsMemoryVM & m_MMU;
|
|
|
|
CODES_ARRAY m_Codes;
|
|
|
|
ORIGINAL_VALUES16 m_OriginalValues16;
|
|
|
|
ORIGINAL_VALUES8 m_OriginalValues8;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2017-06-30 11:11:56 +00:00
|
|
|
bool LoadCode(const stdstr & CheatEntry, SettingID ExtensionSetting, int ExtensionIndex);
|
|
|
|
void ApplyCheatEntry(CODES & CodeEntry, int32_t CurrentEntry);
|
|
|
|
void ModifyMemory8(uint32_t Address, uint8_t Value);
|
|
|
|
void ModifyMemory16(uint32_t Address, uint16_t Value);
|
|
|
|
void ResetCodes(void);
|
2015-01-31 19:27:27 +00:00
|
|
|
};
|