Refactor so parallel-rdp is in charge of polling inputs and not the EmuThread

This commit is contained in:
SimoneN64
2024-09-25 22:09:44 +02:00
parent 56b9d69861
commit 2744de8d3e
14 changed files with 174 additions and 151 deletions

View File

@@ -3,7 +3,7 @@
#include <Scheduler.hpp>
namespace n64 {
Core::Core(ParallelRDP &parallel) : cpu(std::make_unique<Interpreter>(parallel)) {}
Core::Core() : cpu(std::make_unique<Interpreter>(parallel)) {}
void Core::Stop() {
render = false;
@@ -106,15 +106,15 @@ void Core::Serialize() {
}
void Core::Deserialize() {
std::vector<u8> dVER(serialized[slot].begin(), serialized[slot].begin() + verSize);
std::vector dVER(serialized[slot].begin(), serialized[slot].begin() + verSize);
if (dVER[0] != (KAIZEN_VERSION >> 8) || dVER[1] != (KAIZEN_VERSION >> 4) || dVER[2] != (KAIZEN_VERSION & 0xFF)) {
Util::panic("PROBLEMI!");
}
cpu->GetMem().Deserialize(
std::vector<u8>(serialized[slot].begin() + verSize, serialized[slot].begin() + verSize + memSize));
cpu->Deserialize(std::vector<u8>(serialized[slot].begin() + verSize + memSize,
serialized[slot].begin() + verSize + memSize + cpuSize));
std::vector(serialized[slot].begin() + verSize, serialized[slot].begin() + verSize + memSize));
cpu->Deserialize(
std::vector(serialized[slot].begin() + verSize + memSize, serialized[slot].begin() + verSize + memSize + cpuSize));
serialized[slot].erase(serialized[slot].begin(), serialized[slot].end());
}
} // namespace n64

View File

@@ -1,14 +1,12 @@
#pragma once
#include <ParallelRDPWrapper.hpp>
#include <backend/core/Interpreter.hpp>
#include <backend/core/JIT.hpp>
#include <string>
struct Window;
struct Event;
namespace n64 {
struct Core {
explicit Core(ParallelRDP &);
explicit Core();
void Stop();
void LoadROM(const std::string &);
[[nodiscard]] bool LoadTAS(const fs::path &) const;
@@ -29,5 +27,6 @@ struct Core {
std::vector<u8> serialized[10]{};
size_t memSize{}, cpuSize{}, verSize{};
int slot = 0;
ParallelRDP parallel;
};
} // namespace n64

View File

@@ -2,7 +2,6 @@
#include <capstone/capstone.h>
#include <utils/log.hpp>
#include <utils/MemoryHelpers.hpp>
#include <portable_endian_bswap.h>
#include <array>
struct Disassembler {
@@ -19,7 +18,7 @@ struct Disassembler {
return ret;
}
DisassemblyResult Disassemble(u32 address, u32 instruction) {
DisassemblyResult Disassemble(const u32 address, const u32 instruction) {
return details ? DisassembleDetailed(address, instruction) : DisassembleSimple(address, instruction);
}
@@ -29,7 +28,7 @@ private:
DisassemblyResult DisassembleDetailed(u32 address, u32 instruction);
DisassemblyResult DisassembleSimple(u32 address, u32 instruction);
Disassembler(bool rsp) : rsp(rsp) {
explicit Disassembler(const bool rsp) : rsp(rsp) {
if (cs_open(CS_ARCH_MIPS, static_cast<cs_mode>((rsp ? CS_MODE_32 : CS_MODE_64) | CS_MODE_BIG_ENDIAN), &handle) !=
CS_ERR_OK) {
Util::panic("Could not initialize {} disassembler!", rsp ? "RSP" : "CPU");
@@ -43,5 +42,5 @@ private:
bool rsp = false;
bool details = true;
csh handle;
csh handle{};
};

View File

@@ -2,6 +2,7 @@
#include <core/RSP.hpp>
#include <log.hpp>
#include <parallel-rdp/ParallelRDPWrapper.hpp>
#include <core/Mem.hpp>
namespace n64 {
RDP::RDP(Mem &mem, ParallelRDP &parallel) : mem(mem), parallel(parallel) {