A7800: savestate everything, should fix determinism issues this time

This commit is contained in:
alyosha-tas 2021-11-12 17:54:44 -05:00
parent 5f847fe55c
commit 92c60385f4
4 changed files with 74 additions and 6 deletions
src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk

View File

@ -414,7 +414,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
tia.AudioClocks = 0;
master_audio_clock = 0;
_blip.Clear();
}
public void DisposeSound()

View File

@ -38,6 +38,32 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
ser.Sync(nameof(cpu_halt_pending), ref cpu_halt_pending);
ser.Sync(nameof(cpu_resume_pending), ref cpu_resume_pending);
ser.Sync(nameof(p1_state), ref p1_state);
ser.Sync(nameof(p2_state), ref p2_state);
ser.Sync(nameof(p1_fire), ref p1_fire);
ser.Sync(nameof(p2_fire), ref p2_fire);
ser.Sync(nameof(p1_fire_2x), ref p1_fire_2x);
ser.Sync(nameof(p2_fire_2x), ref p2_fire_2x);
ser.Sync(nameof(con_state), ref con_state);
ser.Sync(nameof(left_toggle), ref left_toggle);
ser.Sync(nameof(right_toggle), ref right_toggle);
ser.Sync(nameof(left_was_pressed), ref left_was_pressed);
ser.Sync(nameof(right_was_pressed), ref right_was_pressed);
ser.Sync(nameof(p1_is_2button), ref p1_is_2button);
ser.Sync(nameof(p2_is_2button), ref p2_is_2button);
ser.Sync(nameof(p1_is_lightgun), ref p1_is_lightgun);
ser.Sync(nameof(p2_is_lightgun), ref p2_is_lightgun);
ser.Sync(nameof(p1_lightgun_x), ref p1_lightgun_x);
ser.Sync(nameof(p1_lightgun_y), ref p1_lightgun_y);
ser.Sync(nameof(p2_lightgun_x), ref p2_lightgun_x);
ser.Sync(nameof(p2_lightgun_y), ref p2_lightgun_y);
ser.Sync(nameof(lg_1_counting_down), ref lg_1_counting_down);
ser.Sync(nameof(lg_1_counting_down_2), ref lg_1_counting_down_2);
ser.Sync(nameof(lg_2_counting_down), ref lg_2_counting_down);
ser.Sync(nameof(lg_2_counting_down_2), ref lg_2_counting_down_2);
ser.Sync(nameof(lg_1_trigger_hit), ref lg_1_trigger_hit);
ser.Sync(nameof(lg_2_trigger_hit), ref lg_2_trigger_hit);
ser.Sync(nameof(slow_access), ref slow_access);
ser.Sync(nameof(slow_countdown), ref slow_countdown);
ser.Sync("small flag", ref small_flag);
@ -45,10 +71,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
ser.Sync("Cart RAM", ref cart_RAM);
ser.Sync(nameof(is_pokey), ref is_pokey);
ser.Sync(nameof(is_pokey_450), ref is_pokey_450);
ser.Sync(nameof(left_toggle), ref left_toggle);
ser.Sync(nameof(right_toggle), ref right_toggle);
ser.Sync(nameof(left_was_pressed), ref left_was_pressed);
ser.Sync(nameof(right_was_pressed), ref right_was_pressed);
ser.Sync(nameof(temp_s_tia), ref temp_s_tia);
ser.Sync(nameof(temp_s_pokey), ref temp_s_pokey);

View File

@ -688,8 +688,50 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
ser.BeginSection(nameof(Maria));
ser.Sync(nameof(temp_check), ref temp_check);
ser.Sync(nameof(GFX_index), ref GFX_index);
ser.Sync(nameof(cycle), ref cycle);
ser.Sync(nameof(scanline), ref scanline);
ser.Sync(nameof(DLI_countdown), ref DLI_countdown);
ser.Sync(nameof(sl_DMA_complete), ref sl_DMA_complete);
ser.Sync(nameof(do_dma), ref do_dma);
ser.Sync(nameof(DMA_phase), ref DMA_phase);
ser.Sync(nameof(DMA_phase_counter), ref DMA_phase_counter);
ser.Sync(nameof(header_read_time), ref header_read_time);
ser.Sync(nameof(graphics_read_time), ref graphics_read_time);
ser.Sync(nameof(DMA_phase_next), ref DMA_phase_next);
ser.Sync(nameof(display_zone_pointer), ref display_zone_pointer);
ser.Sync(nameof(display_zone_counter), ref display_zone_counter);
ser.Sync(nameof(current_DLL_offset), ref current_DLL_offset);
ser.Sync(nameof(current_DLL_addr), ref current_DLL_addr);
ser.Sync(nameof(current_DLL_DLI), ref current_DLL_DLI);
ser.Sync(nameof(current_DLL_H16), ref current_DLL_H16);
ser.Sync(nameof(current_DLL_H8), ref current_DLL_H8);
ser.Sync(nameof(global_write_mode), ref global_write_mode);
ser.Sync(nameof(header_counter), ref header_counter);
ser.Sync(nameof(header_pointer), ref header_pointer);
ser.Sync(nameof(addr_t), ref addr_t);
ser.Sync(nameof(ch_size), ref ch_size);
ser.Sync(nameof(scan_index), ref scan_index);
ser.Sync(nameof(read_time), ref read_time);
ser.Sync(nameof(zero_hole), ref zero_hole);
ser.Sync(nameof(color), ref color);
ser.Sync(nameof(local_GFX_index), ref local_GFX_index);
ser.Sync(nameof(temp_palette), ref temp_palette);
ser.Sync(nameof(temp_bit_0), ref temp_bit_0);
ser.Sync(nameof(temp_bit_1), ref temp_bit_1);
ser.Sync(nameof(disp_mode), ref disp_mode);
ser.Sync(nameof(BG_latch_1), ref BG_latch_1);
ser.Sync(nameof(pixel), ref pixel);
ser.EndSection();
}
}

View File

@ -33,7 +33,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public bool high_pass_1;
public bool high_pass_2;
// these are derived values and do not need to be save-stated
public bool[] clock_ch = new bool[4];
public int bit_xor;
@ -306,6 +305,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
ser.BeginSection(nameof(Pokey));
ser.Sync(nameof(LocalAudioCycles), ref LocalAudioCycles);
ser.Sync(nameof(Regs), ref Regs, false);
ser.Sync(nameof(poly4), ref poly4);
@ -320,6 +321,9 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
ser.Sync(nameof(high_pass_1), ref high_pass_1);
ser.Sync(nameof(high_pass_2), ref high_pass_2);
ser.Sync(nameof(clock_ch), ref clock_ch, false);
ser.Sync(nameof(bit_xor), ref bit_xor);
ser.EndSection();
}
}