#define STATE_VERSION 1
-void LS393::save_state(FILEIO* state_fio)
+bool LS393::process_state(FILEIO* state_fio, bool loading)
{
- state_fio->FputUint32(STATE_VERSION);
- state_fio->FputInt32(this_device_id);
-
- state_fio->FputUint32(count);
- state_fio->FputBool(prev_in);
-}
-
-bool LS393::load_state(FILEIO* state_fio)
-{
- if(state_fio->FgetUint32() != STATE_VERSION) {
- return false;
- }
- if(state_fio->FgetInt32() != this_device_id) {
- return false;
- }
- count = state_fio->FgetUint32();
- prev_in = state_fio->FgetBool();
- return true;
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+ return false;
+ }
+ if(!state_fio->StateCheckInt32(this_device_id)) {
+ return false;
+ }
+ state_fio->StateUint32(count);
+ state_fio->StateBool(prev_in);
+ return true;
}