Huge refactor: Make Core a singleton

This commit is contained in:
irisz64
2025-07-29 11:08:05 +02:00
parent e0e887ce90
commit 3061334004
56 changed files with 426 additions and 594 deletions

View File

@@ -3,6 +3,7 @@
#include <execution>
bool Debugger::render() {
n64::Core& core = n64::Core::GetInstance();
if(enabled && ImGui::Begin("Debugger", &enabled)) {
static u64 startAddr = 0xFFFF'FFFF'8000'0000;
static constexpr int addrStep = 4;
@@ -13,7 +14,7 @@ bool Debugger::render() {
ImGui::SameLine();
ImGui::Checkbox("Follow program counter:", &followPC);
if(followPC)
startAddr = core->cpu->GetRegs().oldPC - 64; // TODO: arbitrary???
startAddr = core.cpu->GetRegs().oldPC - 64; // TODO: arbitrary???
if(ImGui::BeginTable("Disassembly", 3, ImGuiTableFlags_RowBg)) {
ImGui::TableSetupColumn("Address");
@@ -22,7 +23,7 @@ bool Debugger::render() {
ImGui::TableHeadersRow();
for(u64 addr = startAddr; addr < startAddr + MAX_LINES_OF_DISASM * sizeof(u32); addr += sizeof(u32)) {
auto disasm = core->cpu->Disassemble(addr);
auto disasm = core.cpu->Disassemble(addr);
std::string op_str;
for(int i = 0; i < 3; i++) {
if(i < 2) {
@@ -34,7 +35,7 @@ bool Debugger::render() {
if(!disasm.ops[i].empty()) op_str += disasm.ops[i];
}
}
auto isPc = addr == core->cpu->GetRegs().oldPC;
auto isPc = addr == core.cpu->GetRegs().oldPC;
if(isPc) {
ImGui::PushStyleColor(ImGuiCol_TableRowBg, 0x809a9ade);
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, 0x807777bf);