OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2800 / joystick.cpp
index d8b9912..510b326 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "joystick.h"
 
+namespace MZ2800 {
+
 void JOYSTICK::initialize()
 {
        mode = 0xf;
@@ -53,44 +55,16 @@ uint32_t JOYSTICK::read_io8(uint32_t addr)
 
 #define STATE_VERSION  2
 
-#include "../../statesub.h"
-
-void JOYSTICK::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_UINT32(mode);
-       
-       leave_decl_state();
-}
-
-void JOYSTICK::save_state(FILEIO* state_fio)
+bool JOYSTICK::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);
-       
-//     state_fio->FputUint32(mode);
-}
-
-bool JOYSTICK::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;
-//     }
-//     mode = state_fio->FgetUint32();
+       state_fio->StateUint32(mode);
        return true;
 }
 
+}