wavelength 1.0.0
Loading...
Searching...
No Matches
CheatsManager Class Reference

Listener of the controllers that recognises the cheat sequences of the long-cheats section. More...

#include <cheatsmanager.h>

Inheritance diagram for CheatsManager:
Collaboration diagram for CheatsManager:

Classes

struct  LongCheat
 A sequence of presses that runs a script command. More...
struct  ComboCheat
 A press made while a combination is held that runs a script command. More...

Public Types

enum  Combo { kComboLeft = 0 , kComboRight = 1 , kComboCount = 2 }
 Combinations that select a table of mComboCheats. More...

Public Member Functions

 ~CheatsManager () override=default
 Destroy the object.
 CheatsManager ()
 Construct a manager with no cheat.
void RunAction (DataArray *pAction, int nPad)
 Run a cheat's script command, first storing the controller in its controller entry.
bool HandleButton (JoypadInputMsg *pMsg)
 Add a press to the history and run every cheat it completes.
bool DispatchPriv (Message *pMsg) override
 Handle controller button messages.
 CheatsManager ()
 Create a manager with no cheats.
virtual ~CheatsManager ()
 Destroy the cheats.
virtual bool DispatchPriv (Message *msg)
 Handle a button message.
void ExecuteCheat (DataArray *command, int pad)
 Run a cheat's command, first setting its controller entry to the controller.
bool OnButtonDown (JoypadButtonMsg *msg)
 Run the cheats a button change completes.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the pool heaps under the tag "MsgSink".
void operator delete (void *pBlock)
 Return a sink to the pool heaps.
virtual ~MsgSink ()
virtual bool Dispatch (Message *pMsg)
 Accept a message.
void * operator new (size_t size)
 Allocate from the main heap under the name MsgSink.
void operator delete (void *mem)
 Return memory to its heap.
virtual ~MsgSink ()
 Destroy the sink.
virtual bool Dispatch (Message *msg)
 Handle a message.

Static Public Member Functions

static int IsCheatEntered ()
 Report whether a cheat that marks the game was entered.
static void Init ()
 Create the one instance, listen to the controllers, load the long-cheats section, and register the test script command.
static void Terminate ()
 Stop listening to the controllers and delete the one instance.

Public Attributes

std::vector< QuickCheat > mQuickCheats [2]
std::deque< int > mButtons
float mLastTime
bool mFlags

Static Public Attributes

static constexpr int kMaxHistory = 16
 Presses mHistory retains.
static constexpr int kMaxCheatButtons = 16
 Buttons one long cheat may have.

Detailed Description

Listener of the controllers that recognises the cheat sequences of the long-cheats section.

Runs script commands entered on a controller.

The RTTI records the class as deriving from MsgSink. The object is 0x6c bytes and its vtable is at 0x003d6e48. Init() creates the one instance.

The RTTI records the class as deriving from MsgSink. The object is 0x58 bytes. A quick cheat runs when its button is pressed while the left or right modifier combination is held. A long cheat runs when the last buttons pressed, each within 750 milliseconds of the one before, match its sequence.

Member Enumeration Documentation

◆ Combo

Combinations that select a table of mComboCheats.

Enumerator
kComboLeft 

L1, L2, and L3 held.

kComboRight 

R1, R2, and R3 held.

kComboCount 

Entries of mComboCheats.

Constructor & Destructor Documentation

◆ ~CheatsManager() [1/2]

CheatsManager::~CheatsManager ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x003a9268
Ghidra address:
PAL: 0x00418028

◆ CheatsManager() [1/2]

CheatsManager::CheatsManager ( )

Construct a manager with no cheat.

Ghidra address:
NTSC-U/C: 0x00294678
Ghidra address:
PAL: 0x0029e2a0

◆ CheatsManager() [2/2]

CheatsManager::CheatsManager ( )

Create a manager with no cheats.

Ghidra address:
0x10013580

◆ ~CheatsManager() [2/2]

virtual CheatsManager::~CheatsManager ( )
virtual

Destroy the cheats.

Their commands are not released.

Ghidra address:
0x10013690

Member Function Documentation

◆ RunAction()

void CheatsManager::RunAction ( DataArray * pAction,
int nPad )

Run a cheat's script command, first storing the controller in its controller entry.

Parameters
pActionThe command.
nPadThe controller that entered the cheat.
Ghidra address:
NTSC-U/C: 0x00294728
Ghidra address:
PAL: 0x0029e350

◆ HandleButton()

bool CheatsManager::HandleButton ( JoypadInputMsg * pMsg)

Add a press to the history and run every cheat it completes.

A press more than 750 milliseconds after the previous one starts a new history. A long cheat matches when its presses open the history, and the history is then cleared.

Parameters
pMsgThe press or release.
Returns
Always true.
Ghidra address:
NTSC-U/C: 0x00294788
Ghidra address:
PAL: 0x0029e3b0

◆ DispatchPriv() [1/2]

bool CheatsManager::DispatchPriv ( Message * pMsg)
overridevirtual

Handle controller button messages.

Parameters
pMsgThe message.
Returns
HandleButton() for a JoypadInputMsg, otherwise false.
Ghidra address:
NTSC-U/C: 0x00294c20
Ghidra address:
PAL: 0x0029e848

Implements MsgSink.

◆ IsCheatEntered()

int CheatsManager::IsCheatEntered ( )
static

Report whether a cheat that marks the game was entered.

Returns
mCheatEntered of the one instance.
Ghidra address:
NTSC-U/C: 0x00295178
Ghidra address:
PAL: 0x0029eda0

◆ Init()

void CheatsManager::Init ( )
static

Create the one instance, listen to the controllers, load the long-cheats section, and register the test script command.

Ghidra address:
NTSC-U/C: 0x00295188
Ghidra address:
PAL: 0x0029edb0

◆ Terminate()

void CheatsManager::Terminate ( )
static

Stop listening to the controllers and delete the one instance.

Ghidra address:
NTSC-U/C: 0x00295210
Ghidra address:
PAL: 0x0029ee38

◆ DispatchPriv() [2/2]

virtual bool CheatsManager::DispatchPriv ( Message * msg)
virtual

Handle a button message.

Parameters
msgThe message.
Returns
Whether the message was a button change.
Ghidra address:
0x10013b80

Implements MsgSink.

◆ ExecuteCheat()

void CheatsManager::ExecuteCheat ( DataArray * command,
int pad )

Run a cheat's command, first setting its controller entry to the controller.

Parameters
commandThe command.
padThe controller.
Ghidra address:
0x100137f0

◆ OnButtonDown()

bool CheatsManager::OnButtonDown ( JoypadButtonMsg * msg)

Run the cheats a button change completes.

Parameters
msgThe button change.
Returns
True.
Ghidra address:
0x10013830

Member Data Documentation

◆ kMaxHistory

int CheatsManager::kMaxHistory = 16
staticconstexpr

Presses mHistory retains.

◆ kMaxCheatButtons

int CheatsManager::kMaxCheatButtons = 16
staticconstexpr

Buttons one long cheat may have.

◆ mQuickCheats

std::vector<QuickCheat> CheatsManager::mQuickCheats[2]

The quick cheats of the left and right modifiers.

◆ mButtons

std::deque<int> CheatsManager::mButtons

The last buttons pressed, oldest first.

◆ mLastTime

float CheatsManager::mLastTime

When the last button was pressed, in ms.

◆ mFlags

bool CheatsManager::mFlags

The flags of the long cheats that ran.


The documentation for this class was generated from the following files: