OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / jr800 / io.cpp
index 37b0e98..fcbd6f3 100644 (file)
@@ -8,9 +8,11 @@
        [ memory mapped i/o ]
 */
 
-#include "io.h"
+#include "./io.h"
 #include "../hd44102.h"
 
+namespace JR800 {
+
 void IO::write_memory_mapped_io8(uint32_t addr, uint32_t data)
 {
        int chip = 0;
@@ -164,39 +166,15 @@ uint32_t IO::read_memory_mapped_io8(uint32_t addr)
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void IO::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-       
-       leave_decl_state();
-}
-
-void IO::save_state(FILEIO* state_fio)
+bool IO::process_state(FILEIO* state_fio, bool loading)
 {
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-}
-
-bool IO::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+               return false;
        }
-       if(!mb) {
+       if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
        return true;
 }
 
+}