bsnes/gba/ppu/serialization.cpp

125 lines
3.1 KiB
C++
Raw Normal View History

void PPU::serialize(serializer& s) {
Thread::serialize(s);
s.array(vram, 96 * 1024);
s.array(pram, 512);
s.integer(regs.control.bgmode);
s.integer(regs.control.cgbmode);
s.integer(regs.control.frame);
s.integer(regs.control.hblank);
s.integer(regs.control.objmapping);
s.integer(regs.control.forceblank);
for(auto& flag : regs.control.enable) s.integer(flag);
for(auto& flag : regs.control.enablewindow) s.integer(flag);
s.integer(regs.greenswap);
s.integer(regs.status.vblank);
s.integer(regs.status.hblank);
s.integer(regs.status.vcoincidence);
s.integer(regs.status.irqvblank);
s.integer(regs.status.irqhblank);
s.integer(regs.status.irqvcoincidence);
s.integer(regs.status.vcompare);
s.integer(regs.vcounter);
for(auto& bg : regs.bg) {
s.integer(bg.control.priority);
s.integer(bg.control.characterbaseblock);
s.integer(bg.control.unused);
s.integer(bg.control.mosaic);
s.integer(bg.control.colormode);
s.integer(bg.control.screenbaseblock);
s.integer(bg.control.affinewrap);
s.integer(bg.control.screensize);
s.integer(bg.hoffset);
s.integer(bg.voffset);
s.integer(bg.pa);
s.integer(bg.pb);
s.integer(bg.pc);
s.integer(bg.pd);
s.integer(bg.x);
s.integer(bg.y);
s.integer(bg.lx);
s.integer(bg.ly);
s.integer(bg.vmosaic);
s.integer(bg.hmosaic);
s.integer(bg.id);
}
for(auto& window : regs.window) {
s.integer(window.x1);
s.integer(window.x2);
s.integer(window.y1);
s.integer(window.y2);
}
for(auto& windowflags : regs.windowflags) {
for(auto& flag : windowflags.enable) s.integer(flag);
}
s.integer(regs.mosaic.bghsize);
s.integer(regs.mosaic.bgvsize);
s.integer(regs.mosaic.objhsize);
s.integer(regs.mosaic.objvsize);
for(auto& flag : regs.blend.control.above) s.integer(flag);
for(auto& flag : regs.blend.control.below) s.integer(flag);
s.integer(regs.blend.control.mode);
s.integer(regs.blend.eva);
s.integer(regs.blend.evb);
s.integer(regs.blend.evy);
for(unsigned l = 0; l < 6; l++) {
for(unsigned p = 0; p < 240; p++) {
auto& pixel = layer[l][p];
s.integer(pixel.enable);
s.integer(pixel.priority);
s.integer(pixel.color);
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(pixel.translucent);
s.integer(pixel.mosaic);
}
}
for(unsigned w = 0; w < 3; w++) {
for(unsigned p = 0; p < 240; p++) {
s.integer(windowmask[w][p]);
}
}
for(auto& value : vmosaic) s.integer(value);
for(auto& value : hmosaic) s.integer(value);
for(auto& obj : object) {
s.integer(obj.y);
s.integer(obj.affine);
s.integer(obj.affinesize);
s.integer(obj.mode);
s.integer(obj.mosaic);
s.integer(obj.colors);
s.integer(obj.shape);
s.integer(obj.x);
s.integer(obj.affineparam);
s.integer(obj.hflip);
s.integer(obj.vflip);
s.integer(obj.size);
s.integer(obj.character);
s.integer(obj.priority);
s.integer(obj.palette);
s.integer(obj.width);
s.integer(obj.height);
}
for(auto& par : objectparam) {
s.integer(par.pa);
s.integer(par.pb);
s.integer(par.pc);
s.integer(par.pd);
}
}