2010-08-09 13:28:56 +00:00
|
|
|
#ifdef SYSTEM_CPP
|
|
|
|
|
|
|
|
serializer System::serialize() {
|
|
|
|
serializer s(serialize_size);
|
|
|
|
|
2012-04-29 06:16:44 +00:00
|
|
|
unsigned signature = 0x31545342, version = Info::SerializerVersion;
|
|
|
|
char hash[64], description[512], profile[16];
|
|
|
|
memcpy(&hash, (const char*)cartridge.sha256(), 64);
|
2010-08-09 13:28:56 +00:00
|
|
|
memset(&description, 0, sizeof description);
|
2011-09-15 12:41:49 +00:00
|
|
|
memset(&profile, 0, sizeof profile);
|
2012-01-15 08:29:57 +00:00
|
|
|
strmcpy(profile, Info::Profile, sizeof profile);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
s.integer(signature);
|
|
|
|
s.integer(version);
|
2012-04-29 06:16:44 +00:00
|
|
|
s.array(hash);
|
2010-08-09 13:28:56 +00:00
|
|
|
s.array(description);
|
2011-09-15 12:41:49 +00:00
|
|
|
s.array(profile);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
serialize_all(s);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool System::unserialize(serializer &s) {
|
2012-04-29 06:16:44 +00:00
|
|
|
unsigned signature, version;
|
|
|
|
char hash[64], description[512], profile[16];
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
s.integer(signature);
|
|
|
|
s.integer(version);
|
2012-04-29 06:16:44 +00:00
|
|
|
s.array(hash);
|
2010-08-09 13:28:56 +00:00
|
|
|
s.array(description);
|
2011-09-15 12:41:49 +00:00
|
|
|
s.array(profile);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
if(signature != 0x31545342) return false;
|
|
|
|
if(version != Info::SerializerVersion) return false;
|
2010-08-20 13:01:32 +00:00
|
|
|
if(strcmp(profile, Info::Profile)) return false;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2011-10-27 13:30:19 +00:00
|
|
|
power();
|
2010-08-09 13:28:56 +00:00
|
|
|
serialize_all(s);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//========
|
|
|
|
//internal
|
|
|
|
//========
|
|
|
|
|
|
|
|
void System::serialize(serializer &s) {
|
|
|
|
s.integer((unsigned&)region);
|
|
|
|
s.integer((unsigned&)expansion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void System::serialize_all(serializer &s) {
|
|
|
|
cartridge.serialize(s);
|
|
|
|
system.serialize(s);
|
2011-03-20 13:57:55 +00:00
|
|
|
random.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
cpu.serialize(s);
|
|
|
|
smp.serialize(s);
|
|
|
|
ppu.serialize(s);
|
|
|
|
dsp.serialize(s);
|
|
|
|
|
Update to v088r11 release.
byuu says:
Changelog:
- phoenix has added Window::setModal(bool modal = true);
- file dialog is now modal. This allows emulation cores to request data
and get it immediately before continuing the loading process
- save data is hooked up for most systems, still need to handle
subsystem slot saves (Sufami Turbo, basically.)
- toggle fullscreen key binding added (Alt+Enter for now. I think F11 is
probably better though, Enter is often mapped to game start button.)
- video scaling is in (center, scale, stretch), works the same in
windowed and fullscreen mode (stretch hides resize window option), all
in the settings menu now
- enough structure to map all saved paths for the browser and to load
BS-X slotted carts, BS-X carts, single Sufami Turbo carts
Caveats / Missing:
- Super Game Boy input doesn't work yet (due to change in callback
binding)
- doesn't load secondary Sufami Turbo slot yet
- BS-X BIOS isn't show the data pack games to load for some reason (ugh,
I hate the shit out of debugging BS-X stuff ...)
- need mute audio, sync audio+video toggle, save/load state menu and
quick keys, XML mapping information window
- need cheat editor and cheat database
- need state manager
- need to sort subsystems below main systems in load menu (basically
just see if media.slot.size() > 0)
- need video shaders (will probably leave off filters for the time being
... due to that 24/30-bit thing)
- need video adjustments (contrast etc, overscan masks)
- need audio adjustments (frequency, latency, resampler, volume,
per-system frequency)
- need driver selection and input focus policy (driver crash detection
would be nice too)
- need NSS DIP switch settings (that one will be really fun)
- need to save and load window geometry settings
- need to hook up controller selection (won't be fun), create a map to
hide controllers with no inputs to reassign
2012-05-03 12:36:47 +00:00
|
|
|
if(cartridge.has_gb_slot()) icd2.serialize(s);
|
2012-05-12 02:34:35 +00:00
|
|
|
if(cartridge.has_bs_cart()) bsxcartridge.serialize(s);
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
if(cartridge.has_event()) event.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
if(cartridge.has_sa1()) sa1.serialize(s);
|
2012-05-22 12:10:00 +00:00
|
|
|
if(cartridge.has_superfx()) superfx.serialize(s);
|
2012-02-26 07:59:44 +00:00
|
|
|
if(cartridge.has_armdsp()) armdsp.serialize(s);
|
2012-05-22 12:10:00 +00:00
|
|
|
if(cartridge.has_hitachidsp()) hitachidsp.serialize(s);
|
|
|
|
if(cartridge.has_necdsp()) necdsp.serialize(s);
|
|
|
|
if(cartridge.has_epsonrtc()) epsonrtc.serialize(s);
|
|
|
|
if(cartridge.has_sharprtc()) sharprtc.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
if(cartridge.has_spc7110()) spc7110.serialize(s);
|
2012-05-22 12:10:00 +00:00
|
|
|
if(cartridge.has_sdd1()) sdd1.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
if(cartridge.has_obc1()) obc1.serialize(s);
|
2012-11-02 10:37:38 +00:00
|
|
|
if(cartridge.has_hsu1()) hsu1.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
if(cartridge.has_msu1()) msu1.serialize(s);
|
2013-01-21 12:27:15 +00:00
|
|
|
if(cartridge.has_st_slots()) sufamiturboA.serialize(s), sufamiturboB.serialize(s);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
Update to v073r03 release.
byuu says:
Changelog:
- much tighter SGB integration, but this is still a work-in-progress
- memory::gb(rom,ram,rtc) is gone, uses GameBoy:: memory structures
directly (a big gain, no need to copy memory to save and load)
- UI-based cartridge loading works with GameBoy:: directly as well
- libsnes will need to be updated internally to reflect this
- games can save and load (even before bgameboy can, hah)
- save states hooked up, but they crash the DMG. I don't know why, as
if it was hard enough saving states with libco, try doing it for an
emulator inside an emulator >_<
- last remnants of old SGB stuff removed, <sueprgameboy> XML converted
to <icd2>
- looks like the XML list idea is looking pretty useless for
SNES::Cartridge now that bgameboy handles its own XML mapping
2011-01-08 10:06:09 +00:00
|
|
|
//perform dry-run state save:
|
2010-08-09 13:28:56 +00:00
|
|
|
//determines exactly how many bytes are needed to save state for this cartridge,
|
|
|
|
//as amount varies per game (eg different RAM sizes, special chips, etc.)
|
|
|
|
void System::serialize_init() {
|
|
|
|
serializer s;
|
|
|
|
|
2012-04-29 06:16:44 +00:00
|
|
|
unsigned signature = 0, version = 0;
|
|
|
|
char hash[64], profile[16], description[512];
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
s.integer(signature);
|
|
|
|
s.integer(version);
|
2012-04-29 06:16:44 +00:00
|
|
|
s.array(hash);
|
2010-08-20 13:01:32 +00:00
|
|
|
s.array(profile);
|
2010-08-09 13:28:56 +00:00
|
|
|
s.array(description);
|
|
|
|
|
|
|
|
serialize_all(s);
|
|
|
|
serialize_size = s.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|