comparison genesis.c @ 1636:d2775a242dc6

Make sure M68K sync and target cycles are updated after loading a savestate. Fixes an issue in which loading a savestate would result in things being unresponsive until emulation cycle caught up to whatever the pre-state load sync cycle was
author Mike Pavone <pavone@retrodev.com>
date Sun, 11 Nov 2018 11:33:38 -0800
parents c4ba3177b72d
children 3602f3b20072
comparison
equal deleted inserted replaced
1635:022d01b64496 1636:d2775a242dc6
125 gen->z80->reset = load_int8(buf); 125 gen->z80->reset = load_int8(buf);
126 gen->z80->busreq = load_int8(buf); 126 gen->z80->busreq = load_int8(buf);
127 gen->z80->bank_reg = load_int16(buf) & 0x1FF; 127 gen->z80->bank_reg = load_int16(buf) & 0x1FF;
128 } 128 }
129 129
130 static void adjust_int_cycle(m68k_context * context, vdp_context * v_context);
130 void genesis_deserialize(deserialize_buffer *buf, genesis_context *gen) 131 void genesis_deserialize(deserialize_buffer *buf, genesis_context *gen)
131 { 132 {
132 register_section_handler(buf, (section_handler){.fun = m68k_deserialize, .data = gen->m68k}, SECTION_68000); 133 register_section_handler(buf, (section_handler){.fun = m68k_deserialize, .data = gen->m68k}, SECTION_68000);
133 register_section_handler(buf, (section_handler){.fun = z80_deserialize, .data = gen->z80}, SECTION_Z80); 134 register_section_handler(buf, (section_handler){.fun = z80_deserialize, .data = gen->z80}, SECTION_Z80);
134 register_section_handler(buf, (section_handler){.fun = vdp_deserialize, .data = gen->vdp}, SECTION_VDP); 135 register_section_handler(buf, (section_handler){.fun = vdp_deserialize, .data = gen->vdp}, SECTION_VDP);
144 while (buf->cur_pos < buf->size) 145 while (buf->cur_pos < buf->size)
145 { 146 {
146 load_section(buf); 147 load_section(buf);
147 } 148 }
148 update_z80_bank_pointer(gen); 149 update_z80_bank_pointer(gen);
150 adjust_int_cycle(gen->m68k, gen->vdp);
149 } 151 }
150 152
151 uint16_t read_dma_value(uint32_t address) 153 uint16_t read_dma_value(uint32_t address)
152 { 154 {
153 genesis_context *genesis = (genesis_context *)current_system; 155 genesis_context *genesis = (genesis_context *)current_system;