コード例 #1
0
ファイル: Memory.cs プロジェクト: JavierCanon/MAME.NET
 public static void ZWriteHardware_rtype2(ushort address, byte value)
 {
     address &= 0xff;
     if (address == 0x00)
     {
         YM2151.ym2151_register_port_0_w(value);
     }
     else if (address == 0x01)
     {
         YM2151.ym2151_data_port_0_w(value);
     }
     else if (address >= 0x80 && address <= 0x81)
     {
         int offset = address - 0x80;
         rtype2_sample_addr_w(offset, value);
     }
     else if (address == 0x82)
     {
         m72_sample_w(value);
     }
     else if (address == 0x83)
     {
         m72_sound_irq_ack_w(0, value);
     }
 }
コード例 #2
0
        public static ushort N1ReadWord(int address)
        {
            address &= 0xfffff;
            ushort result = 0;

            if (address >= 0 && address + 1 <= 0x1ffff)
            {
                result = (ushort)(Memory.audiorom[address] + Memory.audiorom[address + 1] * 0x100);
            }
            else if (address >= 0xa0000 && address + 1 <= 0xa3fff)
            {
                int offset = address - 0xa0000;
                result = (ushort)(Memory.audioram[offset] + Memory.audioram[offset + 1] * 0x100);
            }
            else if (address >= 0xa8000 && address + 1 <= 0xa803f)
            {
                int offset = (address - 0xa8000) / 2;
                result = Iremga20.irem_ga20_r(offset);
            }
            else if (address >= 0xa8042 && address + 1 <= 0xa8043)
            {
                result = YM2151.ym2151_status_port_0_r();
            }
            else if (address >= 0xa8044 && address + 1 <= 0xa8045)
            {
                result = m92_soundlatch_r();
            }
            else if (address >= 0xffff0 && address + 1 <= 0xfffff)
            {
                int offset = address - 0xe0000;
                result = (ushort)(Memory.mainrom[offset] + Memory.mainrom[offset + 1] * 0x100);
            }
            return(result);
        }
コード例 #3
0
        public static byte N1ReadByte(int address)
        {
            address &= 0xfffff;
            byte result = 0;

            if (address >= 0 && address <= 0x1ffff)
            {
                result = Memory.audiorom[address];
            }
            else if (address >= 0xa0000 && address <= 0xa3fff)
            {
                int offset = address - 0xa0000;
                result = Memory.audioram[offset];
            }
            else if (address >= 0xa8000 && address <= 0xa803f)
            {
                int offset = (address - 0xa8000) / 2;
                result = (byte)Iremga20.irem_ga20_r(offset);
            }
            else if (address >= 0xa8042 && address <= 0xa8043)
            {
                result = YM2151.ym2151_status_port_0_r();
            }
            else if (address >= 0xa8044 && address <= 0xa8045)
            {
                result = (byte)m92_soundlatch_r();
            }
            else if (address >= 0xffff0 && address <= 0xfffff)
            {
                int offset = address - 0xe0000;
                result = Memory.mainrom[offset];
            }
            return(result);
        }
コード例 #4
0
        public static void sound_reset()
        {
            switch (Machine.sBoard)
            {
            case "CPS-1":
                YM2151.ym2151_reset_chip();
                OKI6295.okim6295_reset();
                break;

            case "CPS-1(QSound)":
            case "CPS2":
                break;

            case "Neo Geo":
                FM.ym2610_reset_chip();
                break;

            case "Namco System 1":
                YM2151.ym2151_reset_chip();
                break;

            case "IGS011":
                OKI6295.okim6295_reset();
                break;

            case "PGM":
                ICS2115.ics2115_reset();
                break;
            }
        }
コード例 #5
0
 public static void N1WriteWord(int address, ushort value)
 {
     address &= 0xfffff;
     if (address >= 0x9ff00 && address + 1 <= 0x9ffff)
     {
     }
     else if (address >= 0xa0000 && address + 1 <= 0xa3fff)
     {
         int offset = address - 0xa0000;
         Memory.audioram[offset]     = (byte)value;
         Memory.audioram[offset + 1] = (byte)(value >> 8);
     }
     else if (address >= 0xa8000 && address + 1 <= 0xa803f)
     {
         int offset = (address - 0xa8000) / 2;
         Iremga20.irem_ga20_w(offset, value);
     }
     else if (address >= 0xa8040 && address + 1 <= 0xa8041)
     {
         YM2151.ym2151_register_port_0_w((byte)value);
     }
     else if (address >= 0xa8042 && address + 1 <= 0xa8043)
     {
         YM2151.ym2151_data_port_0_w((byte)value);
     }
     else if (address >= 0xa8044 && address + 1 <= 0xa8045)
     {
         m92_sound_irq_ack_w();
     }
     else if (address >= 0xa8046 && address + 1 <= 0xa8047)
     {
         m92_sound_status_w(value);
     }
 }
コード例 #6
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);
        }
コード例 #7
0
        public static void LoadStateBinaryC(BinaryReader reader)
        {
            int i, i1, n1, n2;

            dswa        = reader.ReadByte();
            dswb        = reader.ReadByte();
            dswc        = reader.ReadByte();
            basebanksnd = reader.ReadInt32();
            for (i = 0; i < 0x20; i++)
            {
                cps_a_regs[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x20; i++)
            {
                cps_b_regs[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0xc00; i++)
            {
                Palette.entry_color[i] = reader.ReadUInt32();
            }
            Memory.mainram = reader.ReadBytes(0x10000);
            gfxram         = reader.ReadBytes(0x30000);
            MC68000.m1.LoadStateBinary(reader);
            Memory.audioram = reader.ReadBytes(0x800);
            Z80A.z1.LoadStateBinary(reader);
            Cpuint.LoadStateBinary(reader);
            Timer.global_basetime.seconds     = reader.ReadInt32();
            Timer.global_basetime.attoseconds = reader.ReadInt64();
            Video.screenstate.frame_number    = reader.ReadInt64();
            Sound.last_update_second          = reader.ReadInt32();
            for (i = 0; i < 2; i++)
            {
                Cpuexec.cpu[i].suspend               = reader.ReadByte();
                Cpuexec.cpu[i].nextsuspend           = reader.ReadByte();
                Cpuexec.cpu[i].eatcycles             = reader.ReadByte();
                Cpuexec.cpu[i].nexteatcycles         = reader.ReadByte();
                Cpuexec.cpu[i].localtime.seconds     = reader.ReadInt32();
                Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
            }
            Timer.LoadStateBinary(reader);
            Memory.audioram = reader.ReadBytes(0x800);
            YM2151.LoadStateBinary(reader);
            OKI6295.LoadStateBinary(reader);
            for (i = 0; i < 2; i++)
            {
                Sound.latched_value[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 2; i++)
            {
                Sound.utempdata[i] = reader.ReadUInt16();
            }
            Sound.ym2151stream.output_sampindex      = reader.ReadInt32();
            Sound.ym2151stream.output_base_sampindex = reader.ReadInt32();
            Sound.okistream.output_sampindex         = reader.ReadInt32();
            Sound.okistream.output_base_sampindex    = reader.ReadInt32();
            Sound.mixerstream.output_sampindex       = reader.ReadInt32();
            Sound.mixerstream.output_base_sampindex  = reader.ReadInt32();
        }
コード例 #8
0
        public static void postload()
        {
            int i;

            switch (Machine.sBoard)
            {
            case "CPS-1":
                for (i = 0; i < 3; i++)
                {
                    CPS.ttmap[i].all_tiles_dirty = true;
                }
                YM2151.ym2151_postload();
                break;

            case "CPS-1(QSound)":
            case "CPS2":
                for (i = 0; i < 3; i++)
                {
                    CPS.ttmap[i].all_tiles_dirty = true;
                }
                break;

            case "Neo Geo":
                Neogeo.regenerate_pens();
                FM.ym2610_postload();
                break;

            case "Namco System 1":
                for (i = 0; i < 6; i++)
                {
                    Namcos1.ttmap[i].all_tiles_dirty = true;
                }
                YM2151.ym2151_postload();
                break;

            case "IGS011":
                break;

            case "PGM":
                PGM.pgm_tx_tilemap.all_tiles_dirty = true;
                PGM.pgm_bg_tilemap.all_tiles_dirty = true;
                break;

            case "M72":
                M72.bg_tilemap.all_tiles_dirty = true;
                M72.fg_tilemap.all_tiles_dirty = true;
                break;

            case "M92":
                for (i = 0; i < 3; i++)
                {
                    M92.pf_layer[i].tmap.all_tiles_dirty      = true;
                    M92.pf_layer[i].wide_tmap.all_tiles_dirty = true;
                }
                break;
            }
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        public FormYM2151Editor(YM2151 inst, YM2151Timbre timbre, bool singleSelect) : base(inst, timbre, singleSelect)
        {
            this.timbre = timbre;
            InitializeComponent();

            Size = Settings.Default.YM2151EdSize;

            AddControl(new YM2151GeneralContainer(inst, timbre, "General"));

            AddControl(new YM2151OperatorContainer(timbre.Ops[0], "Operator 1"));
            AddControl(new YM2151OperatorContainer(timbre.Ops[1], "Operator 2"));
            AddControl(new YM2151OperatorContainer(timbre.Ops[2], "Operator 3"));
            AddControl(new YM2151OperatorContainer(timbre.Ops[3], "Operator 4"));
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: MiklosPathy/TrackConv
        public YMshell()
        {
            SetWaveFormat(44100, 2);

            YM2151code.init_tables();
            chip = YM2151code.ym2151_init(1000000, 44100);
            YM2151code.init_chip_tables(chip);
            YM2151code.ym2151_reset_chip(chip);
            YM2151code.ym2151_set_mask(chip, 0);


            playthread = new Thread(new ThreadStart(SynthThread));
            playthread.IsBackground = true;
            playthread.Start();
        }
コード例 #11
0
        public static void postload()
        {
            int i;

            switch (Machine.sBoard)
            {
            case "CPS-1":
                Tmap.ttmap[0].all_tiles_dirty = true;
                Tmap.ttmap[1].all_tiles_dirty = true;
                Tmap.ttmap[2].all_tiles_dirty = true;
                YM2151.ym2151_postload();
                break;

            case "CPS-1(QSound)":
                Tmap.ttmap[0].all_tiles_dirty = true;
                Tmap.ttmap[1].all_tiles_dirty = true;
                Tmap.ttmap[2].all_tiles_dirty = true;
                break;

            case "CPS2":
                Tmap.ttmap[0].all_tiles_dirty = true;
                Tmap.ttmap[1].all_tiles_dirty = true;
                Tmap.ttmap[2].all_tiles_dirty = true;
                break;

            case "Neo Geo":
                Neogeo.regenerate_pens();
                FM.ym2610_postload();
                break;

            case "Namco System 1":
                for (i = 0; i < 6; i++)
                {
                    Tmap.ttmap[i].all_tiles_dirty = true;
                }
                YM2151.ym2151_postload();
                break;

            case "IGS011":
                break;

            case "PGM":
                Tmap.pgm_tx_tilemap.all_tiles_dirty = true;
                Tmap.pgm_bg_tilemap.all_tiles_dirty = true;
                break;
            }
        }
コード例 #12
0
ファイル: Memory.cs プロジェクト: JavierCanon/MAME.NET
        public static void N2WriteMemory(ushort address, byte data)
        {
            int offset;

            if (address == 0x4000)
            {
                YM2151.ym2151_register_port_0_w(data);
            }
            else if (address == 0x4001)
            {
                YM2151.ym2151_data_port_0_w(data);
            }
            else if (address >= 0x5000 && address <= 0x53ff)
            {
                offset = address & 0x3ff;
                Namco.namcos1_cus30_w(offset, data);
            }
            else if (address >= 0x7000 && address <= 0x77ff)
            {
                offset = address & 0x7ff;
                namcos1_triram[offset] = data;
            }
            else if (address >= 0x8000 && address <= 0x9fff)
            {
                offset             = address & 0x1fff;
                bank_ram20[offset] = data;
            }
            else if (address >= 0xc000 && address <= 0xc001)
            {
                namcos1_sound_bankswitch_w(data);
            }
            else if (address == 0xd001)
            {
                namcos1_watchdog_w();
            }
            else if (address == 0xe000)
            {
                irq_ack_w(2);
            }
            else
            {
                int i1 = 1;
            }
        }
コード例 #13
0
ファイル: Memory.cs プロジェクト: JavierCanon/MAME.NET
        public static byte ZReadHardware_rtype2(ushort address)
        {
            byte result = 0;

            address &= 0xff;
            if (address == 0x01)
            {
                result = YM2151.ym2151_status_port_0_r();
            }
            else if (address == 0x80)
            {
                result = (byte)Sound.soundlatch_r();
            }
            else if (address == 0x84)
            {
                result = m72_sample_r();
            }

            return(result);
        }
コード例 #14
0
ファイル: Memory.cs プロジェクト: JavierCanon/MAME.NET
 public static void ZWriteHardware(ushort address, byte value)
 {
     address &= 0xff;
     if (address == 0x00)
     {
         YM2151.ym2151_register_port_0_w(value);
     }
     else if (address == 0x01)
     {
         YM2151.ym2151_data_port_0_w(value);
     }
     else if (address == 0x06)
     {
         m72_sound_irq_ack_w(0, value);
     }
     else if (address == 0x82)
     {
         m72_sample_w(value);
     }
 }
コード例 #15
0
ファイル: Memory.cs プロジェクト: JavierCanon/MAME.NET
        public static byte N2ReadMemory(ushort address)
        {
            byte result;
            int  offset;

            if (address >= 0x0000 && address <= 0x3fff)
            {
                offset = address & 0x3fff;
                result = audiorom[audiocpurom_offset + offset];
            }
            else if (address >= 0x4000 && address <= 0x4001)
            {
                result = YM2151.ym2151_status_port_0_r();
            }
            else if (address >= 0x5000 && address <= 0x53ff)
            {
                offset = address & 0x3ff;
                result = Namco.namcos1_cus30_r(offset);
            }
            else if (address >= 0x7000 && address <= 0x77ff)
            {
                offset = address & 0x7ff;
                result = namcos1_triram[offset];
            }
            else if (address >= 0x8000 && address <= 0x9fff)
            {
                offset = address & 0x1fff;
                result = bank_ram20[offset];
            }
            else if (address >= 0xc000 && address <= 0xffff)
            {
                offset = address & 0x3fff;
                result = audiorom[offset];
            }
            else
            {
                result = 0;
            }
            return(result);
        }
コード例 #16
0
        public static void sound_init()
        {
            iRecord = 0;

            leftmix  = new int[0x3c0];
            rightmix = new int[0x3c0];

            finalmixb = new byte[0xf00];

            sound_muted = 0;

            buf2.Play(0, BufferPlayFlags.Looping);

            last_update_second = 0;
            //WavWrite.CreateSoundFile(@"\VS2008\compare1\compare1\bin\Debug\2.wav");
            Atime update_frequency = new Atime(0, Attotime.ATTOSECONDS_PER_SECOND / 50);

            switch (Machine.sBoard)
            {
            case "CPS-1":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateC;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                OKI6295.okim6295_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                okistream    = new sound_stream(1000000 / 132, 0, 1, OKI6295.okim6295_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "CPS-1(QSound)":
            case "CPS2":
                sound_update       = sound_updateQ;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                QSound.qsound_start();
                qsoundstream = new sound_stream(4000000 / 166, 0, 2, QSound.qsound_update);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "Neo Geo":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateN;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2610.ym2610_start();
                ay8910stream = new sound_stream(250000, 0, 1, AY8910.ay8910_update);
                ym2610stream = new sound_stream(111111, 0, 2, FM.ym2610_update_one);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "Namco System 1":
                sound_update       = sound_updateNa;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579580);
                Namco.namco_start();
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                namcostream  = new sound_stream(192000, 0, 2, Namco.namco_update_stereo);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 5, 0, null);
                break;

            case "IGS011":
                sound_update       = sound_updateIGS011;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                OKI6295.okim6295_start();
                YM3812.ym3812_start(3579545);
                okistream    = new sound_stream(1047600 / 132, 0, 1, OKI6295.okim6295_update);
                ym3812stream = new sound_stream(49715, 0, 1, FMOpl.ym3812_update_one);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "PGM":
                latched_value      = new ushort[3];
                utempdata          = new ushort[3];
                sound_update       = sound_updatePGM;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                ICS2115.ics2115_start();
                ics2115stream = new sound_stream(33075, 0, 2, ICS2115.ics2115_update);
                mixerstream   = new sound_stream(48000, 2, 0, null);
                break;

            case "M72":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM72;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "M92":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM92;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                Iremga20.iremga20_start();
                ym2151stream   = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                iremga20stream = new sound_stream(894886, 0, 2, Iremga20.iremga20_update);
                mixerstream    = new sound_stream(48000, 4, 0, null);
                break;
            }
            Timer.timer_adjust_periodic(sound_update_timer, update_frequency, update_frequency);
        }
コード例 #17
0
ファイル: State.cs プロジェクト: beginor/mame.net
        public static void LoadStateBinary(BinaryReader reader)
        {
            int i, j;

            dipsw = reader.ReadByte();
            for (i = 0; i < 0x2000; i++)
            {
                Palette.entry_color[i] = reader.ReadUInt32();
            }
            bank_ram20                = reader.ReadBytes(0x2000);
            bank_ram30                = reader.ReadBytes(0x80);
            namcos1_videoram          = reader.ReadBytes(0x8000);
            namcos1_cus116            = reader.ReadBytes(0x10);
            namcos1_spriteram         = reader.ReadBytes(0x1000);
            namcos1_playfield_control = reader.ReadBytes(0x20);
            copy_sprites              = reader.ReadInt32();
            s1ram              = reader.ReadBytes(0x8000);
            namcos1_triram     = reader.ReadBytes(0x800);
            namcos1_paletteram = reader.ReadBytes(0x8000);
            key = reader.ReadBytes(8);
            audiocpurom_offset = reader.ReadInt32();
            mcu_patch_data     = reader.ReadInt32();
            mcurom_offset      = reader.ReadInt32();
            namcos1_reset      = reader.ReadInt32();
            wdog                  = reader.ReadInt32();
            dac0_value            = reader.ReadInt32();
            dac1_value            = reader.ReadInt32();
            dac0_gain             = reader.ReadInt32();
            dac1_gain             = reader.ReadInt32();
            Generic.generic_nvram = reader.ReadBytes(0x800);
            for (i = 0; i < 2; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    cus117_offset[i, j] = reader.ReadInt32();
                }
            }
            for (i = 0; i < 2; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    user1rom_offset[i, j] = reader.ReadInt32();
                }
            }
            for (i = 0; i < 3; i++)
            {
                M6809.mm1[i].PC.LowWord   = reader.ReadUInt16();
                M6809.mm1[i].PPC.LowWord  = reader.ReadUInt16();
                M6809.mm1[i].D.LowWord    = reader.ReadUInt16();
                M6809.mm1[i].DP.LowWord   = reader.ReadUInt16();
                M6809.mm1[i].U.LowWord    = reader.ReadUInt16();
                M6809.mm1[i].S.LowWord    = reader.ReadUInt16();
                M6809.mm1[i].X.LowWord    = reader.ReadUInt16();
                M6809.mm1[i].Y.LowWord    = reader.ReadUInt16();
                M6809.mm1[i].CC           = reader.ReadByte();
                M6809.mm1[i].irq_state[0] = (LineState)reader.ReadByte();
                M6809.mm1[i].irq_state[1] = (LineState)reader.ReadByte();
                M6809.mm1[i].int_state    = reader.ReadByte();
                M6809.mm1[i].nmi_state    = (LineState)reader.ReadByte();
            }
            M6800.m1.PPC.LowWord      = reader.ReadUInt16();
            M6800.m1.PC.LowWord       = reader.ReadUInt16();
            M6800.m1.S.LowWord        = reader.ReadUInt16();
            M6800.m1.X.LowWord        = reader.ReadUInt16();
            M6800.m1.D.LowWord        = reader.ReadUInt16();
            M6800.m1.cc               = reader.ReadByte();
            M6800.m1.wai_state        = reader.ReadByte();
            M6800.m1.nmi_state        = (LineState)reader.ReadByte();
            M6800.m1.irq_state[0]     = (LineState)reader.ReadByte();
            M6800.m1.irq_state[1]     = (LineState)reader.ReadByte();
            M6800.m1.ic_eddge         = reader.ReadByte();
            M6800.m1.port1_ddr        = reader.ReadByte();
            M6800.m1.port2_ddr        = reader.ReadByte();
            M6800.m1.port3_ddr        = reader.ReadByte();
            M6800.m1.port4_ddr        = reader.ReadByte();
            M6800.m1.port1_data       = reader.ReadByte();
            M6800.m1.port2_data       = reader.ReadByte();
            M6800.m1.port3_data       = reader.ReadByte();
            M6800.m1.port4_data       = reader.ReadByte();
            M6800.m1.tcsr             = reader.ReadByte();
            M6800.m1.pending_tcsr     = reader.ReadByte();
            M6800.m1.irq2             = reader.ReadByte();
            M6800.m1.ram_ctrl         = reader.ReadByte();
            M6800.m1.counter.d        = reader.ReadUInt32();
            M6800.m1.output_compare.d = reader.ReadUInt32();
            M6800.m1.input_capture    = reader.ReadUInt16();
            M6800.m1.timer_over.d     = reader.ReadUInt32();
            M6800.m1.clock            = reader.ReadInt32();
            M6800.m1.trcsr            = reader.ReadByte();
            M6800.m1.rmcr             = reader.ReadByte();
            M6800.m1.rdr              = reader.ReadByte();
            M6800.m1.tdr              = reader.ReadByte();
            M6800.m1.rsr              = reader.ReadByte();
            M6800.m1.tsr              = reader.ReadByte();
            M6800.m1.rxbits           = reader.ReadInt32();
            M6800.m1.txbits           = reader.ReadInt32();
            M6800.m1.txstate          = (M6800.M6800_TX_STATE)reader.ReadInt32();
            M6800.m1.trcsr_read       = reader.ReadInt32();
            M6800.m1.tx               = reader.ReadInt32();
            Cpuint.LoadStateBinary(reader);
            Timer.global_basetime.seconds                   = reader.ReadInt32();
            Timer.global_basetime.attoseconds               = reader.ReadInt64();
            Video.screenstate.vblank_start_time.seconds     = reader.ReadInt32();
            Video.screenstate.vblank_start_time.attoseconds = reader.ReadInt64();
            Video.screenstate.frame_number                  = reader.ReadInt64();
            Sound.last_update_second = reader.ReadInt32();
            for (i = 0; i < 4; i++)
            {
                Cpuexec.cpu[i].suspend               = reader.ReadByte();
                Cpuexec.cpu[i].nextsuspend           = reader.ReadByte();
                Cpuexec.cpu[i].eatcycles             = reader.ReadByte();
                Cpuexec.cpu[i].nexteatcycles         = reader.ReadByte();
                Cpuexec.cpu[i].localtime.seconds     = reader.ReadInt32();
                Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
                Cpuexec.cpu[i].TotalExecutedCycles   = reader.ReadUInt64();
                Cpuexec.cpu[i].PendingCycles         = reader.ReadInt32();
            }
            Timer.LoadStateBinary(reader);
            YM2151.LoadStateBinary(reader);
            Namco.nam1.num_voices   = reader.ReadInt32();
            Namco.nam1.sound_enable = reader.ReadInt32();
            for (i = 0; i < 16; i++)
            {
                for (j = 0; j < 32 * 16; j++)
                {
                    Namco.nam1.waveform[i][j] = reader.ReadInt16();
                }
            }
            for (i = 0; i < 8; i++)
            {
                Namco.nam1.channel_list[i].frequency       = reader.ReadInt32();
                Namco.nam1.channel_list[i].counter         = reader.ReadInt32();
                Namco.nam1.channel_list[i].volume[0]       = reader.ReadInt32();
                Namco.nam1.channel_list[i].volume[1]       = reader.ReadInt32();
                Namco.nam1.channel_list[i].noise_sw        = reader.ReadInt32();
                Namco.nam1.channel_list[i].noise_state     = reader.ReadInt32();
                Namco.nam1.channel_list[i].noise_seed      = reader.ReadInt32();
                Namco.nam1.channel_list[i].noise_hold      = reader.ReadInt32();
                Namco.nam1.channel_list[i].noise_counter   = reader.ReadInt32();
                Namco.nam1.channel_list[i].waveform_select = reader.ReadInt32();
            }
            Namco.namco_wavedata = reader.ReadBytes(0x400);
            DAC.dac1.output      = reader.ReadInt16();
            Sound.ym2151stream.output_sampindex      = reader.ReadInt32();
            Sound.ym2151stream.output_base_sampindex = reader.ReadInt32();
            Sound.namcostream.output_sampindex       = reader.ReadInt32();
            Sound.namcostream.output_base_sampindex  = reader.ReadInt32();
            Sound.dacstream.output_sampindex         = reader.ReadInt32();
            Sound.dacstream.output_base_sampindex    = reader.ReadInt32();
            Sound.mixerstream.output_sampindex       = reader.ReadInt32();
            Sound.mixerstream.output_base_sampindex  = reader.ReadInt32();
        }
コード例 #18
0
ファイル: State.cs プロジェクト: beginor/mame.net
        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);
        }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;

            if (provider != null)
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService == null)
            {
                return(value);
            }

            bool         singleSel = true;
            YM2151Timbre tim       = context.Instance as YM2151Timbre;

            YM2151Timbre[] tims = value as YM2151Timbre[];
            if (tims != null)
            {
                tim       = tims[0];
                singleSel = false;
            }

            YM2151 inst = null;

            try
            {
                //InstrumentManager.ExclusiveLockObject.EnterReadLock();

                inst = InstrumentManager.FindParentInstrument(InstrumentType.YM2151, tim) as YM2151;
            }
            finally
            {
                //InstrumentManager.ExclusiveLockObject.ExitReadLock();
            }

            if (inst != null)
            {
                if (singleSel)
                {
                    var mmlValueGeneral = SimpleSerializer.SerializeProps(tim,
                                                                          nameof(tim.ALG),
                                                                          nameof(tim.FB),
                                                                          nameof(tim.AMS),
                                                                          nameof(tim.PMS),
                                                                          "GlobalSettings.EN",
                                                                          "GlobalSettings.LFRQ",
                                                                          "GlobalSettings.LFOF",
                                                                          "GlobalSettings.LFOD",
                                                                          "GlobalSettings.LFOW",
                                                                          "GlobalSettings.NE",
                                                                          "GlobalSettings.NFRQ"
                                                                          );

                    List <string> mmlValueOps = new List <string>();
                    for (int i = 0; i < tim.Ops.Length; i++)
                    {
                        var op = tim.Ops[i];
                        mmlValueOps.Add(SimpleSerializer.SerializeProps(op,
                                                                        nameof(op.EN),
                                                                        nameof(op.AR),
                                                                        nameof(op.D1R),
                                                                        nameof(op.D2R),
                                                                        nameof(op.RR),
                                                                        nameof(op.SL),
                                                                        nameof(op.TL),
                                                                        nameof(op.RS),
                                                                        nameof(op.MUL),
                                                                        nameof(op.DT1),
                                                                        nameof(op.AM),
                                                                        nameof(op.DT2),
                                                                        nameof(op.LS),
                                                                        nameof(op.KVS)
                                                                        ));
                    }
                    FormYM2151Editor ed = new FormYM2151Editor(inst, tim, singleSel);
                    {
                        ed.MmlValueGeneral = mmlValueGeneral;

                        ed.FormClosed += (s, e) =>
                        {
                            if (ed.DialogResult == DialogResult.OK)
                            {
                                tim.Detailed = ed.MmlValueGeneral + "," + ed.MmlValueOps[0] + "," + ed.MmlValueOps[1] + "," + ed.MmlValueOps[2] + "," + ed.MmlValueOps[3];
                            }
                            else if (ed.DialogResult == DialogResult.Cancel)
                            {
                                tim.Detailed = mmlValueGeneral + "," + mmlValueOps[0] + "," + mmlValueOps[1] + "," + mmlValueOps[2] + "," + mmlValueOps[3];
                            }
                        };
                        ed.Show();
                        ed.Activated += (s, e) =>
                        {
                            tim.Detailed = ed.MmlValueGeneral + "," + ed.MmlValueOps[0] + "," + ed.MmlValueOps[1] + "," + ed.MmlValueOps[2] + "," + ed.MmlValueOps[3];
                        };
                    }
                }
                else
                {
                    using (FormYM2151Editor ed = new FormYM2151Editor(inst, tim, singleSel))
                    {
                        string       org = JsonConvert.SerializeObject(tims, Formatting.Indented);
                        DialogResult dr  = editorService.ShowDialog(ed);
                        if (dr == DialogResult.OK || dr == DialogResult.Abort)
                        {
                            return(value);
                        }
                        else
                        {
                            return(JsonConvert.DeserializeObject <YM2151Timbre[]>(org));
                        }
                    }
                }
            }

            return(value);                   // エディタ呼び出し直前の設定値をそのまま返す
        }
コード例 #20
0
ファイル: State.cs プロジェクト: JavierCanon/MAME.NET
        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);
        }
コード例 #21
0
ファイル: State.cs プロジェクト: JavierCanon/MAME.NET
        public static void LoadStateBinary(BinaryReader reader)
        {
            int i, j;

            dsw                     = reader.ReadUInt16();
            irqvector               = reader.ReadByte();
            sound_status            = reader.ReadUInt16();
            bankaddress             = reader.ReadInt32();
            m92_irq_vectorbase      = reader.ReadByte();
            m92_raster_irq_position = reader.ReadInt32();
            m92_scanline_param      = reader.ReadInt32();
            setvector_param         = reader.ReadInt32();
            m92_sprite_buffer_busy  = reader.ReadByte();
            for (i = 0; i < 4; i++)
            {
                pf_master_control[i] = reader.ReadUInt16();
            }
            m92_sprite_list   = reader.ReadInt32();
            m92_vram_data     = reader.ReadBytes(0x10000);
            m92_spritecontrol = reader.ReadBytes(0x10);
            m92_game_kludge   = reader.ReadInt32();
            m92_palette_bank  = reader.ReadInt32();
            for (i = 0; i < 3; i++)
            {
                pf_layer[i].vram_base = reader.ReadUInt16();
            }
            for (i = 0; i < 3; i++)
            {
                for (j = 0; j < 4; j++)
                {
                    pf_layer[i].control[j] = reader.ReadUInt16();
                }
            }
            for (i = 0; i < 0x800; i++)
            {
                Generic.paletteram16[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x400; i++)
            {
                Generic.spriteram16[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x400; i++)
            {
                Generic.buffered_spriteram16[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x801; i++)
            {
                Palette.entry_color[i] = reader.ReadUInt32();
            }
            Memory.mainram = reader.ReadBytes(0x10000);
            Nec.nn1[0].LoadStateBinary(reader);
            Memory.audioram = reader.ReadBytes(0x4000);
            Nec.nn1[1].LoadStateBinary(reader);
            Cpuint.LoadStateBinary(reader);
            Timer.global_basetime.seconds     = reader.ReadInt32();
            Timer.global_basetime.attoseconds = reader.ReadInt64();
            Video.LoadStateBinary(reader);
            Sound.last_update_second = reader.ReadInt32();
            for (i = 0; i < 2; i++)
            {
                Cpuexec.cpu[i].suspend               = reader.ReadByte();
                Cpuexec.cpu[i].nextsuspend           = reader.ReadByte();
                Cpuexec.cpu[i].eatcycles             = reader.ReadByte();
                Cpuexec.cpu[i].nexteatcycles         = reader.ReadByte();
                Cpuexec.cpu[i].localtime.seconds     = reader.ReadInt32();
                Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
            }
            Timer.LoadStateBinary(reader);
            YM2151.LoadStateBinary(reader);
            Iremga20.LoadStateBinary(reader);
            Sound.latched_value[0] = reader.ReadUInt16();
            Sound.utempdata[0]     = reader.ReadUInt16();
            Sound.ym2151stream.output_sampindex        = reader.ReadInt32();
            Sound.ym2151stream.output_base_sampindex   = reader.ReadInt32();
            Sound.iremga20stream.output_sampindex      = reader.ReadInt32();
            Sound.iremga20stream.output_base_sampindex = reader.ReadInt32();
            Sound.mixerstream.output_sampindex         = reader.ReadInt32();
            Sound.mixerstream.output_base_sampindex    = reader.ReadInt32();
        }
コード例 #22
0
ファイル: State.cs プロジェクト: JavierCanon/MAME.NET
        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);
        }
コード例 #23
0
ファイル: State.cs プロジェクト: JavierCanon/MAME.NET
        public static void LoadStateBinary(BinaryReader reader)
        {
            int i;

            dsw                = reader.ReadUInt16();
            setvector_param    = reader.ReadInt32();
            irqvector          = reader.ReadByte();
            sample_addr        = reader.ReadInt32();
            protection_ram     = reader.ReadBytes(0x1000);
            m72_irq_base       = reader.ReadByte();
            m72_scanline_param = reader.ReadInt32();
            for (i = 0; i < 0x600; i++)
            {
                Generic.paletteram16[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x600; i++)
            {
                Generic.paletteram16_2[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x200; i++)
            {
                Generic.spriteram16[i] = reader.ReadUInt16();
            }
            m72_videoram1           = reader.ReadBytes(0x4000);
            m72_videoram2           = reader.ReadBytes(0x4000);
            m72_raster_irq_position = reader.ReadInt32();
            video_off = reader.ReadInt32();
            scrollx1  = reader.ReadInt32();
            scrolly1  = reader.ReadInt32();
            scrollx2  = reader.ReadInt32();
            scrolly2  = reader.ReadInt32();
            for (i = 0; i < 0x200; i++)
            {
                m72_spriteram[i] = reader.ReadUInt16();
            }
            for (i = 0; i < 0x201; i++)
            {
                Palette.entry_color[i] = reader.ReadUInt32();
            }
            Memory.mainram = reader.ReadBytes(0x4000);
            Nec.nn1[0].LoadStateBinary(reader);
            Memory.audioram = reader.ReadBytes(0x10000);
            Z80A.z1.LoadStateBinary(reader);
            Cpuint.LoadStateBinary(reader);
            Timer.global_basetime.seconds     = reader.ReadInt32();
            Timer.global_basetime.attoseconds = reader.ReadInt64();
            Video.LoadStateBinary(reader);
            Sound.last_update_second = reader.ReadInt32();
            for (i = 0; i < 2; i++)
            {
                Cpuexec.cpu[i].suspend               = reader.ReadByte();
                Cpuexec.cpu[i].nextsuspend           = reader.ReadByte();
                Cpuexec.cpu[i].eatcycles             = reader.ReadByte();
                Cpuexec.cpu[i].nexteatcycles         = reader.ReadByte();
                Cpuexec.cpu[i].localtime.seconds     = reader.ReadInt32();
                Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
            }
            Timer.LoadStateBinary(reader);
            YM2151.LoadStateBinary(reader);
            DAC.dac1.output        = reader.ReadInt16();
            Sound.latched_value[0] = reader.ReadUInt16();
            Sound.utempdata[0]     = reader.ReadUInt16();
            Sound.ym2151stream.output_sampindex      = reader.ReadInt32();
            Sound.ym2151stream.output_base_sampindex = reader.ReadInt32();
            Sound.dacstream.output_sampindex         = reader.ReadInt32();
            Sound.dacstream.output_base_sampindex    = reader.ReadInt32();
            Sound.mixerstream.output_sampindex       = reader.ReadInt32();
            Sound.mixerstream.output_base_sampindex  = reader.ReadInt32();
        }