#define STATE_VERSION 1
-#include "../statesub.h"
-
-void CMT::decl_state()
-{
- enter_decl_state(STATE_VERSION);
-
- DECL_STATE_ENTRY_INT32(bufcnt);
- DECL_STATE_ENTRY_1D_ARRAY(buffer, sizeof(buffer));
- DECL_STATE_ENTRY_BOOL(play);
- DECL_STATE_ENTRY_BOOL(rec);
- DECL_STATE_ENTRY_BOOL(remote);
-
- leave_decl_state();
-}
-
-void CMT::save_state(FILEIO* state_fio)
+bool CMT::process_state(FILEIO* state_fio, bool loading)
{
- if(state_entry != NULL) {
- state_entry->save_state(state_fio);
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+ return false;
}
-// state_fio->FputUint32(STATE_VERSION);
-// state_fio->FputInt32(this_device_id);
-
-// state_fio->FputInt32(bufcnt);
-// state_fio->Fwrite(buffer, sizeof(buffer), 1);
-// state_fio->FputBool(play);
-// state_fio->FputBool(rec);
-// state_fio->FputBool(remote);
-}
-
-bool CMT::load_state(FILEIO* state_fio)
-{
- bool mb = false;
- if(state_entry != NULL) {
- mb = state_entry->load_state(state_fio);
+ if(!state_fio->StateCheckInt32(this_device_id)) {
+ return false;
}
- if(!mb) return false;
-// if(state_fio->FgetUint32() != STATE_VERSION) {
-// return false;
-// }
-// if(state_fio->FgetInt32() != this_device_id) {
-// return false;
-// }
-// bufcnt = state_fio->FgetInt32();
-// state_fio->Fread(buffer, sizeof(buffer), 1);
-// play = state_fio->FgetBool();
-// rec = state_fio->FgetBool();
-// remote = state_fio->FgetBool();
+ state_fio->StateInt32(bufcnt);
+ state_fio->StateBuffer(buffer, sizeof(buffer), 1);
+ state_fio->StateBool(play);
+ state_fio->StateBool(rec);
+ state_fio->StateBool(remote);
return true;
}