diff --git a/libgambatte/src/cpu.cpp b/libgambatte/src/cpu.cpp index 4a830ed411..9fc7c43ed1 100644 --- a/libgambatte/src/cpu.cpp +++ b/libgambatte/src/cpu.cpp @@ -89,25 +89,6 @@ void CPU::setStatePtrs(SaveState &state) { memory.setStatePtrs(state); } -void CPU::saveState(SaveState &state) { - cycleCounter_ = memory.saveState(state, cycleCounter_); - - calcHF(HF1, HF2); - - state.cpu.cycleCounter = cycleCounter_; - state.cpu.PC = PC_; - state.cpu.SP = SP; - state.cpu.A = A_; - state.cpu.B = B; - state.cpu.C = C; - state.cpu.D = D; - state.cpu.E = E; - state.cpu.F = F(); - state.cpu.H = H; - state.cpu.L = L; - state.cpu.skip = skip; -} - void CPU::loadState(const SaveState &state) { memory.loadState(state/*, cycleCounter_*/); diff --git a/libgambatte/src/cpu.h b/libgambatte/src/cpu.h index 6b7fbd691d..55a72b6364 100644 --- a/libgambatte/src/cpu.h +++ b/libgambatte/src/cpu.h @@ -51,7 +51,6 @@ public: long runFor(unsigned long cycles); void setStatePtrs(SaveState &state); - void saveState(SaveState &state); void loadState(const SaveState &state); void loadSavedata(const char *data) { memory.loadSavedata(data); } diff --git a/libgambatte/src/interruptrequester.cpp b/libgambatte/src/interruptrequester.cpp index 32ab016da6..5ed7869c39 100644 --- a/libgambatte/src/interruptrequester.cpp +++ b/libgambatte/src/interruptrequester.cpp @@ -23,12 +23,6 @@ namespace gambatte { InterruptRequester::InterruptRequester() : minIntTime(0), ifreg_(0), iereg_(0) {} -void InterruptRequester::saveState(SaveState &state) const { - state.mem.minIntTime = minIntTime; - state.mem.IME = ime(); - state.mem.halted = halted(); -} - void InterruptRequester::loadState(const SaveState &state) { minIntTime = state.mem.minIntTime; ifreg_ = state.mem.ioamhram.get()[0x10F]; diff --git a/libgambatte/src/interruptrequester.h b/libgambatte/src/interruptrequester.h index 54a0acd7e2..c99efc73f6 100644 --- a/libgambatte/src/interruptrequester.h +++ b/libgambatte/src/interruptrequester.h @@ -57,7 +57,6 @@ class InterruptRequester { public: InterruptRequester(); - void saveState(SaveState &) const; void loadState(const SaveState &); void resetCc(unsigned long oldCc, unsigned long newCc); diff --git a/libgambatte/src/mem/cartridge.cpp b/libgambatte/src/mem/cartridge.cpp index 9f649a0b84..ac16d17262 100644 --- a/libgambatte/src/mem/cartridge.cpp +++ b/libgambatte/src/mem/cartridge.cpp @@ -502,11 +502,6 @@ void Cartridge::setStatePtrs(SaveState &state) { state.mem.wram.set(memptrs.wramdata(0), memptrs.wramdataend() - memptrs.wramdata(0)); } -void Cartridge::saveState(SaveState &state) const { - mbc->saveState(state.mem); - rtc.saveState(state); -} - void Cartridge::loadState(const SaveState &state) { rtc.loadState(state); mbc->loadState(state.mem); diff --git a/libgambatte/src/mem/cartridge.h b/libgambatte/src/mem/cartridge.h index 9de575f326..f6ea99bfa9 100644 --- a/libgambatte/src/mem/cartridge.h +++ b/libgambatte/src/mem/cartridge.h @@ -33,7 +33,6 @@ class Mbc { public: virtual ~Mbc() {} virtual void romWrite(unsigned P, unsigned data) = 0; - virtual void saveState(SaveState::Mem &ss) const = 0; virtual void loadState(const SaveState::Mem &ss) = 0; virtual bool isAddressWithinAreaRombankCanBeMappedTo(unsigned address, unsigned rombank) const = 0; @@ -52,7 +51,6 @@ class Cartridge { public: void setStatePtrs(SaveState &); - void saveState(SaveState &) const; void loadState(const SaveState &); bool loaded() const { return mbc.get(); } diff --git a/libgambatte/src/mem/rtc.cpp b/libgambatte/src/mem/rtc.cpp index 9e3f1c55dc..3fc1ed1a2e 100644 --- a/libgambatte/src/mem/rtc.cpp +++ b/libgambatte/src/mem/rtc.cpp @@ -90,17 +90,6 @@ void Rtc::doSwapActive() { } } -void Rtc::saveState(SaveState &state) const { - state.rtc.baseTime = baseTime; - state.rtc.haltTime = haltTime; - state.rtc.dataDh = dataDh; - state.rtc.dataDl = dataDl; - state.rtc.dataH = dataH; - state.rtc.dataM = dataM; - state.rtc.dataS = dataS; - state.rtc.lastLatchData = lastLatchData; -} - void Rtc::loadState(const SaveState &state) { baseTime = state.rtc.baseTime; haltTime = state.rtc.haltTime; diff --git a/libgambatte/src/mem/rtc.h b/libgambatte/src/mem/rtc.h index b71b4f88b4..00652a2181 100644 --- a/libgambatte/src/mem/rtc.h +++ b/libgambatte/src/mem/rtc.h @@ -68,7 +68,6 @@ public: lastLatchData = data; } - void saveState(SaveState &state) const; void loadState(const SaveState &state); void set(const bool enabled, unsigned bank) { diff --git a/libgambatte/src/memory.cpp b/libgambatte/src/memory.cpp index 1424f6c9f7..f4e26ce60f 100644 --- a/libgambatte/src/memory.cpp +++ b/libgambatte/src/memory.cpp @@ -54,28 +54,6 @@ void Memory::setStatePtrs(SaveState &state) { sound.setStatePtrs(state); } -unsigned long Memory::saveState(SaveState &state, unsigned long cycleCounter) { - cycleCounter = resetCounters(cycleCounter); - nontrivial_ff_read(0xFF05, cycleCounter); - nontrivial_ff_read(0xFF0F, cycleCounter); - nontrivial_ff_read(0xFF26, cycleCounter); - - state.mem.divLastUpdate = divLastUpdate; - state.mem.nextSerialtime = intreq.eventTime(SERIAL); - state.mem.unhaltTime = intreq.eventTime(UNHALT); - state.mem.lastOamDmaUpdate = lastOamDmaUpdate; - state.mem.dmaSource = dmaSource; - state.mem.dmaDestination = dmaDestination; - state.mem.oamDmaPos = oamDmaPos; - - intreq.saveState(state); - cart.saveState(state); - tima.saveState(state); - display.saveState(state); - sound.saveState(state); - - return cycleCounter; -} static inline int serialCntFrom(const unsigned long cyclesUntilDone, const bool cgbFast) { return cgbFast ? (cyclesUntilDone + 0xF) >> 4 : (cyclesUntilDone + 0x1FF) >> 9; diff --git a/libgambatte/src/memory.h b/libgambatte/src/memory.h index e83f521bfb..8cc3bfd615 100644 --- a/libgambatte/src/memory.h +++ b/libgambatte/src/memory.h @@ -87,7 +87,6 @@ public: const char * romTitle() const { return cart.romTitle(); } void setStatePtrs(SaveState &state); - unsigned long saveState(SaveState &state, unsigned long cc); void loadState(const SaveState &state/*, unsigned long oldCc*/); void loadSavedata(const char *data) { cart.loadSavedata(data); } int saveSavedataLength() {return cart.saveSavedataLength(); } diff --git a/libgambatte/src/sound.cpp b/libgambatte/src/sound.cpp index cf214486e3..be28da8e1d 100644 --- a/libgambatte/src/sound.cpp +++ b/libgambatte/src/sound.cpp @@ -70,13 +70,6 @@ void PSG::setStatePtrs(SaveState &state) { ch3.setStatePtrs(state); } -void PSG::saveState(SaveState &state) { - ch1.saveState(state); - ch2.saveState(state); - ch3.saveState(state); - ch4.saveState(state); -} - void PSG::loadState(const SaveState &state) { ch1.loadState(state); ch2.loadState(state); diff --git a/libgambatte/src/sound.h b/libgambatte/src/sound.h index 602d2986a0..0d39db788e 100644 --- a/libgambatte/src/sound.h +++ b/libgambatte/src/sound.h @@ -51,7 +51,6 @@ public: void init(bool cgb); void reset(); void setStatePtrs(SaveState &state); - void saveState(SaveState &state); void loadState(const SaveState &state); void generate_samples(unsigned long cycleCounter, unsigned doubleSpeed); diff --git a/libgambatte/src/sound/channel1.cpp b/libgambatte/src/sound/channel1.cpp index 7e1322d0b2..b99902f28e 100644 --- a/libgambatte/src/sound/channel1.cpp +++ b/libgambatte/src/sound/channel1.cpp @@ -90,13 +90,6 @@ void Channel1::SweepUnit::reset() { counter = COUNTER_DISABLED; } -void Channel1::SweepUnit::saveState(SaveState &state) const { - state.spu.ch1.sweep.counter = counter; - state.spu.ch1.sweep.shadow = shadow; - state.spu.ch1.sweep.nr0 = nr0; - state.spu.ch1.sweep.negging = negging; -} - void Channel1::SweepUnit::loadState(const SaveState &state) { counter = std::max(state.spu.ch1.sweep.counter, state.spu.cycleCounter); shadow = state.spu.ch1.sweep.shadow; @@ -202,17 +195,6 @@ void Channel1::init(const bool cgb) { lengthCounter.init(cgb); } -void Channel1::saveState(SaveState &state) { - sweepUnit.saveState(state); - dutyUnit.saveState(state.spu.ch1.duty, cycleCounter); - envelopeUnit.saveState(state.spu.ch1.env); - lengthCounter.saveState(state.spu.ch1.lcounter); - - state.spu.cycleCounter = cycleCounter; - state.spu.ch1.nr4 = nr4; - state.spu.ch1.master = master; -} - void Channel1::loadState(const SaveState &state) { sweepUnit.loadState(state); dutyUnit.loadState(state.spu.ch1.duty, state.mem.ioamhram.get()[0x111], state.spu.ch1.nr4, state.spu.cycleCounter); diff --git a/libgambatte/src/sound/channel1.h b/libgambatte/src/sound/channel1.h index d1afdefd51..3467547a58 100644 --- a/libgambatte/src/sound/channel1.h +++ b/libgambatte/src/sound/channel1.h @@ -47,7 +47,6 @@ class Channel1 { void nr0Change(unsigned newNr0); void nr4Init(unsigned long cycleCounter); void reset(); - void saveState(SaveState &state) const; void loadState(const SaveState &state); templatevoid SyncState(NewState *ns); @@ -88,7 +87,6 @@ public: void reset(); void init(bool cgb); - void saveState(SaveState &state); void loadState(const SaveState &state); templatevoid SyncState(NewState *ns); diff --git a/libgambatte/src/sound/channel2.cpp b/libgambatte/src/sound/channel2.cpp index 567a5c7102..78cb44fb07 100644 --- a/libgambatte/src/sound/channel2.cpp +++ b/libgambatte/src/sound/channel2.cpp @@ -100,15 +100,6 @@ void Channel2::init(const bool cgb) { lengthCounter.init(cgb); } -void Channel2::saveState(SaveState &state) { - dutyUnit.saveState(state.spu.ch2.duty, cycleCounter); - envelopeUnit.saveState(state.spu.ch2.env); - lengthCounter.saveState(state.spu.ch2.lcounter); - - state.spu.ch2.nr4 = nr4; - state.spu.ch2.master = master; -} - void Channel2::loadState(const SaveState &state) { dutyUnit.loadState(state.spu.ch2.duty, state.mem.ioamhram.get()[0x116], state.spu.ch2.nr4,state.spu.cycleCounter); envelopeUnit.loadState(state.spu.ch2.env, state.mem.ioamhram.get()[0x117], state.spu.cycleCounter); diff --git a/libgambatte/src/sound/channel2.h b/libgambatte/src/sound/channel2.h index bb2ecb659e..2f98309e6a 100644 --- a/libgambatte/src/sound/channel2.h +++ b/libgambatte/src/sound/channel2.h @@ -65,7 +65,6 @@ public: void reset(); void init(bool cgb); - void saveState(SaveState &state); void loadState(const SaveState &state); templatevoid SyncState(NewState *ns); diff --git a/libgambatte/src/sound/channel3.cpp b/libgambatte/src/sound/channel3.cpp index fe11399c3d..d4cf78414c 100644 --- a/libgambatte/src/sound/channel3.cpp +++ b/libgambatte/src/sound/channel3.cpp @@ -100,18 +100,6 @@ void Channel3::setStatePtrs(SaveState &state) { state.spu.ch3.waveRam.set(waveRam, sizeof waveRam); } -void Channel3::saveState(SaveState &state) const { - lengthCounter.saveState(state.spu.ch3.lcounter); - - state.spu.ch3.waveCounter = waveCounter; - state.spu.ch3.lastReadTime = lastReadTime; - state.spu.ch3.nr3 = nr3; - state.spu.ch3.nr4 = nr4; - state.spu.ch3.wavePos = wavePos; - state.spu.ch3.sampleBuf = sampleBuf; - state.spu.ch3.master = master; -} - void Channel3::loadState(const SaveState &state) { lengthCounter.loadState(state.spu.ch3.lcounter, state.spu.cycleCounter); diff --git a/libgambatte/src/sound/channel3.h b/libgambatte/src/sound/channel3.h index fe62d91aad..ae0ba2f64a 100644 --- a/libgambatte/src/sound/channel3.h +++ b/libgambatte/src/sound/channel3.h @@ -66,7 +66,6 @@ public: void reset(); void init(bool cgb); void setStatePtrs(SaveState &state); - void saveState(SaveState &state) const; void loadState(const SaveState &state); void setNr0(unsigned data); void setNr1(unsigned data) { lengthCounter.nr1Change(data, nr4, cycleCounter); } diff --git a/libgambatte/src/sound/channel4.cpp b/libgambatte/src/sound/channel4.cpp index 3fb6473868..f1b355adc7 100644 --- a/libgambatte/src/sound/channel4.cpp +++ b/libgambatte/src/sound/channel4.cpp @@ -150,12 +150,6 @@ void Channel4::Lfsr::resetCounters(const unsigned long oldCc) { SoundUnit::resetCounters(oldCc); } -void Channel4::Lfsr::saveState(SaveState &state, const unsigned long cc) { - updateBackupCounter(cc); - state.spu.ch4.lfsr.counter = backupCounter; - state.spu.ch4.lfsr.reg = reg; -} - void Channel4::Lfsr::loadState(const SaveState &state) { counter = backupCounter = std::max(state.spu.ch4.lfsr.counter, state.spu.cycleCounter); reg = state.spu.ch4.lfsr.reg; @@ -249,15 +243,6 @@ void Channel4::init(const bool cgb) { lengthCounter.init(cgb); } -void Channel4::saveState(SaveState &state) { - lfsr.saveState(state, cycleCounter); - envelopeUnit.saveState(state.spu.ch4.env); - lengthCounter.saveState(state.spu.ch4.lcounter); - - state.spu.ch4.nr4 = nr4; - state.spu.ch4.master = master; -} - void Channel4::loadState(const SaveState &state) { lfsr.loadState(state); envelopeUnit.loadState(state.spu.ch4.env, state.mem.ioamhram.get()[0x121], state.spu.cycleCounter); diff --git a/libgambatte/src/sound/channel4.h b/libgambatte/src/sound/channel4.h index fe8eb07f3d..6365ad682f 100644 --- a/libgambatte/src/sound/channel4.h +++ b/libgambatte/src/sound/channel4.h @@ -46,7 +46,6 @@ class Channel4 { void nr3Change(unsigned newNr3, unsigned long cc); void nr4Init(unsigned long cc); void reset(unsigned long cc); - void saveState(SaveState &state, const unsigned long cc); void loadState(const SaveState &state); void resetCounters(unsigned long oldCc); void disableMaster() { killCounter(); master = false; reg = 0x7FFF; } @@ -96,7 +95,6 @@ public: void reset(); void init(bool cgb); - void saveState(SaveState &state); void loadState(const SaveState &state); templatevoid SyncState(NewState *ns); diff --git a/libgambatte/src/sound/duty_unit.cpp b/libgambatte/src/sound/duty_unit.cpp index 130fcbcaea..2059239a75 100644 --- a/libgambatte/src/sound/duty_unit.cpp +++ b/libgambatte/src/sound/duty_unit.cpp @@ -112,13 +112,6 @@ void DutyUnit::reset() { setCounter(); } -void DutyUnit::saveState(SaveState::SPU::Duty &dstate, const unsigned long cc) { - updatePos(cc); - dstate.nextPosUpdate = nextPosUpdate; - dstate.nr3 = getFreq() & 0xFF; - dstate.pos = pos; -} - void DutyUnit::loadState(const SaveState::SPU::Duty &dstate, const unsigned nr1, const unsigned nr4, const unsigned long cc) { nextPosUpdate = std::max(dstate.nextPosUpdate, cc); pos = dstate.pos & 7; diff --git a/libgambatte/src/sound/duty_unit.h b/libgambatte/src/sound/duty_unit.h index de44de30a1..cdf4a64f32 100644 --- a/libgambatte/src/sound/duty_unit.h +++ b/libgambatte/src/sound/duty_unit.h @@ -46,7 +46,6 @@ public: void nr3Change(unsigned newNr3, unsigned long cc); void nr4Change(unsigned newNr4, unsigned long cc); void reset(); - void saveState(SaveState::SPU::Duty &dstate, unsigned long cc); void loadState(const SaveState::SPU::Duty &dstate, unsigned nr1, unsigned nr4, unsigned long cc); void resetCounters(unsigned long oldCc); void killCounter(); diff --git a/libgambatte/src/sound/envelope_unit.cpp b/libgambatte/src/sound/envelope_unit.cpp index 37a1af5578..f482bbf7a3 100644 --- a/libgambatte/src/sound/envelope_unit.cpp +++ b/libgambatte/src/sound/envelope_unit.cpp @@ -92,11 +92,6 @@ void EnvelopeUnit::reset() { counter = COUNTER_DISABLED; } -void EnvelopeUnit::saveState(SaveState::SPU::Env &estate) const { - estate.counter = counter; - estate.volume = volume; -} - void EnvelopeUnit::loadState(const SaveState::SPU::Env &estate, const unsigned nr2, const unsigned long cc) { counter = std::max(estate.counter, cc); volume = estate.volume; diff --git a/libgambatte/src/sound/envelope_unit.h b/libgambatte/src/sound/envelope_unit.h index d7d2eca0a0..68d6bdc54c 100644 --- a/libgambatte/src/sound/envelope_unit.h +++ b/libgambatte/src/sound/envelope_unit.h @@ -46,7 +46,6 @@ public: bool nr2Change(unsigned newNr2); bool nr4Init(unsigned long cycleCounter); void reset(); - void saveState(SaveState::SPU::Env &estate) const; void loadState(const SaveState::SPU::Env &estate, unsigned nr2, unsigned long cc); templatevoid SyncState(NewState *ns); diff --git a/libgambatte/src/sound/length_counter.cpp b/libgambatte/src/sound/length_counter.cpp index 2846c85ba8..cb3616a4ff 100644 --- a/libgambatte/src/sound/length_counter.cpp +++ b/libgambatte/src/sound/length_counter.cpp @@ -78,11 +78,6 @@ void LengthCounter::init(const bool cgb) { this->cgb = cgb; } -void LengthCounter::saveState(SaveState::SPU::LCounter &lstate) const { - lstate.counter = counter; - lstate.lengthCounter = lengthCounter; -} - void LengthCounter::loadState(const SaveState::SPU::LCounter &lstate, const unsigned long cc) { counter = std::max(lstate.counter, cc); lengthCounter = lstate.lengthCounter; diff --git a/libgambatte/src/sound/length_counter.h b/libgambatte/src/sound/length_counter.h index a50d643824..533606171a 100644 --- a/libgambatte/src/sound/length_counter.h +++ b/libgambatte/src/sound/length_counter.h @@ -40,7 +40,6 @@ public: void nr4Change(unsigned oldNr4, unsigned newNr4, unsigned long cc); // void reset(); void init(bool cgb); - void saveState(SaveState::SPU::LCounter &lstate) const; void loadState(const SaveState::SPU::LCounter &lstate, unsigned long cc); templatevoid SyncState(NewState *ns); diff --git a/libgambatte/src/tima.cpp b/libgambatte/src/tima.cpp index 5764afa6b8..c125bd57fb 100644 --- a/libgambatte/src/tima.cpp +++ b/libgambatte/src/tima.cpp @@ -31,11 +31,6 @@ tma_(0), tac_(0) {} -void Tima::saveState(SaveState &state) const { - state.mem.timaLastUpdate = lastUpdate_; - state.mem.tmatime = tmatime_; -} - void Tima::loadState(const SaveState &state, const TimaInterruptRequester timaIrq) { lastUpdate_ = state.mem.timaLastUpdate; tmatime_ = state.mem.tmatime; diff --git a/libgambatte/src/tima.h b/libgambatte/src/tima.h index aece83b286..4bb6c31d31 100644 --- a/libgambatte/src/tima.h +++ b/libgambatte/src/tima.h @@ -50,7 +50,6 @@ class Tima { public: Tima(); - void saveState(SaveState &) const; void loadState(const SaveState &, TimaInterruptRequester timaIrq); void resetCc(unsigned long oldCc, unsigned long newCc, TimaInterruptRequester timaIrq); diff --git a/libgambatte/src/video.cpp b/libgambatte/src/video.cpp index ace0705c7a..fe17b72310 100644 --- a/libgambatte/src/video.cpp +++ b/libgambatte/src/video.cpp @@ -105,16 +105,6 @@ void LCD::setStatePtrs(SaveState &state) { ppu.setStatePtrs(state); } -void LCD::saveState(SaveState &state) const { - state.mem.hdmaTransfer = hdmaIsEnabled(); - state.ppu.nextM0Irq = eventTimes_(MODE0_IRQ) - ppu.now(); - state.ppu.pendingLcdstatIrq = eventTimes_(ONESHOT_LCDSTATIRQ) != DISABLED_TIME; - - lycIrq.saveState(state); - m0Irq_.saveState(state); - ppu.saveState(state); -} - void LCD::loadState(const SaveState &state, const unsigned char *const oamram) { statReg = state.mem.ioamhram.get()[0x141]; m2IrqStatReg_ = statReg; diff --git a/libgambatte/src/video.h b/libgambatte/src/video.h index ffe14894e5..67c0856aed 100644 --- a/libgambatte/src/video.h +++ b/libgambatte/src/video.h @@ -71,10 +71,6 @@ public: lycReg_ = lycReg; } - void saveState(SaveState &state) const { - state.ppu.m0lyc = lycReg_; - } - void loadState(const SaveState &state) { lycReg_ = state.ppu.m0lyc; statReg_ = state.mem.ioamhram.get()[0x141]; @@ -174,7 +170,6 @@ public: LCD(const unsigned char *oamram, const unsigned char *vram_in, VideoInterruptRequester memEventRequester); void reset(const unsigned char *oamram, const unsigned char *vram, bool cgb); void setStatePtrs(SaveState &state); - void saveState(SaveState &state) const; void loadState(const SaveState &state, const unsigned char *oamram); void setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned long rgb32); void setCgbPalette(unsigned *lut); diff --git a/libgambatte/src/video/lyc_irq.cpp b/libgambatte/src/video/lyc_irq.cpp index 5f3a212bb9..d9a138a3fd 100644 --- a/libgambatte/src/video/lyc_irq.cpp +++ b/libgambatte/src/video/lyc_irq.cpp @@ -85,10 +85,6 @@ void LycIrq::loadState(const SaveState &state) { statReg_ = statRegSrc_; } -void LycIrq::saveState(SaveState &state) const { - state.ppu.lyc = lycReg_; -} - void LycIrq::reschedule(const LyCounter & lyCounter, const unsigned long cc) { time_ = std::min(schedule(statReg_ , lycReg_ , lyCounter, cc), schedule(statRegSrc_, lycRegSrc_, lyCounter, cc)); diff --git a/libgambatte/src/video/lyc_irq.h b/libgambatte/src/video/lyc_irq.h index 96e0f7d8c2..19577a802a 100644 --- a/libgambatte/src/video/lyc_irq.h +++ b/libgambatte/src/video/lyc_irq.h @@ -41,7 +41,6 @@ public: void doEvent(unsigned char *ifreg, const LyCounter &lyCounter); unsigned lycReg() const { return lycRegSrc_; } void loadState(const SaveState &state); - void saveState(SaveState &state) const; unsigned long time() const { return time_; } void setCgb(const bool cgb) { cgb_ = cgb; } void lcdReset(); diff --git a/libgambatte/src/video/ppu.cpp b/libgambatte/src/video/ppu.cpp index cf32ebcb86..6813d58990 100644 --- a/libgambatte/src/video/ppu.cpp +++ b/libgambatte/src/video/ppu.cpp @@ -1486,27 +1486,6 @@ static void saveSpriteList(const PPUPriv &p, SaveState &ss) { ss.ppu.currentSprite = p.currentSprite; } -void PPU::saveState(SaveState &ss) const { - p_.spriteMapper.saveState(ss); - ss.ppu.videoCycles = p_.lcdc & 0x80 ? p_.lyCounter.frameCycles(p_.now) : 0; - ss.ppu.xpos = p_.xpos; - ss.ppu.endx = p_.endx; - ss.ppu.reg0 = p_.reg0; - ss.ppu.reg1 = p_.reg1; - ss.ppu.tileword = p_.tileword; - ss.ppu.ntileword = p_.ntileword; - ss.ppu.attrib = p_.attrib; - ss.ppu.nattrib = p_.nattrib; - ss.ppu.winDrawState = p_.winDrawState; - ss.ppu.winYPos = p_.winYPos; - ss.ppu.oldWy = p_.wy2; - ss.ppu.wscx = p_.wscx; - ss.ppu.weMaster = p_.weMaster; - saveSpriteList(p_, ss); - ss.ppu.state = p_.nextCallPtr->id; - ss.ppu.lastM0Time = p_.now - p_.lastM0Time; -} - namespace { template diff --git a/libgambatte/src/video/ppu.h b/libgambatte/src/video/ppu.h index 8152f83376..130e1ffd0a 100644 --- a/libgambatte/src/video/ppu.h +++ b/libgambatte/src/video/ppu.h @@ -118,7 +118,6 @@ public: unsigned long predictedNextXposTime(unsigned xpos) const; void reset(const unsigned char *oamram, const unsigned char *vram, bool cgb); void resetCc(unsigned long oldCc, unsigned long newCc); - void saveState(SaveState &ss) const; void setFrameBuf(uint_least32_t *buf, unsigned pitch) { p_.framebuf.setBuf(buf, pitch); } void setLcdc(unsigned lcdc, unsigned long cc); void setScx(const unsigned scx) { p_.scx = scx; } diff --git a/libgambatte/src/video/sprite_mapper.h b/libgambatte/src/video/sprite_mapper.h index defc39d5cf..09e269d769 100644 --- a/libgambatte/src/video/sprite_mapper.h +++ b/libgambatte/src/video/sprite_mapper.h @@ -55,7 +55,6 @@ class SpriteMapper { const unsigned char *spritePosBuf() const { return buf; } void setStatePtrs(SaveState &state); void enableDisplay(unsigned long cc); - void saveState(SaveState &state) const { state.ppu.enableDisplayM0Time = lu; } void loadState(const SaveState &ss, const unsigned char *oamram); bool inactivePeriodAfterDisplayEnable(const unsigned long cc) const { return cc < lu; } @@ -122,7 +121,6 @@ public: void setStatePtrs(SaveState &state) { oamReader.setStatePtrs(state); } void enableDisplay(unsigned long cc) { oamReader.enableDisplay(cc); } - void saveState(SaveState &state) const { oamReader.saveState(state); } void loadState(const SaveState &state, const unsigned char *const oamram) { oamReader.loadState(state, oamram); mapSprites(); } bool inactivePeriodAfterDisplayEnable(unsigned long cc) const { return oamReader.inactivePeriodAfterDisplayEnable(cc); } diff --git a/output/dll/libgambatte.dll b/output/dll/libgambatte.dll index 4d15c97b79..e893f84f89 100644 Binary files a/output/dll/libgambatte.dll and b/output/dll/libgambatte.dll differ