OSDN Git Service

[VM][WIP] Apply some devices merging upstream 2018-10-05.This still not build.WIP.
[csp-qt/common_source_project-fm7.git] / source / src / vm / msm5205.cpp
index 819ecd9..3635c33 100644 (file)
@@ -333,73 +333,25 @@ void MSM5205::set_volume(int ch, int decibel_l, int decibel_r)
 
 #define STATE_VERSION  1
 
-#include "../statesub.h"
-
-void MSM5205::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-       
-       DECL_STATE_ENTRY_INT32(m_mod_clock);
-       DECL_STATE_ENTRY_INT32(m_timer);
-       DECL_STATE_ENTRY_INT32(m_data);
-       DECL_STATE_ENTRY_INT32(m_vclk);
-       DECL_STATE_ENTRY_INT32(m_reset);
-       DECL_STATE_ENTRY_INT32(m_prescaler);
-       DECL_STATE_ENTRY_INT32(m_bitwidth);
-       DECL_STATE_ENTRY_INT32(m_signal);
-       DECL_STATE_ENTRY_INT32(m_step);
-       DECL_STATE_ENTRY_INT32(m_select);
-       DECL_STATE_ENTRY_INT32(volume_m);
-
-       leave_decl_state();
-}
-void MSM5205::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-       
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-//     
-//     state_fio->FputInt32(m_mod_clock);
-//     state_fio->FputInt32(m_timer);
-//     state_fio->FputInt32(m_data);
-//     state_fio->FputInt32(m_vclk);
-//     state_fio->FputInt32(m_reset);
-//     state_fio->FputInt32(m_prescaler);
-//     state_fio->FputInt32(m_bitwidth);
-//     state_fio->FputInt32(m_signal);
-//     state_fio->FputInt32(m_step);
-//     state_fio->FputInt32(m_select);
-//     state_fio->FputInt32(volume_m);
-}
-
-bool MSM5205::load_state(FILEIO* state_fio)
+bool MSM5205::process_state(FILEIO* state_fio, bool loading)
 {
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) return false;
-       
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     m_mod_clock = state_fio->FgetInt32();
-//     m_timer = state_fio->FgetInt32();
-//     m_data = state_fio->FgetInt32();
-//     m_vclk = state_fio->FgetInt32();
-//     m_reset = state_fio->FgetInt32();
-//     m_prescaler = state_fio->FgetInt32();
-//     m_bitwidth = state_fio->FgetInt32();
-//     m_signal = state_fio->FgetInt32();
-//     m_step = state_fio->FgetInt32();
-//     m_select = state_fio->FgetInt32();
-//     volume_m = state_fio->FgetInt32();
-       return true;
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+               return false;
+       }
+       if(!state_fio->StateCheckInt32(this_device_id)) {
+               return false;
+       }
+       state_fio->StateInt32(m_mod_clock);
+       state_fio->StateInt32(m_timer);
+       state_fio->StateInt32(m_data);
+       state_fio->StateInt32(m_vclk);
+       state_fio->StateInt32(m_reset);
+       state_fio->StateInt32(m_prescaler);
+       state_fio->StateInt32(m_bitwidth);
+       state_fio->StateInt32(m_signal);
+       state_fio->StateInt32(m_step);
+       state_fio->StateInt32(m_select);
+       state_fio->StateInt32(volume_m);
+       return true;
 }