gb: cleanup some unused code

This commit is contained in:
goyuken 2014-06-11 19:07:57 +00:00
parent e0a9fcd650
commit 525871d6e4
36 changed files with 0 additions and 207 deletions

View File

@ -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_*/);

View File

@ -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); }

View File

@ -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];

View File

@ -57,7 +57,6 @@ class InterruptRequester {
public:
InterruptRequester();
void saveState(SaveState &) const;
void loadState(const SaveState &);
void resetCc(unsigned long oldCc, unsigned long newCc);

View File

@ -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);

View File

@ -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(); }

View File

@ -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;

View File

@ -68,7 +68,6 @@ public:
lastLatchData = data;
}
void saveState(SaveState &state) const;
void loadState(const SaveState &state);
void set(const bool enabled, unsigned bank) {

View File

@ -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;

View File

@ -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(); }

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
template<bool isReader>void SyncState(NewState *ns);
@ -88,7 +87,6 @@ public:
void reset();
void init(bool cgb);
void saveState(SaveState &state);
void loadState(const SaveState &state);
template<bool isReader>void SyncState(NewState *ns);

View File

@ -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);

View File

@ -65,7 +65,6 @@ public:
void reset();
void init(bool cgb);
void saveState(SaveState &state);
void loadState(const SaveState &state);
template<bool isReader>void SyncState(NewState *ns);

View File

@ -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);

View File

@ -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); }

View File

@ -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);

View File

@ -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);
template<bool isReader>void SyncState(NewState *ns);

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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);
template<bool isReader>void SyncState(NewState *ns);

View File

@ -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;

View File

@ -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);
template<bool isReader>void SyncState(NewState *ns);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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();

View File

@ -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<class T, class K, std::size_t start, std::size_t len>

View File

@ -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; }

View File

@ -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); }

Binary file not shown.