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 / cmt.cpp
index bbc1e6c..4196372 100644 (file)
@@ -106,31 +106,19 @@ void CMT::release_tape()
 
 #define STATE_VERSION  1
 
-void CMT::save_state(FILEIO* state_fio)
+bool CMT::process_state(FILEIO* state_fio, bool loading)
 {
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-       state_fio->FputInt32(bufcnt);
-       state_fio->Fwrite(buffer, sizeof(buffer), 1);
-       state_fio->FputBool(play);
-       state_fio->FputBool(rec);
-       state_fio->FputBool(remote);
-}
-
-bool CMT::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;
        }
-       bufcnt = state_fio->FgetInt32();
-       state_fio->Fread(buffer, sizeof(buffer), 1);
-       play = state_fio->FgetBool();
-       rec = state_fio->FgetBool();
-       remote = state_fio->FgetBool();
+       state_fio->StateInt32(bufcnt);
+       state_fio->StateBuffer(buffer, sizeof(buffer), 1);
+       state_fio->StateBool(play);
+       state_fio->StateBool(rec);
+       state_fio->StateBool(remote);
        return true;
 }