OSDN Git Service

[General] Tracking to upstream, rev 2015-01-14.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz700 / keyboard.cpp
index 86bb5d3..ddd55e0 100644 (file)
@@ -11,6 +11,7 @@
 \r
 #include "keyboard.h"\r
 #include "../i8255.h"\r
+#include "../../fileio.h"\r
 \r
 static const int key_map[10][8] = {\r
 #if defined(_MZ800)\r
@@ -63,3 +64,25 @@ void KEYBOARD::update_key()
        d_pio->write_signal(SIG_I8255_PORT_B, stat, 0xff);\r
 }\r
 \r
+#define STATE_VERSION  1\r
+\r
+void KEYBOARD::save_state(FILEIO* state_fio)\r
+{\r
+       state_fio->FputUint32(STATE_VERSION);\r
+       state_fio->FputInt32(this_device_id);\r
+       \r
+       state_fio->FputUint8(column);\r
+}\r
+\r
+bool KEYBOARD::load_state(FILEIO* state_fio)\r
+{\r
+       if(state_fio->FgetUint32() != STATE_VERSION) {\r
+               return false;\r
+       }\r
+       if(state_fio->FgetInt32() != this_device_id) {\r
+               return false;\r
+       }\r
+       column = state_fio->FgetUint8();\r
+       return true;\r
+}\r
+\r