#define STATE_VERSION 2
+#include "../../statesub.h"
+
+void MZ1E30::decl_state()
+{
+ enter_decl_state(STATE_VERSION);
+
+ DECL_STATE_ENTRY_UINT32(rom_address);
+ DECL_STATE_ENTRY_BOOL(irq_status);
+ DECL_STATE_ENTRY_BOOL(drq_status);
+
+ leave_decl_state();
+}
+
void MZ1E30::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(rom_address);
- state_fio->FputBool(irq_status);
- state_fio->FputBool(drq_status);
+// state_fio->FputUint32(rom_address);
+// state_fio->FputBool(irq_status);
+// state_fio->FputBool(drq_status);
}
bool MZ1E30::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;
}
- rom_address = state_fio->FgetUint32();
- irq_status = state_fio->FgetBool();
- drq_status = state_fio->FgetBool();
+// if(state_fio->FgetUint32() != STATE_VERSION) {
+// return false;
+// }
+// if(state_fio->FgetInt32() != this_device_id) {
+// return false;
+// }
+// rom_address = state_fio->FgetUint32();
+// irq_status = state_fio->FgetBool();
+// drq_status = state_fio->FgetBool();
return true;
}
+bool MZ1E30::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(rom_address);
+ state_fio->StateBool(irq_status);
+ state_fio->StateBool(drq_status);
+ return true;
+}