Reset system overhaul
This commit is contained in:
@@ -20,7 +20,6 @@ void Core::Stop() {
|
|||||||
void Core::LoadROM(const std::string& rom_) {
|
void Core::LoadROM(const std::string& rom_) {
|
||||||
rom = rom_;
|
rom = rom_;
|
||||||
cpu.Reset();
|
cpu.Reset();
|
||||||
cpu.mem.Reset();
|
|
||||||
pause = false;
|
pause = false;
|
||||||
romLoaded = true;
|
romLoaded = true;
|
||||||
|
|
||||||
@@ -29,9 +28,8 @@ void Core::LoadROM(const std::string& rom_) {
|
|||||||
cpu.mem.mmio.si.pif.InitDevices(cpu.mem.saveType);
|
cpu.mem.mmio.si.pif.InitDevices(cpu.mem.saveType);
|
||||||
cpu.mem.mmio.si.pif.LoadMempak(rom_);
|
cpu.mem.mmio.si.pif.LoadMempak(rom_);
|
||||||
cpu.mem.mmio.si.pif.LoadEeprom(cpu.mem.saveType, rom_);
|
cpu.mem.mmio.si.pif.LoadEeprom(cpu.mem.saveType, rom_);
|
||||||
isPAL = cpu.mem.IsROMPAL();
|
|
||||||
cpu.mem.mmio.vi.isPal = isPAL;
|
|
||||||
cpu.mem.mmio.si.pif.ExecutePIF(cpu.mem, cpu.regs);
|
cpu.mem.mmio.si.pif.ExecutePIF(cpu.mem, cpu.regs);
|
||||||
|
cpu.mem.mmio.vi.isPal = cpu.mem.IsROMPAL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Run(float volumeL, float volumeR) {
|
void Core::Run(float volumeL, float volumeR) {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ struct Core {
|
|||||||
|
|
||||||
bool pause = true;
|
bool pause = true;
|
||||||
int cycles = 0;
|
int cycles = 0;
|
||||||
bool isPAL = false;
|
|
||||||
bool romLoaded = false;
|
bool romLoaded = false;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
std::string rom;
|
std::string rom;
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
namespace n64 {
|
namespace n64 {
|
||||||
void Interpreter::Reset() {
|
void Interpreter::Reset() {
|
||||||
regs.Reset();
|
regs.Reset();
|
||||||
|
mem.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,6 @@
|
|||||||
#include <core/registers/Registers.hpp>
|
#include <core/registers/Registers.hpp>
|
||||||
|
|
||||||
namespace n64 {
|
namespace n64 {
|
||||||
MMIO::MMIO () {
|
|
||||||
Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MMIO::Reset() {
|
void MMIO::Reset() {
|
||||||
rsp.Reset();
|
rsp.Reset();
|
||||||
rdp.Reset();
|
rdp.Reset();
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ struct Mem;
|
|||||||
struct Registers;
|
struct Registers;
|
||||||
|
|
||||||
struct MMIO {
|
struct MMIO {
|
||||||
MMIO();
|
MMIO() = default;
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
VI vi;
|
VI vi;
|
||||||
MI mi;
|
MI mi;
|
||||||
AI ai;
|
AI ai;
|
||||||
|
|||||||
@@ -7,12 +7,6 @@
|
|||||||
|
|
||||||
namespace n64 {
|
namespace n64 {
|
||||||
Mem::Mem() {
|
Mem::Mem() {
|
||||||
rom.cart = (u8*)calloc(CART_SIZE, 1);
|
|
||||||
sram = (u8*)calloc(SRAM_SIZE, 1);
|
|
||||||
Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mem::Reset() {
|
|
||||||
memset(readPages, 0, PAGE_COUNT);
|
memset(readPages, 0, PAGE_COUNT);
|
||||||
memset(writePages, 0, PAGE_COUNT);
|
memset(writePages, 0, PAGE_COUNT);
|
||||||
|
|
||||||
@@ -23,6 +17,11 @@ void Mem::Reset() {
|
|||||||
writePages[i] = pointer;
|
writePages[i] = pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rom.cart = (u8*)calloc(CART_SIZE, 1);
|
||||||
|
sram = (u8*)calloc(SRAM_SIZE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mem::Reset() {
|
||||||
memset(rom.cart, 0, CART_SIZE);
|
memset(rom.cart, 0, CART_SIZE);
|
||||||
memset(sram, 0, SRAM_SIZE);
|
memset(sram, 0, SRAM_SIZE);
|
||||||
mmio.Reset();
|
mmio.Reset();
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
namespace n64 {
|
namespace n64 {
|
||||||
RDP::RDP() {
|
RDP::RDP() {
|
||||||
rdram = (u8*)calloc(RDRAM_SIZE, 1);
|
rdram = (u8*)calloc(RDRAM_SIZE, 1);
|
||||||
Reset();
|
memset(cmd_buf, 0, 0x100000);
|
||||||
|
dpc.status.raw = 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP::Reset() {
|
void RDP::Reset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user