X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fmz2800%2Fmz2800.cpp;h=7e10273e52630bc01348577028d3537cc382604b;hb=90a1d498c79c26d69c78435600856b152aa07291;hp=5fa1225ebb8b9ce82e48b4fa322614e3af3d5630;hpb=5f6cf75c70fc5720b528fb655988b7b863700614;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/mz2800/mz2800.cpp b/source/src/vm/mz2800/mz2800.cpp index 5fa1225eb..7e10273e5 100644 --- a/source/src/vm/mz2800/mz2800.cpp +++ b/source/src/vm/mz2800/mz2800.cpp @@ -50,7 +50,7 @@ // initialize // ---------------------------------------------------------------------------- -VM::VM(EMU* parent_emu) : emu(parent_emu) +VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) { // create devices first_device = last_device = NULL; @@ -107,7 +107,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) pio0->set_context_port_c(crtc, SIG_CRTC_MASK, 0x01, 0); pio0->set_context_port_c(pcm, SIG_PCM1BIT_SIGNAL, 0x04, 0); // Sound:: Force realtime rendering. This is temporally fix. 20161024 K.O - pcm->set_realtime_render(true); + //pcm->set_realtime_render(true); pic->set_context_cpu(cpu); @@ -141,16 +141,16 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) keyboard->set_context_pio1(pio1); memory->set_context_crtc(crtc); mouse->set_context_sio(sio); - if(config.printer_device_type == 0) { + if(config.printer_type == 0) { PRNFILE *prnfile = new PRNFILE(this, emu); prnfile->set_context_busy(not_busy, SIG_NOT_INPUT, 1); printer->set_context_prn(prnfile); - } else if(config.printer_device_type == 1) { + } else if(config.printer_type == 1) { MZ1P17 *mz1p17 = new MZ1P17(this, emu); mz1p17->mode = MZ1P17_MODE_MZ1; mz1p17->set_context_busy(not_busy, SIG_NOT_INPUT, 1); printer->set_context_prn(mz1p17); -// } else if(config.printer_device_type == 2) { +// } else if(config.printer_type == 2) { // PCPR201 *pcpr201 = new PCPR201(this, emu); // pcpr201->set_context_busy(not_busy, SIG_NOT_INPUT, 1); // printer->set_context_prn(pcpr201); @@ -213,9 +213,13 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) io->set_iomap_single_rw(0x274, memory); // initialize all devices +#if defined(__GIT_REPO_VERSION) + strncpy(_git_revision, __GIT_REPO_VERSION, sizeof(_git_revision) - 1); +#endif for(DEVICE* device = first_device; device; device = device->next_device) { device->initialize(); } + decl_state(); } VM::~VM() @@ -379,12 +383,27 @@ void VM::update_config() } } -#define STATE_VERSION 3 +#define STATE_VERSION 4 + +#include "../../statesub.h" +#include "../../qt/gui/csp_logger.h" +extern CSP_Logger DLL_PREFIX_I *csp_logger; + +void VM::decl_state(void) +{ + state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::MZ_2800_HEAD")), csp_logger); + for(DEVICE* device = first_device; device; device = device->next_device) { + device->decl_state(); + } +} void VM::save_state(FILEIO* state_fio) { - state_fio->FputUint32(STATE_VERSION); + //state_fio->FputUint32(STATE_VERSION); + if(state_entry != NULL) { + state_entry->save_state(state_fio); + } for(DEVICE* device = first_device; device; device = device->next_device) { device->save_state(state_fio); } @@ -392,7 +411,15 @@ void VM::save_state(FILEIO* state_fio) bool VM::load_state(FILEIO* state_fio) { - if(state_fio->FgetUint32() != STATE_VERSION) { + //if(state_fio->FgetUint32() != STATE_VERSION) { + // return false; + //} + bool mb = false; + if(state_entry != NULL) { + mb = state_entry->load_state(state_fio); + } + if(!mb) { + emu->out_debug_log("INFO: HEADER DATA ERROR"); return false; } for(DEVICE* device = first_device; device; device = device->next_device) {