Пример #1
0
        public static void SaveStateBinary(BinaryWriter writer)
        {
            int i, j;

            writer.Write(pgm_tx_videoram, 0, 0x2000);
            writer.Write(pgm_bg_videoram, 0, 0x4000);
            writer.Write(pgm_rowscrollram, 0, 0x800);
            writer.Write(pgm_videoregs, 0, 0x10000);
            writer.Write(CalVal);
            writer.Write(CalMask);
            writer.Write(CalCom);
            writer.Write(CalCnt);
            writer.Write(asic3_reg);
            writer.Write(asic3_x);
            for (i = 0; i < 3; i++)
            {
                writer.Write(asic3_latch[i]);
            }
            writer.Write(asic3_hold);
            writer.Write(asic3_hilo);
            writer.Write(Video.paletteram16, 0, 0x1200);
            for (i = 0; i < 0x901; i++)
            {
                writer.Write(Palette.entry_color[i]);
            }
            writer.Write(Memory.mainram, 0, 0x20000);
            MC68000.m1.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);
            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 < 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);
            ICS2115.SaveStateBinary(writer);
            for (i = 0; i < 3; i++)
            {
                writer.Write(Sound.latched_value[i]);
            }
            for (i = 0; i < 3; i++)
            {
                writer.Write(Sound.utempdata[i]);
            }
            writer.Write(Sound.ics2115stream.output_sampindex);
            writer.Write(Sound.ics2115stream.output_base_sampindex);
            writer.Write(Sound.mixerstream.output_sampindex);
            writer.Write(Sound.mixerstream.output_base_sampindex);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public static void SaveStateBinaryQ(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(qsound_sharedram1);
            writer.Write(qsound_sharedram2);
            //QSound.SaveStateBinary(writer);
            //writer.Write(Sound.qsoundstream.output_sampindex);
            //writer.Write(Sound.qsoundstream.output_base_sampindex);
            //writer.Write(Sound.mixerstream.output_sampindex);
            //writer.Write(Sound.mixerstream.output_base_sampindex);
            writer.Write(Eeprom.eeprom_data);
            writer.Write(Eeprom.serial_buffer);
            writer.Write((int)Eeprom.clock_line);
            writer.Write((int)Eeprom.reset_line);
            writer.Write(Eeprom.locked);
            writer.Write(Eeprom.serial_count);
            writer.Write(Eeprom.latch);
            writer.Write(Eeprom.sending);
            writer.Write(Eeprom.eeprom_data_bits);
        }
Пример #4
0
        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);
            //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);
            switch (RomInfo.Rom.Name)
            {
            case "forgottn":
            case "forgottna":
            case "forgottnu":
            case "forgottnue":
            case "forgottnuc":
            case "forgottnua":
            case "forgottnuaa":
            case "lostwrld":
            case "lostwrldo":
                //writer.Write(Inptport.portdata.last_delta_nsec);
                break;
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
        public static void SaveStateBinary(BinaryWriter writer)
        {
            int i, j;

            for (i = 0; i < 0x800; i++)
            {
                writer.Write(Palette.entry_color[i]);
            }
            writer.Write(Generic.generic_nvram, 0, 0x4000);
            for (i = 0; i < 0x800; i++)
            {
                writer.Write(priority_ram[i]);
            }
            for (i = 0; i < 0x1000; i++)
            {
                writer.Write(paletteram16[i]);
            }
            writer.Write(prot1);
            writer.Write(prot2);
            writer.Write(prot1_swap);
            writer.Write(prot1_addr);
            for (i = 0; i < 2; i++)
            {
                writer.Write(igs003_reg[i]);
            }
            for (i = 0; i < 2; i++)
            {
                writer.Write(vbowl_trackball[i]);
            }
            writer.Write(priority);
            writer.Write(igs_dips_sel);
            writer.Write(igs_input_sel);
            writer.Write(lhb_irq_enable);
            writer.Write(igs012_prot);
            writer.Write(igs012_prot_swap);
            writer.Write(igs012_prot_mode);
            for (i = 0; i < 8; i++)
            {
                for (j = 0; j < 0x20000; j++)
                {
                    writer.Write(layer[i][j]);
                }
            }
            writer.Write(lhb2_pen_hi);
            writer.Write(blitter.x);
            writer.Write(blitter.y);
            writer.Write(blitter.w);
            writer.Write(blitter.h);
            writer.Write(blitter.gfx_lo);
            writer.Write(blitter.gfx_hi);
            writer.Write(blitter.depth);
            writer.Write(blitter.pen);
            writer.Write(blitter.flags);
            MC68000.m1.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);
            writer.Write(Cpuexec.cpu[0].localtime.seconds);
            writer.Write(Cpuexec.cpu[0].localtime.attoseconds);
            Timer.SaveStateBinary(writer);
            OKI6295.SaveStateBinary(writer);
            for (i = 0; i < 9; i++)
            {
                writer.Write(FMOpl.OPL.P_CH[i].block_fnum);
                writer.Write(FMOpl.OPL.P_CH[i].kcode);
                for (j = 0; j < 2; j++)
                {
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ar);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].dr);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].rr);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].KSR);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ksl);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ksr);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].mul);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].Cnt);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].FB);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].op1_out[0]);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].op1_out[1]);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].CON);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].eg_type);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].state);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].TL);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].volume);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].sl);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].key);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].AMmask);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].vib);
                    writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].wavetable);
                }
            }
            writer.Write(FMOpl.OPL.eg_cnt);
            writer.Write(FMOpl.OPL.eg_timer);
            writer.Write(FMOpl.OPL.rhythm);
            writer.Write(FMOpl.OPL.lfo_am_depth);
            writer.Write(FMOpl.OPL.lfo_pm_depth_range);
            writer.Write(FMOpl.OPL.lfo_am_cnt);
            writer.Write(FMOpl.OPL.lfo_pm_cnt);
            writer.Write(FMOpl.OPL.noise_rng);
            writer.Write(FMOpl.OPL.noise_p);
            writer.Write(FMOpl.OPL.wavesel);
            for (i = 0; i < 2; i++)
            {
                writer.Write(FMOpl.OPL.T[i]);
            }
            for (i = 0; i < 2; i++)
            {
                writer.Write(FMOpl.OPL.st[i]);
            }
            writer.Write(FMOpl.OPL.address);
            writer.Write(FMOpl.OPL.status);
            writer.Write(FMOpl.OPL.statusmask);
            writer.Write(FMOpl.OPL.mode);
            writer.Write(Sound.okistream.output_sampindex);
            writer.Write(Sound.okistream.output_base_sampindex);
            writer.Write(Sound.ym3812stream.output_sampindex);
            writer.Write(Sound.ym3812stream.output_base_sampindex);
            writer.Write(Sound.mixerstream.output_sampindex);
            writer.Write(Sound.mixerstream.output_base_sampindex);
        }
Пример #7
0
        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);
        }
Пример #8
0
        public static void SaveStateBinary(BinaryWriter writer)
        {
            int i, j;

            writer.Write(dsw);
            writer.Write(display_position_interrupt_control);
            writer.Write(display_counter);
            writer.Write(vblank_interrupt_pending);
            writer.Write(display_position_interrupt_pending);
            writer.Write(irq3_pending);
            writer.Write(controller_select);
            writer.Write(main_cpu_bank_address);
            writer.Write(main_cpu_vector_table_source);
            writer.Write(audio_cpu_banks, 0, 4);
            writer.Write(save_ram_unlocked);
            writer.Write(audio_cpu_nmi_enabled);
            writer.Write(audio_cpu_nmi_pending);
            writer.Write(mainram2, 0, 0x10000);
            writer.Write(pvc_cartridge_ram, 0, 0x2000);
            for (i = 0; i < 2; i++)
            {
                for (j = 0; j < 0x1000; j++)
                {
                    writer.Write(palettes[i, j]);
                }
            }
            for (i = 0; i < 0x10000; i++)
            {
                writer.Write(neogeo_videoram[i]);
            }
            writer.Write(videoram_read_buffer);
            writer.Write(videoram_modulo);
            writer.Write(videoram_offset);
            writer.Write(fixed_layer_source);
            writer.Write(screen_dark);
            writer.Write(palette_bank);
            writer.Write(auto_animation_speed);
            writer.Write(auto_animation_disabled);
            writer.Write(auto_animation_counter);
            writer.Write(auto_animation_frame_counter);
            writer.Write(Memory.mainram, 0, 0x10000);
            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.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 < 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(AY8910.ay8910info.register_latch);
            writer.Write(AY8910.ay8910info.regs, 0, 16);
            for (i = 0; i < 3; i++)
            {
                writer.Write(AY8910.ay8910info.count[i]);
            }
            writer.Write(AY8910.ay8910info.output, 0, 3);
            writer.Write(AY8910.ay8910info.output_noise);
            writer.Write(AY8910.ay8910info.count_noise);
            writer.Write(AY8910.ay8910info.count_env);
            writer.Write(AY8910.ay8910info.env_step);
            writer.Write(AY8910.ay8910info.env_volume);
            writer.Write(AY8910.ay8910info.hold);
            writer.Write(AY8910.ay8910info.alternate);
            writer.Write(AY8910.ay8910info.attack);
            writer.Write(AY8910.ay8910info.holding);
            writer.Write(AY8910.ay8910info.rng);
            writer.Write(AY8910.ay8910info.vol_enabled, 0, 3);
            writer.Write(FM.F2610.REGS, 0, 512);
            writer.Write(FM.F2610.addr_A1);
            writer.Write(FM.F2610.adpcmTL);
            writer.Write(FM.F2610.adpcmreg, 0, 0x30);
            writer.Write(FM.F2610.adpcm_arrivedEndAddress);
            writer.Write(FM.ST.freqbase);
            writer.Write(FM.ST.timer_prescaler);
            writer.Write(FM.ST.busy_expiry_time.seconds);
            writer.Write(FM.ST.busy_expiry_time.attoseconds);
            writer.Write(FM.ST.address);
            writer.Write(FM.ST.irq);
            writer.Write(FM.ST.irqmask);
            writer.Write(FM.ST.status);
            writer.Write(FM.ST.mode);
            writer.Write(FM.ST.prescaler_sel);
            writer.Write(FM.ST.fn_h);
            writer.Write(FM.ST.TA);
            writer.Write(FM.ST.TAC);
            writer.Write(FM.ST.TB);
            writer.Write(FM.ST.TBC);
            for (i = 0; i < 12; i++)
            {
                writer.Write(FM.OPN.pan[i]);
            }
            writer.Write(FM.OPN.eg_cnt);
            writer.Write(FM.OPN.eg_timer);
            writer.Write(FM.OPN.eg_timer_add);
            writer.Write(FM.OPN.eg_timer_overflow);
            writer.Write(FM.OPN.lfo_cnt);
            writer.Write(FM.OPN.lfo_inc);
            for (i = 0; i < 8; i++)
            {
                writer.Write(FM.OPN.lfo_freq[i]);
            }
            for (i = 0; i < 6; i++)
            {
                for (j = 0; j < 4; j++)
                {
                    writer.Write(FM.SLOT[i,j].KSR);
                    writer.Write(FM.SLOT[i,j].ar);
                    writer.Write(FM.SLOT[i,j].d1r);
                    writer.Write(FM.SLOT[i,j].d2r);
                    writer.Write(FM.SLOT[i,j].rr);
                    writer.Write(FM.SLOT[i,j].ksr);
                    writer.Write(FM.SLOT[i,j].mul);
                    writer.Write(FM.SLOT[i,j].phase);
                    writer.Write(FM.SLOT[i,j].Incr);
                    writer.Write(FM.SLOT[i,j].state);
                    writer.Write(FM.SLOT[i,j].tl);
                    writer.Write(FM.SLOT[i,j].volume);
                    writer.Write(FM.SLOT[i,j].sl);
                    writer.Write(FM.SLOT[i,j].vol_out);
                    writer.Write(FM.SLOT[i,j].eg_sh_ar);
                    writer.Write(FM.SLOT[i,j].eg_sel_ar);
                    writer.Write(FM.SLOT[i,j].eg_sh_d1r);
                    writer.Write(FM.SLOT[i,j].eg_sel_d1r);
                    writer.Write(FM.SLOT[i,j].eg_sh_d2r);
                    writer.Write(FM.SLOT[i,j].eg_sel_d2r);
                    writer.Write(FM.SLOT[i,j].eg_sh_rr);
                    writer.Write(FM.SLOT[i,j].eg_sel_rr);
                    writer.Write(FM.SLOT[i,j].ssg);
                    writer.Write(FM.SLOT[i,j].ssgn);
                    writer.Write(FM.SLOT[i,j].key);
                    writer.Write(FM.SLOT[i,j].AMmask);
                }
            }
            for (i = 0; i < 6; i++)
            {
                writer.Write(FM.adpcm[i].flag);
                writer.Write(FM.adpcm[i].flagMask);
                writer.Write(FM.adpcm[i].now_data);
                writer.Write(FM.adpcm[i].now_addr);
                writer.Write(FM.adpcm[i].now_step);
                writer.Write(FM.adpcm[i].step);
                writer.Write(FM.adpcm[i].start);
                writer.Write(FM.adpcm[i].end);
                writer.Write(FM.adpcm[i].IL);
                writer.Write(FM.adpcm[i].adpcm_acc);
                writer.Write(FM.adpcm[i].adpcm_step);
                writer.Write(FM.adpcm[i].adpcm_out);
                writer.Write(FM.adpcm[i].vol_mul);
                writer.Write(FM.adpcm[i].vol_shift);
            }
            for (i = 0; i < 6; i++)
            {
                writer.Write(FM.CH[i].ALGO);
                writer.Write(FM.CH[i].FB);
                writer.Write(FM.CH[i].op1_out0);
                writer.Write(FM.CH[i].op1_out1);
                writer.Write(FM.CH[i].mem_value);
                writer.Write(FM.CH[i].pms);
                writer.Write(FM.CH[i].ams);
                writer.Write(FM.CH[i].fc);
                writer.Write(FM.CH[i].kcode);
                writer.Write(FM.CH[i].block_fnum);
            }
            for (i = 0; i < 3; i++)
            {
                writer.Write(FM.SL3.fc[i]);
            }
            writer.Write(FM.SL3.fn_h);
            writer.Write(FM.SL3.kcode,0,3);
            for (i = 0; i < 3; i++)
            {
                writer.Write(FM.SL3.block_fnum[i]);
            }
            writer.Write(YMDeltat.DELTAT.portstate);
            writer.Write(YMDeltat.DELTAT.now_addr);
            writer.Write(YMDeltat.DELTAT.now_step);
            writer.Write(YMDeltat.DELTAT.acc);
            writer.Write(YMDeltat.DELTAT.prev_acc);
            writer.Write(YMDeltat.DELTAT.adpcmd);
            writer.Write(YMDeltat.DELTAT.adpcml);
            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.ay8910stream.output_sampindex);
            writer.Write(Sound.ay8910stream.output_base_sampindex);
            writer.Write(Sound.ym2610stream.output_sampindex);
            writer.Write(Sound.ym2610stream.output_base_sampindex);
            writer.Write(Sound.mixerstream.output_sampindex);
            writer.Write(Sound.mixerstream.output_base_sampindex);
            writer.Write(Pd4900a.pd4990a.seconds);
            writer.Write(Pd4900a.pd4990a.minutes);
            writer.Write(Pd4900a.pd4990a.hours);
            writer.Write(Pd4900a.pd4990a.days);
            writer.Write(Pd4900a.pd4990a.month);
            writer.Write(Pd4900a.pd4990a.year);
            writer.Write(Pd4900a.pd4990a.weekday);
            writer.Write(Pd4900a.shiftlo);
            writer.Write(Pd4900a.shifthi);
            writer.Write(Pd4900a.retraces);
            writer.Write(Pd4900a.testwaits);
            writer.Write(Pd4900a.maxwaits);
            writer.Write(Pd4900a.testbit);
            writer.Write(Pd4900a.outputbit);
            writer.Write(Pd4900a.bitno);
            writer.Write(Pd4900a.reading);
            writer.Write(Pd4900a.writting);
            writer.Write(Pd4900a.clock_line);
            writer.Write(Pd4900a.command_line);
        }
Пример #9
0
        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);
        }