#pragma once #include #include #include namespace n64 { struct Registers { Registers(); void Reset(); void SetPC64(s64); void SetPC32(s32); void SetJIT(JIT* jit) { this->jit = jit; } [[nodiscard]] bool IsRegConstant(const u32 index) const { if (index == 0) return true; return regIsConstant & (1 << index); } [[nodiscard]] bool IsRegConstant(const u32 first, const u32 second) const { return IsRegConstant(first) && IsRegConstant(second); } bool GetLOConstant() { return regIsConstant & (1ull << 32); } bool GetHIConstant() { return regIsConstant & (1ull << 33); } void SetLOConstant() { regIsConstant |= (1ull << 32); } void SetHIConstant() { regIsConstant |= (1ull << 33); } void UnsetLOConstant() { regIsConstant &= ~(1ull << 32); } void UnsetHIConstant() { regIsConstant &= ~(1ull << 33); } JIT *jit = nullptr; uint64_t regIsConstant = 0; Cop0 cop0; Cop1 cop1; s64 oldPC{}, pc{}, nextPC{}; s64 hi{}, lo{}; bool prevDelaySlot{}, delaySlot{}; u32 steps = 0; u32 extraCycles = 0; void CpuStall(u32 cycles) { extraCycles += cycles; } u32 PopStalledCycles() { u32 ret = extraCycles; extraCycles = 0; return ret; } template __attribute__((always_inline)) T Read(size_t); template __attribute__((always_inline)) void Read(size_t, Xbyak::Reg); template __attribute__((always_inline)) void Write(size_t, T); template __attribute__((always_inline)) void Write(size_t, Xbyak::Reg); std::array gpr{}; }; } // namespace n64