#define STATE_VERSION 3
-void SUB::save_state(FILEIO* state_fio)
+bool SUB::process_state(FILEIO* state_fio, bool loading)
{
- state_fio->FputUint32(STATE_VERSION);
- state_fio->FputInt32(this_device_id);
-
- state_fio->Fwrite(ram, sizeof(ram), 1);
- state_fio->Fwrite(vram_chr, sizeof(vram_chr), 1);
- state_fio->Fwrite(vram_gfx, sizeof(vram_gfx), 1);
- state_fio->Fwrite(disp, sizeof(disp), 1);
- state_fio->FputInt32(cblink);
- state_fio->FputBool(crt_400line);
-}
-
-bool SUB::load_state(FILEIO* state_fio)
-{
- if(state_fio->FgetUint32() != STATE_VERSION) {
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
- if(state_fio->FgetInt32() != this_device_id) {
+ if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->Fread(ram, sizeof(ram), 1);
- state_fio->Fread(vram_chr, sizeof(vram_chr), 1);
- state_fio->Fread(vram_gfx, sizeof(vram_gfx), 1);
- state_fio->Fread(disp, sizeof(disp), 1);
- cblink = state_fio->FgetInt32();
- crt_400line = state_fio->FgetBool();
+ state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateBuffer(vram_chr, sizeof(vram_chr), 1);
+ state_fio->StateBuffer(vram_gfx, sizeof(vram_gfx), 1);
+ state_fio->StateBuffer(disp, sizeof(disp), 1);
+ state_fio->StateInt32(cblink);
+ state_fio->StateBool(crt_400line);
return true;
}
-