overhaul cleanups

This commit is contained in:
scawful
2024-04-22 15:58:39 -04:00
parent b4556b56f0
commit 1a4563f9e7
8 changed files with 57 additions and 71 deletions

View File

@@ -473,6 +473,7 @@ class Rom : public core::ExperimentFlags {
auto filename() const { return filename_; }
auto is_loaded() const { return is_loaded_; }
auto version() const { return version_; }
auto renderer() const { return renderer_; }
uint8_t& operator[](int i) {
if (i > size_) {

View File

@@ -106,7 +106,6 @@ void DungeonObjectRenderer::RenderObject(const SubtypeInfo& info) {
while (true) {
uint8_t opcode = cpu.ReadByte(cpu.PB << 16 | cpu.PC);
cpu.ExecuteInstruction(opcode);
cpu.HandleInterrupts();
if ((i != 0 &&
(cpu.ReadWord((0x00 << 16 | cpu.SP() + 2)) == info.routine_ptr) ||

View File

@@ -48,7 +48,8 @@ class DungeonObjectRenderer : public SharedRom {
std::vector<uint8_t> rom_data_;
emu::memory::MemoryImpl memory_;
emu::ClockImpl clock_;
emu::Cpu cpu{memory_, clock_};
emu::memory::CpuCallbacks cpu_callbacks_;
emu::Cpu cpu{memory_, clock_, cpu_callbacks_};
emu::video::Ppu ppu{memory_, clock_};
gfx::Bitmap bitmap_;
PseudoVram vram_;

View File

@@ -316,38 +316,6 @@ class Emulator : public CommandHandler {
std::string filename = arg_vec[0];
RETURN_IF_ERROR(rom_.LoadFromFile(filename))
bool step = false;
if (arg_vec[1].empty()) {
snes.SetCpuMode(0);
} else {
snes.SetCpuMode(1);
step = true;
}
snes.Init(rom_);
if (!step) {
int i = 0;
while (i < 80000) {
snes.Run();
i++;
}
} else {
// This loop should take in input from the keyboard, such as pressing
// space to step through the loop and pressing x to end the execution.
bool stepping = true;
std::cout << "Press space to step, x to exit" << std::endl;
while (stepping) {
char input;
std::cin.get(input);
if (input == 'x') {
break;
} else {
snes.StepRun();
}
}
}
return absl::OkStatus();
}