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