From d7322d8e91d4b4eba191026447a227390106ffd2 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Wed, 12 Nov 2025 16:13:37 +0800 Subject: [PATCH] =?UTF-8?q?MAME:=E8=A7=A3=E5=86=B3NEOGEO=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?BIOS=E6=97=B6=E5=BC=80=E9=94=80=E5=A4=A7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=A0=B8=E5=BF=83=E6=98=AFmame=20watchdog?= =?UTF-8?q?=E5=9C=A8=E5=8A=A0=E8=BD=BDbios=E6=97=B6=E6=AF=8F=E5=B8=A7?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=95=B0=E5=8D=83=E6=AC=A1watchdog=20reset?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E5=AE=9E=E6=AF=8F=E5=B8=A7=E8=87=B3=E5=A4=9A?= =?UTF-8?q?=E5=8F=AA=E9=9C=80=E8=A6=81=E4=B8=80=E6=AC=A1=E5=8D=B3=E5=8F=AF?= =?UTF-8?q?=E5=BE=97=E5=88=B0=E7=AD=89=E6=95=88=E6=95=88=E6=9E=9C=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=80=E4=B8=AA=E9=99=90=E5=88=B6=EF=BC=8C?= =?UTF-8?q?=E5=8A=A0=E8=BD=BDBIOS=E6=97=B6=E5=92=8C=E5=B9=B3=E5=B8=B8?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E6=97=B6=E6=80=A7=E8=83=BD=E6=8E=A5=E8=BF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Plugins/Mame.Core/emu/Watchdog.cs | 29 +++++++++++ .../Plugins/Mame.Core/mame/neogeo/Memory.cs | 51 +++++++++++++++++-- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/emu/Watchdog.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/emu/Watchdog.cs index b5a4af4f..41eb4de2 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/emu/Watchdog.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/emu/Watchdog.cs @@ -42,8 +42,22 @@ { Mame.mame_schedule_soft_reset(); } + static long LastCheckFrame; + static int frame_reset_count; + const byte maxLimitReset_everyFrame = 1; public static void watchdog_reset() { + if (LastCheckFrame != Video.screenstate.frame_number) + { + LastCheckFrame = Video.screenstate.frame_number; + //UnityEngine.Debug.Log($"上一帧数跳过watchdog_reset:{frame_reset_count}次"); + frame_reset_count = 0; + } + + frame_reset_count++; + if (frame_reset_count > maxLimitReset_everyFrame) + return; + if (!watchdog_enabled) { EmuTimer.timer_adjust_periodic(watchdog_timer, Attotime.ATTOTIME_NEVER, Attotime.ATTOTIME_NEVER); @@ -57,5 +71,20 @@ EmuTimer.timer_adjust_periodic(watchdog_timer, new Atime(3, 0), Attotime.ATTOTIME_NEVER); } } + //public static void watchdog_reset() + //{ + // if (!watchdog_enabled) + // { + // EmuTimer.timer_adjust_periodic(watchdog_timer, Attotime.ATTOTIME_NEVER, Attotime.ATTOTIME_NEVER); + // } + // else if (Attotime.attotime_compare(watchdog_time, Attotime.ATTOTIME_ZERO) != 0) + // { + // EmuTimer.timer_adjust_periodic(watchdog_timer, watchdog_time, Attotime.ATTOTIME_NEVER); + // } + // else + // { + // EmuTimer.timer_adjust_periodic(watchdog_timer, new Atime(3, 0), Attotime.ATTOTIME_NEVER); + // } + //} } } 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 9e9c9619..f9b038a1 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/mame/neogeo/Memory.cs @@ -175,6 +175,49 @@ namespace MAME.Core } return result; } + //public static short MReadOpWord(int address) + //{ + // address &= 0xffffff; + // short result = 0; + // if (address >= 0x000000 && address + 1 <= 0x00007f) + // { + // if (main_cpu_vector_table_source == 0) + // { + // result = (short)(mainbiosrom[address] * 0x100 + mainbiosrom[address + 1]); + // } + // else if (main_cpu_vector_table_source == 1) + // { + // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // } + // } + // else if (address >= 0x000080 && address + 1 <= 0x0fffff) + // { + // if (address >= 0x142B9 && address <= 0x142C9) + // { + // //m68000Form.iStatus = 1; + // } + // result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); + // } + // else if (address >= 0x100000 && address + 1 <= 0x1fffff) + // { + // result = (short)(Memory.mainram[address & 0xffff] * 0x100 + Memory.mainram[(address & 0xffff) + 1]); + // } + // 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]); + // } + // else if (address >= 0xc00000 && address + 1 <= 0xcfffff) + // { + // result = (short)(mainbiosrom[address & 0x1ffff] * 0x100 + mainbiosrom[(address & 0x1ffff) + 1]); + // } + // else + // { + // result = 0; + // } + // return result; + //} + + //手动优化 public static short MReadOpWord(int address) { address &= 0xffffff; @@ -192,10 +235,10 @@ namespace MAME.Core } else if (address >= 0x000080 && address + 1 <= 0x0fffff) { - if (address >= 0x142B9 && address <= 0x142C9) - { - //m68000Form.iStatus = 1; - } + //if (address >= 0x142B9 && address <= 0x142C9) + //{ + // //m68000Form.iStatus = 1; + //} result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); } else if (address >= 0x100000 && address + 1 <= 0x1fffff)