Compare commits
3 Commits
c1a8733431
...
bfc8651b1e
| Author | SHA1 | Date | |
|---|---|---|---|
| bfc8651b1e | |||
| d553052006 | |||
| 89bab5f308 |
@ -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)
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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];
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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())
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
namespace MAME.Core.run_interface
|
namespace MAME.Core.run_interface
|
||||||
{
|
{
|
||||||
|
|
||||||
public enum Corekey
|
public enum Corekey
|
||||||
{
|
{
|
||||||
Next = 209,
|
Next = 209,
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8068b465f3dd6864f807fa17ca4bd813
|
guid: fae13461b22160c47b5ee9964058b719
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@ -838,7 +838,8 @@ MonoBehaviour:
|
|||||||
btnStop: {fileID: 1268518242613896174}
|
btnStop: {fileID: 1268518242613896174}
|
||||||
btnStart: {fileID: 3471319445208116035}
|
btnStart: {fileID: 3471319445208116035}
|
||||||
btnRomDir: {fileID: 0}
|
btnRomDir: {fileID: 0}
|
||||||
mChangeRomName: mslug3
|
bQuickTestRom: 0
|
||||||
|
mQuickTestRom:
|
||||||
--- !u!114 &3471319444260926879
|
--- !u!114 &3471319444260926879
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1665,7 +1666,7 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 3471319445290242363}
|
- component: {fileID: 3471319445290242363}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: KeyPad
|
m_Name: tfKeyPad
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@ -1691,9 +1692,9 @@ RectTransform:
|
|||||||
- {fileID: 809123066073945339}
|
- {fileID: 809123066073945339}
|
||||||
- {fileID: 5041497614654165726}
|
- {fileID: 5041497614654165726}
|
||||||
- {fileID: 175721420956369396}
|
- {fileID: 175721420956369396}
|
||||||
- {fileID: 3471319446131231223}
|
|
||||||
- {fileID: 3471319446251103890}
|
|
||||||
- {fileID: 4705889093872201058}
|
- {fileID: 4705889093872201058}
|
||||||
|
- {fileID: 3471319446251103890}
|
||||||
|
- {fileID: 3471319446131231223}
|
||||||
m_Father: {fileID: 3471319444310732615}
|
m_Father: {fileID: 3471319444310732615}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -2557,7 +2558,7 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3471319445650276455}
|
- {fileID: 3471319445650276455}
|
||||||
m_Father: {fileID: 3471319445290242363}
|
m_Father: {fileID: 3471319445290242363}
|
||||||
m_RootOrder: 9
|
m_RootOrder: 11
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
@ -3393,7 +3394,7 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4705889095025944828}
|
- {fileID: 4705889095025944828}
|
||||||
m_Father: {fileID: 3471319445290242363}
|
m_Father: {fileID: 3471319445290242363}
|
||||||
m_RootOrder: 11
|
m_RootOrder: 9
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
|||||||
@ -265,9 +265,17 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
||||||
|
propertyPath: bQuickTestRom
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
||||||
|
propertyPath: mQuickTestRom
|
||||||
|
value: 1944
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
||||||
propertyPath: mChangeRomName
|
propertyPath: mChangeRomName
|
||||||
value: mslug2
|
value: opwolf
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3471319445309129982, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
- target: {fileID: 3471319445309129982, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
|
|||||||
8
MAME.Unity/Assets/Script/UMAME/Common.meta
Normal file
8
MAME.Unity/Assets/Script/UMAME/Common.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bc7cc4529e6fe0b43baa64e8494efcd0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
35
MAME.Unity/Assets/Script/UMAME/Common/UniMAMESetting.cs
Normal file
35
MAME.Unity/Assets/Script/UMAME/Common/UniMAMESetting.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.Script.UMAME.Common
|
||||||
|
{
|
||||||
|
public class UniMAMESetting
|
||||||
|
{
|
||||||
|
public static UniMAMESetting instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (mInstance == null)
|
||||||
|
mInstance = new UniMAMESetting();
|
||||||
|
return mInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static UniMAMESetting mInstance;
|
||||||
|
|
||||||
|
const string KEY_LASTGAMEROM = "MAME_LASTGAMEROM";
|
||||||
|
|
||||||
|
public string LastGameRom
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(PlayerPrefs.HasKey(KEY_LASTGAMEROM))
|
||||||
|
return PlayerPrefs.GetString(KEY_LASTGAMEROM);
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(KEY_LASTGAMEROM, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
11
MAME.Unity/Assets/Script/UMAME/Common/UniMAMESetting.cs.meta
Normal file
11
MAME.Unity/Assets/Script/UMAME/Common/UniMAMESetting.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8e93a2fd757533948a43218e424841a7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,17 +1,16 @@
|
|||||||
|
using Assets.Script.UMAME.Common;
|
||||||
using mame;
|
using mame;
|
||||||
using MAME.Core.Common;
|
using MAME.Core.Motion;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class UMAME : MonoBehaviour
|
public class UMAME : MonoBehaviour
|
||||||
{
|
{
|
||||||
mainMotion mainmotion;
|
MameMainMotion emu;
|
||||||
UniLog mUniLog;
|
UniLog mUniLog;
|
||||||
UniMouse mUniMouse;
|
UniMouse mUniMouse;
|
||||||
UniVideoPlayer mUniVideoPlayer;
|
UniVideoPlayer mUniVideoPlayer;
|
||||||
@ -19,17 +18,19 @@ public class UMAME : MonoBehaviour
|
|||||||
UniKeyboard mUniKeyboard;
|
UniKeyboard mUniKeyboard;
|
||||||
UniResources mUniResources;
|
UniResources mUniResources;
|
||||||
public Text mFPS;
|
public Text mFPS;
|
||||||
|
|
||||||
public Button btnStop;
|
public Button btnStop;
|
||||||
public Button btnStart;
|
public Button btnStart;
|
||||||
public Button btnRomDir;
|
public Button btnRomDir;
|
||||||
public Dictionary<string, RomInfo> ALLGame;
|
public Dictionary<string, RomInfo> ALLGame;
|
||||||
public List<RomInfo> HadGameList = new List<RomInfo>();
|
public List<RomInfo> HadGameList = new List<RomInfo>();
|
||||||
|
string mChangeRomName = string.Empty;
|
||||||
|
public bool bQuickTestRom = false;
|
||||||
|
public string mQuickTestRom = string.Empty;
|
||||||
|
|
||||||
Dropdown optionDropdown;
|
Dropdown optionDropdown;
|
||||||
|
|
||||||
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
|
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
public static bool bStart { get; private set; }
|
public static bool bInGame { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR_WIN
|
#if UNITY_EDITOR_WIN
|
||||||
@ -42,25 +43,35 @@ public class UMAME : MonoBehaviour
|
|||||||
public static string RomPath => Application.persistentDataPath;
|
public static string RomPath => Application.persistentDataPath;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public string mChangeRomName = string.Empty;
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
mFPS = GameObject.Find("FPS").GetComponent<Text>();
|
mFPS = GameObject.Find("FPS").GetComponent<Text>();
|
||||||
optionDropdown = GameObject.Find("optionDropdown").GetComponent<Dropdown>();
|
optionDropdown = GameObject.Find("optionDropdown").GetComponent<Dropdown>();
|
||||||
mainmotion = new mainMotion();
|
emu = new MameMainMotion();
|
||||||
mUniLog = new UniLog();
|
mUniLog = new UniLog();
|
||||||
mUniMouse = this.gameObject.AddComponent<UniMouse>();
|
mUniMouse = this.gameObject.AddComponent<UniMouse>();
|
||||||
mUniVideoPlayer = this.gameObject.AddComponent<UniVideoPlayer>();
|
mUniVideoPlayer = this.gameObject.AddComponent<UniVideoPlayer>();
|
||||||
mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>();
|
mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>();
|
||||||
mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>();
|
mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>();
|
||||||
mUniResources = new UniResources();
|
mUniResources = new UniResources();
|
||||||
|
mChangeRomName = UniMAMESetting.instance.LastGameRom;
|
||||||
|
|
||||||
mainmotion.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse);
|
emu.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse);
|
||||||
ALLGame = mainmotion.GetGameList();
|
ALLGame = emu.GetGameList();
|
||||||
|
|
||||||
Debug.Log($"ALLGame:{ALLGame.Count}");
|
Debug.Log($"ALLGame:{ALLGame.Count}");
|
||||||
|
|
||||||
|
#if !UNITY_EDITOR
|
||||||
|
bQuickTestRom = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (bQuickTestRom)
|
||||||
|
mChangeRomName = mQuickTestRom;
|
||||||
|
|
||||||
GetHadRomList();
|
GetHadRomList();
|
||||||
|
|
||||||
|
if (bQuickTestRom)
|
||||||
|
LoadGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
@ -72,51 +83,41 @@ public class UMAME : MonoBehaviour
|
|||||||
void LoadGame()
|
void LoadGame()
|
||||||
{
|
{
|
||||||
mChangeRomName = HadGameList[optionDropdown.value].Name;
|
mChangeRomName = HadGameList[optionDropdown.value].Name;
|
||||||
|
UniMAMESetting.instance.LastGameRom = mChangeRomName;
|
||||||
StopGame();
|
StopGame();
|
||||||
mainmotion.LoadRom(mChangeRomName);
|
//读取ROM
|
||||||
if (Machine.bRom)
|
emu.LoadRom(mChangeRomName);
|
||||||
|
//读取成功
|
||||||
|
if (emu.bRom)
|
||||||
{
|
{
|
||||||
m68000Motion.iStatus = 0;
|
//读取ROM之后获得宽高初始化画面
|
||||||
m68000Motion.iValue = 0;
|
emu.GetGameScreenSize(out int _width, out int _height, out IntPtr _framePtr);
|
||||||
Mame.exit_pending = false;
|
Debug.Log($"_width->{_width}, _height->{_height}, _framePtr->{_framePtr}");
|
||||||
mame.Motion.init();
|
mUniVideoPlayer.Initialize(_width, _height, _framePtr);
|
||||||
mainMotion.t1 = new Thread(Mame.mame_execute);
|
//初始化音频
|
||||||
mainMotion.t1.Start();
|
mUniSoundPlayer.Initialize();
|
||||||
|
//开始游戏
|
||||||
StartCoroutine(StartGame());
|
emu.StartGame();
|
||||||
|
bInGame = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"ROM加载失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
mFPS.text = ($"fpsv {mUniVideoPlayer.videoFPS.ToString("F2")} fpsa {mUniSoundPlayer.audioFPS.ToString("F2")}");
|
mFPS.text = ($"fpsv {mUniVideoPlayer.videoFPS.ToString("F2")} fpsa {mUniSoundPlayer.audioFPS.ToString("F2")}");
|
||||||
}
|
}
|
||||||
IEnumerator StartGame()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(2f);
|
|
||||||
StartEmu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartEmu()
|
|
||||||
{
|
|
||||||
if (bStart)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mUniSoundPlayer.Initialize();
|
|
||||||
mainmotion.GetGameScreenSize(out int _width, out int _height, out IntPtr _framePtr);
|
|
||||||
mUniVideoPlayer.Initialize(_width, _height, _framePtr);
|
|
||||||
Mame.mame_pause(false);
|
|
||||||
bStart = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StopGame()
|
void StopGame()
|
||||||
{
|
{
|
||||||
//如果已经有正在运行的游戏,使其释放
|
if (bInGame)
|
||||||
if (bStart || Machine.bRom)
|
|
||||||
{
|
{
|
||||||
bStart = false;
|
emu.StopGame();
|
||||||
Mame.exit_pending = true;
|
mUniVideoPlayer.StopVideo();
|
||||||
Thread.Sleep(100);
|
mUniSoundPlayer.StopPlay();
|
||||||
|
bInGame = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
public UILongClickButton btnCD;
|
public UILongClickButton btnCD;
|
||||||
public UILongClickButton btnABC;
|
public UILongClickButton btnABC;
|
||||||
FloatingJoystick mJoystick;
|
FloatingJoystick mJoystick;
|
||||||
|
public Transform tfKeyPad;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
List<UILongClickButton> mUIBtns = new List<UILongClickButton>();
|
List<UILongClickButton> mUIBtns = new List<UILongClickButton>();
|
||||||
@ -30,7 +31,7 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>();
|
mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>();
|
||||||
|
tfKeyPad = GameObject.Find("tfKeyPad").transform;
|
||||||
btnP1 = GameObject.Find("btnP1").GetComponent<UILongClickButton>();
|
btnP1 = GameObject.Find("btnP1").GetComponent<UILongClickButton>();
|
||||||
btnCoin1 = GameObject.Find("btnCoin1").GetComponent<UILongClickButton>();
|
btnCoin1 = GameObject.Find("btnCoin1").GetComponent<UILongClickButton>();
|
||||||
btnA = GameObject.Find("btnA").GetComponent<UILongClickButton>();
|
btnA = GameObject.Find("btnA").GetComponent<UILongClickButton>();
|
||||||
@ -46,6 +47,9 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
btnE.gameObject.SetActive(false);
|
btnE.gameObject.SetActive(false);
|
||||||
btnF.gameObject.SetActive(false);
|
btnF.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
|
||||||
|
tfKeyPad.gameObject.SetActive(false);
|
||||||
|
#endif
|
||||||
dictKeyCfgs.Add(KeyCode.P, MotionKey.EMU_PAUSED);
|
dictKeyCfgs.Add(KeyCode.P, MotionKey.EMU_PAUSED);
|
||||||
|
|
||||||
dictKeyCfgs.Add(KeyCode.Alpha1, MotionKey.P1_GAMESTART);
|
dictKeyCfgs.Add(KeyCode.Alpha1, MotionKey.P1_GAMESTART);
|
||||||
|
|||||||
@ -1,18 +1,23 @@
|
|||||||
using MAME.Core.run_interface;
|
using MAME.Core.run_interface;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class UniMouse : MonoBehaviour,IMouse
|
public class UniMouse : MonoBehaviour, IMouse
|
||||||
{
|
{
|
||||||
static int mX, mY;
|
static int mX, mY;
|
||||||
|
public byte[] buttons = new byte[2];
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
mX = (int)Input.mousePosition.x;
|
mX = (int)Input.mousePosition.x;
|
||||||
mY = (int)Input.mousePosition.y;
|
mY = (int)Input.mousePosition.y;
|
||||||
|
buttons[0] = Input.GetMouseButton(0) ? (byte)1 : (byte)0;
|
||||||
|
buttons[1] = Input.GetMouseButton(1) ? (byte)1 : (byte)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MouseXY(out int X, out int Y)
|
public void MouseXY(out int X, out int Y, out byte[] MouseButtons)
|
||||||
{
|
{
|
||||||
X = mX;
|
X = mX;
|
||||||
Y = mY;
|
Y = mY * -1;
|
||||||
|
MouseButtons = buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,6 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
||||||
{
|
{
|
||||||
public int mWrite_position = 0;
|
|
||||||
public int mPlay_position =0;
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private AudioSource m_as;
|
private AudioSource m_as;
|
||||||
private RingBuffer<float> _buffer = new RingBuffer<float>(4096);
|
private RingBuffer<float> _buffer = new RingBuffer<float>(4096);
|
||||||
@ -26,21 +23,30 @@ public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
|||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
m_as.Play();
|
if (!m_as.isPlaying)
|
||||||
|
{
|
||||||
|
m_as.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopPlay()
|
||||||
|
{
|
||||||
|
if (m_as.isPlaying)
|
||||||
|
{
|
||||||
|
m_as.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAudioFilterRead(float[] data, int channels)
|
void OnAudioFilterRead(float[] data, int channels)
|
||||||
{
|
{
|
||||||
if (!UMAME.bStart) return;
|
if (!UMAME.bInGame) return;
|
||||||
int step = channels;
|
int step = channels;
|
||||||
mWrite_position = 0;
|
|
||||||
for (int i = 0; i < data.Length; i += step)
|
for (int i = 0; i < data.Length; i += step)
|
||||||
{
|
{
|
||||||
float rawFloat = lastData;
|
float rawFloat = lastData;
|
||||||
if (_buffer.TryRead(out float rawData))
|
if (_buffer.TryRead(out float rawData))
|
||||||
{
|
{
|
||||||
rawFloat = rawData;
|
rawFloat = rawData;
|
||||||
mWrite_position++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data[i] = rawFloat;
|
data[i] = rawFloat;
|
||||||
@ -62,6 +68,8 @@ public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
|||||||
_buffer.Write(floatdata[i]);
|
_buffer.Write(floatdata[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public float[] ConvertByteArrayToFloatArray(byte[] bytes, int sampleRate, int channels)
|
public float[] ConvertByteArrayToFloatArray(byte[] bytes, int sampleRate, int channels)
|
||||||
{
|
{
|
||||||
int sampleCount = bytes.Length / (channels * 2); // 16位,所以每个样本2字节
|
int sampleCount = bytes.Length / (channels * 2); // 16位,所以每个样本2字节
|
||||||
@ -72,10 +80,6 @@ public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
|||||||
// 读取左右声道
|
// 读取左右声道
|
||||||
short left = BitConverter.ToInt16(bytes, i * channels * 2);
|
short left = BitConverter.ToInt16(bytes, i * channels * 2);
|
||||||
short right = BitConverter.ToInt16(bytes, i * channels * 2 + 2);
|
short right = BitConverter.ToInt16(bytes, i * channels * 2 + 2);
|
||||||
|
|
||||||
//short left = (short)BitConverter.ToUInt16(bytes, i * channels * 2);
|
|
||||||
//short right = (short)BitConverter.ToUInt16(bytes, i * channels * 2 + 2);
|
|
||||||
|
|
||||||
// 转换为-1.0到1.0的浮点数
|
// 转换为-1.0到1.0的浮点数
|
||||||
floatArray[i] = left / 32767.0f; // 32767是16位整数的最大值
|
floatArray[i] = left / 32767.0f; // 32767是16位整数的最大值
|
||||||
floatArray[i + 1] = right / 32767.0f;
|
floatArray[i + 1] = right / 32767.0f;
|
||||||
@ -86,22 +90,12 @@ public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
|||||||
|
|
||||||
public void BufferWirte(int Off, byte[] Data)
|
public void BufferWirte(int Off, byte[] Data)
|
||||||
{
|
{
|
||||||
//var current = sw.Elapsed;
|
|
||||||
//var delta = current - lastElapsed;
|
|
||||||
//lastElapsed = current;
|
|
||||||
|
|
||||||
//FPS = 1d / delta.TotalSeconds;
|
|
||||||
|
|
||||||
//for (int i = Off; i < Data.Length; i++)
|
|
||||||
//{
|
|
||||||
// _buffer.Write(Data[i]);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetCurrentPosition(out int play_position, out int write_position)
|
public void GetCurrentPosition(out int play_position, out int write_position)
|
||||||
{
|
{
|
||||||
play_position = mPlay_position;
|
play_position = 0;
|
||||||
write_position = mWrite_position;
|
write_position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVolume(int Vol)
|
public void SetVolume(int Vol)
|
||||||
@ -110,5 +104,4 @@ public class UniSoundPlayer : MonoBehaviour, ISoundPlayer
|
|||||||
return;
|
return;
|
||||||
m_as.volume = Vol;
|
m_as.volume = Vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,39 +22,46 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
|||||||
|
|
||||||
private TimeSpan lastElapsed;
|
private TimeSpan lastElapsed;
|
||||||
public double videoFPS { get; private set; }
|
public double videoFPS { get; private set; }
|
||||||
bool bInitTexture = false;
|
bool bInit = false;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
m_drawCanvas = GameObject.Find("GameRawImage").GetComponent<RawImage>();
|
m_drawCanvas = GameObject.Find("GameRawImage").GetComponent<RawImage>();
|
||||||
m_drawCanvasrect = m_drawCanvas.GetComponent<RectTransform>();
|
m_drawCanvasrect = m_drawCanvas.GetComponent<RectTransform>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(int width, int height,IntPtr framePtr)
|
public void Initialize(int width, int height,IntPtr framePtr)
|
||||||
{
|
{
|
||||||
m_drawCanvas.color = Color.white;
|
m_drawCanvas.color = Color.white;
|
||||||
//384 * 264
|
|
||||||
mWidth = width;
|
|
||||||
mHeight = height;
|
|
||||||
mDataLenght = width * height * 4;
|
|
||||||
mFrameDataPtr = framePtr;
|
|
||||||
//m_rawBufferWarper = new Texture2D(mWidth, mHeight,TextureFormat.RGBA32,false);
|
|
||||||
//MAMEÀ´µÄÊÇBGRA32£¬ºÃºÃºÃ
|
|
||||||
m_rawBufferWarper = new Texture2D(mWidth, mHeight, TextureFormat.BGRA32, false);
|
|
||||||
m_rawBufferWarper.filterMode = FilterMode.Point;
|
|
||||||
|
|
||||||
|
if (m_rawBufferWarper == null || mWidth != width || mHeight != height)
|
||||||
|
{
|
||||||
|
mWidth = width;
|
||||||
|
mHeight = height;
|
||||||
|
mDataLenght = width * height * 4;
|
||||||
|
mFrameData = new int[mWidth * mHeight];
|
||||||
|
//MAMEÀ´µÄÊÇBGRA32£¬ºÃºÃºÃ
|
||||||
|
m_rawBufferWarper = new Texture2D(mWidth, mHeight, TextureFormat.BGRA32, false);
|
||||||
|
m_rawBufferWarper.filterMode = FilterMode.Point;
|
||||||
|
}
|
||||||
|
|
||||||
|
mFrameDataPtr = framePtr;
|
||||||
m_drawCanvas.texture = m_rawBufferWarper;
|
m_drawCanvas.texture = m_rawBufferWarper;
|
||||||
mFrameData = new int[mWidth * mHeight];
|
bInit = true;
|
||||||
bInitTexture = true;
|
|
||||||
|
|
||||||
float targetWidth = ((float)mWidth / mHeight) * m_drawCanvasrect.rect.height ;
|
float targetWidth = ((float)mWidth / mHeight) * m_drawCanvasrect.rect.height ;
|
||||||
m_drawCanvasrect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, targetWidth);
|
m_drawCanvasrect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, targetWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StopVideo()
|
||||||
|
{
|
||||||
|
bInit = false;
|
||||||
|
m_drawCanvas.color = new Color(0,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (!bInitTexture) return;
|
if (!bInit) return;
|
||||||
|
|
||||||
//m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mFrameData.Length * 4);
|
|
||||||
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
|
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
|
||||||
m_rawBufferWarper.Apply();
|
m_rawBufferWarper.Apply();
|
||||||
}
|
}
|
||||||
|
|||||||
65
README.md
65
README.md
@ -1,21 +1,64 @@
|
|||||||
# MAME.Core
|
## MAME.Core
|
||||||
|
|
||||||
一个MAME模拟器核心的现代化.Net版本移植作为独立模拟器核心(但是.NetStandard 2.0)
|
一个MAME模拟器核心的现代化.Net版本移植作为独立模拟器核心(但是.NetStandard 2.0)
|
||||||
|
|
||||||
移植的目的是,便于用于Unity Godot Stride MonoGame FNA 等跨平台的游戏引擎,并运行在不同平台
|
移植的目的是,便于用于Unity Godot Stride MonoGame FNA 等跨平台的游戏引擎,并运行在不同平台。
|
||||||
|
|
||||||
所以要脱离WinForm或者说Windows。
|
MAME.Core 接口化的核心。算一个真正的泛用型.Net/mono 任意生态版本 可用的MAME核心库。性能卓越。
|
||||||
目前大部分已经移植,原始有些静态变量是放在Form做GDI。这些我基本已经解耦
|
|
||||||
然后把Mouse Keyboard Input Video Sound接口化了,不依赖DX的
|
|
||||||
变成一个MAME模拟器核心类库。并尝开发联机功能
|
|
||||||
|
|
||||||
原项目gdi的扩展类里都是Bitmap用unsafe处理指针来填充RGBA
|
并且,最终会接入HaoYueNet高性能网络库
|
||||||
这部分我已经做到脱离System.Drawing(脱离平台依赖),重写BitmapData的逻辑,使其可以跨平台
|
|
||||||
|
|
||||||
git.axibug.com/sin365/MAME.Core
|
[HaoYueNet-Github](https://github.com/Sin365/HaoYueNet "HaoYueNet-Github")
|
||||||
总之 ,研究过程很欢乐。
|
|
||||||
|
|
||||||
# References
|
自己开发联机功能。
|
||||||
|
|
||||||
|
## MAME.Core 项目说明
|
||||||
|
|
||||||
|
原项目将MAME C++翻译为C#的一个Windows下的WinForm项目,
|
||||||
|
|
||||||
|
高度依赖Windows、WinForm、Win32API(Tick)、System.Drawing、Bitmap,DirectX音/视频
|
||||||
|
|
||||||
|
有些静态变量是放在Form做GDI,gdi的扩展类里都是Bitmap用unsafe处理指针来填充RGBA。
|
||||||
|
|
||||||
|
本项目(MAME.Core)中 **已经完全脱离如上依赖** ,并将一切标准化,去掉和整理好一切不规范的部分。
|
||||||
|
|
||||||
|
是一个标准的.Net Standard 2.0 库。无障碍跨平台。
|
||||||
|
|
||||||
|
接口抽象化:IKeyboard、ILog、IMouse、IResources、ISoundPlayer、IVideoPlayer
|
||||||
|
|
||||||
|
抽象枚举:MotionKey
|
||||||
|
|
||||||
|
资源加载,设置,按键映射,音视频接入,可以自由自定义接入任何C#生态的平台。
|
||||||
|
|
||||||
|
btw,总所周知街机游戏,已经有类似现代的场景和摄像机的概念,
|
||||||
|
|
||||||
|
比如CPS1 实际逻辑绘制的画布场景是512x512,实际显示区域(类似摄像机概念)只有其中384*224
|
||||||
|
|
||||||
|
在完美显示必要内容时,不再使用Clone的方式重写,而是像素矩阵绘制时,那么我们需要扣出中间那部分。
|
||||||
|
|
||||||
|
最高效率的数据读取设计模式,就是直接不拷贝。
|
||||||
|
|
||||||
|
MAME.Core中,通过计算的方式,仅处理显示区域的颜色。
|
||||||
|
|
||||||
|
并在提交颜色int[]时,额外提供了GC固定维护的安全Ptr(非unsafe),甚至可以做到显示GPU提交直通。
|
||||||
|
|
||||||
|
即,模拟器核心中的颜色缓冲的指针引用直接提交给外部GPU DrawCall,如Unity接入可以用于直接映射Texture
|
||||||
|
|
||||||
|
**效率极佳**,没有新的内存对象,无GC。
|
||||||
|
|
||||||
|
## MAME.Unity 项目说明
|
||||||
|
|
||||||
|
是基于MAME.Core,在Unity中的实现,
|
||||||
|
|
||||||
|
如上所说,加上对色彩通道和精度的合理对齐,视频非常高效的显示。音频也处理得较为完备。
|
||||||
|
|
||||||
|
PC和Android,已经就比较好的实现。
|
||||||
|
|
||||||
|
目前有一个简易的游戏选择器,Android制作了虚拟按键。
|
||||||
|
|
||||||
|
下一步是接入PSV,PS3等游戏机,往跨平台联机靠拢。
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
shunninghuang - https://www.codeproject.com/Articles/1275365/The-Main-Architecture-of-MAME-NET
|
shunninghuang - https://www.codeproject.com/Articles/1275365/The-Main-Architecture-of-MAME-NET
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user