Emulator cleanup, add AR conditionals

This commit is contained in:
wheremyfoodat 2023-07-21 00:55:08 +03:00
parent 08596c1a24
commit d007b2d780
5 changed files with 79 additions and 62 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include <array>
#include <bitset>
#include <vector>
#include "helpers.hpp"
@ -7,6 +8,7 @@
class ActionReplay {
using Cheat = std::vector<u32>; // A cheat is really just a bunch of 64-bit opcodes neatly encoded into 32-bit chunks
static constexpr size_t ifStackSize = 32; // TODO: How big is this, really?
u32 offset1, offset2; // Memory offset registers. Non-persistent.
u32 data1, data2; // Data offset registers. Non-persistent.
@ -15,7 +17,10 @@ class ActionReplay {
// When an instruction does not specify which offset or data register to use, we use the "active" one
// Which is by default #1 and may be changed by certain AR operations
u32 *activeOffset, *activeData, *activeStorage;
u32 ifStackIndex; // Our index in the if stack. Shows how many entries we have at the moment.
u32 loopStackIndex; // Same but for loops
std::bitset<32> ifStack;
// Program counter
u32 pc = 0;
Memory& mem;

View file

@ -91,6 +91,7 @@ class HIDService {
void pressKey(u32 mask) { newButtons |= mask; }
void releaseKey(u32 mask) { newButtons &= ~mask; }
u32 getOldButtons() { return oldButtons; }
s16 getCirclepadX() { return circlePadX; }
s16 getCirclepadY() { return circlePadY; }

View file

@ -90,17 +90,5 @@ class ServiceManager {
void signalDSPEvents() { dsp.signalEvents(); }
// Input function wrappers
void pressKey(u32 key) { hid.pressKey(key); }
void releaseKey(u32 key) { hid.releaseKey(key); }
s16 getCirclepadX() { return hid.getCirclepadX(); }
s16 getCirclepadY() { return hid.getCirclepadY(); }
void setCirclepadX(s16 x) { hid.setCirclepadX(x); }
void setCirclepadY(s16 y) { hid.setCirclepadY(y); }
void updateInputs(u64 currentTimestamp) { hid.updateInputs(currentTimestamp); }
void setTouchScreenPress(u16 x, u16 y) { hid.setTouchScreenPress(x, y); }
void releaseTouchScreen() { hid.releaseTouchScreen(); }
void setRoll(s16 roll) { hid.setRoll(roll); }
void setPitch(s16 pitch) { hid.setPitch(pitch); }
void setYaw(s16 yaw) { hid.setYaw(yaw); }
HIDService& getHID() { return hid; }
};