public static void SaveStateBinaryC(BinaryWriter writer) { int i; writer.Write(dswa); writer.Write(dswb); writer.Write(dswc); writer.Write(basebanksnd); for (i = 0; i < 0x20; i++) { writer.Write(cps_a_regs[i]); } for (i = 0; i < 0x20; i++) { writer.Write(cps_b_regs[i]); } for (i = 0; i < 0xc00; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram, 0, 0x10000); writer.Write(gfxram, 0, 0x30000); MC68000.m1.SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x800); Z80A.z1.SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); writer.Write(Video.screenstate.frame_number); writer.Write(Sound.last_update_second); for (i = 0; i < 2; i++) { writer.Write(Cpuexec.cpu[i].suspend); writer.Write(Cpuexec.cpu[i].nextsuspend); writer.Write(Cpuexec.cpu[i].eatcycles); writer.Write(Cpuexec.cpu[i].nexteatcycles); writer.Write(Cpuexec.cpu[i].localtime.seconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds); } Timer.SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x800); YM2151.SaveStateBinary(writer); OKI6295.SaveStateBinary(writer); for (i = 0; i < 2; i++) { writer.Write(Sound.latched_value[i]); } for (i = 0; i < 2; i++) { writer.Write(Sound.utempdata[i]); } writer.Write(Sound.ym2151stream.output_sampindex); writer.Write(Sound.ym2151stream.output_base_sampindex); writer.Write(Sound.okistream.output_sampindex); writer.Write(Sound.okistream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }
public static void SaveStateBinary(BinaryWriter writer) { int i, j; writer.Write(dipsw); for (i = 0; i < 0x2000; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(bank_ram20, 0, 0x2000); writer.Write(bank_ram30, 0, 0x80); writer.Write(namcos1_videoram, 0, 0x8000); writer.Write(namcos1_cus116, 0, 0x10); writer.Write(namcos1_spriteram, 0, 0x1000); writer.Write(namcos1_playfield_control, 0, 0x20); writer.Write(copy_sprites); writer.Write(s1ram, 0, 0x8000); writer.Write(namcos1_triram, 0, 0x800); writer.Write(namcos1_paletteram, 0, 0x8000); writer.Write(key, 0, 8); writer.Write(audiocpurom_offset); writer.Write(mcu_patch_data); writer.Write(mcurom_offset); writer.Write(namcos1_reset); writer.Write(wdog); writer.Write(dac0_value); writer.Write(dac1_value); writer.Write(dac0_gain); writer.Write(dac1_gain); writer.Write(Generic.generic_nvram, 0, 0x800); for (i = 0; i < 2; i++) { for (j = 0; j < 8; j++) { writer.Write(cus117_offset[i, j]); } } for (i = 0; i < 2; i++) { for (j = 0; j < 8; j++) { writer.Write(user1rom_offset[i, j]); } } for (i = 0; i < 3; i++) { writer.Write(M6809.mm1[i].PC.LowWord); writer.Write(M6809.mm1[i].PPC.LowWord); writer.Write(M6809.mm1[i].D.LowWord); writer.Write(M6809.mm1[i].DP.LowWord); writer.Write(M6809.mm1[i].U.LowWord); writer.Write(M6809.mm1[i].S.LowWord); writer.Write(M6809.mm1[i].X.LowWord); writer.Write(M6809.mm1[i].Y.LowWord); writer.Write(M6809.mm1[i].CC); writer.Write((byte)M6809.mm1[i].irq_state[0]); writer.Write((byte)M6809.mm1[i].irq_state[1]); writer.Write(M6809.mm1[i].int_state); writer.Write((byte)M6809.mm1[i].nmi_state); } writer.Write(M6800.m1.PPC.LowWord); writer.Write(M6800.m1.PC.LowWord); writer.Write(M6800.m1.S.LowWord); writer.Write(M6800.m1.X.LowWord); writer.Write(M6800.m1.D.LowWord); writer.Write(M6800.m1.cc); writer.Write(M6800.m1.wai_state); writer.Write((byte)M6800.m1.nmi_state); writer.Write((byte)M6800.m1.irq_state[0]); writer.Write((byte)M6800.m1.irq_state[1]); writer.Write(M6800.m1.ic_eddge); writer.Write(M6800.m1.port1_ddr); writer.Write(M6800.m1.port2_ddr); writer.Write(M6800.m1.port3_ddr); writer.Write(M6800.m1.port4_ddr); writer.Write(M6800.m1.port1_data); writer.Write(M6800.m1.port2_data); writer.Write(M6800.m1.port3_data); writer.Write(M6800.m1.port4_data); writer.Write(M6800.m1.tcsr); writer.Write(M6800.m1.pending_tcsr); writer.Write(M6800.m1.irq2); writer.Write(M6800.m1.ram_ctrl); writer.Write(M6800.m1.counter.d); writer.Write(M6800.m1.output_compare.d); writer.Write(M6800.m1.input_capture); writer.Write(M6800.m1.timer_over.d); writer.Write(M6800.m1.clock); writer.Write(M6800.m1.trcsr); writer.Write(M6800.m1.rmcr); writer.Write(M6800.m1.rdr); writer.Write(M6800.m1.tdr); writer.Write(M6800.m1.rsr); writer.Write(M6800.m1.tsr); writer.Write(M6800.m1.rxbits); writer.Write(M6800.m1.txbits); writer.Write((int)M6800.m1.txstate); writer.Write(M6800.m1.trcsr_read); writer.Write(M6800.m1.tx); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); writer.Write(Video.screenstate.vblank_start_time.seconds); writer.Write(Video.screenstate.vblank_start_time.attoseconds); writer.Write(Video.screenstate.frame_number); writer.Write(Sound.last_update_second); for (i = 0; i < 4; i++) { writer.Write(Cpuexec.cpu[i].suspend); writer.Write(Cpuexec.cpu[i].nextsuspend); writer.Write(Cpuexec.cpu[i].eatcycles); writer.Write(Cpuexec.cpu[i].nexteatcycles); writer.Write(Cpuexec.cpu[i].localtime.seconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds); writer.Write(Cpuexec.cpu[i].TotalExecutedCycles); writer.Write(Cpuexec.cpu[i].PendingCycles); } Timer.SaveStateBinary(writer); YM2151.SaveStateBinary(writer); writer.Write(Namco.nam1.num_voices); writer.Write(Namco.nam1.sound_enable); for (i = 0; i < 16; i++) { for (j = 0; j < 32 * 16; j++) { writer.Write(Namco.nam1.waveform[i][j]); } } for (i = 0; i < 8; i++) { writer.Write(Namco.nam1.channel_list[i].frequency); writer.Write(Namco.nam1.channel_list[i].counter); writer.Write(Namco.nam1.channel_list[i].volume[0]); writer.Write(Namco.nam1.channel_list[i].volume[1]); writer.Write(Namco.nam1.channel_list[i].noise_sw); writer.Write(Namco.nam1.channel_list[i].noise_state); writer.Write(Namco.nam1.channel_list[i].noise_seed); writer.Write(Namco.nam1.channel_list[i].noise_hold); writer.Write(Namco.nam1.channel_list[i].noise_counter); writer.Write(Namco.nam1.channel_list[i].waveform_select); } writer.Write(Namco.namco_wavedata, 0, 0x400); writer.Write(DAC.dac1.output); writer.Write(Sound.ym2151stream.output_sampindex); writer.Write(Sound.ym2151stream.output_base_sampindex); writer.Write(Sound.namcostream.output_sampindex); writer.Write(Sound.namcostream.output_base_sampindex); writer.Write(Sound.dacstream.output_sampindex); writer.Write(Sound.dacstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }
public static void SaveStateBinary(BinaryWriter writer) { int i; writer.Write(dsw); writer.Write(setvector_param); writer.Write(irqvector); writer.Write(sample_addr); writer.Write(protection_ram, 0, 0x1000); writer.Write(m72_irq_base); writer.Write(m72_scanline_param); for (i = 0; i < 0x600; i++) { writer.Write(Generic.paletteram16[i]); } for (i = 0; i < 0x600; i++) { writer.Write(Generic.paletteram16_2[i]); } for (i = 0; i < 0x200; i++) { writer.Write(Generic.spriteram16[i]); } writer.Write(m72_videoram1, 0, 0x4000); writer.Write(m72_videoram2, 0, 0x4000); writer.Write(m72_raster_irq_position); writer.Write(video_off); writer.Write(scrollx1); writer.Write(scrolly1); writer.Write(scrollx2); writer.Write(scrolly2); for (i = 0; i < 0x200; i++) { writer.Write(m72_spriteram[i]); } //majtitle_rowscrollram spriteram_size majtitle_rowscroll for (i = 0; i < 0x201; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram, 0, 0x4000); Nec.nn1[0].SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x10000); Z80A.z1.SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); Video.SaveStateBinary(writer); writer.Write(Sound.last_update_second); for (i = 0; i < 2; i++) { writer.Write(Cpuexec.cpu[i].suspend); writer.Write(Cpuexec.cpu[i].nextsuspend); writer.Write(Cpuexec.cpu[i].eatcycles); writer.Write(Cpuexec.cpu[i].nexteatcycles); writer.Write(Cpuexec.cpu[i].localtime.seconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds); } Timer.SaveStateBinary(writer); YM2151.SaveStateBinary(writer); writer.Write(DAC.dac1.output); writer.Write(Sound.latched_value[0]); writer.Write(Sound.utempdata[0]); writer.Write(Sound.ym2151stream.output_sampindex); writer.Write(Sound.ym2151stream.output_base_sampindex); writer.Write(Sound.dacstream.output_sampindex); writer.Write(Sound.dacstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }
public static void SaveStateBinary(BinaryWriter writer) { int i, j; writer.Write(dsw); writer.Write(irqvector); writer.Write(sound_status); writer.Write(bankaddress); writer.Write(m92_irq_vectorbase); writer.Write(m92_raster_irq_position); writer.Write(m92_scanline_param); writer.Write(setvector_param); writer.Write(m92_sprite_buffer_busy); for (i = 0; i < 4; i++) { writer.Write(pf_master_control[i]); } writer.Write(m92_sprite_list); writer.Write(m92_vram_data, 0, 0x10000); writer.Write(m92_spritecontrol, 0, 0x10); writer.Write(m92_game_kludge); writer.Write(m92_palette_bank); for (i = 0; i < 3; i++) { writer.Write(pf_layer[i].vram_base); } for (i = 0; i < 3; i++) { for (j = 0; j < 4; j++) { writer.Write(pf_layer[i].control[j]); } } for (i = 0; i < 0x800; i++) { writer.Write(Generic.paletteram16[i]); } for (i = 0; i < 0x400; i++) { writer.Write(Generic.spriteram16[i]); } for (i = 0; i < 0x400; i++) { writer.Write(Generic.buffered_spriteram16[i]); } for (i = 0; i < 0x801; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram, 0, 0x10000); Nec.nn1[0].SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x4000); Nec.nn1[1].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); Video.SaveStateBinary(writer); writer.Write(Sound.last_update_second); for (i = 0; i < 2; i++) { writer.Write(Cpuexec.cpu[i].suspend); writer.Write(Cpuexec.cpu[i].nextsuspend); writer.Write(Cpuexec.cpu[i].eatcycles); writer.Write(Cpuexec.cpu[i].nexteatcycles); writer.Write(Cpuexec.cpu[i].localtime.seconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds); } Timer.SaveStateBinary(writer); YM2151.SaveStateBinary(writer); Iremga20.SaveStateBinary(writer); writer.Write(Sound.latched_value[0]); writer.Write(Sound.utempdata[0]); writer.Write(Sound.ym2151stream.output_sampindex); writer.Write(Sound.ym2151stream.output_base_sampindex); writer.Write(Sound.iremga20stream.output_sampindex); writer.Write(Sound.iremga20stream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }