#define STATE_VERSION 1
-void IOCTRL::decl_state(FILEIO* state_fio)
+bool IOCTRL::process_state(FILEIO* state_fio, bool loading)
{
- enter_decl_state(STATE_VERSION);
-
- DECL_STATE_ENTRY_BOOL(caps);
- DECL_STATE_ENTRY_BOOL(kana);
- DECL_STATE_ENTRY_FIFO(key_buf);
- DECL_STATE_ENTRY_UINT32(key_val);
- DECL_STATE_ENTRY_UINT32(key_mouse);
- DECL_STATE_ENTRY_INT32(key_prev);
- DECL_STATE_ENTRY_BOOL(key_res);
- DECL_STATE_ENTRY_BOOL(key_done);
- DECL_STATE_ENTRY_INT32(register_id);
- DECL_STATE_ENTRY_UINT8(ts);
-
- leave_decl_state();
-}
-
-
-void IOCTRL::save_state(FILEIO* state_fio)
-{
- 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->FputBool(caps);
-// state_fio->FputBool(kana);
-// key_buf->save_state((void *)state_fio);
-// state_fio->FputUint32(key_val);
-// state_fio->FputUint32(key_mouse);
-// state_fio->FputInt32(key_prev);
-// state_fio->FputBool(key_res);
-// state_fio->FputBool(key_done);
-// state_fio->FputInt32(register_id);
-// state_fio->FputUint8(ts);
-}
-
-bool IOCTRL::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) {
+ state_fio->StateBool(caps);
+ state_fio->StateBool(kana);
+ if(!key_buf->process_state((void *)state_fio, loading)) {
return false;
}
-// if(state_fio->FgetUint32() != STATE_VERSION) {
-// return false;
-// }
-// if(state_fio->FgetInt32() != this_device_id) {
-// return false;
-// }
-// caps = state_fio->FgetBool();
-// kana = state_fio->FgetBool();
-// if(!key_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// key_val = state_fio->FgetUint32();
-// key_mouse = state_fio->FgetUint32();
-// key_prev = state_fio->FgetInt32();
-// key_res = state_fio->FgetBool();
-// key_done = state_fio->FgetBool();
-// register_id = state_fio->FgetInt32();
-// ts = state_fio->FgetUint8();
+ state_fio->StateUint32(key_val);
+ state_fio->StateUint32(key_mouse);
+ state_fio->StateInt32(key_prev);
+ state_fio->StateBool(key_res);
+ state_fio->StateBool(key_done);
+ state_fio->StateInt32(register_id);
+ state_fio->StateUint8(ts);
return true;
}
-