Add cheat documentation, enable input repeat for L and R, show cheat category name

This commit is contained in:
Gericom
2026-03-08 13:03:26 +01:00
parent 43b1bf7afa
commit 6c34d9324d
22 changed files with 189 additions and 67 deletions

View File

@@ -1,27 +1,48 @@
#pragma once
#include "CheatTreeItem.h"
class Cheat : public CheatTreeItem
/// @brief Class representing a single cheat.
class Cheat
{
public:
Cheat()
: _cheatData(nullptr), _cheatDataLength(0) { }
Cheat() { }
Cheat(const char* name, const char* description, u32* flagsPointer, const void* cheatData, u32 cheatDataLength)
: CheatTreeItem(name, description), _flagsPointer(flagsPointer)
: _name(name), _description(description), _flagsPointer(flagsPointer)
, _cheatData(cheatData), _cheatDataLength(cheatDataLength) { }
/// @brief Gets the name of this cheat.
/// @return A pointer to the name of this cheat.
const char* GetName() const
{
return _name;
}
/// @brief Gets the description of this cheat.
/// @return A pointer to the description of this cheat.
const char* GetDescription() const
{
return _description;
}
/// @brief Gets a pointer to the data of this cheat.
/// @param cheatDataLength The length of the cheat data is returned in this reference.
/// @return A pointer to the cheat data.
/// This pointer is only valid for the lifetime of the \see GameCheats instance this cheat belongs to.
const void* GetCheatData(u32& cheatDataLength) const
{
cheatDataLength = _cheatDataLength;
return _cheatData;
}
/// @brief Gets whether this cheat is active (enabled) or not.
/// @return \c true when this cheat is active, or \c false when not active.
bool GetIsCheatActive() const
{
return ((*_flagsPointer >> 24) & 1) == 1;
}
/// @brief Sets whether this cheat is active (enabled) or not.
/// @param isCheatActive \c true to enable this cheat, or \c false to disable this cheat.
void SetIsCheatActive(bool isCheatActive) const
{
u32 flags = *_flagsPointer;
@@ -34,7 +55,9 @@ public:
}
private:
u32* _flagsPointer;
const void* _cheatData;
u32 _cheatDataLength;
const char* _name = nullptr;
const char* _description = nullptr;
u32* _flagsPointer = nullptr;
const void* _cheatData = nullptr;
u32 _cheatDataLength = 0;
};