From 81cebcefc06098742dc8bb28085c51606b1de284 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Sun, 19 Jan 2025 21:49:03 +0800 Subject: [PATCH] =?UTF-8?q?audioram=20=E5=85=A8=E5=B1=80=E6=8C=87=E9=92=88?= =?UTF-8?q?=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAME.Unity/Assets/Plugins/UMAME/emu/Memory.cs | 31 ++++++++++++- .../Plugins/UMAME/mame/capcom/Capcom.cs | 4 +- .../Plugins/UMAME/mame/capcom/Memory.cs | 12 ++--- .../Assets/Plugins/UMAME/mame/capcom/State.cs | 8 ++-- .../Assets/Plugins/UMAME/mame/cps/CPS.cs | 2 +- .../Assets/Plugins/UMAME/mame/cps/Memory.cs | 4 +- .../Assets/Plugins/UMAME/mame/cps/State.cs | 12 ++--- .../Plugins/UMAME/mame/dataeast/Memory.cs | 10 ++--- .../Plugins/UMAME/mame/dataeast/Pcktgal.cs | 2 +- .../Plugins/UMAME/mame/dataeast/State.cs | 4 +- .../UMAME/mame/konami68000/Konami68000.cs | 2 +- .../Plugins/UMAME/mame/konami68000/Memory.cs | 30 ++++++------- .../Plugins/UMAME/mame/konami68000/Memory2.cs | 18 ++++---- .../Plugins/UMAME/mame/konami68000/State.cs | 44 +++++++++---------- .../Assets/Plugins/UMAME/mame/m72/M72.cs | 14 +++--- .../Assets/Plugins/UMAME/mame/m72/Memory.cs | 8 ++-- .../Assets/Plugins/UMAME/mame/m72/State.cs | 4 +- .../Assets/Plugins/UMAME/mame/m92/M92.cs | 2 +- .../Assets/Plugins/UMAME/mame/m92/Memory.cs | 10 ++--- .../Assets/Plugins/UMAME/mame/m92/State.cs | 4 +- .../Plugins/UMAME/mame/neogeo/Memory.cs | 6 +-- .../Plugins/UMAME/mame/neogeo/Neogeo.cs | 2 +- .../Assets/Plugins/UMAME/mame/neogeo/State.cs | 4 +- .../Assets/Plugins/UMAME/mame/pgm/Memory.cs | 4 +- .../Assets/Plugins/UMAME/mame/pgm/PGM.cs | 10 ++--- .../Assets/Plugins/UMAME/mame/pgm/State.cs | 4 +- .../Assets/Plugins/UMAME/mame/suna8/Memory.cs | 4 +- .../Assets/Plugins/UMAME/mame/suna8/SunA8.cs | 2 +- .../Assets/Plugins/UMAME/mame/taito/Memory.cs | 18 ++++---- .../Assets/Plugins/UMAME/mame/taito/State.cs | 20 ++++----- .../Assets/Plugins/UMAME/mame/taito/Taito.cs | 14 +++--- .../Plugins/UMAME/mame/taitob/Memory.cs | 4 +- .../Assets/Plugins/UMAME/mame/taitob/State.cs | 4 +- .../Plugins/UMAME/mame/taitob/Taitob.cs | 2 +- .../Plugins/UMAME/mame/tehkan/Memory.cs | 4 +- .../Plugins/UMAME/mame/tehkan/Pbaction.cs | 4 +- .../Assets/Plugins/UMAME/mame/tehkan/State.cs | 4 +- 37 files changed, 181 insertions(+), 154 deletions(-) diff --git a/MAME.Unity/Assets/Plugins/UMAME/emu/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/emu/Memory.cs index c3cf50b..ce08ff9 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/emu/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/emu/Memory.cs @@ -7,9 +7,9 @@ namespace MAME.Core public unsafe class Memory { //public static byte[] mainrom, audiorom, mainram, audioram; - public static byte[] audioram; + //public static byte[] ; - static byte[] mainrom, audiorom, mainram; + static byte[] mainrom, audiorom, mainram, audioram; public static void memory_reset() { switch (Machine.sBoard) @@ -381,6 +381,7 @@ namespace MAME.Core audiorom_Ptr = null; } + static GCHandle mainram_handle; public static byte* mainram_Ptr; public static int mainram_Lenght; @@ -408,6 +409,32 @@ namespace MAME.Core } + static GCHandle audioram_handle; + public static byte* audioram_Ptr; + public static int audioram_Lenght; + public static bool audioram_IsNull => audioram == null; + + public static void Set_audioram(byte[] data) + { + Release_audioram(); + audioram = data; + audioram_handle = GCHandle.Alloc(audioram, GCHandleType.Pinned); + audioram_Ptr = (byte*)audioram_handle.AddrOfPinnedObject(); + audioram_Lenght = data.Length; + } + static void Release_audioram() + { + if (audioram != null) + { + if (audioram_handle.IsAllocated) + audioram_handle.Free(); + } + audioram = null; + audioram_handle = default; + audioram_Ptr = null; + audioram_Lenght = default; + } + } public unsafe static class MemoryEx diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Capcom.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Capcom.cs index 3208056..f0b955d 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Capcom.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Capcom.cs @@ -58,7 +58,7 @@ namespace MAME.Core gfx3rom[i * 2 + 1] = (byte)(gfx32rom[i] & 0x0f); } Memory.Set_mainram(new byte[0x1e00]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Generic.paletteram = new byte[0x100]; Generic.paletteram_2 = new byte[0x100]; if (Memory.mainrom_IsNull|| Memory.audiorom_IsNull || gfx12rom == null || gfx22rom == null || gfx32rom == null) @@ -113,7 +113,7 @@ namespace MAME.Core } gfx5rom = Machine.GetRom("gfx5.rom"); Memory.Set_mainram(new byte[0x6000]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); if (Memory.mainrom_IsNull || Memory.audiorom_IsNull || gfx12rom == null || gfx22rom == null || gfx32rom == null || gfx42rom == null || gfx5rom == null) { Machine.bRom = false; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Memory.cs index 9d304db..c7baa62 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/Memory.cs @@ -235,7 +235,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -253,7 +253,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xc800) { @@ -274,7 +274,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xe000) { @@ -1195,7 +1195,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -1213,7 +1213,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xc800) { @@ -1238,7 +1238,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xe000) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/State.cs index 7f28367..293915d 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/capcom/State.cs @@ -27,7 +27,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x1e00); M6809.mm1[0].SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -73,7 +73,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x1e00)); M6809.mm1[0].LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -126,7 +126,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x6000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Z80A.zz1[1].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); @@ -175,7 +175,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x6000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Z80A.zz1[1].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/CPS.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/CPS.cs index 50ac8cd..4c5037f 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/CPS.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/CPS.cs @@ -50,7 +50,7 @@ namespace MAME.Core cps_b_regs = new ushort[0x20]; gfxram = new byte[0x30000]; Memory.Set_mainram(new byte[0x10000]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Machine.bRom = true; Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); gfxrom = Machine.GetRom("gfx.rom"); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/Memory.cs index 222861c..77cbd2d 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/Memory.cs @@ -376,7 +376,7 @@ namespace MAME.Core } else if (address >= 0xd000 && address <= 0xd7ff) { - result = Memory.audioram[address & 0x7ff]; + result = Memory.audioram_Ptr[address & 0x7ff]; } else if (address == 0xf001) { @@ -404,7 +404,7 @@ namespace MAME.Core { if (address >= 0xd000 && address <= 0xd7ff) { - Memory.audioram[address & 0x7ff] = value; + Memory.audioram_Ptr[address & 0x7ff] = value; } else if (address == 0xf000) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/State.cs index a8e2b37..01b5ee4 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/cps/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/cps/State.cs @@ -28,7 +28,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x10000); writer.Write(gfxram, 0, 0x30000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -98,7 +98,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x10000); writer.Write(gfxram, 0, 0x30000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -161,7 +161,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x10000); writer.Write(gfxram, 0, 0x30000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -209,7 +209,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x10000)); gfxram = reader.ReadBytes(0x30000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -279,7 +279,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x10000)); gfxram = reader.ReadBytes(0x30000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -342,7 +342,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x10000)); gfxram = reader.ReadBytes(0x30000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Memory.cs index 5f549cf..14cf8ee 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Memory.cs @@ -123,7 +123,7 @@ byte result = 0; if (address <= 0x7ff) { - result = Memory.audioram[address]; + result = Memory.audioram_Ptr[address]; } else if (address >= 0x4000 && address <= 0x7fff) { @@ -142,7 +142,7 @@ byte result = 0; if (address <= 0x7ff) { - result = Memory.audioram[address]; + result = Memory.audioram_Ptr[address]; } else if (address >= 0x4000 && address <= 0x7fff) { @@ -160,7 +160,7 @@ byte result = 0; if (address <= 0x7ff) { - result = Memory.audioram[address]; + result = Memory.audioram_Ptr[address]; } else if (address >= 0x4000 && address <= 0x7fff) { @@ -178,7 +178,7 @@ byte result = 0; if (address <= 0x7ff) { - result = Memory.audioram[address]; + result = Memory.audioram_Ptr[address]; } else if (address == 0x3000) { @@ -203,7 +203,7 @@ { if (address <= 0x7ff) { - Memory.audioram[address] = data; + Memory.audioram_Ptr[address] = data; } else if (address == 0x0800) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Pcktgal.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Pcktgal.cs index 202dc6c..9848e99 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Pcktgal.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/Pcktgal.cs @@ -10,7 +10,7 @@ int i, n; Machine.bRom = true; Memory.Set_mainram(new byte[0x800]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Generic.spriteram = new byte[0x200]; Generic.videoram = new byte[0x800]; switch (Machine.sName) diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/State.cs index e93a6b6..faedcc0 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/dataeast/State.cs @@ -21,7 +21,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x800); writer.Write(Generic.videoram, 0, 0x800); writer.Write(Generic.spriteram, 0, 0x200); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); M6502.mm1[0].SaveStateBinary(writer); M6502.mm1[1].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); @@ -64,7 +64,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x800)); Generic.videoram = reader.ReadBytes(0x800); Generic.spriteram = reader.ReadBytes(0x200); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); M6502.mm1[0].LoadStateBinary(reader); M6502.mm1[1].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Konami68000.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Konami68000.cs index 5775e38..00ba558 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Konami68000.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Konami68000.cs @@ -22,7 +22,7 @@ namespace MAME.Core init_eeprom_count = 10; toggle = 0; Memory.Set_mainram(new byte[0x4000]); - Memory.audioram = new byte[0x2000];//0x800 prmrsocr_0x2000 + Memory.Set_audioram(new byte[0x2000]);//0x800 prmrsocr_0x2000 mainram2 = new byte[0x4000];//0x4000 tmnt2_ssriders_0x80 layer_colorbase = new int[3]; cuebrick_nvram = new ushort[0x400 * 0x20]; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory.cs index d88e2b4..348ccac 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory.cs @@ -3201,7 +3201,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3219,7 +3219,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xa000) { @@ -3241,7 +3241,7 @@ namespace MAME.Core if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address >= 0xb000 && address <= 0xb00d) { @@ -3267,7 +3267,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3285,7 +3285,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0x9000) { @@ -3315,7 +3315,7 @@ namespace MAME.Core if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0x9000) { @@ -3353,7 +3353,7 @@ namespace MAME.Core else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3371,7 +3371,7 @@ namespace MAME.Core else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xf801) { @@ -3389,7 +3389,7 @@ namespace MAME.Core if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xf800) { @@ -3419,7 +3419,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3437,7 +3437,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xa001) { @@ -3455,7 +3455,7 @@ namespace MAME.Core if (address >= 0x8000 && address <= 0x87ff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xa000) { @@ -3481,7 +3481,7 @@ namespace MAME.Core else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3499,7 +3499,7 @@ namespace MAME.Core else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xf801) { @@ -3517,7 +3517,7 @@ namespace MAME.Core if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xf800) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory2.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory2.cs index 055c221..3fa833d 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory2.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/Memory2.cs @@ -2893,7 +2893,7 @@ else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -2911,7 +2911,7 @@ else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address >= 0xf800 && address <= 0xf82f) { @@ -2925,7 +2925,7 @@ if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address >= 0xf800 && address <= 0xf82f) { @@ -2947,7 +2947,7 @@ else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -2965,7 +2965,7 @@ else if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xf801 || address == 0xf811) { @@ -2983,7 +2983,7 @@ if (address >= 0xf000 && address <= 0xf7ff) { int offset = address - 0xf000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xf800 || address == 0xf810) { @@ -3018,7 +3018,7 @@ else if (address >= 0xc000 && address <= 0xdfff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else { @@ -3041,7 +3041,7 @@ else if (address >= 0xc000 && address <= 0xdfff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address >= 0xe000 && address <= 0xe0ff) { @@ -3073,7 +3073,7 @@ else if (address >= 0xc000 && address <= 0xdfff) { int offset = address - 0xc000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address >= 0xe000 && address <= 0xe0ff) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/State.cs index f7858cd..648d1e0 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/konami68000/State.cs @@ -48,7 +48,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x4000); writer.Write(mainram2, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); writer.Write(EmuTimer.global_basetime.attoseconds); @@ -104,7 +104,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x4000)); mainram2 = reader.ReadBytes(0x4000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); EmuTimer.global_basetime.attoseconds = reader.ReadInt64(); @@ -154,7 +154,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x4000); writer.Write(mainram2, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -216,7 +216,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x4000)); mainram2 = reader.ReadBytes(0x4000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -282,7 +282,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -354,7 +354,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -421,7 +421,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -474,7 +474,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -527,7 +527,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -580,7 +580,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -631,7 +631,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -683,7 +683,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -738,7 +738,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -789,7 +789,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -841,7 +841,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x4000); writer.Write(mainram2, 0, 0x80); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -897,7 +897,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x4000)); mainram2 = reader.ReadBytes(0x80); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -949,7 +949,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x4000); writer.Write(mainram2, 0, 0x80); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -1001,7 +1001,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x4000)); mainram2 = reader.ReadBytes(0x80); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -1053,7 +1053,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -1105,7 +1105,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); @@ -1158,7 +1158,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x2000); + writer.Write(Memory.audioram_Ptr, 0, 0x2000); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -1216,7 +1216,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x2000); + Memory.Set_audioram(reader.ReadBytes(0x2000)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/M72.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/M72.cs index 893446b..b611c56 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/M72.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/M72.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public partial class M72 + public unsafe partial class M72 { public static byte[] protection_ram; public static EmuTimer.emu_timer scanline_timer; @@ -78,7 +78,7 @@ namespace MAME.Core } samplesrom = Machine.GetRom("samples.rom"); Memory.Set_mainram(new byte[0x4000]); - Memory.audioram = new byte[0x10000]; + Memory.Set_audioram(new byte[0x10000]); dsw = 0xffbf; if (Memory.mainrom_IsNull || Memory.audiorom_IsNull || sprites1rom == null || gfx21rom == null || samplesrom == null) { @@ -137,20 +137,20 @@ namespace MAME.Core } public static byte soundram_r(int offset) { - return Memory.audioram[offset]; + return Memory.audioram_Ptr[offset]; } public static ushort soundram_r2(int offset) { - return (ushort)(Memory.audioram[offset * 2 + 0] | (Memory.audioram[offset * 2 + 1] << 8)); + return (ushort)(Memory.audioram_Ptr[offset * 2 + 0] | (Memory.audioram_Ptr[offset * 2 + 1] << 8)); } public static void soundram_w(int offset, byte data) { - Memory.audioram[offset] = data; + Memory.audioram_Ptr[offset] = data; } public static void soundram_w(int offset, ushort data) { - Memory.audioram[offset * 2] = (byte)data; - Memory.audioram[offset * 2 + 1] = (byte)(data >> 8); + Memory.audioram_Ptr[offset * 2] = (byte)data; + Memory.audioram_Ptr[offset * 2 + 1] = (byte)(data >> 8); } public static void machine_start_m72() { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/Memory.cs index 82e3d51..7480edd 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/Memory.cs @@ -544,7 +544,7 @@ byte result = 0; if (address >= 0 && address <= 0xffff) { - result = Memory.audioram[address]; + result = Memory.audioram_Ptr[address]; } return result; } @@ -557,7 +557,7 @@ } else if (address >= 0xf000 && address <= 0xffff) { - result = Memory.audioram[address - 0xf000]; + result = Memory.audioram_Ptr[address - 0xf000]; } return result; } @@ -565,14 +565,14 @@ { if (address >= 0x0000 && address <= 0xffff) { - Memory.audioram[address] = value; + Memory.audioram_Ptr[address] = value; } } public static void ZWriteMemory_rom(ushort address, byte value) { if (address >= 0xf000 && address <= 0xffff) { - Memory.audioram[address - 0xf000] = value; + Memory.audioram_Ptr[address - 0xf000] = value; } } public static byte ZReadHardware(ushort address) diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/State.cs index c9223fe..8a2fe8f 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m72/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m72/State.cs @@ -47,7 +47,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x4000); Nec.nn1[0].SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x10000); + writer.Write(Memory.audioram_Ptr, 0, 0x10000); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); Cpuint.SaveStateBinary_v(writer); @@ -108,7 +108,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x4000)); Nec.nn1[0].LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x10000); + Memory.Set_audioram(reader.ReadBytes(0x10000)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); Cpuint.LoadStateBinary_v(reader); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/M92.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/M92.cs index 690202b..aa00dcd 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/M92.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/M92.cs @@ -240,7 +240,7 @@ namespace MAME.Core Memory.Set_audiorom(Machine.GetRom("soundcpu.rom")); Iremga20.iremrom = Machine.GetRom("irem.rom"); Memory.Set_mainram(new byte[0x10000]); - Memory.audioram = new byte[0x4000]; + Memory.Set_audioram(new byte[0x4000]); gfx1rom = Machine.GetRom("gfx1.rom"); n1 = gfx1rom.Length; gfx11rom = new byte[n1 * 2]; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/Memory.cs index 83ae46e..c110981 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/Memory.cs @@ -383,7 +383,7 @@ else if (address >= 0xa0000 && address <= 0xa3fff) { int offset = address - 0xa0000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address >= 0xa8000 && address <= 0xa803f) { @@ -416,7 +416,7 @@ else if (address >= 0xa0000 && address + 1 <= 0xa3fff) { int offset = address - 0xa0000; - result = (ushort)(Memory.audioram[offset] + Memory.audioram[offset + 1] * 0x100); + result = (ushort)(Memory.audioram_Ptr[offset] + Memory.audioram_Ptr[offset + 1] * 0x100); } else if (address >= 0xa8000 && address + 1 <= 0xa803f) { @@ -448,7 +448,7 @@ else if (address >= 0xa0000 && address <= 0xa3fff) { int offset = address - 0xa0000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address >= 0xa8000 && address <= 0xa803f) { @@ -482,8 +482,8 @@ else if (address >= 0xa0000 && address + 1 <= 0xa3fff) { int offset = address - 0xa0000; - Memory.audioram[offset] = (byte)value; - Memory.audioram[offset + 1] = (byte)(value >> 8); + Memory.audioram_Ptr[offset] = (byte)value; + Memory.audioram_Ptr[offset + 1] = (byte)(value >> 8); } else if (address >= 0xa8000 && address + 1 <= 0xa803f) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/State.cs index 6043392..dd8c6c2 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/m92/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/m92/State.cs @@ -61,7 +61,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x10000); Nec.nn1[0].SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x4000); + writer.Write(Memory.audioram_Ptr, 0, 0x4000); Nec.nn1[1].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); Cpuint.SaveStateBinary_v(writer); @@ -138,7 +138,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x10000)); Nec.nn1[0].LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x4000); + Memory.Set_audioram(reader.ReadBytes(0x4000)); Nec.nn1[1].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); Cpuint.LoadStateBinary_v(reader); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Memory.cs index c27b381..f84a049 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Memory.cs @@ -2001,7 +2001,7 @@ namespace MAME.Core } else if (address >= 0xf800 && address <= 0xffff) { - result = Memory.audioram[address - 0xf800]; + result = Memory.audioram_Ptr[address - 0xf800]; } return result; } @@ -2030,7 +2030,7 @@ namespace MAME.Core } else if (address >= 0xf800 && address <= 0xffff) { - result = Memory.audioram[address - 0xf800]; + result = Memory.audioram_Ptr[address - 0xf800]; } return result; } @@ -2038,7 +2038,7 @@ namespace MAME.Core { if (address >= 0xf800 && address <= 0xffff) { - Memory.audioram[address - 0xf800] = value; + Memory.audioram_Ptr[address - 0xf800] = value; } else { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Neogeo.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Neogeo.cs index fe240f4..2429747 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Neogeo.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/Neogeo.cs @@ -37,7 +37,7 @@ namespace MAME.Core pvc_cartridge_ram = new byte[0x2000]; Memory.Set_mainram(new byte[0x10000]); mainram2 = new byte[0x10000]; - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Machine.bRom = true; dsw = 0xff; fixedbiosrom = MameMainMotion.resource.sfix; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/State.cs index 02cb80f..a1a27f2 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/neogeo/State.cs @@ -48,7 +48,7 @@ namespace MAME.Core writer.Write(auto_animation_frame_counter); writer.Write(Memory.mainram_Ptr, 0, 0x10000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -119,7 +119,7 @@ namespace MAME.Core auto_animation_frame_counter = reader.ReadInt32(); Memory.Set_mainram(reader.ReadBytes(0x10000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/Memory.cs index 6a9ffdf..acfb5d7 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/Memory.cs @@ -587,12 +587,12 @@ } public static byte ZReadMemory(ushort address) { - byte result = Memory.audioram[address]; + byte result = Memory.audioram_Ptr[address]; return result; } public static void ZWriteMemory(ushort address, byte value) { - Memory.audioram[address] = value; + Memory.audioram_Ptr[address] = value; } public static byte ZReadHardware(ushort address) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/PGM.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/PGM.cs index 7e55728..79351e5 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/PGM.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/PGM.cs @@ -52,7 +52,7 @@ namespace MAME.Core pgm_rowscrollram = new byte[0x800]; Generic.paletteram16 = new ushort[0x900]; pgm_videoregs = new byte[0x10000]; - Memory.audioram = new byte[0x10000]; + Memory.Set_audioram(new byte[0x10000]); if (Memory.mainrom_IsNull || sprmaskrom == null || pgm_sprite_a_region == null) { Machine.bRom = false; @@ -101,14 +101,14 @@ namespace MAME.Core Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_HALT, LineState.ASSERT_LINE); device_reset(); } - public static byte z80_ram_r(int offset) + public unsafe static byte z80_ram_r(int offset) { - return Memory.audioram[offset]; + return Memory.audioram_Ptr[offset]; } - public static void z80_ram_w(int offset, byte data) + public unsafe static void z80_ram_w(int offset, byte data) { int pc = MC68000.m1.PC; - Memory.audioram[offset] = data; + Memory.audioram_Ptr[offset] = data; if (pc != 0xf12 && pc != 0xde2 && pc != 0x100c50 && pc != 0x100b20) { //error diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/State.cs index 5570fbe..075378e 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/pgm/State.cs @@ -35,7 +35,7 @@ namespace MAME.Core } writer.Write(Memory.mainram_Ptr, 0, 0x20000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x10000); + writer.Write(Memory.audioram_Ptr, 0, 0x10000); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -87,7 +87,7 @@ namespace MAME.Core } Memory.Set_mainram(reader.ReadBytes(0x20000)); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x10000); + Memory.Set_audioram(reader.ReadBytes(0x10000)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/Memory.cs index beb75c2..ee1d44b 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/Memory.cs @@ -155,7 +155,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xc800) { @@ -186,7 +186,7 @@ namespace MAME.Core else if (address >= 0xc000 && address <= 0xc7ff) { int offset = address - 0xc000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xd000) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/SunA8.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/SunA8.cs index 5e7b663..c31113a 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/SunA8.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/suna8/SunA8.cs @@ -37,7 +37,7 @@ namespace MAME.Core gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f); } Memory.Set_mainram(new byte[0x1800]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Generic.paletteram = new byte[0x200]; if (mainromop == null || Memory.mainrom_IsNull || Memory.audiorom_IsNull || samplesrom == null || gfx12rom == null) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Memory.cs index be8ad7d..4521355 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Memory.cs @@ -380,7 +380,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0x9000) { @@ -413,7 +413,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0x9000) { @@ -622,7 +622,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } return result; } @@ -636,7 +636,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0x9000) { @@ -669,7 +669,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0x9000) { @@ -2491,7 +2491,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0x9001) { @@ -2500,7 +2500,7 @@ namespace MAME.Core else if (address >= 0x9002 && address <= 0x9100) { int offset = address - 0x9002; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0xa001) { @@ -2522,7 +2522,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0x8fff) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0x9000) { @@ -2599,7 +2599,7 @@ namespace MAME.Core else if (address == 0x8000) { int offset = address - 0x8000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0x9000) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/State.cs index a29b0da..6c80cd9 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/State.cs @@ -26,7 +26,7 @@ namespace MAME.Core writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram_Ptr, 0, 0x1800); - writer.Write(Memory.audioram, 0, 0x1000); + writer.Write(Memory.audioram_Ptr, 0, 0x1000); for (i = 0; i < 3; i++) { Z80A.zz1[i].SaveStateBinary(writer); @@ -75,7 +75,7 @@ namespace MAME.Core Palette.entry_color[i] = reader.ReadUInt32(); } Memory.Set_mainram(reader.ReadBytes(0x1800)); - Memory.audioram = reader.ReadBytes(0x1000); + Memory.Set_audioram(reader.ReadBytes(0x1000)); for (i = 0; i < 3; i++) { Z80A.zz1[i].LoadStateBinary(reader); @@ -134,7 +134,7 @@ namespace MAME.Core writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram_Ptr, 0, 0x1800); - writer.Write(Memory.audioram, 0, 0x1000); + writer.Write(Memory.audioram_Ptr, 0, 0x1000); writer.Write(mcuram, 0, 0xc0); for (i = 0; i < 3; i++) { @@ -198,7 +198,7 @@ namespace MAME.Core Palette.entry_color[i] = reader.ReadUInt32(); } Memory.Set_mainram(reader.ReadBytes(0x1800)); - Memory.audioram = reader.ReadBytes(0x1000); + Memory.Set_audioram(reader.ReadBytes(0x1000)); mcuram = reader.ReadBytes(0xc0); for (i = 0; i < 3; i++) { @@ -253,7 +253,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x1800); writer.Write(mainram2, 0, 0x100); writer.Write(mainram3, 0, 0x100); - writer.Write(Memory.audioram, 0, 0x1000); + writer.Write(Memory.audioram_Ptr, 0, 0x1000); writer.Write(mcuram, 0, 0xc0); for (i = 0; i < 3; i++) { @@ -307,7 +307,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x1800)); mainram2 = reader.ReadBytes(0x100); mainram3 = reader.ReadBytes(0x100); - Memory.audioram = reader.ReadBytes(0x1000); + Memory.Set_audioram(reader.ReadBytes(0x1000)); for (i = 0; i < 3; i++) { Z80A.zz1[i].LoadStateBinary(reader); @@ -363,7 +363,7 @@ namespace MAME.Core writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram_Ptr, 0, 0x1800); - writer.Write(Memory.audioram, 0, 0x1000); + writer.Write(Memory.audioram_Ptr, 0, 0x1000); writer.Write(mcuram, 0, 0xc0); for (i = 0; i < 3; i++) { @@ -421,7 +421,7 @@ namespace MAME.Core Palette.entry_color[i] = reader.ReadUInt32(); } Memory.Set_mainram(reader.ReadBytes(0x1800)); - Memory.audioram = reader.ReadBytes(0x1000); + Memory.Set_audioram(reader.ReadBytes(0x1000)); mcuram = reader.ReadBytes(0xc0); for (i = 0; i < 3; i++) { @@ -568,7 +568,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x8000); writer.Write(mainram2, 0, 0x10000); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x1000); + writer.Write(Memory.audioram_Ptr, 0, 0x1000); for (i = 0; i < Z80A.nZ80; i++) { Z80A.zz1[i].SaveStateBinary(writer); @@ -705,7 +705,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x8000)); mainram2 = reader.ReadBytes(0x10000); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x1000); + Memory.Set_audioram(reader.ReadBytes(0x1000)); for (i = 0; i < Z80A.nZ80; i++) { Z80A.zz1[i].LoadStateBinary(reader); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Taito.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Taito.cs index 04aa3fa..e951360 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Taito.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taito/Taito.cs @@ -19,7 +19,7 @@ namespace MAME.Core videoram = new byte[0x1d00]; bublbobl_objectram = new byte[0x300]; Memory.Set_mainram(new byte[0x1800]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Generic.paletteram = new byte[0x200]; //bublbobl_mcu_sharedram = new byte[0x400]; Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); @@ -57,7 +57,7 @@ namespace MAME.Core videoram = new byte[0x1d00]; bublbobl_objectram = new byte[0x300]; Memory.Set_mainram(new byte[0x1800]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); mcuram = new byte[0xc0]; Generic.paletteram = new byte[0x200]; bublbobl_mcu_sharedram = new byte[0x400]; @@ -99,7 +99,7 @@ namespace MAME.Core videoram = new byte[0x1d00]; bublbobl_objectram = new byte[0x300]; Memory.Set_mainram(new byte[0x1800]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Generic.paletteram = new byte[0x200]; Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); slaverom = Machine.GetRom("slave.rom"); @@ -132,7 +132,7 @@ namespace MAME.Core videoram = new byte[0x1d00]; bublbobl_objectram = new byte[0x300]; Memory.Set_mainram(new byte[0x1800]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Generic.paletteram = new byte[0x200]; Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); slaverom = Machine.GetRom("slave.rom"); @@ -167,7 +167,7 @@ namespace MAME.Core cchip_ram = new byte[0x2000]; Generic.paletteram16 = new ushort[0x800]; Memory.Set_mainram(new byte[0x8000]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); bb1 = Machine.GetRom("audiocpu.rom"); //Memory.audiorom = new byte[0x20000]; @@ -211,7 +211,7 @@ namespace MAME.Core cchip_ram = new byte[0x2000]; Generic.paletteram16 = new ushort[0x800]; Memory.Set_mainram(new byte[0x8000]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); bb1 = Machine.GetRom("audiocpu.rom"); //Memory.audiorom = new byte[0x20000]; @@ -256,7 +256,7 @@ namespace MAME.Core cchip_ram = new byte[0x2000]; Generic.paletteram16 = new ushort[0x800]; Memory.Set_mainram(new byte[0x8000]); - Memory.audioram = new byte[0x1000]; + Memory.Set_audioram(new byte[0x1000]); Memory.Set_mainrom(Machine.GetRom("maincpu.rom")); bb1 = Machine.GetRom("audiocpu.rom"); //Memory.audiorom = new byte[0x20000]; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Memory.cs index 3b16cfc..62138d1 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Memory.cs @@ -702,7 +702,7 @@ namespace MAME.Core } else if (address >= 0xc000 && address <= 0xdfff) { - result = Memory.audioram[address - 0xc000]; + result = Memory.audioram_Ptr[address - 0xc000]; } else if (address >= 0xe000 && address <= 0xe000) { @@ -738,7 +738,7 @@ namespace MAME.Core } else if (address >= 0xc000 && address <= 0xdfff) { - Memory.audioram[address - 0xc000] = value; + Memory.audioram_Ptr[address - 0xc000] = value; } else if (address >= 0xe000 && address <= 0xe000) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/State.cs index 29cf9b3..03992e1 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/State.cs @@ -56,7 +56,7 @@ namespace MAME.Core writer.Write(Memory.mainram_Ptr, 0, 0x10000); writer.Write(mainram2, 0, 0x1e80); MC68000.m1.SaveStateBinary(writer); - writer.Write(Memory.audioram, 0, 0x2000); + writer.Write(Memory.audioram_Ptr, 0, 0x2000); Z80A.zz1[0].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(EmuTimer.global_basetime.seconds); @@ -145,7 +145,7 @@ namespace MAME.Core Memory.Set_mainram(reader.ReadBytes(0x10000)); mainram2 = reader.ReadBytes(0x1e80); MC68000.m1.LoadStateBinary(reader); - Memory.audioram = reader.ReadBytes(0x2000); + Memory.Set_audioram(reader.ReadBytes(0x2000)); Z80A.zz1[0].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); EmuTimer.global_basetime.seconds = reader.ReadInt32(); diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Taitob.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Taitob.cs index fe555ed..90e2c76 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Taitob.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/taitob/Taitob.cs @@ -22,7 +22,7 @@ namespace MAME.Core Memory.Set_mainram(new byte[0x10000]); mainram2 = new byte[0x1e80]; mainram3 = new byte[0x2000]; - Memory.audioram = new byte[0x2000]; + Memory.Set_audioram(new byte[0x2000]); bg_rambank = new ushort[2]; fg_rambank = new ushort[2]; pixel_scroll = new ushort[2]; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Memory.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Memory.cs index ccd2d6e..a3c8e19 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Memory.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Memory.cs @@ -210,7 +210,7 @@ namespace MAME.Core else if (address >= 0x4000 && address <= 0x47ff) { int offset = address - 0x4000; - result = Memory.audioram[offset]; + result = Memory.audioram_Ptr[offset]; } else if (address == 0x8000) { @@ -227,7 +227,7 @@ namespace MAME.Core else if (address >= 0x4000 && address <= 0x47ff) { int offset = address - 0x4000; - Memory.audioram[offset] = value; + Memory.audioram_Ptr[offset] = value; } else if (address == 0xffff) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Pbaction.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Pbaction.cs index 73dcaef..b134737 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Pbaction.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/Pbaction.cs @@ -22,7 +22,7 @@ namespace MAME.Core gfx3rom = Machine.GetRom("gfx3.rom"); gfx32rom = Machine.GetRom("gfx32.rom"); Memory.Set_mainram(new byte[0x1000]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Generic.videoram = new byte[0x400]; pbaction_videoram2 = new byte[0x400]; Generic.colorram = new byte[0x400]; @@ -46,7 +46,7 @@ namespace MAME.Core gfx3rom = Machine.GetRom("gfx3.rom"); gfx32rom = Machine.GetRom("gfx32.rom"); Memory.Set_mainram(new byte[0x1000]); - Memory.audioram = new byte[0x800]; + Memory.Set_audioram(new byte[0x800]); Generic.videoram = new byte[0x400]; pbaction_videoram2 = new byte[0x400]; Generic.colorram = new byte[0x400]; diff --git a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/State.cs b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/State.cs index 73db2d0..c1e218a 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/State.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/mame/tehkan/State.cs @@ -22,7 +22,7 @@ namespace MAME.Core writer.Write(pbaction_colorram2, 0, 0x400); writer.Write(Generic.spriteram, 0, 0x80); writer.Write(Generic.paletteram, 0, 0x200); - writer.Write(Memory.audioram, 0, 0x800); + writer.Write(Memory.audioram_Ptr, 0, 0x800); Z80A.zz1[0].SaveStateBinary(writer); Z80A.zz1[1].SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); @@ -63,7 +63,7 @@ namespace MAME.Core pbaction_colorram2 = reader.ReadBytes(0x400); Generic.spriteram = reader.ReadBytes(0x80); Generic.paletteram = reader.ReadBytes(0x200); - Memory.audioram = reader.ReadBytes(0x800); + Memory.Set_audioram(reader.ReadBytes(0x800)); Z80A.zz1[0].LoadStateBinary(reader); Z80A.zz1[1].LoadStateBinary(reader); Cpuint.LoadStateBinary(reader);