OSDN Git Service

[General] Merge from upstream version, 2015-01-28.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2800 / reset.cpp
index 601fbcd..5faaf08 100644 (file)
@@ -8,6 +8,7 @@
 */
 
 #include "reset.h"
+#include "../../fileio.h"
 
 void RESET::initialize()
 {
@@ -26,3 +27,25 @@ void RESET::write_signal(int id, uint32 data, uint32 mask)
        prev = data & mask;
 }
 
+#define STATE_VERSION  1
+
+void RESET::save_state(FILEIO* state_fio)
+{
+       state_fio->FputUint32(STATE_VERSION);
+       state_fio->FputInt32(this_device_id);
+       
+       state_fio->FputUint8(prev);
+}
+
+bool RESET::load_state(FILEIO* state_fio)
+{
+       if(state_fio->FgetUint32() != STATE_VERSION) {
+               return false;
+       }
+       if(state_fio->FgetInt32() != this_device_id) {
+               return false;
+       }
+       prev = state_fio->FgetUint8();
+       return true;
+}
+