bsnes/higan/gba/cpu/serialization.cpp

113 lines
3.6 KiB
C++
Raw Normal View History

auto CPU::serialize(serializer& s) -> void {
ARM::serialize(s);
Thread::serialize(s);
s.array(iwram, 32 * 1024);
s.array(ewram, 256 * 1024);
for(auto& dma : regs.dma) {
s.integer(dma.source);
s.integer(dma.target);
s.integer(dma.length);
s.integer(dma.data);
s.integer(dma.control.targetmode);
s.integer(dma.control.sourcemode);
s.integer(dma.control.repeat);
s.integer(dma.control.size);
s.integer(dma.control.drq);
s.integer(dma.control.timingmode);
s.integer(dma.control.irq);
s.integer(dma.control.enable);
s.integer(dma.run.target);
s.integer(dma.run.source);
s.integer(dma.run.length);
}
for(auto& timer : regs.timer) {
s.integer(timer.period);
s.integer(timer.reload);
s.integer(timer.pending);
s.integer(timer.control.frequency);
s.integer(timer.control.cascade);
s.integer(timer.control.irq);
s.integer(timer.control.enable);
}
for(auto& value : regs.serial.data) s.integer(value);
Update to v087r28 release. byuu says: Be sure to run make install, and move required images to their appropriate system profile folders. I still have no warnings in place if those images aren't present. Changelog: - OBJ mosaic should hopefully be emulated correctly now (thanks to krom and Cydrak for testing the hardware behavior) - emulated dummy serial registers, fixes Sonic Advance (you may still need to specify 512KB FlashROM with an appropriate ID, I used Panaonic's) - GBA core exits scheduler (PPU thread) and calls interface->videoRefresh() from main thread (not required, just nice) - SRAM, FRAM, EEPROM and FlashROM initialized to 0xFF if it does not exist (probably not needed, but FlashROM likes to reset to 0xFF anyway) - GBA manifest.xml for file-mode will now use "gamename.xml" instead of "gamename.gba.xml" - started renaming "NES" to "Famicom" and "SNES" to "Super Famicom" in the GUI (may or may not change source code in the long-term) - removed target-libsnes/ - added profile/ Profiles are the major new feature. So far we have: Famicom.sys/{nothing (yet?)} Super Famicom.sys/{ipl.rom} Game Boy.sys/{boot.rom} Game Boy Color.sys/{boot.rom} Game Boy Advance.sys/{bios.rom[not included]} Super Game Boy.sfc/{boot.rom,program.rom[not included]} BS-X Satellaview.sfc/{program.rom,bsx.ram,bsx.pram} Sufami Turbo.sfc/{program.rom} The SGB, BSX and ST cartridges ask you to load GB, BS or ST cartridges directly now. No slot loader for them. So the obvious downsides: you can't quickly pick between different SGB BIOSes, but why would you want to? Just use SGB2/JP. It's still possible, so I'll sacrifice a little complexity for a rare case to make it a lot easier for the more common case. ST cartridges currently won't let you load the secondary slot. BS-X Town cart is the only useful game to load with nothing in the slot, but only barely, since games are all seeded on flash and not on PSRAM images. We can revisit a way to boot the BIOS directly if and when we get the satellite uplink emulated and data can be downloaded onto the PSRAM :P BS-X slotted cartridges still require the secondary slot. My plan for BS-X slotted cartridges is to require a manifest.xml to specify that it has the BS-X slot present. Otherwise, we have to load the ROM into the SNES cartridge class, and parse its header before we can find out if it has one. Screw that. If it's in the XML, I can tell before loading the ROM if I need to present you with an optional slot loading dialog. I will probably do something similar for Sufami Turbo. Not all games even work with a secondary slot, so why ask you to load a second slot for them? Let the XML request a second slot. A complete Sufami Turbo ROM set will be trivial anyway. Not sure how I want to do the sub dialog yet. We want basic file loading, but we don't want it to look like the dialog 'didn't do anything' if it pops back open immediately again. Maybe change the background color of the dialog to a darker gray? Tacky, but it'd give you the visual cue without the need for some subtle text changes.
2012-04-18 13:58:04 +00:00
s.integer(regs.serial.control.shiftclockselect);
s.integer(regs.serial.control.shiftclockfrequency);
s.integer(regs.serial.control.transferenablereceive);
s.integer(regs.serial.control.transferenablesend);
s.integer(regs.serial.control.startbit);
s.integer(regs.serial.control.transferlength);
s.integer(regs.serial.control.irqenable);
s.integer(regs.serial.data8);
for(auto& flag : regs.keypad.control.flag) s.integer(flag);
s.integer(regs.keypad.control.enable);
s.integer(regs.keypad.control.condition);
Update to v087r28 release. byuu says: Be sure to run make install, and move required images to their appropriate system profile folders. I still have no warnings in place if those images aren't present. Changelog: - OBJ mosaic should hopefully be emulated correctly now (thanks to krom and Cydrak for testing the hardware behavior) - emulated dummy serial registers, fixes Sonic Advance (you may still need to specify 512KB FlashROM with an appropriate ID, I used Panaonic's) - GBA core exits scheduler (PPU thread) and calls interface->videoRefresh() from main thread (not required, just nice) - SRAM, FRAM, EEPROM and FlashROM initialized to 0xFF if it does not exist (probably not needed, but FlashROM likes to reset to 0xFF anyway) - GBA manifest.xml for file-mode will now use "gamename.xml" instead of "gamename.gba.xml" - started renaming "NES" to "Famicom" and "SNES" to "Super Famicom" in the GUI (may or may not change source code in the long-term) - removed target-libsnes/ - added profile/ Profiles are the major new feature. So far we have: Famicom.sys/{nothing (yet?)} Super Famicom.sys/{ipl.rom} Game Boy.sys/{boot.rom} Game Boy Color.sys/{boot.rom} Game Boy Advance.sys/{bios.rom[not included]} Super Game Boy.sfc/{boot.rom,program.rom[not included]} BS-X Satellaview.sfc/{program.rom,bsx.ram,bsx.pram} Sufami Turbo.sfc/{program.rom} The SGB, BSX and ST cartridges ask you to load GB, BS or ST cartridges directly now. No slot loader for them. So the obvious downsides: you can't quickly pick between different SGB BIOSes, but why would you want to? Just use SGB2/JP. It's still possible, so I'll sacrifice a little complexity for a rare case to make it a lot easier for the more common case. ST cartridges currently won't let you load the secondary slot. BS-X Town cart is the only useful game to load with nothing in the slot, but only barely, since games are all seeded on flash and not on PSRAM images. We can revisit a way to boot the BIOS directly if and when we get the satellite uplink emulated and data can be downloaded onto the PSRAM :P BS-X slotted cartridges still require the secondary slot. My plan for BS-X slotted cartridges is to require a manifest.xml to specify that it has the BS-X slot present. Otherwise, we have to load the ROM into the SNES cartridge class, and parse its header before we can find out if it has one. Screw that. If it's in the XML, I can tell before loading the ROM if I need to present you with an optional slot loading dialog. I will probably do something similar for Sufami Turbo. Not all games even work with a secondary slot, so why ask you to load a second slot for them? Let the XML request a second slot. A complete Sufami Turbo ROM set will be trivial anyway. Not sure how I want to do the sub dialog yet. We want basic file loading, but we don't want it to look like the dialog 'didn't do anything' if it pops back open immediately again. Maybe change the background color of the dialog to a darker gray? Tacky, but it'd give you the visual cue without the need for some subtle text changes.
2012-04-18 13:58:04 +00:00
s.integer(regs.joybus.settings.sc);
s.integer(regs.joybus.settings.sd);
s.integer(regs.joybus.settings.si);
s.integer(regs.joybus.settings.so);
s.integer(regs.joybus.settings.scmode);
s.integer(regs.joybus.settings.sdmode);
s.integer(regs.joybus.settings.simode);
s.integer(regs.joybus.settings.somode);
s.integer(regs.joybus.settings.irqenable);
s.integer(regs.joybus.settings.mode);
s.integer(regs.joybus.control.resetsignal);
s.integer(regs.joybus.control.receivecomplete);
s.integer(regs.joybus.control.sendcomplete);
s.integer(regs.joybus.control.irqenable);
s.integer(regs.joybus.receive);
s.integer(regs.joybus.transmit);
s.integer(regs.joybus.status.receiveflag);
s.integer(regs.joybus.status.sendflag);
s.integer(regs.joybus.status.generalflag);
s.integer(regs.ime);
s.integer(regs.irq.enable.vblank);
s.integer(regs.irq.enable.hblank);
s.integer(regs.irq.enable.vcoincidence);
for(auto& flag : regs.irq.enable.timer) s.integer(flag);
s.integer(regs.irq.enable.serial);
for(auto& flag : regs.irq.enable.dma) s.integer(flag);
s.integer(regs.irq.enable.keypad);
s.integer(regs.irq.enable.cartridge);
s.integer(regs.irq.flag.vblank);
s.integer(regs.irq.flag.hblank);
s.integer(regs.irq.flag.vcoincidence);
for(auto& flag : regs.irq.flag.timer) s.integer(flag);
s.integer(regs.irq.flag.serial);
for(auto& flag : regs.irq.flag.dma) s.integer(flag);
s.integer(regs.irq.flag.keypad);
s.integer(regs.irq.flag.cartridge);
for(auto& flag : regs.wait.control.nwait) s.integer(flag);
for(auto& flag : regs.wait.control.swait) s.integer(flag);
s.integer(regs.wait.control.phi);
s.integer(regs.wait.control.prefetch);
s.integer(regs.wait.control.gametype);
s.integer(regs.memory.control.disable);
s.integer(regs.memory.control.unknown1);
s.integer(regs.memory.control.ewram);
s.integer(regs.memory.control.ewramwait);
s.integer(regs.memory.control.unknown2);
s.integer(regs.postboot);
s.integer((uint&)regs.mode);
s.integer(regs.clock);
s.integer(pending.dma.vblank);
s.integer(pending.dma.hblank);
s.integer(pending.dma.hdma);
}