X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fmz700%2Ffloppy.cpp;h=93069ca1858844933f59f91bba747e1adefc2ca3;hb=411218144c2e1cc0f97b53d8469bed1325de05c2;hp=5412a8d3303d7583904aacf660396a0850094540;hpb=59fc5b4623a08b55dbe3d82782d533a3144be0e9;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/mz700/floppy.cpp b/source/src/vm/mz700/floppy.cpp index 5412a8d33..93069ca18 100644 --- a/source/src/vm/mz700/floppy.cpp +++ b/source/src/vm/mz700/floppy.cpp @@ -96,29 +96,67 @@ void FLOPPY::write_signal(int id, uint32_t data, uint32_t mask) #define STATE_VERSION 1 +#include "../../statesub.h" + +void FLOPPY::decl_state() +{ + enter_decl_state(STATE_VERSION); + + DECL_STATE_ENTRY_UINT32(prev_dc); + DECL_STATE_ENTRY_INT32(register_id); + DECL_STATE_ENTRY_BOOL(motor_on); + DECL_STATE_ENTRY_BOOL(irq_enabled); + + leave_decl_state(); +} + void FLOPPY::save_state(FILEIO* state_fio) { - state_fio->FputUint32(STATE_VERSION); - state_fio->FputInt32(this_device_id); + if(state_entry != NULL) { + state_entry->save_state(state_fio); + } +// state_fio->FputUint32(STATE_VERSION); +// state_fio->FputInt32(this_device_id); - state_fio->FputUint32(prev_dc); - state_fio->FputInt32(register_id); - state_fio->FputBool(motor_on); - state_fio->FputBool(irq_enabled); +// state_fio->FputUint32(prev_dc); +// state_fio->FputInt32(register_id); +// state_fio->FputBool(motor_on); +// state_fio->FputBool(irq_enabled); } bool FLOPPY::load_state(FILEIO* state_fio) { - if(state_fio->FgetUint32() != STATE_VERSION) { - return false; + bool mb = false; + if(state_entry != NULL) { + mb = state_entry->load_state(state_fio); } - if(state_fio->FgetInt32() != this_device_id) { + if(!mb) { return false; } - prev_dc = state_fio->FgetUint32(); - register_id = state_fio->FgetInt32(); - motor_on = state_fio->FgetBool(); - irq_enabled = state_fio->FgetBool(); +// if(state_fio->FgetUint32() != STATE_VERSION) { +// return false; +// } +// if(state_fio->FgetInt32() != this_device_id) { +// return false; +// } +// prev_dc = state_fio->FgetUint32(); +// register_id = state_fio->FgetInt32(); +// motor_on = state_fio->FgetBool(); +// irq_enabled = state_fio->FgetBool(); return true; } +bool FLOPPY::process_state(FILEIO* state_fio, bool loading) +{ + if(!state_fio->StateCheckUint32(STATE_VERSION)) { + return false; + } + if(!state_fio->StateCheckInt32(this_device_id)) { + return false; + } + state_fio->StateUint32(prev_dc); + state_fio->StateInt32(register_id); + state_fio->StateBool(motor_on); + state_fio->StateBool(irq_enabled); + return true; +}