Add CheatEngine and support for Gateway cheats (#4406)

* Add CheatEngine; Add support for Gateway cheats; Add Cheat UI

* fix a potential crash on some systems

* fix substr with negative length

* Add Joker to the NonOp comp handling

* Fixup JokerOp

* minor fixup in patchop; add todo for nested loops

* Add comment for PadState member variable in HID

* fix: stol to stoul in parsing cheat file

* fix misplaced parsing of values; fix patchop code

* add missing break

* Make read_func and write_func a template parameter
This commit is contained in:
Ben 2018-11-17 02:01:10 +01:00 committed by James Rowe
parent 560df843b1
commit b90ff739a0
23 changed files with 1052 additions and 1 deletions

View file

@ -74,7 +74,6 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
if (is_device_reload_pending.exchange(false))
LoadInputDevices();
PadState state;
using namespace Settings::NativeButton;
state.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus());
state.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus());
@ -394,6 +393,10 @@ void Module::ReloadInputDevices() {
is_device_reload_pending.store(true);
}
const PadState& Module::GetState() const {
return state;
}
std::shared_ptr<Module> GetModule(Core::System& system) {
auto hid = system.ServiceManager().GetService<Service::HID::Module::Interface>("hid:USER");
if (!hid)

View file

@ -299,6 +299,8 @@ public:
void ReloadInputDevices();
const PadState& GetState() const;
private:
void LoadInputDevices();
void UpdatePadCallback(u64 userdata, s64 cycles_late);
@ -317,6 +319,10 @@ private:
Kernel::SharedPtr<Kernel::Event> event_gyroscope;
Kernel::SharedPtr<Kernel::Event> event_debug_pad;
// The HID module of a 3DS does not store the PadState.
// Storing this here was necessary for emulation specific tasks like cheats or scripting.
PadState state;
u32 next_pad_index = 0;
u32 next_touch_index = 0;
u32 next_accelerometer_index = 0;