Huge refactor: Make Core a singleton
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user