This commit is contained in:
wheremyfoodat 2023-10-24 22:10:40 +03:00 committed by offtkp
parent 8502cd9285
commit f922870785
3 changed files with 13 additions and 16 deletions

View file

@ -12,9 +12,8 @@ class Memory;
class Cheats { class Cheats {
public: public:
enum class CheatType { enum class CheatType {
None, None, // Cheat has been removed by the frontend or is invalid
ActionReplay, // CTRPF cheats ActionReplay, // CTRPF cheats
// TODO: Other cheat devices and standards?
}; };
struct Cheat { struct Cheat {

View file

@ -144,9 +144,7 @@ u32 HydraCore::addCheat(const u8* data, u32 size) {
cheat.type = Cheats::CheatType::ActionReplay; cheat.type = Cheats::CheatType::ActionReplay;
for (u32 i = 0; i < size; i += 8) { for (u32 i = 0; i < size; i += 8) {
auto read32 = [](const u8* ptr) { auto read32 = [](const u8* ptr) { return (u32(ptr[3]) << 24) | (u32(ptr[2]) << 16) | (u32(ptr[1]) << 8) | u32(ptr[0]); };
return (u32(ptr[3]) << 24) | (u32(ptr[2]) << 16) | (u32(ptr[1]) << 8) | u32(ptr[0]);
};
// Data is passed to us in big endian so we bswap // Data is passed to us in big endian so we bswap
u32 firstWord = Common::swap32(read32(data + i)); u32 firstWord = Common::swap32(read32(data + i));