// 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;
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);
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);
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()
}
}
-#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);
}
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) {