From 96570647404804ac1128c3a8686a2ffe67967032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Mon, 19 Aug 2019 03:37:47 +0530 Subject: [PATCH] Fix 32-bit register reading/writing Co-Authored-By: Ryan Teal --- app/src/main/cpp/switch/hw/cpu.cpp | 4 ++-- app/src/main/cpp/switch/hw/cpu.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/switch/hw/cpu.cpp b/app/src/main/cpp/switch/hw/cpu.cpp index a794c3c4..70cf6e60 100644 --- a/app/src/main/cpp/switch/hw/cpu.cpp +++ b/app/src/main/cpp/switch/hw/cpu.cpp @@ -107,10 +107,10 @@ namespace lightSwitch::hw { } uint64_t Cpu::GetRegister(wreg reg_id) { - return (reinterpret_cast(regs.regs))[wreg_lut[reg_id]]; + return (reinterpret_cast(®s.regs))[wreg_lut[reg_id]]; } void Cpu::SetRegister(wreg reg_id, uint32_t value) { - (reinterpret_cast(regs.regs))[wreg_lut[reg_id]] = value; + (reinterpret_cast(®s.regs))[wreg_lut[reg_id]] = value; } } \ No newline at end of file diff --git a/app/src/main/cpp/switch/hw/cpu.h b/app/src/main/cpp/switch/hw/cpu.h index ba7f17b5..ef300c52 100644 --- a/app/src/main/cpp/switch/hw/cpu.h +++ b/app/src/main/cpp/switch/hw/cpu.h @@ -34,7 +34,7 @@ namespace lightSwitch::hw { void WriteBreakpoint(uint64_t address, uint64_t size); - uint8_t wreg_lut[31] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61}; + uint8_t wreg_lut[31] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60}; public: ~Cpu();