Huge refactor: Make Core a singleton
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <Core.hpp>
|
||||
|
||||
namespace n64 {
|
||||
Interpreter::Interpreter(ParallelRDP ¶llel) : mem(regs, parallel) {}
|
||||
Interpreter::Interpreter(ParallelRDP ¶llel) {}
|
||||
|
||||
bool Interpreter::ShouldServiceInterrupt() const {
|
||||
const bool interrupts_pending = (regs.cop0.status.im & regs.cop0.cause.interruptPending) != 0;
|
||||
@@ -26,7 +26,7 @@ Disassembler::DisassemblyResult Interpreter::Disassemble(const u32 address) {
|
||||
if (!regs.cop0.MapVAddr(Cop0::LOAD, address, paddr)) {
|
||||
return {};
|
||||
}
|
||||
return Disassembler::GetInstance().Disassemble(address, mem.Read<u32>(regs, paddr));
|
||||
return Disassembler::GetInstance().Disassemble(address, mem.Read<u32>(paddr));
|
||||
}
|
||||
|
||||
int Interpreter::Step() {
|
||||
@@ -48,7 +48,7 @@ int Interpreter::Step() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const u32 instruction = mem.Read<u32>(regs, paddr);
|
||||
const u32 instruction = mem.Read<u32>(paddr);
|
||||
|
||||
if (ShouldServiceInterrupt()) {
|
||||
regs.cop0.FireException(ExceptionCode::Interrupt, 0, regs.pc);
|
||||
@@ -63,16 +63,4 @@ int Interpreter::Step() {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<u8> Interpreter::Serialize() {
|
||||
std::vector<u8> res{};
|
||||
|
||||
res.resize(sizeof(Registers));
|
||||
|
||||
memcpy(res.data(), ®s, sizeof(Registers));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void Interpreter::Deserialize(const std::vector<u8> &data) { memcpy(®s, data.data(), sizeof(Registers)); }
|
||||
} // namespace n64
|
||||
|
||||
Reference in New Issue
Block a user