diff --git a/MAME.Core/Motion/mainMotion.cs b/MAME.Core/Motion/MameMainMotion.cs similarity index 93% rename from MAME.Core/Motion/mainMotion.cs rename to MAME.Core/Motion/MameMainMotion.cs index 7cde691..0e71f23 100644 --- a/MAME.Core/Motion/mainMotion.cs +++ b/MAME.Core/Motion/MameMainMotion.cs @@ -6,32 +6,33 @@ using System.Linq; using System.Threading; using System.Xml.Linq; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public class mainMotion + public class MameMainMotion { public string tsslStatus; - public cheatMotion cheatmotion; - public m68000Motion m68000motion; - public z80Motion z80motion; - public m6809Motion m6809motion; - public cpsMotion cpsmotion; - public neogeoMotion neogeomotion; - public konami68000Motion konami68000motion; + public CheatMotion cheatmotion; + public M68000Motion m68000motion; + public Z80Motion z80motion; + public M6809Motion m6809motion; + public CpsMotion cpsmotion; + public NeogeoMotion neogeomotion; + public Konami68000Motion konami68000motion; public string sSelect; - public static Thread t1; + public static Thread mainThread; public static IResources resource; + public bool bRom => Machine.bRom; - public mainMotion() + public MameMainMotion() { - neogeomotion = new neogeoMotion(); - cheatmotion = new cheatMotion(); - m68000motion = new m68000Motion(); - m6809motion = new m6809Motion(); - z80motion = new z80Motion(); - cpsmotion = new cpsMotion(); - konami68000motion = new konami68000Motion(); + neogeomotion = new NeogeoMotion(); + cheatmotion = new CheatMotion(); + m68000motion = new M68000Motion(); + m6809motion = new M6809Motion(); + z80motion = new Z80Motion(); + cpsmotion = new CpsMotion(); + konami68000motion = new Konami68000Motion(); } public void Init( @@ -41,7 +42,8 @@ namespace MAME.Core.Common IVideoPlayer ivp, ISoundPlayer isp, IKeyboard ikb, - IMouse imou) + IMouse imou + ) { Mame.RomRoot = RomDir; EmuLogger.BindFunc(ilog); @@ -49,21 +51,12 @@ namespace MAME.Core.Common Sound.BindFunc(isp); resource = iRes; - //StreamReader sr1 = new StreamReader("mame.ini"); - //sr1.ReadLine(); - //sSelect = sr1.ReadLine(); - //sr1.Close(); - - //TODO 上次选择 - sSelect = "samsho2"; - + sSelect = string.Empty; RomInfo.Rom = new RomInfo(); LoadROMXML(); - //TODO Wavebuffer - //desc1.BufferBytes = 0x9400; Keyboard.InitializeInput(ikb); - Mouse.InitialMouse(this, imou); + Mouse.InitialMouse(imou); } private void LoadROMXML() @@ -119,7 +112,7 @@ namespace MAME.Core.Common mame.Timer.lt = new List(); sSelect = RomInfo.Rom.Name; - Machine.FORM = this; + Machine.mainMotion = this; Machine.rom = RomInfo.Rom; Machine.sName = Machine.rom.Name; Machine.sParent = Machine.rom.Parent; @@ -237,7 +230,7 @@ namespace MAME.Core.Common if (Machine.bRom) { EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]"); - Mame.init_machine(this); + Mame.init_machine(); Generic.nvram_load(); } else @@ -246,6 +239,24 @@ namespace MAME.Core.Common } } + public void StartGame() + { + M68000Motion.iStatus = 0; + M68000Motion.iValue = 0; + Mame.exit_pending = false; + MameMainMotion.mainThread = new Thread(Mame.mame_execute); + MameMainMotion.mainThread.Start(); + } + + public void StopGame() + { + if (Machine.bRom) + { + Mame.exit_pending = true; + Thread.Sleep(100); + } + } + private void itemSelect() { switch (Machine.sBoard) diff --git a/MAME.Core/Motion/cheatMotion.cs b/MAME.Core/Motion/cheatMotion.cs index 036e0df..9d50d51 100644 --- a/MAME.Core/Motion/cheatMotion.cs +++ b/MAME.Core/Motion/cheatMotion.cs @@ -4,9 +4,9 @@ using mame; using System; using System.Collections.Generic; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public partial class cheatMotion + public partial class CheatMotion { public enum LockState { @@ -25,7 +25,7 @@ namespace MAME.Core.Common #region List mTxList_tbResult = new List(); #endregion - public cheatMotion() + public CheatMotion() { cheatForm_Load(); } diff --git a/MAME.Core/Motion/cpsMotion.cs b/MAME.Core/Motion/cpsMotion.cs index 529e678..1883383 100644 --- a/MAME.Core/Motion/cpsMotion.cs +++ b/MAME.Core/Motion/cpsMotion.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public partial class cpsMotion + public partial class CpsMotion { private string[] sde2 = new string[] { "," }; private int locationX, locationY; @@ -31,7 +31,7 @@ namespace MAME.Core.Common public string tbScrollsy = string.Empty; public List tbResult = new List(); #endregion - public cpsMotion() + public CpsMotion() { } } diff --git a/MAME.Core/Motion/konami68000Motion.cs b/MAME.Core/Motion/konami68000Motion.cs index 04b8f59..babd94d 100644 --- a/MAME.Core/Motion/konami68000Motion.cs +++ b/MAME.Core/Motion/konami68000Motion.cs @@ -1,6 +1,6 @@ -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public class konami68000Motion + public class Konami68000Motion { private int locationX, locationY; @@ -11,7 +11,7 @@ public bool cbSprite = false; public string tbSprite; #endregion - public konami68000Motion() + public Konami68000Motion() { tbSprite = "0000-4000"; } diff --git a/MAME.Core/Motion/m68000Motion.cs b/MAME.Core/Motion/m68000Motion.cs index 51c6f93..7f6056d 100644 --- a/MAME.Core/Motion/m68000Motion.cs +++ b/MAME.Core/Motion/m68000Motion.cs @@ -2,9 +2,9 @@ using System; using System.Collections.Generic; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public class m68000Motion + public class M68000Motion { private string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" }; private bool bLogNew, bNew; @@ -54,7 +54,7 @@ namespace MAME.Core.Common M68000_STOP, } public static M68000State m68000State, m68000FState; - public m68000Motion() + public M68000Motion() { int i; mTxList_tbDs = new string[8]; diff --git a/MAME.Core/Motion/m6809Motion.cs b/MAME.Core/Motion/m6809Motion.cs index 7910a20..cef6beb 100644 --- a/MAME.Core/Motion/m6809Motion.cs +++ b/MAME.Core/Motion/m6809Motion.cs @@ -2,10 +2,10 @@ using mame; using System.Collections.Generic; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public partial class m6809Motion + public partial class M6809Motion { //private Disassembler disassembler; private bool bLogNew; @@ -34,7 +34,7 @@ namespace MAME.Core.Common public string tbDisassemble = string.Empty; #endregion - public m6809Motion() + public M6809Motion() { } public void GetData() diff --git a/MAME.Core/Motion/neogeoMotion.cs b/MAME.Core/Motion/neogeoMotion.cs index acac3cc..299c015 100644 --- a/MAME.Core/Motion/neogeoMotion.cs +++ b/MAME.Core/Motion/neogeoMotion.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; using System.IO; -namespace MAME.Core.Common +namespace MAME.Core.Motion { - public partial class neogeoMotion + public partial class NeogeoMotion { private string[] sde2 = new string[] { "," }; private int locationX, locationY; @@ -20,7 +20,7 @@ namespace MAME.Core.Common bool cbL0 = false; bool cbL1 = false; #endregion - public neogeoMotion() + public NeogeoMotion() { tbResult = new List(); neogeoForm_Load(); diff --git a/MAME.Core/Motion/z80Motion.cs b/MAME.Core/Motion/z80Motion.cs index ea0d21f..d97c39f 100644 --- a/MAME.Core/Motion/z80Motion.cs +++ b/MAME.Core/Motion/z80Motion.cs @@ -1,7 +1,7 @@ using cpu.z80; using System.Collections.Generic; -namespace MAME.Core.Common +namespace MAME.Core.Motion { public enum CPUState { @@ -12,7 +12,7 @@ namespace MAME.Core.Common STEP3, STOP, } - public partial class z80Motion + public partial class Z80Motion { private Disassembler disassembler; private bool bLogNew; @@ -55,7 +55,7 @@ namespace MAME.Core.Common Z80A_STOP, } public static Z80AState z80State, z80FState; - public z80Motion() + public Z80Motion() { disassembler = new Disassembler(); Disassembler.GenerateOpcodeSizes(); diff --git a/MAME.Core/emu/Cpuexec.cs b/MAME.Core/emu/Cpuexec.cs index a9dc782..be68a26 100644 --- a/MAME.Core/emu/Cpuexec.cs +++ b/MAME.Core/emu/Cpuexec.cs @@ -5,7 +5,7 @@ using cpu.m6805; using cpu.m6809; using cpu.nec; using cpu.z80; -using MAME.Core.Common; +using MAME.Core.Motion; using System; using System.IO; @@ -2118,46 +2118,46 @@ namespace mame case "Neo Geo": case "PGM": case "Taito B": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; case "Tehkan": - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; break; case "IGS011": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; break; case "SunA8": - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; break; case "Namco System 1": - m6809Motion.m6809State = CPUState.RUN; + M6809Motion.m6809State = CPUState.RUN; M6809.mm1[0].DisassemblerInit(); - M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; - M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug; + M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_start_debug; + M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_stop_debug; M6809.mm1[1].debugger_start_cpu_hook_callback = null_callback; M6809.mm1[1].debugger_stop_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_start_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback; break; case "M72": - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; case "M92": break; @@ -2186,35 +2186,35 @@ namespace mame case "boblcave": case "bublcave11": case "bublcave10": - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; - Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; + Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; case "opwolf": case "opwolfa": case "opwolfj": case "opwolfu": case "opwolfp": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; case "opwolfb": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; } break; @@ -2222,17 +2222,17 @@ namespace mame switch (Machine.sName) { case "cuebrick": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; break; default: - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; } break; @@ -2250,13 +2250,13 @@ namespace mame case "makaimurc": case "makaimurg": case "diamond": - m6809Motion.m6809State = CPUState.RUN; + M6809Motion.m6809State = CPUState.RUN; M6809.mm1[0].DisassemblerInit(); - M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; - M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_start_debug; + M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; case "sf": case "sfua": @@ -2264,14 +2264,14 @@ namespace mame case "sfjan": case "sfan": case "sfp": - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug; break; } break; @@ -2472,9 +2472,9 @@ namespace mame cpu[icpu].eatcycles = cpu[icpu].nexteatcycles; } Timer.timer_set_global_time(target); - if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatmotion.lockState == cheatMotion.LockState.LOCK_SECOND) + if (Timer.global_basetime.attoseconds == 0 && Machine.mainMotion.cheatmotion.lockState == CheatMotion.LockState.LOCK_SECOND) { - Machine.FORM.cheatmotion.ApplyCheat(); + Machine.mainMotion.cheatmotion.ApplyCheat(); } } public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration) diff --git a/MAME.Core/emu/Gdi.cs b/MAME.Core/emu/Gdi.cs index 285c0fd..0cd2a03 100644 --- a/MAME.Core/emu/Gdi.cs +++ b/MAME.Core/emu/Gdi.cs @@ -90,27 +90,27 @@ namespace mame // bitmapGDI.UnlockBits(bitmapData); // if (Wintime.osd_ticks() < popup_text_end) // { - // Machine.FORM.tsslStatus = sDrawText; + // Machine.mainMotion.tsslStatus = sDrawText; // } // else // { // popup_text_end = 0; // if (Mame.paused) // { - // Machine.FORM.tsslStatus = "pause"; + // Machine.mainMotion.tsslStatus = "pause"; // } // else // { // switch (Mame.playState) // { // case Mame.PlayState.PLAY_RECORDRUNNING: - // Machine.FORM.tsslStatus = "record"; + // Machine.mainMotion.tsslStatus = "record"; // break; // case Mame.PlayState.PLAY_REPLAYRUNNING: - // Machine.FORM.tsslStatus = "replay"; + // Machine.mainMotion.tsslStatus = "replay"; // break; // default: - // Machine.FORM.tsslStatus = "run"; + // Machine.mainMotion.tsslStatus = "run"; // break; // } // } @@ -131,7 +131,7 @@ namespace mame // bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone); // break; // } - // //Machine.FORM.pictureBox1.Image = bbmp[iMode]; + // //Machine.mainMotion.pictureBox1.Image = bbmp[iMode]; // SubmitVideo(bbmp[iMode]); // } // catch @@ -163,7 +163,7 @@ namespace mame // bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone); // break; //} - //Machine.FORM.pictureBox1.Image = bbmp[iMode]; + //Machine.mainMotion.pictureBox1.Image = bbmp[iMode]; //AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor,Video.bitmapcolorRect, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height)); SubmitVideo(Video.bitmapcolorRect); diff --git a/MAME.Core/emu/Machine.cs b/MAME.Core/emu/Machine.cs index b8afc60..7902978 100644 --- a/MAME.Core/emu/Machine.cs +++ b/MAME.Core/emu/Machine.cs @@ -1,4 +1,4 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using System.Collections.Generic; using System.IO; @@ -8,7 +8,7 @@ namespace mame { public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer; public static List lsParents; - public static mainMotion FORM; + public static MameMainMotion mainMotion; public static RomInfo rom; public static bool bRom; public delegate void machine_delegate(); diff --git a/MAME.Core/emu/Mame.cs b/MAME.Core/emu/Mame.cs index 226c45c..65d8f07 100644 --- a/MAME.Core/emu/Mame.cs +++ b/MAME.Core/emu/Mame.cs @@ -1,4 +1,4 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using MAME.Core.run_interface; using System.IO; @@ -46,7 +46,9 @@ namespace mame public static void mame_execute() { soft_reset(); - mame_pause(true); + //mame_pause(true); + //开始不暂停 + mame_pause(false); while (!exit_pending) { if (!paused) @@ -82,6 +84,8 @@ namespace mame handlestate(); } } + + public static void mame_schedule_soft_reset() { Timer.timer_adjust_periodic(soft_reset_timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER); @@ -127,14 +131,14 @@ namespace mame handle_replay(); } } - public static void init_machine(mainMotion form) + public static void init_machine() { Inptport.input_init(); Palette.palette_init(); Generic.generic_machine_init(); Timer.timer_init(); soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false); - Window.osd_init(form); + Window.osd_init(); Inptport.input_port_init(); Cpuexec.cpuexec_init(); Watchdog.watchdog_init(); diff --git a/MAME.Core/emu/Motion.cs b/MAME.Core/emu/Motion.cs index 31ab8c3..449e82a 100644 --- a/MAME.Core/emu/Motion.cs +++ b/MAME.Core/emu/Motion.cs @@ -1,4 +1,4 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using MAME.Core.run_interface; namespace mame @@ -12,11 +12,6 @@ namespace mame public delegate void motion_delegate(); public static motion_delegate motion_handler_callback, motion_update_callback; public static bool single_step; - //public static mainMotion mainmotion; - public static void init() - { - //mainmotion = motion; - } public static void ui_update_and_render() { motion_update_callback(); @@ -510,10 +505,10 @@ namespace mame } public static void cpurun() { - m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; - Machine.FORM.m68000motion.mTx_tsslStatus = "run"; - z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; - Machine.FORM.z80motion.mTx_tsslStatus = "run"; + M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN; + Machine.mainMotion.m68000motion.mTx_tsslStatus = "run"; + Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN; + Machine.mainMotion.z80motion.mTx_tsslStatus = "run"; } private static double ui_get_line_height() { diff --git a/MAME.Core/emu/Mouse.cs b/MAME.Core/emu/Mouse.cs index 6c94304..93ac8f4 100644 --- a/MAME.Core/emu/Mouse.cs +++ b/MAME.Core/emu/Mouse.cs @@ -1,4 +1,4 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using MAME.Core.run_interface; namespace mame @@ -8,7 +8,7 @@ namespace mame public static int deltaX, deltaY, oldX, oldY; public static byte[] buttons; static IMouse iMouse; - public static void InitialMouse(mainMotion form1, IMouse im) + public static void InitialMouse(IMouse im) { iMouse = im; } @@ -16,12 +16,13 @@ namespace mame public static void Update() { int X, Y; - iMouse.MouseXY(out X, out Y); + iMouse.MouseXY(out X, out Y, out byte[] MouseButtons); deltaX = X - oldX; deltaY = Y - oldY; oldX = X; oldY = Y; - //TODO + buttons = MouseButtons; + //MouseState mouseState = mouseDevice.CurrentMouseState; //deltaX = mouseState.X - oldX; //deltaY = mouseState.Y - oldY; diff --git a/MAME.Core/emu/Video.cs b/MAME.Core/emu/Video.cs index 9e97338..85bc05f 100644 --- a/MAME.Core/emu/Video.cs +++ b/MAME.Core/emu/Video.cs @@ -1,4 +1,5 @@ -using MAME.Core.run_interface; +using MAME.Core.Motion; +using MAME.Core.run_interface; using System; using System.IO; using System.Runtime.InteropServices; @@ -895,9 +896,9 @@ namespace mame Mouse.Update(); Inptport.frame_update_callback(); Motion.ui_update_and_render(); - if (Machine.FORM.cheatmotion.lockState == MAME.Core.Common.cheatMotion.LockState.LOCK_FRAME) + if (Machine.mainMotion.cheatmotion.lockState == CheatMotion.LockState.LOCK_FRAME) { - Machine.FORM.cheatmotion.ApplyCheat(); + Machine.mainMotion.cheatmotion.ApplyCheat(); } GDIDraw(); if (effective_throttle()) diff --git a/MAME.Core/emu/Window.cs b/MAME.Core/emu/Window.cs index eb64310..6b9f652 100644 --- a/MAME.Core/emu/Window.cs +++ b/MAME.Core/emu/Window.cs @@ -1,10 +1,10 @@ -using MAME.Core.Common; +using MAME.Core.Motion; namespace mame { public class Window { - private static mainMotion _myParentForm; + private static MameMainMotion _myParentForm; //[DllImport("kernel32.dll ")] //private static extern uint GetTickCount(); @@ -47,9 +47,8 @@ namespace mame } winwindow_process_events(true); } - public static void osd_init(mainMotion form) + public static void osd_init() { - _myParentForm = form; wininput_init(); } public static void wininput_init() diff --git a/MAME.Core/mame/namcos1/Namcos1.cs b/MAME.Core/mame/namcos1/Namcos1.cs index b9a2a6d..e4ef7a5 100644 --- a/MAME.Core/mame/namcos1/Namcos1.cs +++ b/MAME.Core/mame/namcos1/Namcos1.cs @@ -1,6 +1,5 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using System; -using System.IO; namespace mame { @@ -36,7 +35,7 @@ namespace mame gfx2rom = Machine.GetRom("gfx2.rom"); gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom")); user1rom = Machine.GetRom("user1.rom"); - mcurom = mainMotion.resource.mcu; + mcurom = MameMainMotion.resource.mcu; voicerom = new byte[0xc0000]; byte[] bb1 = Machine.GetRom("voice.rom"); Array.Copy(bb1, voicerom, bb1.Length); diff --git a/MAME.Core/mame/neogeo/Memory.cs b/MAME.Core/mame/neogeo/Memory.cs index 8cea1b5..49bf340 100644 --- a/MAME.Core/mame/neogeo/Memory.cs +++ b/MAME.Core/mame/neogeo/Memory.cs @@ -1,5 +1,5 @@ using cpu.m68000; -using MAME.Core.Common; +using MAME.Core.Motion; namespace mame { @@ -420,8 +420,8 @@ namespace mame public static void MWriteByte(int address, sbyte value) { address &= 0xffffff; - m68000Motion.iWAddress = address; - m68000Motion.iWOp = 0x01; + M68000Motion.iWAddress = address; + M68000Motion.iWOp = 0x01; if (address >= 0x100000 && address <= 0x1fffff) { if (address == 0x100d0b && value == 0x06)//&&MC68000.m1.TotalExecutedCycles>0x3F6FC8C) @@ -497,8 +497,8 @@ namespace mame public static void MWriteWord(int address, short value) { address &= 0xffffff; - m68000Motion.iWAddress = address; - m68000Motion.iWOp = 0x02; + M68000Motion.iWAddress = address; + M68000Motion.iWOp = 0x02; if (address >= 0x100000 && address + 1 <= 0x1fffff) { if (address == 0x1007c4 && value == unchecked((short)0xb102)) @@ -550,8 +550,8 @@ namespace mame public static void MWriteLong(int address, int value) { address &= 0xffffff; - m68000Motion.iWAddress = address; - m68000Motion.iWOp = 0x03; + M68000Motion.iWAddress = address; + M68000Motion.iWOp = 0x03; if (address >= 0x100000 && address + 3 <= 0x1fffff) { if (address == 0x1051e4 && value == 0x00130070) diff --git a/MAME.Core/mame/neogeo/Neogeo.cs b/MAME.Core/mame/neogeo/Neogeo.cs index 4b21426..80ca4ad 100644 --- a/MAME.Core/mame/neogeo/Neogeo.cs +++ b/MAME.Core/mame/neogeo/Neogeo.cs @@ -1,4 +1,4 @@ -using MAME.Core.Common; +using MAME.Core.Motion; using System; using System.IO; @@ -41,10 +41,10 @@ namespace mame Memory.audioram = new byte[0x800]; Machine.bRom = true; dsw = 0xff; - fixedbiosrom = mainMotion.resource.sfix; - zoomyrom = mainMotion.resource._000_lo; - audiobiosrom = mainMotion.resource.sm1; - mainbiosrom = mainMotion.resource.mainbios; + fixedbiosrom = MameMainMotion.resource.sfix; + zoomyrom = MameMainMotion.resource._000_lo; + audiobiosrom = MameMainMotion.resource.sm1; + mainbiosrom = MameMainMotion.resource.mainbios; Memory.mainrom = Machine.GetRom("maincpu.rom"); Memory.audiorom = Machine.GetRom("audiocpu.rom"); fixedrom = Machine.GetRom("fixed.rom"); diff --git a/MAME.Core/mame/pgm/PGM.cs b/MAME.Core/mame/pgm/PGM.cs index fd320e9..15faea5 100644 --- a/MAME.Core/mame/pgm/PGM.cs +++ b/MAME.Core/mame/pgm/PGM.cs @@ -1,5 +1,5 @@ using cpu.m68000; -using MAME.Core.Common; +using MAME.Core.Motion; using System; namespace mame @@ -15,9 +15,9 @@ namespace mame public static void PGMInit() { Machine.bRom = true; - mainbiosrom = mainMotion.resource.pgmmainbios; - videobios = mainMotion.resource.pgmvideobios; - audiobios = mainMotion.resource.pgmaudiobios; + mainbiosrom = MameMainMotion.resource.pgmmainbios; + videobios = MameMainMotion.resource.pgmvideobios; + audiobios = MameMainMotion.resource.pgmaudiobios; ICS2115.icsrom = audiobios; byte[] bb1, bb2; int i3, n1, n2, n3; diff --git a/MAME.Core/run_interface/Corekey.cs b/MAME.Core/run_interface/Corekey.cs index 1c306f8..5c0630c 100644 --- a/MAME.Core/run_interface/Corekey.cs +++ b/MAME.Core/run_interface/Corekey.cs @@ -1,6 +1,5 @@ namespace MAME.Core.run_interface { - public enum Corekey { Next = 209, diff --git a/MAME.Core/run_interface/IMouse.cs b/MAME.Core/run_interface/IMouse.cs index db4ab6d..74a2ead 100644 --- a/MAME.Core/run_interface/IMouse.cs +++ b/MAME.Core/run_interface/IMouse.cs @@ -2,6 +2,6 @@ { public interface IMouse { - void MouseXY(out int X, out int Y); + void MouseXY(out int X, out int Y,out byte[] MouseButtons); } }