Change callbacks from using this to & for lambda
This commit is contained in:
@@ -97,7 +97,7 @@ class Apu {
|
||||
Timer timer[3];
|
||||
uint32_t cycles_;
|
||||
uint8_t dspAdr;
|
||||
bool romReadable = true;
|
||||
bool romReadable = false;
|
||||
|
||||
// Member variables to store internal APU state and resources
|
||||
AudioRam &aram_;
|
||||
@@ -105,9 +105,9 @@ class Apu {
|
||||
MemoryImpl &memory_;
|
||||
|
||||
ApuCallbacks callbacks_ = {
|
||||
[this](uint16_t adr, uint8_t val) { SpcWrite(adr, val); },
|
||||
[this](uint16_t adr) { return SpcRead(adr); },
|
||||
[this](bool waiting) { SpcIdle(waiting); },
|
||||
[&](uint16_t adr, uint8_t val) { SpcWrite(adr, val); },
|
||||
[&](uint16_t adr) { return SpcRead(adr); },
|
||||
[&](bool waiting) { SpcIdle(waiting); },
|
||||
};
|
||||
Dsp dsp_{aram_};
|
||||
Spc700 spc700_{aram_, callbacks_};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "app/emu/snes.h"
|
||||
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -40,7 +38,7 @@ void SNES::Init(Rom& rom) {
|
||||
Reset(true);
|
||||
|
||||
// Disable the emulation flag (switch to 65816 native mode)
|
||||
cpu_.E = 0;
|
||||
// cpu_.E = 0;
|
||||
// cpu_.PB = 0x00;
|
||||
// cpu_.PC = 0x8000;
|
||||
|
||||
@@ -85,6 +83,7 @@ void SNES::Reset(bool hard) {
|
||||
cpu_.Reset(hard);
|
||||
apu_.Reset();
|
||||
ppu_.Reset();
|
||||
memory::dma::Reset(&memory_);
|
||||
input1.latchLine = false;
|
||||
input2.latchLine = false;
|
||||
input1.latchedState = 0;
|
||||
|
||||
@@ -67,8 +67,8 @@ class SNES {
|
||||
void SetPixels(uint8_t* pixel_data);
|
||||
|
||||
bool running() const { return running_; }
|
||||
auto cpu() -> Cpu& { return cpu_; }
|
||||
auto ppu() -> video::Ppu& { return ppu_; }
|
||||
auto cpu() -> Cpu* { return &cpu_; }
|
||||
auto ppu() -> video::Ppu* { return &ppu_; }
|
||||
auto Memory() -> memory::MemoryImpl* { return &memory_; }
|
||||
|
||||
private:
|
||||
@@ -80,9 +80,9 @@ class SNES {
|
||||
audio::AudioRamImpl audio_ram_;
|
||||
|
||||
memory::CpuCallbacks cpu_callbacks_ = {
|
||||
[this](uint32_t adr) { return CpuRead(adr); },
|
||||
[this](uint32_t adr, uint8_t val) { CpuWrite(adr, val); },
|
||||
[this](bool waiting) { CpuIdle(waiting); },
|
||||
[&](uint32_t adr) { return CpuRead(adr); },
|
||||
[&](uint32_t adr, uint8_t val) { CpuWrite(adr, val); },
|
||||
[&](bool waiting) { CpuIdle(waiting); },
|
||||
};
|
||||
Cpu cpu_{memory_, clock_, cpu_callbacks_};
|
||||
video::Ppu ppu_{memory_, clock_};
|
||||
@@ -118,8 +118,8 @@ class SNES {
|
||||
// Multiplication / Division
|
||||
uint8_t multiply_a_;
|
||||
uint16_t multiply_result_;
|
||||
uint8_t divide_a_;
|
||||
uint8_t divide_result_;
|
||||
uint16_t divide_a_;
|
||||
uint16_t divide_result_;
|
||||
|
||||
// Joypad State
|
||||
Input input1;
|
||||
|
||||
Reference in New Issue
Block a user