From d701377278062f7cdae1e8b95c81c10cb9af1e1c Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Tue, 9 Dec 2025 21:27:43 +0800 Subject: [PATCH] =?UTF-8?q?MAME:main=5From=20unsafe=20=E6=8C=87=E9=92=88?= =?UTF-8?q?=E5=8C=96=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Plugins/Mame.Core/mame/capcom/Memory.cs | 48 ++++---- .../Plugins/Mame.Core/mame/cps/Memory.cs | 30 ++--- .../Plugins/Mame.Core/mame/cps/Memory2.cs | 24 ++-- .../Plugins/Mame.Core/mame/dataeast/Memory.cs | 20 ++-- .../Plugins/Mame.Core/mame/igs011/Memory.cs | 12 +- .../Plugins/Mame.Core/mame/igs011/Memory2.cs | 72 +++++------ .../Mame.Core/mame/konami68000/Konami68000.cs | 4 +- .../Mame.Core/mame/konami68000/Memory.cs | 72 +++++------ .../Mame.Core/mame/konami68000/Memory2.cs | 60 +++++----- .../Plugins/Mame.Core/mame/m72/Memory.cs | 18 +-- .../Plugins/Mame.Core/mame/m72/Memory2.cs | 2 +- .../Plugins/Mame.Core/mame/m92/Memory.cs | 22 ++-- .../Plugins/Mame.Core/mame/m92/Memory2.cs | 8 +- .../Plugins/Mame.Core/mame/neogeo/Memory.cs | 56 ++++----- .../Plugins/Mame.Core/mame/neogeo/Neoprot.cs | 32 ++--- .../Plugins/Mame.Core/mame/pgm/Memory.cs | 12 +- .../Plugins/Mame.Core/mame/suna8/Memory.cs | 10 +- .../Plugins/Mame.Core/mame/taito/Memory.cs | 96 +++++++-------- .../Plugins/Mame.Core/mame/taito/Taito.cs | 10 +- .../Plugins/Mame.Core/mame/taitob/Memory.cs | 26 ++-- .../Plugins/Mame.Core/mame/taitob/Memory2.cs | 26 ++-- .../Plugins/Mame.Core/mame/tehkan/Memory.cs | 14 +-- .../Assets/Plugins/Mame.Core/sound/FM.cs | 112 +++++++++++++++--- .../Assets/Plugins/Mame.Core/sound/YM2610.cs | 70 +++++++---- .../Plugins/Mame.Core/sound/YMDeltat.cs | 10 +- 25 files changed, 489 insertions(+), 377 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/capcom/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/capcom/Memory.cs index d3f4c5d5..a5c77608 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/capcom/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/capcom/Memory.cs @@ -20,11 +20,11 @@ namespace MAME.Core else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0x6000 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else { @@ -85,11 +85,11 @@ namespace MAME.Core else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0x6000 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -146,7 +146,7 @@ namespace MAME.Core else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address == 0x6000) { @@ -154,7 +154,7 @@ namespace MAME.Core } else if (address >= 0x6001 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -222,7 +222,7 @@ namespace MAME.Core } else if (address >= 0x4000 && address <= 0xffff) { - Memory.mainrom[address] = value; + *(Memory.mainrom + (address)) = value; } } public static byte ZReadOp_gng(ushort address) @@ -301,7 +301,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -318,7 +318,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -452,7 +452,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -586,7 +586,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -720,7 +720,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -737,7 +737,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -801,7 +801,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -865,7 +865,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -929,7 +929,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -946,7 +946,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -977,7 +977,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x800000 && address <= 0x800fff) @@ -1095,8 +1095,8 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x800000 && address + 1 <= 0x800fff) @@ -1152,10 +1152,10 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x800000 && address + 3 <= 0x800fff) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory.cs index bfca9572..2e787843 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory.cs @@ -16,7 +16,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -33,7 +33,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -94,7 +94,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -119,7 +119,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -162,7 +162,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -187,7 +187,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -440,7 +440,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -461,7 +461,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -545,7 +545,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -570,7 +570,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -636,7 +636,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -661,7 +661,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -947,7 +947,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -1111,7 +1111,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1254,7 +1254,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory2.cs index ed4acb17..b25a331b 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/cps/Memory2.cs @@ -195,7 +195,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -245,7 +245,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -288,7 +288,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -484,7 +484,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -550,7 +550,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -605,7 +605,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -960,7 +960,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -977,7 +977,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -1112,7 +1112,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1129,7 +1129,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1243,7 +1243,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1260,7 +1260,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/dataeast/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/dataeast/Memory.cs index 82386d89..4b1b5ef7 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/dataeast/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/dataeast/Memory.cs @@ -14,16 +14,16 @@ else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain1 + offset]; + result = *(Memory.mainrom + (basebankmain1 + offset)); } else if (address >= 0x6000 && address <= 0x7fff) { int offset = address - 0x6000; - result = Memory.mainrom[basebankmain2 + offset]; + result = *(Memory.mainrom + (basebankmain2 + offset)); } else if (address >= 0x8000 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -37,16 +37,16 @@ else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain1 + offset]; + result = *(Memory.mainrom + (basebankmain1 + offset)); } else if (address >= 0x6000 && address <= 0x7fff) { int offset = address - 0x6000; - result = Memory.mainrom[basebankmain2 + offset]; + result = *(Memory.mainrom + (basebankmain2 + offset)); } else if (address >= 0x8000 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -72,16 +72,16 @@ else if (address >= 0x4000 && address <= 0x5fff) { int offset = address - 0x4000; - result = Memory.mainrom[basebankmain1 + offset]; + result = *(Memory.mainrom + (basebankmain1 + offset)); } else if (address >= 0x6000 && address <= 0x7fff) { int offset = address - 0x6000; - result = Memory.mainrom[basebankmain2 + offset]; + result = *(Memory.mainrom + (basebankmain2 + offset)); } else if (address >= 0x8000 && address <= 0xffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -115,7 +115,7 @@ } else if (address >= 0x4000 && address <= 0xffff) { - Memory.mainrom[address] = data; + *(Memory.mainrom + (address)) = data; } } public static byte D1ReadOp(ushort address) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory.cs index 4bd757e8..f13e53c4 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory.cs @@ -23,7 +23,7 @@ } else if (address >= 0 && address <= 0x7ffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } return result; } @@ -44,7 +44,7 @@ } else if (address >= 0 && address <= 0x7ffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x100000 && address <= 0x103fff) { @@ -117,7 +117,7 @@ } else if (address >= 0 && address + 1 <= 0x7ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } return result; } @@ -131,7 +131,7 @@ } else if (address >= 0 && address + 1 <= 0x7ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { @@ -179,7 +179,7 @@ int result = 0; if (address >= 0 && address + 3 <= 0x7ffff) { - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } return result; } @@ -189,7 +189,7 @@ int result = 0; if (address >= 0 && address + 3 <= 0x7ffff) { - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } else if (address >= 0x100000 && address + 3 <= 0x103fff) { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory2.cs index 21fa181f..0021dfe7 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/igs011/Memory2.cs @@ -352,7 +352,7 @@ } else if (address >= 0x000000 && address <= 0x07ffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x100000 && address <= 0x103fff) { @@ -436,7 +436,7 @@ } else if (address >= 0 && address + 1 <= 0x7ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } return result; } @@ -454,7 +454,7 @@ } else if (address >= 0x000000 && address + 1 <= 0x07ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { @@ -496,7 +496,7 @@ int result = 0; if (address >= 0x000000 && address + 3 <= 0x07ffff) { - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } else if (address >= 0x100000 && address + 3 <= 0x103fff) { @@ -790,7 +790,7 @@ } else if (address >= 0x000000 && address + 1 <= 0x07ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { @@ -840,7 +840,7 @@ } else if (address >= 0x000000 && address + 1 <= 0x07ffff) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { @@ -902,7 +902,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -937,7 +937,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1025,7 +1025,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1050,7 +1050,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1103,7 +1103,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1120,7 +1120,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1437,7 +1437,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1476,7 +1476,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1555,7 +1555,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1580,7 +1580,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1634,7 +1634,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1657,7 +1657,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x010000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1980,7 +1980,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2023,7 +2023,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2107,7 +2107,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2132,7 +2132,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2189,7 +2189,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2207,7 +2207,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2503,7 +2503,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2564,7 +2564,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2684,7 +2684,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2725,7 +2725,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2801,7 +2801,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2819,7 +2819,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -3267,7 +3267,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -3299,7 +3299,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -3383,7 +3383,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -3408,7 +3408,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -3461,7 +3461,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -3479,7 +3479,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x023000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Konami68000.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Konami68000.cs index 7ae1de63..cc91fd3d 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Konami68000.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Konami68000.cs @@ -1136,7 +1136,7 @@ namespace MAME.Core byte result = 0; if (addr <= 0x07ffff) { - result = Memory.mainrom[addr]; + result = *(Memory.mainrom + (addr)); } else if (addr >= 0x104000 && addr <= 0x107fff) { @@ -1163,7 +1163,7 @@ namespace MAME.Core addr *= 2; if (addr <= 0x07ffff) { - result = (ushort)(Memory.mainrom[addr] * 0x100 + Memory.mainrom[addr + 1]); + result = (ushort)(*(Memory.mainrom + (addr)) * 0x100 + *(Memory.mainrom + (addr + 1))); } else if (addr >= 0x104000 && addr <= 0x107fff) { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory.cs index 6df0efb3..69cfb833 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory.cs @@ -15,7 +15,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -42,7 +42,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -192,7 +192,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -219,7 +219,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -299,7 +299,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -326,7 +326,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -617,7 +617,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -644,7 +644,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -771,7 +771,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -798,7 +798,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -869,7 +869,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -897,7 +897,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1116,7 +1116,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1138,7 +1138,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1282,7 +1282,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1304,7 +1304,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1378,7 +1378,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1400,7 +1400,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1603,7 +1603,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1625,7 +1625,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1741,7 +1741,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1763,7 +1763,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1830,7 +1830,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1853,7 +1853,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2080,7 +2080,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2102,7 +2102,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2250,7 +2250,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2272,7 +2272,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2349,7 +2349,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2372,7 +2372,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2601,7 +2601,7 @@ namespace MAME.Core sbyte result = 0; if (address <= 0x0bffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x104000 && address <= 0x107fff) { @@ -2615,7 +2615,7 @@ namespace MAME.Core sbyte result = 0; if (address <= 0x0bffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x104000 && address <= 0x107fff) { @@ -2776,7 +2776,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2797,7 +2797,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2879,7 +2879,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2900,7 +2900,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory2.cs index aefc71af..b842814d 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/konami68000/Memory2.cs @@ -10,7 +10,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -32,7 +32,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -172,7 +172,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -194,7 +194,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -266,7 +266,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -289,7 +289,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -578,7 +578,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -600,7 +600,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -762,7 +762,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -784,7 +784,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -866,7 +866,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -889,7 +889,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1209,7 +1209,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1231,7 +1231,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1388,7 +1388,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1410,7 +1410,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1496,7 +1496,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1519,7 +1519,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1826,7 +1826,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1848,7 +1848,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1950,7 +1950,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1972,7 +1972,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2032,7 +2032,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2055,7 +2055,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2309,7 +2309,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2331,7 +2331,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2458,7 +2458,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2480,7 +2480,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2547,7 +2547,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2570,7 +2570,7 @@ if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory.cs index a77707da..027e56dd 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory.cs @@ -10,7 +10,7 @@ byte result = 0; if (address >= 0 && address <= 0xfffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -20,7 +20,7 @@ byte result = 0; if (address >= 0 && address <= 0x7ffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0xa0000 && address <= 0xa3fff) { @@ -58,7 +58,7 @@ } else if (address >= 0xffff0 && address <= 0xfffff) { - result = Memory.mainrom[address & 0xfffff]; + result = *(Memory.mainrom + (address & 0xfffff)); } return result; } @@ -68,7 +68,7 @@ ushort result = 0; if (address >= 0 && address + 1 <= 0x7ffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } else if (address >= 0xa0000 && address + 1 <= 0xa3fff) { @@ -106,7 +106,7 @@ } else if (address >= 0xffff0 && address + 1 <= 0xfffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } return result; } @@ -305,7 +305,7 @@ byte result = 0; if (address >= 0 && address <= 0x7ffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x80000 && address <= 0x83fff) { @@ -338,7 +338,7 @@ } else if (address >= 0xffff0 && address <= 0xfffff) { - result = Memory.mainrom[address & 0xfffff]; + result = *(Memory.mainrom + (address & 0xfffff)); } return result; } @@ -348,7 +348,7 @@ ushort result = 0; if (address >= 0 && address + 1 <= 0x7ffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } else if (address >= 0x80000 && address + 1 <= 0x83fff) { @@ -381,7 +381,7 @@ } else if (address >= 0xffff0 && address + 1 <= 0xfffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } return result; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory2.cs index 10ae392c..c11d2df1 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m72/Memory2.cs @@ -15,7 +15,7 @@ namespace MAME.Core } else { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory.cs index b9c420b2..091ebb41 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory.cs @@ -10,7 +10,7 @@ byte result = 0; if (address >= 0 && address <= 0xfffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -20,16 +20,16 @@ byte result = 0; if (address >= 0 && address <= 0x9ffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0xa0000 && address <= 0xbffff) { int offset = address - 0xa0000; - result = Memory.mainrom[bankaddress + offset]; + result = *(Memory.mainrom + (bankaddress + offset)); } else if (address >= 0xc0000 && address <= 0xcffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0xd0000 && address <= 0xdffff) { @@ -60,7 +60,7 @@ } else if (address >= 0xffff0 && address <= 0xfffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -70,16 +70,16 @@ ushort result = 0; if (address >= 0 && address + 1 <= 0x9ffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } else if (address >= 0xa0000 && address + 1 <= 0xbffff) { int offset = address - 0xa0000; - result = (ushort)(Memory.mainrom[bankaddress + offset] + Memory.mainrom[bankaddress + offset + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (bankaddress + offset)) + *(Memory.mainrom + (bankaddress + offset + 1)) * 0x100); } else if (address >= 0xc0000 && address + 1 <= 0xcffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } else if (address >= 0xd0000 && address + 1 <= 0xdffff) { @@ -103,7 +103,7 @@ } else if (address >= 0xffff0 && address + 1 <= 0xfffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } return result; } @@ -401,7 +401,7 @@ else if (address >= 0xffff0 && address <= 0xfffff) { int offset = address - 0xe0000; - result = Memory.mainrom[offset]; + result = *(Memory.mainrom + offset); } return result; } @@ -434,7 +434,7 @@ else if (address >= 0xffff0 && address + 1 <= 0xfffff) { int offset = address - 0xe0000; - result = (ushort)(Memory.mainrom[offset] + Memory.mainrom[offset + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + offset) + *(Memory.mainrom + offset + 1) * 0x100); } return result; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory2.cs index c74080a4..18f2fb41 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/m92/Memory2.cs @@ -8,7 +8,7 @@ byte result = 0; if (address >= 0 && address <= 0x7ffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x80000 && address <= 0x8ffff) { @@ -39,7 +39,7 @@ } else if (address >= 0xffff0 && address <= 0xfffff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -49,7 +49,7 @@ ushort result = 0; if (address >= 0 && address + 1 <= 0x7ffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } else if (address >= 0x80000 && address + 1 <= 0x8ffff) { @@ -73,7 +73,7 @@ } else if (address >= 0xffff0 && address + 1 <= 0xfffff) { - result = (ushort)(Memory.mainrom[address] + Memory.mainrom[address + 1] * 0x100); + result = (ushort)(*(Memory.mainrom + (address)) + *(Memory.mainrom + (address + 1)) * 0x100); } return result; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs index 89f159c6..fab1205a 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs @@ -18,12 +18,12 @@ namespace MAME.Core } else if (main_cpu_vector_table_source == 1) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } } else if (address >= 0x000080 && address <= 0x0fffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x100000 && address <= 0x1fffff) { @@ -31,7 +31,7 @@ namespace MAME.Core } else if (address >= 0x200000 && address <= 0x2fffff) { - result = (sbyte)Memory.mainrom[main_cpu_bank_address + (address - 0x200000)]; + result = (sbyte)*(Memory.mainrom + (main_cpu_bank_address + (address - 0x200000))); } else if (address >= 0xc00000 && address <= 0xcfffff) { @@ -55,12 +55,12 @@ namespace MAME.Core } else if (main_cpu_vector_table_source == 1) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } } else if (address >= 0x000080 && address <= 0x0fffff) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else if (address >= 0x100000 && address <= 0x1fffff) { @@ -68,7 +68,7 @@ namespace MAME.Core } else if (address >= 0x200000 && address <= 0x2fffff) { - result = (sbyte)Memory.mainrom[main_cpu_bank_address + (address - 0x200000)]; + result = (sbyte)*(Memory.mainrom + (main_cpu_bank_address + (address - 0x200000))); } /*else if (address >= 0x300000 && address <= 0x300001) { @@ -187,7 +187,7 @@ namespace MAME.Core // } // else if (main_cpu_vector_table_source == 1) // { - // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); // } // } // else if (address >= 0x000080 && address + 1 <= 0x0fffff) @@ -196,7 +196,7 @@ namespace MAME.Core // { // //m68000Form.iStatus = 1; // } - // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); // } // else if (address >= 0x100000 && address + 1 <= 0x1fffff) // { @@ -204,7 +204,7 @@ namespace MAME.Core // } // else if (address >= 0x200000 && address + 1 <= 0x2fffff) // { - // result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]); + // result = (short)(*(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1))); // } // else if (address >= 0xc00000 && address + 1 <= 0xcfffff) // { @@ -223,7 +223,7 @@ namespace MAME.Core address &= 0xffffff; if (address >= 0x000000 && address + 1 <= 0x00007f) { - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + (address); if (main_cpu_vector_table_source == 0) { @@ -237,7 +237,7 @@ namespace MAME.Core } else if (address >= 0x000080 && address + 1 <= 0x0fffff) { - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + (address); //if (address >= 0x142B9 && address <= 0x142C9) //{ @@ -254,9 +254,9 @@ namespace MAME.Core } else if (address >= 0x200000 && address + 1 <= 0x2fffff) { - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + (main_cpu_bank_address + (address & 0xfffff)); - //result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]); + //result = (short)(*(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1))); return (short)(*ptr * 0x100 + *(ptr + 1)); } else if (address >= 0xc00000 && address + 1 <= 0xcfffff) @@ -282,7 +282,7 @@ namespace MAME.Core // } // else if (main_cpu_vector_table_source == 1) // { - // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); // } // } // else if (address >= 0x000080 && address + 1 <= 0x0fffff) @@ -291,7 +291,7 @@ namespace MAME.Core // { // //m68000Form.iStatus = 1; // } - // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); // } // else if (address >= 0x100000 && address + 1 <= 0x1fffff) // { @@ -303,7 +303,7 @@ namespace MAME.Core // } // else if (address >= 0x200000 && address <= 0x2fffff) // { - // result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]); + // result = (short)(*(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1))); // } // /*else if (address >= 0x300000 && address <= 0x300001) // { @@ -376,9 +376,9 @@ namespace MAME.Core } else if (main_cpu_vector_table_source == 1) { - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + address; - //result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + //result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); result = (short)(*ptr * 0x100 + *(ptr + 1)); } } @@ -389,9 +389,9 @@ namespace MAME.Core // //m68000Form.iStatus = 1; //} - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + address; - //result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + //result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); result = (short)(*ptr * 0x100 + *(ptr + 1)); } else if (address >= 0x100000 && address + 1 <= 0x1fffff) @@ -408,9 +408,9 @@ namespace MAME.Core } else if (address >= 0x200000 && address <= 0x2fffff) { - byte* ptr_0 = &Memory.mainrom[0]; + byte* ptr_0 = Memory.mainrom; byte* ptr = ptr_0 + (main_cpu_bank_address + (address & 0xfffff)); - //result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]); + //result = (short)(*(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1))); result = (short)(*ptr * 0x100 + *(ptr + 1)); } /*else if (address >= 0x300000 && address <= 0x300001) @@ -485,7 +485,7 @@ namespace MAME.Core } else if (main_cpu_vector_table_source == 1) { - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } } else if (address >= 0x000080 && address + 3 <= 0x0fffff) @@ -494,7 +494,7 @@ namespace MAME.Core { //m68000Form.iStatus = 1; } - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } else if (address >= 0x100000 && address + 3 <= 0x1fffff) { @@ -502,7 +502,7 @@ namespace MAME.Core } else if (address >= 0x200000 && address + 3 <= 0x2fffff) { - result = Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x1000000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1] * 0x10000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 2] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 3]; + result = *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x1000000 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1)) * 0x10000 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 2)) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 3)); } else if (address >= 0xc00000 && address + 3 <= 0xcfffff) { @@ -526,7 +526,7 @@ namespace MAME.Core } else if (main_cpu_vector_table_source == 1) { - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } } else if (address >= 0x000080 && address + 3 <= 0x0fffff) @@ -535,7 +535,7 @@ namespace MAME.Core { //m68000Form.iStatus = 1; } - result = Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]; + result = *(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3)); } else if (address >= 0x100000 && address + 3 <= 0x1fffff) { @@ -543,7 +543,7 @@ namespace MAME.Core } else if (address >= 0x200000 && address + 3 <= 0x2fffff) { - result = Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x1000000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1] * 0x10000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 2] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 3]; + result = *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff))) * 0x1000000 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 1)) * 0x10000 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 2)) * 0x100 + *(Memory.mainrom + (main_cpu_bank_address + (address & 0xfffff) + 3)); } else if (address >= 0x300000 && address <= 0x31ffff) { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Neoprot.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Neoprot.cs index 482dab95..248fd912 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Neoprot.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Neoprot.cs @@ -63,16 +63,16 @@ namespace MAME.Core switch (value) { case 0x0090: - Memory.mainrom[0x100] = 0x00; - Memory.mainrom[0x101] = 0xc2; - Memory.mainrom[0x102] = 0x00; - Memory.mainrom[0x103] = 0xfd; + *(Memory.mainrom + 0x100) = 0x00; + *(Memory.mainrom + 0x101) = 0xc2; + *(Memory.mainrom + 0x102) = 0x00; + *(Memory.mainrom + 0x103) = 0xfd; break; case 0x00f0: - Memory.mainrom[0x100] = 0x4e; - Memory.mainrom[0x101] = 0x45; - Memory.mainrom[0x102] = 0x4f; - Memory.mainrom[0x103] = 0x2d; + *(Memory.mainrom + 0x100) = 0x4e; + *(Memory.mainrom + 0x101) = 0x45; + *(Memory.mainrom + 0x102) = 0x4f; + *(Memory.mainrom + 0x103) = 0x2d; break; default: break; @@ -113,7 +113,7 @@ namespace MAME.Core public static void kof99_bankswitch_w(int data) { int bankaddress; - + data = (((data >> 14) & 1) << 0) + (((data >> 6) & 1) << 1) + @@ -144,7 +144,7 @@ namespace MAME.Core public static void garou_bankswitch_w(int data) { int bankaddress; - + data = (((data >> 5) & 1) << 0) + (((data >> 9) & 1) << 1) + @@ -311,7 +311,7 @@ namespace MAME.Core extra_ram[0x1ff1] = 0xa0; extra_ram[0x1ff2] &= 0x7f; main_cpu_bank_address = address + 0x100000; - Memory.mainrom[0x58197] = prt; + *(Memory.mainrom + 0x58197) = prt; } } public static void kof2003p_w(int offset) @@ -323,12 +323,12 @@ namespace MAME.Core extra_ram[0x1ff1] &= 0xfe; extra_ram[0x1ff2] &= 0x7f; main_cpu_bank_address = address + 0x100000; - Memory.mainrom[0x58197] = prt; + *(Memory.mainrom + 0x58197) = prt; } } public static byte sbp_protection_r(int offset) { - byte origdata = Memory.mainrom[offset + 0x200]; + byte origdata = *(Memory.mainrom + offset + 0x200); byte data = (byte)BITSWAP8(origdata, 3, 2, 1, 0, 7, 6, 5, 4); int realoffset = 0x200 + offset; if (realoffset == 0xd5e || realoffset == 0xd5f) @@ -354,7 +354,7 @@ namespace MAME.Core { if (extra_ram[0x1ffc] == 0 && extra_ram[0x1ffd] == 0) { - Memory.mainrom[0xe0000 + offset] = (byte)data; + *(Memory.mainrom + 0xe0000 + offset) = (byte)data; } else { @@ -365,8 +365,8 @@ namespace MAME.Core { if (extra_ram[0x1ffc] == 0 && extra_ram[0x1ffd] == 0) { - Memory.mainrom[0xe0000 + offset] = (byte)(data >> 8); - Memory.mainrom[0xe0000 + offset + 1] = (byte)data; + *(Memory.mainrom + 0xe0000 + offset) = (byte)(data >> 8); + *(Memory.mainrom + 0xe0000 + offset + 1) = (byte)data; } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/pgm/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/pgm/Memory.cs index bf177ac9..755010db 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/pgm/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/pgm/Memory.cs @@ -16,7 +16,7 @@ { if (address < 0x100000 + Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address - 0x100000]); + result = (sbyte)(*(Memory.mainrom + (address - 0x100000))); } else { @@ -41,7 +41,7 @@ { if (address < 0x100000 + Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address - 0x100000]); + result = (sbyte)(*(Memory.mainrom + (address - 0x100000))); } else { @@ -130,7 +130,7 @@ { if (address + 1 < 0x100000 + Memory.mainromLength) { - result = (short)(Memory.mainrom[address - 0x100000] * 0x100 + Memory.mainrom[address - 0x100000 + 1]); + result = (short)(*(Memory.mainrom + (address - 0x100000)) * 0x100 + *(Memory.mainrom + (address - 0x100000 + 1))); } else { @@ -155,7 +155,7 @@ { if (address + 1 < 0x100000 + Memory.mainromLength) { - result = (short)(Memory.mainrom[address - 0x100000] * 0x100 + Memory.mainrom[address - 0x100000 + 1]); + result = (short)(*(Memory.mainrom + (address - 0x100000)) * 0x100 + *(Memory.mainrom + (address - 0x100000 + 1))); } else { @@ -237,7 +237,7 @@ { if (address + 3 < 0x100000 + Memory.mainromLength) { - result = Memory.mainrom[address - 0x100000] * 0x1000000 + Memory.mainrom[address - 0x100000 + 1] * 0x10000 + Memory.mainrom[address - 0x100000 + 2] * 0x100 + Memory.mainrom[address - 0x100000 + 3]; + result = *(Memory.mainrom + (address - 0x100000)) * 0x1000000 + *(Memory.mainrom + (address - 0x100000 + 1)) * 0x10000 + *(Memory.mainrom + (address - 0x100000 + 2)) * 0x100 + *(Memory.mainrom + (address - 0x100000 + 3)); } else { @@ -262,7 +262,7 @@ { if (address + 3 < 0x100000 + Memory.mainromLength) { - result = Memory.mainrom[address - 0x100000] * 0x1000000 + Memory.mainrom[address - 0x100000 + 1] * 0x10000 + Memory.mainrom[address - 0x100000 + 2] * 0x100 + Memory.mainrom[address - 0x100000 + 3]; + result = *(Memory.mainrom + (address - 0x100000)) * 0x1000000 + *(Memory.mainrom + (address - 0x100000 + 1)) * 0x10000 + *(Memory.mainrom + (address - 0x100000 + 2)) * 0x100 + *(Memory.mainrom + (address - 0x100000 + 3)); } else { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/suna8/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/suna8/Memory.cs index c222001b..cd41aa6f 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/suna8/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/suna8/Memory.cs @@ -16,7 +16,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else { @@ -29,12 +29,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address == 0xc000) { @@ -77,12 +77,12 @@ namespace MAME.Core { if (address <= 0x7fff) { - Memory.mainrom[address] = value; + *(Memory.mainrom + (address)) = value; } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - Memory.mainrom[basebankmain + offset] = value; + *(Memory.mainrom + (basebankmain + offset)) = value; } else if (address == 0xc200) { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Memory.cs index 74f334f1..f939c9aa 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Memory.cs @@ -12,12 +12,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0xc000 && address <= 0xdcff) { @@ -73,12 +73,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0xc000 && address <= 0xdcff) { @@ -134,12 +134,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0xc000 && address <= 0xdcff) { @@ -207,7 +207,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - Memory.mainrom[basebankmain + offset] = value; + *(Memory.mainrom + (basebankmain + offset)) = value; } else if (address >= 0xc000 && address <= 0xdcff) { @@ -263,7 +263,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - Memory.mainrom[basebankmain + offset] = value; + *(Memory.mainrom + (basebankmain + offset)) = value; } else if (address >= 0xc000 && address <= 0xdcff) { @@ -445,12 +445,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else { @@ -463,12 +463,12 @@ namespace MAME.Core byte result = 0; if (address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - result = Memory.mainrom[basebankmain + offset]; + result = *(Memory.mainrom + (basebankmain + offset)); } else if (address >= 0xc000 && address <= 0xdcff) { @@ -505,7 +505,7 @@ namespace MAME.Core else if (address >= 0x8000 && address <= 0xbfff) { int offset = address - 0x8000; - Memory.mainrom[basebankmain + offset] = value; + *(Memory.mainrom + (basebankmain + offset)) = value; } else if (address >= 0xc000 && address <= 0xdcff) { @@ -898,7 +898,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -916,7 +916,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1040,7 +1040,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1058,7 +1058,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1126,7 +1126,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1145,7 +1145,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1200,7 +1200,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x0ff000 && address <= 0x0ff7ff) @@ -1342,8 +1342,8 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x0ff000 && address + 1 <= 0x0ff7ff) @@ -1426,10 +1426,10 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x0ff000 && address + 3 <= 0x0ff7ff) @@ -1485,7 +1485,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -1606,7 +1606,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1623,7 +1623,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -1688,7 +1688,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1706,7 +1706,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -1762,7 +1762,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x0ff000 && address <= 0x0fffff) @@ -1893,8 +1893,8 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x0ff000 && address + 1 <= 0x0fffff) @@ -1969,10 +1969,10 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x0ff000 && address + 3 <= 0x0fffff) @@ -2028,7 +2028,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else { @@ -2125,7 +2125,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -2181,7 +2181,7 @@ namespace MAME.Core if (address + 3 < Memory.mainromLength) { int offset = (address - 0x000000) / 2; - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -2227,7 +2227,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x100000 && address <= 0x107fff) @@ -2346,8 +2346,8 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x100000 && address + 1 <= 0x107fff) @@ -2417,10 +2417,10 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x100000 && address + 3 <= 0x107fff) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Taito.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Taito.cs index a3d609e2..a9d6ef8b 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Taito.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taito/Taito.cs @@ -345,22 +345,22 @@ namespace MAME.Core } public unsafe static void driver_init_opwolf() { - opwolf_region = Memory.mainrom[0x03ffff]; + opwolf_region = *(Memory.mainrom + 0x03ffff); opwolf_cchip_init(); - opwolf_gun_xoffs = 0xec - Memory.mainrom[0x03ffb1]; - opwolf_gun_yoffs = 0x1c - Memory.mainrom[0x03ffaf]; + opwolf_gun_xoffs = 0xec - *(Memory.mainrom + 0x03ffb1); + opwolf_gun_yoffs = 0x1c - *(Memory.mainrom + 0x03ffaf); basebanksnd = 0x10000; } public unsafe static void driver_init_opwolfb() { - opwolf_region = Memory.mainrom[0x03ffff]; + opwolf_region = *(Memory.mainrom + 0x03ffff); opwolf_gun_xoffs = -2; opwolf_gun_yoffs = 17; basebanksnd = 0x10000; } public unsafe static void driver_init_opwolfp() { - opwolf_region = Memory.mainrom[0x03ffff]; + opwolf_region = *(Memory.mainrom + 0x03ffff); opwolf_gun_xoffs = 5; opwolf_gun_yoffs = 30; basebanksnd = 0x10000; diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory.cs index 81df7952..44c91b9d 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory.cs @@ -12,7 +12,7 @@ namespace MAME.Core sbyte result = 0; if (address <= 0x07ffff) { - result = (sbyte)(Memory.mainrom[address]); + result = (sbyte)(*(Memory.mainrom + (address))); } else if (address >= 0x800000 && address <= 0x801fff) { @@ -40,7 +40,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -197,7 +197,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -223,7 +223,7 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -304,7 +304,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -330,7 +330,7 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -390,7 +390,7 @@ namespace MAME.Core { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x400000 && address <= 0x40ffff) @@ -525,8 +525,8 @@ namespace MAME.Core { if (address + 1 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x400000 && address + 1 <= 0x40ffff) @@ -605,10 +605,10 @@ namespace MAME.Core { if (address + 3 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x400000 && address + 3 <= 0x40ffff) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory2.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory2.cs index f66f350b..2e6b8d4a 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory2.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/taitob/Memory2.cs @@ -10,7 +10,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -43,7 +43,7 @@ { if (address < Memory.mainromLength) { - result = (sbyte)Memory.mainrom[address]; + result = (sbyte)*(Memory.mainrom + (address)); } else { @@ -200,7 +200,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -226,7 +226,7 @@ { if (address + 1 < Memory.mainromLength) { - result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + result = (short)(*(Memory.mainrom + (address)) * 0x100 + *(Memory.mainrom + (address + 1))); } else { @@ -306,7 +306,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -332,7 +332,7 @@ { if (address + 3 < Memory.mainromLength) { - result = (int)(Memory.mainrom[address] * 0x1000000 + Memory.mainrom[address + 1] * 0x10000 + Memory.mainrom[address + 2] * 0x100 + Memory.mainrom[address + 3]); + result = (int)(*(Memory.mainrom + (address)) * 0x1000000 + *(Memory.mainrom + (address + 1)) * 0x10000 + *(Memory.mainrom + (address + 2)) * 0x100 + *(Memory.mainrom + (address + 3))); } else { @@ -391,7 +391,7 @@ { if (address < Memory.mainromLength) { - Memory.mainrom[address] = (byte)value; + *(Memory.mainrom + (address)) = (byte)value; } } else if (address >= 0x100000 && address <= 0x100001) @@ -507,8 +507,8 @@ { if (address + 1 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 8); - Memory.mainrom[address + 1] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 1)) = (byte)value; } } else if (address >= 0x100000 && address + 1 <= 0x100001) @@ -578,10 +578,10 @@ { if (address + 1 < Memory.mainromLength) { - Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value >> 16); - Memory.mainrom[address + 2] = (byte)(value >> 8); - Memory.mainrom[address + 3] = (byte)value; + *(Memory.mainrom + (address)) = (byte)(value >> 24); + *(Memory.mainrom + (address + 1)) = (byte)(value >> 16); + *(Memory.mainrom + (address + 2)) = (byte)(value >> 8); + *(Memory.mainrom + (address + 3)) = (byte)value; } } else if (address >= 0x200000 && address + 3 <= 0x20000f) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/tehkan/Memory.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/tehkan/Memory.cs index 0ab24b1c..8b1115ea 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/tehkan/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/tehkan/Memory.cs @@ -11,11 +11,11 @@ namespace MAME.Core byte result = 0; if (address >= 0 && address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -28,7 +28,7 @@ namespace MAME.Core } else if (address >= 0x8000 && address <= 0xbfff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } return result; } @@ -37,11 +37,11 @@ namespace MAME.Core byte result = 0; if (address >= 0 && address <= 0x7fff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0x8000 && address <= 0xbfff) { - result = Memory.mainrom[address]; + result = *(Memory.mainrom + (address)); } else if (address >= 0xc000 && address <= 0xcfff) { @@ -121,11 +121,11 @@ namespace MAME.Core { if (address >= 0x0000 && address <= 0x7fff) { - Memory.mainrom[address] = value; + *(Memory.mainrom + (address)) = value; } else if (address >= 0x8000 && address <= 0xbfff) { - Memory.mainrom[address] = value; + *(Memory.mainrom + (address)) = value; } else if (address >= 0xc000 && address <= 0xcfff) { diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/FM.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/FM.cs index 6e804403..ad0c3e82 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/FM.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/FM.cs @@ -1,8 +1,9 @@ using System; +using System.Runtime.InteropServices; namespace MAME.Core { - public class FM + public unsafe class FM { public class FM_OPN { @@ -10,7 +11,26 @@ namespace MAME.Core public FM_ST ST; public FM_3SLOT SL3; public FM_CH[] CH; - public uint[] pan; + //public uint[] pan; + + #region //指针化 pan + uint[] pan_src; + GCHandle pan_handle; + public uint* pan; + public int panLength; + public bool pan_IsNull => pan == null; + public uint[] pan_set + { + set + { + pan_handle.ReleaseGCHandle(); + pan_src = value; + panLength = value.Length; + pan_src.GetObjectPtr(ref pan_handle, ref pan); + } + } + #endregion + public uint eg_cnt; public uint eg_timer; public uint eg_timer_add; @@ -36,7 +56,8 @@ namespace MAME.Core SL3.fc = new uint[3]; SL3.kcode = new byte[3]; SL3.block_fnum = new uint[3]; - pan = new uint[12]; + //pan = new uint[12]; + pan_set = new uint[12]; fn_table = new uint[4096]; lfo_freq = new int[8]; ST.timer_handler = null; @@ -624,20 +645,21 @@ namespace MAME.Core uint eg_out; //减少寻址 int imem_ToIndex_c = imem[c]; + int* out_fm_ptr = out_fm; fixed (FM_SLOT* CH_c_SLOT = &CH[c].SLOT[0])//因为是引用类型,所以敢这么玩 - fixed (int* out_fm_ptr = &out_fm[0]) + //fixed (int* out_fm_ptr = &out_fm[0]) { - FM_SLOT* cslot_0 = &CH_c_SLOT[0]; - FM_SLOT* cslot_1 = &CH_c_SLOT[1]; - FM_SLOT* cslot_2 = &CH_c_SLOT[2]; - FM_SLOT* cslot_3 = &CH_c_SLOT[3]; + FM_SLOT* cslot_0 = CH_c_SLOT; + FM_SLOT* cslot_1 = CH_c_SLOT + 1; + FM_SLOT* cslot_2 = CH_c_SLOT + 2; + FM_SLOT* cslot_3 = CH_c_SLOT + 3; //out_fm[8] = out_fm[9] = out_fm[10] = out_fm[11] = 0; //本来就是注释->m2 = c1 = c2 = mem = 0; - out_fm_ptr[8] = out_fm_ptr[9] = out_fm_ptr[10] = out_fm_ptr[11] = 0; + *(out_fm_ptr + 8) = *(out_fm_ptr + 9) = *(out_fm_ptr + 10) = *(out_fm_ptr + 11) = 0; //set_mem(c); if (imem_ToIndex_c == 8 || imem_ToIndex_c == 10 || imem_ToIndex_c == 11) - out_fm_ptr[imem_ToIndex_c] = CH[c].mem_value; + *(out_fm_ptr + imem_ToIndex_c) = CH[c].mem_value; //eg_out = volume_calc(c, 0); eg_out = (uint)(cslot_0->vol_out + ((LFO_AM >> CH[c].ams) & cslot_0->AMmask)); @@ -648,7 +670,8 @@ namespace MAME.Core //set_value1(c); if (iconnect1[c] == 12) { - out_fm_ptr[11] = out_fm_ptr[9] = out_fm_ptr[10] = CH[c].op1_out0; + //out_fm_ptr[11] = out_fm_ptr[9] = out_fm_ptr[10] = CH[c].op1_out0; + *(out_fm_ptr + 11) = *(out_fm_ptr + 9) = *(out_fm_ptr + 10) = CH[c].op1_out0; } else { @@ -1358,15 +1381,76 @@ namespace MAME.Core public delegate void reset_handler(); private static int[] lfo_pm_table = new int[128 * 8 * 32]; private static int[] iconnect1 = new int[8], iconnect2 = new int[8], iconnect3 = new int[8], iconnect4 = new int[6], imem = new int[13]; - public static int[] out_fm = new int[13]; - public static int[] out_adpcm = new int[4]; - public static int[] out_delta = new int[4]; + //public static int[] out_fm = new int[13]; + + #region //指针化 out_fm + static int[] out_fm_src; + static GCHandle out_fm_handle; + public static int* out_fm; + public static int out_fmLength; + public static bool out_fm_IsNull => out_fm == null; + public static int[] out_fm_set + { + set + { + out_fm_handle.ReleaseGCHandle(); + out_fm_src = value; + out_fmLength = value.Length; + out_fm_src.GetObjectPtr(ref out_fm_handle, ref out_fm); + } + } + #endregion + + //public static int[] out_adpcm = new int[4]; + + #region //指针化 out_adpcm + static int[] out_adpcm_src; + static GCHandle out_adpcm_handle; + public static int* out_adpcm; + public static int out_adpcmLength; + public static bool out_adpcm_IsNull => out_adpcm == null; + public static int[] out_adpcm_set + { + set + { + out_adpcm_handle.ReleaseGCHandle(); + out_adpcm_src = value; + out_adpcmLength = value.Length; + out_adpcm_src.GetObjectPtr(ref out_adpcm_handle, ref out_adpcm); + } + } + #endregion + + //public static int[] out_delta = new int[4]; + + #region //指针化 out_delta + static int[] out_delta_src; + static GCHandle out_delta_handle; + public static int* out_delta; + public static int out_deltaLength; + public static bool out_delta_IsNull => out_delta == null; + public static int[] out_delta_set + { + set + { + out_delta_handle.ReleaseGCHandle(); + out_delta_src = value; + out_deltaLength = value.Length; + out_delta_src.GetObjectPtr(ref out_delta_handle, ref out_delta); + } + } + #endregion + public static byte[] ymsndrom; public static int LFO_AM; public static int LFO_PM; private static int fn_max; public static void FM_init() { + //初始化一下 + out_fm_set = new int[13]; + out_adpcm_set = new int[4]; + out_delta_set = new int[4]; init_tables(); } public static int Limit(int val, int max, int min) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YM2610.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YM2610.cs index 56712202..187b6d58 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YM2610.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YM2610.cs @@ -547,15 +547,29 @@ namespace MAME.Core int* streamoutput_0_offset_ptr = &Sound.ym2610stream.streamoutput_Ptrs[0][offset]; int* streamoutput_1_offset_ptr = &Sound.ym2610stream.streamoutput_Ptrs[1][offset]; + int* out_adpcm_ptr_0 = FM.out_adpcm; + int* out_adpcm_ptr_1 = FM.out_adpcm + 1; + int* out_adpcm_ptr_2 = FM.out_adpcm + 2; + int* out_adpcm_ptr_3 = FM.out_adpcm + 3; + int* out_delta_ptr_0 = FM.out_delta; + int* out_delta_ptr_1 = FM.out_delta + 1; + int* out_delta_ptr_2 = FM.out_delta + 2; + int* out_delta_ptr_3 = FM.out_delta + 3; for (i = 0; i < length; i++) { OPN.advance_lfo(); - FM.out_adpcm[2] = FM.out_adpcm[1] = FM.out_adpcm[3] = 0; - FM.out_delta[2] = FM.out_delta[1] = FM.out_delta[3] = 0; - FM.out_fm[1] = 0; - FM.out_fm[2] = 0; - FM.out_fm[4] = 0; - FM.out_fm[5] = 0; + //FM.out_adpcm[2] = FM.out_adpcm[1] = FM.out_adpcm[3] = 0; + *out_adpcm_ptr_2 = *out_adpcm_ptr_1 = *out_adpcm_ptr_3 = 0; + //FM.out_delta[2] = FM.out_delta[1] = FM.out_delta[3] = 0; + *out_delta_ptr_2 = *out_delta_ptr_1 = *out_delta_ptr_3 = 0; + //FM.out_fm[1] = 0; + //FM.out_fm[2] = 0; + //FM.out_fm[4] = 0; + //FM.out_fm[5] = 0; + *(FM.out_fm + 1) = 0; + *(FM.out_fm + 2) = 0; + *(FM.out_fm + 4) = 0; + *(FM.out_fm + 5) = 0; OPN.eg_timer += OPN.eg_timer_add; while (OPN.eg_timer >= OPN.eg_timer_overflow) { @@ -570,10 +584,10 @@ namespace MAME.Core //OPN.chan_calc(2, 2); //OPN.chan_calc(4, 4); //OPN.chan_calc(5, 5); - OPN.chan_calc(1,false); - OPN.chan_calc(2,true); - OPN.chan_calc(4,false); - OPN.chan_calc(5,false); + OPN.chan_calc(1, false); + OPN.chan_calc(2, true); + OPN.chan_calc(4, false); + OPN.chan_calc(5, false); if ((YMDeltat.DELTAT.portstate & 0x80) != 0) { YMDeltat.YM_DELTAT_ADPCM_CALC(); @@ -586,18 +600,30 @@ namespace MAME.Core } } int lt, rt; - lt = FM.out_adpcm[2] + FM.out_adpcm[3]; - rt = FM.out_adpcm[1] + FM.out_adpcm[3]; - lt += (FM.out_delta[2] + FM.out_delta[3]) >> 9; - rt += (FM.out_delta[1] + FM.out_delta[3]) >> 9; - lt += (int)((FM.out_fm[1] >> 1) & OPN.pan[2]); - rt += (int)((FM.out_fm[1] >> 1) & OPN.pan[3]); - lt += (int)((FM.out_fm[2] >> 1) & OPN.pan[4]); - rt += (int)((FM.out_fm[2] >> 1) & OPN.pan[5]); - lt += (int)((FM.out_fm[4] >> 1) & OPN.pan[8]); - rt += (int)((FM.out_fm[4] >> 1) & OPN.pan[9]); - lt += (int)((FM.out_fm[5] >> 1) & OPN.pan[10]); - rt += (int)((FM.out_fm[5] >> 1) & OPN.pan[11]); + //lt = FM.out_adpcm[2] + FM.out_adpcm[3]; + lt = *out_adpcm_ptr_2 + *out_adpcm_ptr_3; + //rt = FM.out_adpcm[1] + FM.out_adpcm[3]; + rt = *out_adpcm_ptr_1 + *out_adpcm_ptr_3; + //lt += (FM.out_delta[2] + FM.out_delta[3]) >> 9; + lt += (*out_delta_ptr_2 + *out_delta_ptr_3) >> 9; + //rt += (FM.out_delta[1] + FM.out_delta[3]) >> 9; + rt += (*out_delta_ptr_1 + *out_delta_ptr_3) >> 9; + //lt += (int)((FM.out_fm[1] >> 1) & OPN.pan[2]); + //rt += (int)((FM.out_fm[1] >> 1) & OPN.pan[3]); + //lt += (int)((FM.out_fm[2] >> 1) & OPN.pan[4]); + //rt += (int)((FM.out_fm[2] >> 1) & OPN.pan[5]); + //lt += (int)((FM.out_fm[4] >> 1) & OPN.pan[8]); + //rt += (int)((FM.out_fm[4] >> 1) & OPN.pan[9]); + //lt += (int)((FM.out_fm[5] >> 1) & OPN.pan[10]); + //rt += (int)((FM.out_fm[5] >> 1) & OPN.pan[11]); + lt += (int)((*(FM.out_fm + 1) >> 1) & *(OPN.pan + 2)); + rt += (int)((*(FM.out_fm + 1) >> 1) & *(OPN.pan + 3)); + lt += (int)((*(FM.out_fm + 2) >> 1) & *(OPN.pan + 4)); + rt += (int)((*(FM.out_fm + 2) >> 1) & *(OPN.pan + 5)); + lt += (int)((*(FM.out_fm + 4) >> 1) & *(OPN.pan + 8)); + rt += (int)((*(FM.out_fm + 4) >> 1) & *(OPN.pan + 9)); + lt += (int)((*(FM.out_fm + 5) >> 1) & *(OPN.pan + 10)); + rt += (int)((*(FM.out_fm + 5) >> 1) & *(OPN.pan + 11)); //lt = FM.Limit(lt, 32767, -32768); //rt = FM.Limit(rt, 32767, -32768); lt = Math.Min(lt, 32767); diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YMDeltat.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YMDeltat.cs index 41ca872b..da76ebad 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YMDeltat.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/YMDeltat.cs @@ -279,7 +279,7 @@ return val; } } - private static void YM_DELTAT_synthesis_from_external_memory() + private unsafe static void YM_DELTAT_synthesis_from_external_memory() { int step; int data; @@ -340,9 +340,10 @@ DELTAT.adpcml = DELTAT.prev_acc * (int)((1 << 16) - DELTAT.now_step); DELTAT.adpcml += (DELTAT.acc * (int)DELTAT.now_step); DELTAT.adpcml = (DELTAT.adpcml >> 16) * (int)DELTAT.volume; - FM.out_delta[DELTAT.pan_offset] += DELTAT.adpcml; + //FM.out_delta[DELTAT.pan_offset] += DELTAT.adpcml; + *(FM.out_delta + DELTAT.pan_offset) += DELTAT.adpcml; } - private static void YM_DELTAT_synthesis_from_CPU_memory() + private unsafe static void YM_DELTAT_synthesis_from_CPU_memory() { int step; int data; @@ -376,7 +377,8 @@ DELTAT.adpcml = DELTAT.prev_acc * (int)((1 << 16) - DELTAT.now_step); DELTAT.adpcml += (DELTAT.acc * (int)DELTAT.now_step); DELTAT.adpcml = (DELTAT.adpcml >> 16) * (int)DELTAT.volume; - FM.out_delta[DELTAT.pan_offset] += DELTAT.adpcml; + //FM.out_delta[DELTAT.pan_offset] += DELTAT.adpcml; + *(FM.out_delta + DELTAT.pan_offset) += DELTAT.adpcml; } public static void YM_DELTAT_ADPCM_CALC() {