OSDN Git Service

[VM][STATE][WIP] Apply process_state() to some devices.
[csp-qt/common_source_project-fm7.git] / source / src / vm / ls393.cpp
index ca231fe..632594c 100644 (file)
@@ -29,25 +29,16 @@ void LS393::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  1
 
-void LS393::save_state(FILEIO* state_fio)
+bool LS393::process_state(FILEIO* state_fio, bool loading)
 {
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-       state_fio->FputUint32(count);
-       state_fio->FputBool(prev_in);
-}
-
-bool LS393::load_state(FILEIO* state_fio)
-{
-       if(state_fio->FgetUint32() != STATE_VERSION) {
-               return false;
-       }
-       if(state_fio->FgetInt32() != this_device_id) {
-               return false;
-       }
-       count = state_fio->FgetUint32();
-       prev_in = state_fio->FgetBool();
-       return true;
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+               return false;
+       }
+       if(!state_fio->StateCheckInt32(this_device_id)) {
+               return false;
+       }
+       state_fio->StateUint32(count);
+       state_fio->StateBool(prev_in);
+       return true;
 }