OSDN Git Service

[VM] MEMORY:: class within some VM will change Foo_MEMORY:: to reduce misundestanding...
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmr50 / cmos.cpp
index f59359b..847c18e 100644 (file)
@@ -68,56 +68,16 @@ uint32_t CMOS::read_io8(uint32_t addr)
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void CMOS::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-#ifdef _FMRCARD
-       DECL_STATE_ENTRY_2D_ARRAY(cmos, 4, 0x800);
-#else
-       DECL_STATE_ENTRY_2D_ARRAY(cmos, 1, 0x800);
-#endif
-       DECL_STATE_ENTRY_BOOL(modified);
-       DECL_STATE_ENTRY_UINT8(bank);
-
-       leave_decl_state();
-}
-
-void CMOS::save_state(FILEIO* state_fio)
+bool CMOS::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->Fwrite(cmos, sizeof(cmos), 1);
-//     state_fio->FputBool(modified);
-//     state_fio->FputUint8(bank);
-}
-
-bool CMOS::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;
-//     }
-//     state_fio->Fread(cmos, sizeof(cmos), 1);
-//     modified = state_fio->FgetBool();
-//     bank = state_fio->FgetUint8();
+       state_fio->StateBuffer(cmos, sizeof(cmos), 1);
+       state_fio->StateBool(modified);
+       state_fio->StateUint8(bank);
        return true;
 }
-