支持光枪类游戏 | 规整代码 Core完成所有

This commit is contained in:
sin365 2024-08-08 16:21:02 +08:00
parent c1a8733431
commit 89bab5f308
22 changed files with 185 additions and 176 deletions

View File

@ -6,32 +6,33 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Xml.Linq; using System.Xml.Linq;
namespace MAME.Core.Common namespace MAME.Core.Motion
{ {
public class mainMotion public class MameMainMotion
{ {
public string tsslStatus; public string tsslStatus;
public cheatMotion cheatmotion; public CheatMotion cheatmotion;
public m68000Motion m68000motion; public M68000Motion m68000motion;
public z80Motion z80motion; public Z80Motion z80motion;
public m6809Motion m6809motion; public M6809Motion m6809motion;
public cpsMotion cpsmotion; public CpsMotion cpsmotion;
public neogeoMotion neogeomotion; public NeogeoMotion neogeomotion;
public konami68000Motion konami68000motion; public Konami68000Motion konami68000motion;
public string sSelect; public string sSelect;
public static Thread t1; public static Thread mainThread;
public static IResources resource; public static IResources resource;
public bool bRom => Machine.bRom;
public mainMotion() public MameMainMotion()
{ {
neogeomotion = new neogeoMotion(); neogeomotion = new NeogeoMotion();
cheatmotion = new cheatMotion(); cheatmotion = new CheatMotion();
m68000motion = new m68000Motion(); m68000motion = new M68000Motion();
m6809motion = new m6809Motion(); m6809motion = new M6809Motion();
z80motion = new z80Motion(); z80motion = new Z80Motion();
cpsmotion = new cpsMotion(); cpsmotion = new CpsMotion();
konami68000motion = new konami68000Motion(); konami68000motion = new Konami68000Motion();
} }
public void Init( public void Init(
@ -41,7 +42,8 @@ namespace MAME.Core.Common
IVideoPlayer ivp, IVideoPlayer ivp,
ISoundPlayer isp, ISoundPlayer isp,
IKeyboard ikb, IKeyboard ikb,
IMouse imou) IMouse imou
)
{ {
Mame.RomRoot = RomDir; Mame.RomRoot = RomDir;
EmuLogger.BindFunc(ilog); EmuLogger.BindFunc(ilog);
@ -49,21 +51,12 @@ namespace MAME.Core.Common
Sound.BindFunc(isp); Sound.BindFunc(isp);
resource = iRes; resource = iRes;
//StreamReader sr1 = new StreamReader("mame.ini"); sSelect = string.Empty;
//sr1.ReadLine();
//sSelect = sr1.ReadLine();
//sr1.Close();
//TODO 上次选择
sSelect = "samsho2";
RomInfo.Rom = new RomInfo(); RomInfo.Rom = new RomInfo();
LoadROMXML(); LoadROMXML();
//TODO Wavebuffer
//desc1.BufferBytes = 0x9400;
Keyboard.InitializeInput(ikb); Keyboard.InitializeInput(ikb);
Mouse.InitialMouse(this, imou); Mouse.InitialMouse(imou);
} }
private void LoadROMXML() private void LoadROMXML()
@ -119,7 +112,7 @@ namespace MAME.Core.Common
mame.Timer.lt = new List<mame.Timer.emu_timer>(); mame.Timer.lt = new List<mame.Timer.emu_timer>();
sSelect = RomInfo.Rom.Name; sSelect = RomInfo.Rom.Name;
Machine.FORM = this; Machine.mainMotion = this;
Machine.rom = RomInfo.Rom; Machine.rom = RomInfo.Rom;
Machine.sName = Machine.rom.Name; Machine.sName = Machine.rom.Name;
Machine.sParent = Machine.rom.Parent; Machine.sParent = Machine.rom.Parent;
@ -237,7 +230,7 @@ namespace MAME.Core.Common
if (Machine.bRom) if (Machine.bRom)
{ {
EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]"); EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
Mame.init_machine(this); Mame.init_machine();
Generic.nvram_load(); Generic.nvram_load();
} }
else 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() private void itemSelect()
{ {
switch (Machine.sBoard) switch (Machine.sBoard)

View File

@ -4,9 +4,9 @@ using mame;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace MAME.Core.Common namespace MAME.Core.Motion
{ {
public partial class cheatMotion public partial class CheatMotion
{ {
public enum LockState public enum LockState
{ {
@ -25,7 +25,7 @@ namespace MAME.Core.Common
#region #region
List<string> mTxList_tbResult = new List<string>(); List<string> mTxList_tbResult = new List<string>();
#endregion #endregion
public cheatMotion() public CheatMotion()
{ {
cheatForm_Load(); cheatForm_Load();
} }

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; 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 string[] sde2 = new string[] { "," };
private int locationX, locationY; private int locationX, locationY;
@ -31,7 +31,7 @@ namespace MAME.Core.Common
public string tbScrollsy = string.Empty; public string tbScrollsy = string.Empty;
public List<string> tbResult = new List<string>(); public List<string> tbResult = new List<string>();
#endregion #endregion
public cpsMotion() public CpsMotion()
{ {
} }
} }

View File

@ -1,6 +1,6 @@
namespace MAME.Core.Common namespace MAME.Core.Motion
{ {
public class konami68000Motion public class Konami68000Motion
{ {
private int locationX, locationY; private int locationX, locationY;
@ -11,7 +11,7 @@
public bool cbSprite = false; public bool cbSprite = false;
public string tbSprite; public string tbSprite;
#endregion #endregion
public konami68000Motion() public Konami68000Motion()
{ {
tbSprite = "0000-4000"; tbSprite = "0000-4000";
} }

View File

@ -2,9 +2,9 @@
using System; using System;
using System.Collections.Generic; 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 string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" };
private bool bLogNew, bNew; private bool bLogNew, bNew;
@ -54,7 +54,7 @@ namespace MAME.Core.Common
M68000_STOP, M68000_STOP,
} }
public static M68000State m68000State, m68000FState; public static M68000State m68000State, m68000FState;
public m68000Motion() public M68000Motion()
{ {
int i; int i;
mTxList_tbDs = new string[8]; mTxList_tbDs = new string[8];

View File

@ -2,10 +2,10 @@
using mame; using mame;
using System.Collections.Generic; using System.Collections.Generic;
namespace MAME.Core.Common namespace MAME.Core.Motion
{ {
public partial class m6809Motion public partial class M6809Motion
{ {
//private Disassembler disassembler; //private Disassembler disassembler;
private bool bLogNew; private bool bLogNew;
@ -34,7 +34,7 @@ namespace MAME.Core.Common
public string tbDisassemble = string.Empty; public string tbDisassemble = string.Empty;
#endregion #endregion
public m6809Motion() public M6809Motion()
{ {
} }
public void GetData() public void GetData()

View File

@ -3,9 +3,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; 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 string[] sde2 = new string[] { "," };
private int locationX, locationY; private int locationX, locationY;
@ -20,7 +20,7 @@ namespace MAME.Core.Common
bool cbL0 = false; bool cbL0 = false;
bool cbL1 = false; bool cbL1 = false;
#endregion #endregion
public neogeoMotion() public NeogeoMotion()
{ {
tbResult = new List<string>(); tbResult = new List<string>();
neogeoForm_Load(); neogeoForm_Load();

View File

@ -1,7 +1,7 @@
using cpu.z80; using cpu.z80;
using System.Collections.Generic; using System.Collections.Generic;
namespace MAME.Core.Common namespace MAME.Core.Motion
{ {
public enum CPUState public enum CPUState
{ {
@ -12,7 +12,7 @@ namespace MAME.Core.Common
STEP3, STEP3,
STOP, STOP,
} }
public partial class z80Motion public partial class Z80Motion
{ {
private Disassembler disassembler; private Disassembler disassembler;
private bool bLogNew; private bool bLogNew;
@ -55,7 +55,7 @@ namespace MAME.Core.Common
Z80A_STOP, Z80A_STOP,
} }
public static Z80AState z80State, z80FState; public static Z80AState z80State, z80FState;
public z80Motion() public Z80Motion()
{ {
disassembler = new Disassembler(); disassembler = new Disassembler();
Disassembler.GenerateOpcodeSizes(); Disassembler.GenerateOpcodeSizes();

View File

@ -5,7 +5,7 @@ using cpu.m6805;
using cpu.m6809; using cpu.m6809;
using cpu.nec; using cpu.nec;
using cpu.z80; using cpu.z80;
using MAME.Core.Common; using MAME.Core.Motion;
using System; using System;
using System.IO; using System.IO;
@ -2118,46 +2118,46 @@ namespace mame
case "Neo Geo": case "Neo Geo":
case "PGM": case "PGM":
case "Taito B": case "Taito B":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
case "Tehkan": case "Tehkan":
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_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_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "IGS011": case "IGS011":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
break; break;
case "SunA8": case "SunA8":
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_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_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "Namco System 1": case "Namco System 1":
m6809Motion.m6809State = CPUState.RUN; M6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit(); M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_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_start_cpu_hook_callback = null_callback;
M6809.mm1[1].debugger_stop_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_start_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "M72": case "M72":
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
case "M92": case "M92":
break; break;
@ -2186,35 +2186,35 @@ namespace mame
case "boblcave": case "boblcave":
case "bublcave11": case "bublcave11":
case "bublcave10": case "bublcave10":
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
case "opwolf": case "opwolf":
case "opwolfa": case "opwolfa":
case "opwolfj": case "opwolfj":
case "opwolfu": case "opwolfu":
case "opwolfp": case "opwolfp":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
case "opwolfb": case "opwolfb":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2222,17 +2222,17 @@ namespace mame
switch (Machine.sName) switch (Machine.sName)
{ {
case "cuebrick": case "cuebrick":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
break; break;
default: default:
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2250,13 +2250,13 @@ namespace mame
case "makaimurc": case "makaimurc":
case "makaimurg": case "makaimurg":
case "diamond": case "diamond":
m6809Motion.m6809State = CPUState.RUN; M6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit(); M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug; M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.m6809motion.m6809_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
case "sf": case "sf":
case "sfua": case "sfua":
@ -2264,14 +2264,14 @@ namespace mame
case "sfjan": case "sfjan":
case "sfan": case "sfan":
case "sfp": case "sfp":
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.mainMotion.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.mainMotion.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.mainMotion.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2472,9 +2472,9 @@ namespace mame
cpu[icpu].eatcycles = cpu[icpu].nexteatcycles; cpu[icpu].eatcycles = cpu[icpu].nexteatcycles;
} }
Timer.timer_set_global_time(target); 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) public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration)

View File

@ -90,27 +90,27 @@ namespace mame
// bitmapGDI.UnlockBits(bitmapData); // bitmapGDI.UnlockBits(bitmapData);
// if (Wintime.osd_ticks() < popup_text_end) // if (Wintime.osd_ticks() < popup_text_end)
// { // {
// Machine.FORM.tsslStatus = sDrawText; // Machine.mainMotion.tsslStatus = sDrawText;
// } // }
// else // else
// { // {
// popup_text_end = 0; // popup_text_end = 0;
// if (Mame.paused) // if (Mame.paused)
// { // {
// Machine.FORM.tsslStatus = "pause"; // Machine.mainMotion.tsslStatus = "pause";
// } // }
// else // else
// { // {
// switch (Mame.playState) // switch (Mame.playState)
// { // {
// case Mame.PlayState.PLAY_RECORDRUNNING: // case Mame.PlayState.PLAY_RECORDRUNNING:
// Machine.FORM.tsslStatus = "record"; // Machine.mainMotion.tsslStatus = "record";
// break; // break;
// case Mame.PlayState.PLAY_REPLAYRUNNING: // case Mame.PlayState.PLAY_REPLAYRUNNING:
// Machine.FORM.tsslStatus = "replay"; // Machine.mainMotion.tsslStatus = "replay";
// break; // break;
// default: // default:
// Machine.FORM.tsslStatus = "run"; // Machine.mainMotion.tsslStatus = "run";
// break; // break;
// } // }
// } // }
@ -131,7 +131,7 @@ namespace mame
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone); // bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone);
// break; // break;
// } // }
// //Machine.FORM.pictureBox1.Image = bbmp[iMode]; // //Machine.mainMotion.pictureBox1.Image = bbmp[iMode];
// SubmitVideo(bbmp[iMode]); // SubmitVideo(bbmp[iMode]);
// } // }
// catch // catch
@ -163,7 +163,7 @@ namespace mame
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone); // bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone);
// break; // 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)); //AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor,Video.bitmapcolorRect, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height));
SubmitVideo(Video.bitmapcolorRect); SubmitVideo(Video.bitmapcolorRect);

View File

@ -1,4 +1,4 @@
using MAME.Core.Common; using MAME.Core.Motion;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -8,7 +8,7 @@ namespace mame
{ {
public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer; public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer;
public static List<string> lsParents; public static List<string> lsParents;
public static mainMotion FORM; public static MameMainMotion mainMotion;
public static RomInfo rom; public static RomInfo rom;
public static bool bRom; public static bool bRom;
public delegate void machine_delegate(); public delegate void machine_delegate();

View File

@ -1,4 +1,4 @@
using MAME.Core.Common; using MAME.Core.Motion;
using MAME.Core.run_interface; using MAME.Core.run_interface;
using System.IO; using System.IO;
@ -46,7 +46,9 @@ namespace mame
public static void mame_execute() public static void mame_execute()
{ {
soft_reset(); soft_reset();
mame_pause(true); //mame_pause(true);
//开始不暂停
mame_pause(false);
while (!exit_pending) while (!exit_pending)
{ {
if (!paused) if (!paused)
@ -82,6 +84,8 @@ namespace mame
handlestate(); handlestate();
} }
} }
public static void mame_schedule_soft_reset() public static void mame_schedule_soft_reset()
{ {
Timer.timer_adjust_periodic(soft_reset_timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER); Timer.timer_adjust_periodic(soft_reset_timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
@ -127,14 +131,14 @@ namespace mame
handle_replay(); handle_replay();
} }
} }
public static void init_machine(mainMotion form) public static void init_machine()
{ {
Inptport.input_init(); Inptport.input_init();
Palette.palette_init(); Palette.palette_init();
Generic.generic_machine_init(); Generic.generic_machine_init();
Timer.timer_init(); Timer.timer_init();
soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false); soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false);
Window.osd_init(form); Window.osd_init();
Inptport.input_port_init(); Inptport.input_port_init();
Cpuexec.cpuexec_init(); Cpuexec.cpuexec_init();
Watchdog.watchdog_init(); Watchdog.watchdog_init();

View File

@ -1,4 +1,4 @@
using MAME.Core.Common; using MAME.Core.Motion;
using MAME.Core.run_interface; using MAME.Core.run_interface;
namespace mame namespace mame
@ -12,11 +12,6 @@ namespace mame
public delegate void motion_delegate(); public delegate void motion_delegate();
public static motion_delegate motion_handler_callback, motion_update_callback; public static motion_delegate motion_handler_callback, motion_update_callback;
public static bool single_step; public static bool single_step;
//public static mainMotion mainmotion;
public static void init()
{
//mainmotion = motion;
}
public static void ui_update_and_render() public static void ui_update_and_render()
{ {
motion_update_callback(); motion_update_callback();
@ -510,10 +505,10 @@ namespace mame
} }
public static void cpurun() public static void cpurun()
{ {
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; M68000Motion.m68000State = M68000Motion.M68000State.M68000_RUN;
Machine.FORM.m68000motion.mTx_tsslStatus = "run"; Machine.mainMotion.m68000motion.mTx_tsslStatus = "run";
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; Z80Motion.z80State = Z80Motion.Z80AState.Z80A_RUN;
Machine.FORM.z80motion.mTx_tsslStatus = "run"; Machine.mainMotion.z80motion.mTx_tsslStatus = "run";
} }
private static double ui_get_line_height() private static double ui_get_line_height()
{ {

View File

@ -1,4 +1,4 @@
using MAME.Core.Common; using MAME.Core.Motion;
using MAME.Core.run_interface; using MAME.Core.run_interface;
namespace mame namespace mame
@ -8,7 +8,7 @@ namespace mame
public static int deltaX, deltaY, oldX, oldY; public static int deltaX, deltaY, oldX, oldY;
public static byte[] buttons; public static byte[] buttons;
static IMouse iMouse; static IMouse iMouse;
public static void InitialMouse(mainMotion form1, IMouse im) public static void InitialMouse(IMouse im)
{ {
iMouse = im; iMouse = im;
} }
@ -16,12 +16,13 @@ namespace mame
public static void Update() public static void Update()
{ {
int X, Y; int X, Y;
iMouse.MouseXY(out X, out Y); iMouse.MouseXY(out X, out Y, out byte[] MouseButtons);
deltaX = X - oldX; deltaX = X - oldX;
deltaY = Y - oldY; deltaY = Y - oldY;
oldX = X; oldX = X;
oldY = Y; oldY = Y;
//TODO buttons = MouseButtons;
//MouseState mouseState = mouseDevice.CurrentMouseState; //MouseState mouseState = mouseDevice.CurrentMouseState;
//deltaX = mouseState.X - oldX; //deltaX = mouseState.X - oldX;
//deltaY = mouseState.Y - oldY; //deltaY = mouseState.Y - oldY;

View File

@ -1,4 +1,5 @@
using MAME.Core.run_interface; using MAME.Core.Motion;
using MAME.Core.run_interface;
using System; using System;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -895,9 +896,9 @@ namespace mame
Mouse.Update(); Mouse.Update();
Inptport.frame_update_callback(); Inptport.frame_update_callback();
Motion.ui_update_and_render(); 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(); GDIDraw();
if (effective_throttle()) if (effective_throttle())

View File

@ -1,10 +1,10 @@
using MAME.Core.Common; using MAME.Core.Motion;
namespace mame namespace mame
{ {
public class Window public class Window
{ {
private static mainMotion _myParentForm; private static MameMainMotion _myParentForm;
//[DllImport("kernel32.dll ")] //[DllImport("kernel32.dll ")]
//private static extern uint GetTickCount(); //private static extern uint GetTickCount();
@ -47,9 +47,8 @@ namespace mame
} }
winwindow_process_events(true); winwindow_process_events(true);
} }
public static void osd_init(mainMotion form) public static void osd_init()
{ {
_myParentForm = form;
wininput_init(); wininput_init();
} }
public static void wininput_init() public static void wininput_init()

View File

@ -1,6 +1,5 @@
using MAME.Core.Common; using MAME.Core.Motion;
using System; using System;
using System.IO;
namespace mame namespace mame
{ {
@ -36,7 +35,7 @@ namespace mame
gfx2rom = Machine.GetRom("gfx2.rom"); gfx2rom = Machine.GetRom("gfx2.rom");
gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom")); gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom"));
user1rom = Machine.GetRom("user1.rom"); user1rom = Machine.GetRom("user1.rom");
mcurom = mainMotion.resource.mcu; mcurom = MameMainMotion.resource.mcu;
voicerom = new byte[0xc0000]; voicerom = new byte[0xc0000];
byte[] bb1 = Machine.GetRom("voice.rom"); byte[] bb1 = Machine.GetRom("voice.rom");
Array.Copy(bb1, voicerom, bb1.Length); Array.Copy(bb1, voicerom, bb1.Length);

View File

@ -1,5 +1,5 @@
using cpu.m68000; using cpu.m68000;
using MAME.Core.Common; using MAME.Core.Motion;
namespace mame namespace mame
{ {
@ -420,8 +420,8 @@ namespace mame
public static void MWriteByte(int address, sbyte value) public static void MWriteByte(int address, sbyte value)
{ {
address &= 0xffffff; address &= 0xffffff;
m68000Motion.iWAddress = address; M68000Motion.iWAddress = address;
m68000Motion.iWOp = 0x01; M68000Motion.iWOp = 0x01;
if (address >= 0x100000 && address <= 0x1fffff) if (address >= 0x100000 && address <= 0x1fffff)
{ {
if (address == 0x100d0b && value == 0x06)//&&MC68000.m1.TotalExecutedCycles>0x3F6FC8C) if (address == 0x100d0b && value == 0x06)//&&MC68000.m1.TotalExecutedCycles>0x3F6FC8C)
@ -497,8 +497,8 @@ namespace mame
public static void MWriteWord(int address, short value) public static void MWriteWord(int address, short value)
{ {
address &= 0xffffff; address &= 0xffffff;
m68000Motion.iWAddress = address; M68000Motion.iWAddress = address;
m68000Motion.iWOp = 0x02; M68000Motion.iWOp = 0x02;
if (address >= 0x100000 && address + 1 <= 0x1fffff) if (address >= 0x100000 && address + 1 <= 0x1fffff)
{ {
if (address == 0x1007c4 && value == unchecked((short)0xb102)) if (address == 0x1007c4 && value == unchecked((short)0xb102))
@ -550,8 +550,8 @@ namespace mame
public static void MWriteLong(int address, int value) public static void MWriteLong(int address, int value)
{ {
address &= 0xffffff; address &= 0xffffff;
m68000Motion.iWAddress = address; M68000Motion.iWAddress = address;
m68000Motion.iWOp = 0x03; M68000Motion.iWOp = 0x03;
if (address >= 0x100000 && address + 3 <= 0x1fffff) if (address >= 0x100000 && address + 3 <= 0x1fffff)
{ {
if (address == 0x1051e4 && value == 0x00130070) if (address == 0x1051e4 && value == 0x00130070)

View File

@ -1,4 +1,4 @@
using MAME.Core.Common; using MAME.Core.Motion;
using System; using System;
using System.IO; using System.IO;
@ -41,10 +41,10 @@ namespace mame
Memory.audioram = new byte[0x800]; Memory.audioram = new byte[0x800];
Machine.bRom = true; Machine.bRom = true;
dsw = 0xff; dsw = 0xff;
fixedbiosrom = mainMotion.resource.sfix; fixedbiosrom = MameMainMotion.resource.sfix;
zoomyrom = mainMotion.resource._000_lo; zoomyrom = MameMainMotion.resource._000_lo;
audiobiosrom = mainMotion.resource.sm1; audiobiosrom = MameMainMotion.resource.sm1;
mainbiosrom = mainMotion.resource.mainbios; mainbiosrom = MameMainMotion.resource.mainbios;
Memory.mainrom = Machine.GetRom("maincpu.rom"); Memory.mainrom = Machine.GetRom("maincpu.rom");
Memory.audiorom = Machine.GetRom("audiocpu.rom"); Memory.audiorom = Machine.GetRom("audiocpu.rom");
fixedrom = Machine.GetRom("fixed.rom"); fixedrom = Machine.GetRom("fixed.rom");

View File

@ -1,5 +1,5 @@
using cpu.m68000; using cpu.m68000;
using MAME.Core.Common; using MAME.Core.Motion;
using System; using System;
namespace mame namespace mame
@ -15,9 +15,9 @@ namespace mame
public static void PGMInit() public static void PGMInit()
{ {
Machine.bRom = true; Machine.bRom = true;
mainbiosrom = mainMotion.resource.pgmmainbios; mainbiosrom = MameMainMotion.resource.pgmmainbios;
videobios = mainMotion.resource.pgmvideobios; videobios = MameMainMotion.resource.pgmvideobios;
audiobios = mainMotion.resource.pgmaudiobios; audiobios = MameMainMotion.resource.pgmaudiobios;
ICS2115.icsrom = audiobios; ICS2115.icsrom = audiobios;
byte[] bb1, bb2; byte[] bb1, bb2;
int i3, n1, n2, n3; int i3, n1, n2, n3;

View File

@ -1,6 +1,5 @@
namespace MAME.Core.run_interface namespace MAME.Core.run_interface
{ {
public enum Corekey public enum Corekey
{ {
Next = 209, Next = 209,

View File

@ -2,6 +2,6 @@
{ {
public interface IMouse public interface IMouse
{ {
void MouseXY(out int X, out int Y); void MouseXY(out int X, out int Y,out byte[] MouseButtons);
} }
} }