fix crash on Windows + small performace improvement BUT breaks Donkey
Kong
This commit is contained in:
@@ -6,6 +6,9 @@ struct BaseCPU {
|
||||
virtual ~BaseCPU() {}
|
||||
virtual void Reset() {}
|
||||
virtual int Run() {}
|
||||
void RunRSP(int cpuCount) {
|
||||
mem.mmio.rsp.Run(cpuCount, regs, mem);
|
||||
}
|
||||
Registers regs;
|
||||
Mem mem;
|
||||
};
|
||||
|
||||
@@ -26,8 +26,8 @@ void Interpreter::Reset() {
|
||||
}
|
||||
|
||||
int Interpreter::Run() {
|
||||
int cycles = 0;
|
||||
for(; cycles <= mem.mmio.vi.cyclesPerHalfline; cycles++) {
|
||||
int cycles = 1;
|
||||
for(; cycles < mem.mmio.vi.cyclesPerHalfline; cycles++) {
|
||||
CheckCompareInterrupt(mem.mmio.mi, regs);
|
||||
|
||||
regs.prevDelaySlot = regs.delaySlot;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
namespace n64 {
|
||||
Mem::Mem() {
|
||||
cart = (u8*)calloc(CART_SIZE, 1);
|
||||
sram = (u8*)calloc(SRAM_SIZE, 1);
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -22,16 +24,8 @@ void Mem::Reset() {
|
||||
writePages[i] = pointer;
|
||||
}
|
||||
|
||||
if(sram) {
|
||||
free(sram);
|
||||
}
|
||||
|
||||
if(cart) {
|
||||
free(cart);
|
||||
}
|
||||
|
||||
cart = (u8*)calloc(CART_SIZE, 1);
|
||||
sram = (u8*)calloc(SRAM_SIZE, 1);
|
||||
memset(cart, 0, CART_SIZE);
|
||||
memset(sram, 0, SRAM_SIZE);
|
||||
mmio.Reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,13 @@
|
||||
|
||||
namespace n64 {
|
||||
RDP::RDP() {
|
||||
rdram = (u8*)calloc(RDRAM_SIZE, 1);
|
||||
Reset();
|
||||
}
|
||||
|
||||
void RDP::Reset() {
|
||||
dpc.status.raw = 0x80;
|
||||
if(rdram) {
|
||||
free(rdram);
|
||||
}
|
||||
rdram = (u8*)calloc(RDRAM_SIZE, 1);
|
||||
memset(rdram, 0, RDRAM_SIZE);
|
||||
memset(cmd_buf, 0, 0x100000);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ struct RDP {
|
||||
RDP();
|
||||
void Reset();
|
||||
|
||||
u8* rdram;
|
||||
u8* rdram = nullptr;
|
||||
[[nodiscard]] auto Read(u32 addr) const -> u32;
|
||||
void Write(MI& mi, Registers& regs, RSP& rsp, u32 addr, u32 val);
|
||||
void WriteStatus(MI& mi, Registers& regs, RSP& rsp, u32 val);
|
||||
|
||||
Reference in New Issue
Block a user