• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision89bb3c57cee8fa1474a37291cea34fb5558561fe (tree)
Time2018-07-02 16:47:12
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[VM][STATE][MZ2500] .

Change Summary

Incremental Difference

--- a/source/src/vm/mz2500/cmt.cpp
+++ b/source/src/vm/mz2500/cmt.cpp
@@ -317,55 +317,92 @@ void CMT::close_tape()
317317
318318 #define STATE_VERSION 1
319319
320-void CMT::save_state(FILEIO* state_fio)
320+#include "../../statesub.h"
321+
322+void CMT::decl_state()
321323 {
322- state_fio->FputUint32(STATE_VERSION);
323- state_fio->FputInt32(this_device_id);
324-
325- state_fio->FputUint8(pa);
326- state_fio->FputUint8(pc);
327- state_fio->FputBool(play);
328- state_fio->FputBool(rec);
329- state_fio->FputBool(now_play);
330- state_fio->FputBool(now_rewind);
331- state_fio->FputInt32(register_id_frew);
332- state_fio->FputInt32(register_id_ffwd);
333- state_fio->FputInt32(register_id_fwd);
334- state_fio->FputInt32(register_id_stop);
335- state_fio->FputInt32(register_id_eject);
324+ enter_decl_state(STATE_VERSION);
325+
326+ DECL_STATE_ENTRY_UINT8(pa);
327+ DECL_STATE_ENTRY_UINT8(pc);
328+ DECL_STATE_ENTRY_BOOL(play);
329+ DECL_STATE_ENTRY_BOOL(rec);
330+ DECL_STATE_ENTRY_BOOL(now_play);
331+ DECL_STATE_ENTRY_BOOL(now_rewind);
332+ DECL_STATE_ENTRY_INT32(register_id_frew);
333+ DECL_STATE_ENTRY_INT32(register_id_ffwd);
334+ DECL_STATE_ENTRY_INT32(register_id_fwd);
335+ DECL_STATE_ENTRY_INT32(register_id_stop);
336+ DECL_STATE_ENTRY_INT32(register_id_eject);
336337 #ifndef _MZ80B
337- state_fio->FputInt32(register_id_apss);
338- state_fio->FputBool(now_apss);
339- state_fio->FputBool(now_apss_tmp);
338+ DECL_STATE_ENTRY_INT32(register_id_apss);
339+ DECL_STATE_ENTRY_BOOL(now_apss);
340+ DECL_STATE_ENTRY_BOOL(now_apss_tmp);
340341 #endif
341- state_fio->FputInt32(register_id_ipl);
342+ DECL_STATE_ENTRY_INT32(register_id_ipl);
343+
344+ leave_decl_state();
345+}
346+
347+void CMT::save_state(FILEIO* state_fio)
348+{
349+ if(state_entry != NULL) {
350+ state_entry->save_state(state_fio);
351+ }
352+// state_fio->FputUint32(STATE_VERSION);
353+// state_fio->FputInt32(this_device_id);
354+
355+// state_fio->FputUint8(pa);
356+// state_fio->FputUint8(pc);
357+// state_fio->FputBool(play);
358+// state_fio->FputBool(rec);
359+// state_fio->FputBool(now_play);
360+// state_fio->FputBool(now_rewind);
361+// state_fio->FputInt32(register_id_frew);
362+// state_fio->FputInt32(register_id_ffwd);
363+// state_fio->FputInt32(register_id_fwd);
364+// state_fio->FputInt32(register_id_stop);
365+// state_fio->FputInt32(register_id_eject);
366+//#ifndef _MZ80B
367+// state_fio->FputInt32(register_id_apss);
368+// state_fio->FputBool(now_apss);
369+// state_fio->FputBool(now_apss_tmp);
370+//#endif
371+// state_fio->FputInt32(register_id_ipl);
342372 }
343373
344374 bool CMT::load_state(FILEIO* state_fio)
345375 {
346- if(state_fio->FgetUint32() != STATE_VERSION) {
347- return false;
376+ bool mb = false;
377+ if(state_entry != NULL) {
378+ mb = state_entry->load_state(state_fio);
348379 }
349- if(state_fio->FgetInt32() != this_device_id) {
380+ if(!mb) {
350381 return false;
351382 }
352- pa = state_fio->FgetUint8();
353- pc = state_fio->FgetUint8();
354- play = state_fio->FgetBool();
355- rec = state_fio->FgetBool();
356- now_play = state_fio->FgetBool();
357- now_rewind = state_fio->FgetBool();
358- register_id_frew = state_fio->FgetInt32();
359- register_id_ffwd = state_fio->FgetInt32();
360- register_id_fwd = state_fio->FgetInt32();
361- register_id_stop = state_fio->FgetInt32();
362- register_id_eject = state_fio->FgetInt32();
363-#ifndef _MZ80B
364- register_id_apss = state_fio->FgetInt32();
365- now_apss = state_fio->FgetBool();
366- now_apss_tmp = state_fio->FgetBool();
367-#endif
368- register_id_ipl = state_fio->FgetInt32();
383+// if(state_fio->FgetUint32() != STATE_VERSION) {
384+// return false;
385+// }
386+// if(state_fio->FgetInt32() != this_device_id) {
387+// return false;
388+// }
389+// pa = state_fio->FgetUint8();
390+// pc = state_fio->FgetUint8();
391+// play = state_fio->FgetBool();
392+// rec = state_fio->FgetBool();
393+// now_play = state_fio->FgetBool();
394+// now_rewind = state_fio->FgetBool();
395+// register_id_frew = state_fio->FgetInt32();
396+// register_id_ffwd = state_fio->FgetInt32();
397+// register_id_fwd = state_fio->FgetInt32();
398+// register_id_stop = state_fio->FgetInt32();
399+// register_id_eject = state_fio->FgetInt32();
400+//#ifndef _MZ80B
401+// register_id_apss = state_fio->FgetInt32();
402+// now_apss = state_fio->FgetBool();
403+// now_apss_tmp = state_fio->FgetBool();
404+//#endif
405+// register_id_ipl = state_fio->FgetInt32();
369406 return true;
370407 }
371408
--- a/source/src/vm/mz2500/cmt.h
+++ b/source/src/vm/mz2500/cmt.h
@@ -63,6 +63,7 @@ public:
6363 void reset();
6464 void write_signal(int id, uint32_t data, uint32_t mask);
6565 void event_callback(int event_id, int err);
66+ void decl_state();
6667 void save_state(FILEIO* state_fio);
6768 bool load_state(FILEIO* state_fio);
6869
--- a/source/src/vm/mz2500/mz2500.cpp
+++ b/source/src/vm/mz2500/mz2500.cpp
@@ -238,7 +238,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
238238 for(DEVICE* device = first_device; device; device = device->next_device) {
239239 device->initialize();
240240 }
241- decl_state();
241+
242242 for(int drv = 0; drv < USE_HARD_DISK; drv++) {
243243 #if defined(OPEN_HARD_DISK_IN_RESET)
244244 create_local_path(hd_file_path[drv], _MAX_PATH, _T("SASI%d.DAT"), drv);
@@ -247,6 +247,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
247247 #endif
248248 }
249249 monitor_type = config.monitor_type;
250+ decl_state();
250251 }
251252
252253 VM::~VM()
Show on old repository browser