OSDN Git Service

[VM][PC9801] Enable to build PC-9801 with upstream 2018-10-05.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / floppy.cpp
index 2248ed8..fa2bae8 100644 (file)
@@ -319,43 +319,25 @@ void FLOPPY::event_callback(int event_id, int err)
 
 #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;
 }