set_busy(true);
// wait 1sec and finish printing
-//#ifdef SUPPORT_VARIABLE_TIMING
-// wait_frames = (int)(vm->get_frame_rate() * 1.0 + 0.5);
-//#else
-// wait_frames = (int)(FRAMES_PER_SEC * 1.0 + 0.5);
-//#endif
- wait_frames = (int)(osd->vm_frame_rate() * 1.0 + 0.5);
+ wait_frames = (int)(vm->get_frame_rate() * 1.0 + 0.5);
}
} else if(id == SIG_PRINTER_RESET) {
bool new_res = ((data & mask) != 0);
#define STATE_VERSION 2
-void PRNFILE::save_state(FILEIO* state_fio)
-{
- state_fio->FputUint32(STATE_VERSION);
- state_fio->FputInt32(this_device_id);
-
- state_fio->FputInt32(value);
- state_fio->FputInt32(busy_id);
- state_fio->FputInt32(ack_id);
- state_fio->FputBool(strobe);
- state_fio->FputBool(res);
- state_fio->FputBool(busy);
- state_fio->FputBool(ack);
-}
-
-bool PRNFILE::load_state(FILEIO* state_fio)
+bool PRNFILE::process_state(FILEIO* state_fio, bool loading)
{
- close_file();
-
- if(state_fio->FgetUint32() != STATE_VERSION) {
- return false;
+ if(loading) {
+ //close_file();
}
- if(state_fio->FgetInt32() != this_device_id) {
- return false;
- }
- value = state_fio->FgetInt32();
- busy_id = state_fio->FgetInt32();
- ack_id = state_fio->FgetInt32();
- strobe = state_fio->FgetBool();
- res = state_fio->FgetBool();
- busy = state_fio->FgetBool();
- ack = state_fio->FgetBool();
- // post process
- wait_frames = -1;
- return true;
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+ return false;
+ }
+ if(!state_fio->StateCheckInt32(this_device_id)) {
+ return false;
+ }
+ state_fio->StateInt32(value);
+ state_fio->StateInt32(busy_id);
+ state_fio->StateInt32(ack_id);
+ state_fio->StateBool(strobe);
+ state_fio->StateBool(res);
+ state_fio->StateBool(busy);
+ state_fio->StateBool(ack);
+
+ // post process
+ if(loading) {
+ wait_frames = -1;
+ }
+ return true;
}