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 14b5108..510b326 100644 (file)
@@ -9,20 +9,22 @@
 
 #include "joystick.h"
 
+namespace MZ2800 {
+
 void JOYSTICK::initialize()
 {
        mode = 0xf;
-       joy_stat = emu->joy_buffer();
+       joy_stat = emu->get_joy_buffer();
 }
 
-void JOYSTICK::write_io8(uint32 addr, uint32 data)
+void JOYSTICK::write_io8(uint32_t addr, uint32_t data)
 {
        mode = data;
 }
 
-uint32 JOYSTICK::read_io8(uint32 addr)
+uint32_t JOYSTICK::read_io8(uint32_t addr)
 {
-       uint32 val = 0x3f;
+       uint32_t val = 0x3f;
        int num = (mode & 0x40) ? 1 : 0;
        bool dir = true;
        
@@ -53,23 +55,16 @@ uint32 JOYSTICK::read_io8(uint32 addr)
 
 #define STATE_VERSION  2
 
-void JOYSTICK::save_state(FILEIO* 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 JOYSTICK::process_state(FILEIO* state_fio, bool loading)
 {
-       if(state_fio->FgetUint32() != STATE_VERSION) {
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
-       if(state_fio->FgetInt32() != this_device_id) {
+       if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       mode = state_fio->FgetUint32();
+       state_fio->StateUint32(mode);
        return true;
 }
 
+}