bsnes/higan/ms/vdp/serialization.cpp

65 lines
1.7 KiB
C++
Raw Normal View History

Update to v102r10 release. byuu says: Changelog: - removed Emulator::Interface::Capabilities¹ - MS: improved the PSG emulation a bit - MS: added cheat code support - MS: added save state support² - MD: emulated the PSG³ ¹: there's really no point to it anymore. I intend to add cheat codes to the GBA core, as well as both cheat codes and save states to the Mega Drive core. I no longer intend to emulate any new systems, so these values will always be true. Further, the GUI doesn't respond to these values to disable those features anymore ever since the hiro rewrite, so they're double useless. ²: right now, the Z80 core is using a pointer for HL-\>(IX,IY) overrides. But I can't reliably serialize pointers, so I need to convert the Z80 core to use an integer here. The save states still appear to work fine, but there's the potential for an instruction to execute incorrectly if you're incredibly unlucky, so this needs to be fixed as soon as possible. Further, I still need a way to serialize array<T, Size> objects, and I should also add nall::Boolean serialization support. ³: I don't have a system in place to share identical sound chips. But this chip is so incredibly simple that it's not really much trouble to duplicate it. Further, I can strip out the stereo sound support code from the Game Gear portion, so it's even tinier. Note that the Mega Drive only just barely uses the PSG. Not at all in Altered Beast, and only for a tiny part of the BGM music on Sonic 1, plus his jump sound effect.
2017-02-22 21:25:01 +00:00
auto VDP::serialize(serializer& s) -> void {
Thread::serialize(s);
background.serialize(s);
sprite.serialize(s);
s.array(vram);
s.array(cram);
s.integer(io.vcounter);
s.integer(io.hcounter);
s.integer(io.lcounter);
s.integer(io.intLine);
s.integer(io.intFrame);
s.integer(io.spriteOverflow);
s.integer(io.spriteCollision);
s.integer(io.fifthSprite);
s.integer(io.controlLatch);
s.integer(io.controlData);
s.integer(io.code);
s.integer(io.address);
s.integer(io.vramLatch);
s.integer(io.externalSync);
s.integer(io.extendedHeight);
s.integer(io.mode4);
s.integer(io.spriteShift);
s.integer(io.lineInterrupts);
s.integer(io.leftClip);
s.integer(io.horizontalScrollLock);
s.integer(io.verticalScrollLock);
s.integer(io.spriteDouble);
s.integer(io.spriteTile);
s.integer(io.lines240);
s.integer(io.lines224);
s.integer(io.frameInterrupts);
s.integer(io.displayEnable);
s.integer(io.nameTableMask);
s.integer(io.nameTableAddress);
s.integer(io.colorTableAddress);
s.integer(io.patternTableAddress);
s.integer(io.spriteAttributeTableMask);
s.integer(io.spriteAttributeTableAddress);
s.integer(io.spritePatternTableMask);
s.integer(io.spritePatternTableAddress);
s.integer(io.backdropColor);
s.integer(io.hscroll);
s.integer(io.vscroll);
s.integer(io.lineCounter);
}
auto VDP::Background::serialize(serializer& s) -> void {
s.integer(state.x);
s.integer(state.y);
s.integer(output.color);
s.integer(output.palette);
s.integer(output.priority);
}
auto VDP::Sprite::serialize(serializer& s) -> void {
s.integer(state.x);
s.integer(state.y);
s.integer(output.color);
//todo: array<Object, 8> is not serializable
}