#define STATE_VERSION 1
-void FLOPPY::save_state(FILEIO* state_fio)
+bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
{
- state_fio->FputUint32(STATE_VERSION);
- state_fio->FputInt32(this_device_id);
-
-#if defined(SUPPORT_2HD_FDD_IF)
- state_fio->FputUint8(ctrlreg_2hd);
-#endif
-#if defined(SUPPORT_2DD_FDD_IF)
- state_fio->FputUint8(ctrlreg_2dd);
-#endif
-#if defined(SUPPORT_2HD_2DD_FDD_IF)
- state_fio->FputUint8(ctrlreg);
- state_fio->FputUint8(modereg);
-#endif
- state_fio->FputInt32(timer_id);
-}
-
-bool FLOPPY::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;
}
#if defined(SUPPORT_2HD_FDD_IF)
- ctrlreg_2hd = state_fio->FgetUint8();
+ state_fio->StateUint8(ctrlreg_2hd);
#endif
#if defined(SUPPORT_2DD_FDD_IF)
- ctrlreg_2dd = state_fio->FgetUint8();
+ state_fio->StateUint8(ctrlreg_2dd);
#endif
#if defined(SUPPORT_2HD_2DD_FDD_IF)
- ctrlreg = state_fio->FgetUint8();
- modereg = state_fio->FgetUint8();
+ state_fio->StateUint8(ctrlreg);
+ state_fio->StateUint8(modereg);
#endif
- timer_id = state_fio->FgetInt32();
+ state_fio->StateInt32(timer_id);
return true;
}