• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

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


Commit MetaInfo

Revisione3782e259b70fd96b83e4fee51955f69c2d9b5ef (tree)
Time2018-05-31 04:37:04
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[VM][MSX][STATE] Add new state feature.
[VM][MZ700][STATE] Add new state feature.
[VM][MZ2500][STATE] Add new state feature.
[VM][MZ80K][STATE] Add new state feature.
[VM][PCENGINE][STATE] Add new state feature.

Change Summary

Incremental Difference

--- a/source/src/vm/msx/msx_ex.cpp
+++ b/source/src/vm/msx/msx_ex.cpp
@@ -340,6 +340,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
340340 for(DEVICE* device = first_device; device; device = device->next_device) {
341341 device->initialize();
342342 }
343+ decl_state();
343344 }
344345
345346 VM::~VM()
@@ -640,10 +641,22 @@ void VM::update_config()
640641
641642 #define STATE_VERSION 5
642643
644+#include "../../statesub.h"
645+
646+void VM::decl_state(void)
647+{
648+ state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::MSX_SERIES_HEAD")));
649+ for(DEVICE* device = first_device; device; device = device->next_device) {
650+ device->decl_state();
651+ }
652+}
653+
643654 void VM::save_state(FILEIO* state_fio)
644655 {
645- state_fio->FputUint32(STATE_VERSION);
646-
656+ //state_fio->FputUint32(STATE_VERSION);
657+ if(state_entry != NULL) {
658+ state_entry->save_state(state_fio);
659+ }
647660 for(DEVICE* device = first_device; device; device = device->next_device) {
648661 device->save_state(state_fio);
649662 }
@@ -651,7 +664,15 @@ void VM::save_state(FILEIO* state_fio)
651664
652665 bool VM::load_state(FILEIO* state_fio)
653666 {
654- if(state_fio->FgetUint32() != STATE_VERSION) {
667+ //if(state_fio->FgetUint32() != STATE_VERSION) {
668+ // return false;
669+ //}
670+ bool mb = false;
671+ if(state_entry != NULL) {
672+ mb = state_entry->load_state(state_fio);
673+ }
674+ if(!mb) {
675+ emu->out_debug_log("INFO: HEADER DATA ERROR");
655676 return false;
656677 }
657678 for(DEVICE* device = first_device; device; device = device->next_device) {
--- a/source/src/vm/msx/msx_ex.h
+++ b/source/src/vm/msx/msx_ex.h
@@ -213,6 +213,7 @@ static const _TCHAR *sound_device_caption[] = {
213213 };
214214 #endif
215215
216+class csp_state_utils;
216217 class EMU;
217218 class DEVICE;
218219 class EVENT;
@@ -282,6 +283,7 @@ class VM
282283 {
283284 protected:
284285 EMU* emu;
286+ csp_state_utils* state_entry;
285287
286288 // devices
287289 EVENT* event;
@@ -419,6 +421,7 @@ public:
419421 bool is_frame_skippable();
420422
421423 void update_config();
424+ void decl_state();
422425 void save_state(FILEIO* state_fio);
423426 bool load_state(FILEIO* state_fio);
424427
--- a/source/src/vm/mz2500/mz2500.cpp
+++ b/source/src/vm/mz2500/mz2500.cpp
@@ -238,6 +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();
241242 for(int drv = 0; drv < USE_HARD_DISK; drv++) {
242243 #if defined(OPEN_HARD_DISK_IN_RESET)
243244 create_local_path(hd_file_path[drv], _MAX_PATH, _T("SASI%d.DAT"), drv);
--- a/source/src/vm/mz2500/mz80b.cpp
+++ b/source/src/vm/mz2500/mz80b.cpp
@@ -251,11 +251,11 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
251251 io->set_iowait_range_rw(0xd8, 0xdf, 1);
252252 io->set_iowait_range_rw(0xe8, 0xeb, 1);
253253
254- decl_state();
255254 // initialize all devices
256255 for(DEVICE* device = first_device; device; device = device->next_device) {
257256 device->initialize();
258257 }
258+ decl_state();
259259 }
260260
261261 VM::~VM()
--- a/source/src/vm/mz700/mz700.cpp
+++ b/source/src/vm/mz700/mz700.cpp
@@ -716,11 +716,12 @@ bool VM::load_state(FILEIO* state_fio)
716716 mb = state_entry->load_state(state_fio);
717717 }
718718 if(!mb) {
719- emu->out_debug_log("INFO: HEADER DATA ERROR");
719+ printf("INFO: HEADER DATA ERROR\n");
720720 return false;
721721 }
722722 for(DEVICE* device = first_device; device; device = device->next_device) {
723723 if(!device->load_state(state_fio)) {
724+ printf("INFO: DATA ERROR at DEVID=%d\n", device->this_device_id);
724725 return false;
725726 }
726727 }
--- a/source/src/vm/mz80k/mz80k.cpp
+++ b/source/src/vm/mz80k/mz80k.cpp
@@ -182,6 +182,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
182182 for(DEVICE* device = first_device; device; device = device->next_device) {
183183 device->initialize();
184184 }
185+ decl_state();
185186 }
186187
187188 VM::~VM()
--- a/source/src/vm/pcengine/pcengine.cpp
+++ b/source/src/vm/pcengine/pcengine.cpp
@@ -85,6 +85,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
8585 for(DEVICE* device = first_device; device; device = device->next_device) {
8686 device->initialize();
8787 }
88+ decl_state();
8889 }
8990
9091 VM::~VM()
@@ -242,10 +243,23 @@ void VM::update_config()
242243
243244 #define STATE_VERSION 2
244245
246+#include "../../statesub.h"
247+
248+void VM::decl_state(void)
249+{
250+ state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::PC_ENGINE_HEAD")));
251+ for(DEVICE* device = first_device; device; device = device->next_device) {
252+ device->decl_state();
253+ }
254+}
255+
245256 void VM::save_state(FILEIO* state_fio)
246257 {
247- state_fio->FputUint32(STATE_VERSION);
258+ //state_fio->FputUint32(STATE_VERSION);
248259
260+ if(state_entry != NULL) {
261+ state_entry->save_state(state_fio);
262+ }
249263 for(DEVICE* device = first_device; device; device = device->next_device) {
250264 device->save_state(state_fio);
251265 }
@@ -253,7 +267,15 @@ void VM::save_state(FILEIO* state_fio)
253267
254268 bool VM::load_state(FILEIO* state_fio)
255269 {
256- if(state_fio->FgetUint32() != STATE_VERSION) {
270+ //if(state_fio->FgetUint32() != STATE_VERSION) {
271+ // return false;
272+ //}
273+ bool mb = false;
274+ if(state_entry != NULL) {
275+ mb = state_entry->load_state(state_fio);
276+ }
277+ if(!mb) {
278+ emu->out_debug_log("INFO: HEADER DATA ERROR");
257279 return false;
258280 }
259281 for(DEVICE* device = first_device; device; device = device->next_device) {
--- a/source/src/vm/pcengine/pcengine.h
+++ b/source/src/vm/pcengine/pcengine.h
@@ -66,6 +66,7 @@ static const _TCHAR *joy_button_captions[] = {
6666 };
6767 #endif
6868
69+class csp_state_utils;
6970 class EMU;
7071 class DEVICE;
7172 class EVENT;
@@ -80,6 +81,7 @@ class VM
8081 {
8182 protected:
8283 EMU* emu;
84+ csp_state_utils* state_entry;
8385
8486 // devices
8587 EVENT* pceevent;
@@ -136,6 +138,7 @@ public:
136138 return false;
137139 }
138140 void update_config();
141+ void decl_state();
139142 void save_state(FILEIO* state_fio);
140143 bool load_state(FILEIO* state_fio);
141144
Show on old repository browser