motionkey重新定义

This commit is contained in:
sin365 2025-01-25 01:43:50 +08:00
parent 35dbd53908
commit ebb3836359
26 changed files with 854 additions and 247 deletions

View File

@ -28,6 +28,8 @@ namespace MAME.Core
ITimeSpan itime ITimeSpan itime
) => mameMainMotion.Init(RomDir, ilog, iRes, ivp, isp, ikb, imou, itime); ) => mameMainMotion.Init(RomDir, ilog, iRes, ivp, isp, ikb, imou, itime);
public void ResetRomRoot(string RomDir) => mameMainMotion.ResetRomRoot(RomDir);
public Dictionary<string, RomInfo> GetGameList() => mameMainMotion.GetGameList(); public Dictionary<string, RomInfo> GetGameList() => mameMainMotion.GetGameList();
public void LoadRom(string Name) => mameMainMotion.LoadRom(Name); public void LoadRom(string Name) => mameMainMotion.LoadRom(Name);
public void GetGameScreenSize(out int _width, out int _height, out IntPtr _framePtr) => mameMainMotion.GetGameScreenSize(out _width, out _height, out _framePtr); public void GetGameScreenSize(out int _width, out int _height, out IntPtr _framePtr) => mameMainMotion.GetGameScreenSize(out _width, out _height, out _framePtr);
@ -37,7 +39,7 @@ namespace MAME.Core
public void UnlockNextFreme(int moreTick = 1) => mameMainMotion.UnlockNextFreme(moreTick); public void UnlockNextFreme(int moreTick = 1) => mameMainMotion.UnlockNextFreme(moreTick);
public void StopGame() => mameMainMotion.StopGame(); public void StopGame() => mameMainMotion.StopGame();
public long currEmuFrame => Video.screenstate.frame_number; public long currEmuFrame => Video.screenstate.frame_number;
public bool IsPaused => Mame.paused;
public void LoadState(BinaryReader sr) public void LoadState(BinaryReader sr)
{ {
Mame.paused = true; Mame.paused = true;
@ -62,6 +64,12 @@ namespace MAME.Core
mameMainMotion.StopGame(); mameMainMotion.StopGame();
mameMainMotion = null; mameMainMotion = null;
GC.Collect(); GC.Collect();
AxiMemoryEx.FreeAllGCHandle();
}
public void SetPaused(bool ispaused)
{
Mame.paused = ispaused;
} }
} }
} }

View File

@ -46,6 +46,9 @@ namespace MAME.Core
) )
{ {
AxiMemoryEx.Init(); AxiMemoryEx.Init();
AxiTimeSpan.Init(itime);
Mame.RomRoot = RomDir; Mame.RomRoot = RomDir;
EmuLogger.BindFunc(ilog); EmuLogger.BindFunc(ilog);
Video.BindFunc(ivp); Video.BindFunc(ivp);
@ -58,7 +61,11 @@ namespace MAME.Core
MAMEDBHelper.LoadROMXML(resource.mame); MAMEDBHelper.LoadROMXML(resource.mame);
Keyboard.InitializeInput(ikb); Keyboard.InitializeInput(ikb);
Mouse.InitialMouse(imou); Mouse.InitialMouse(imou);
AxiTimeSpan.Init(itime); }
public void ResetRomRoot(string RomDir)
{
Mame.RomRoot = RomDir;
} }

View File

@ -167,6 +167,8 @@ namespace MAME.Core
set set
{ {
spriteram_handle.ReleaseGCHandle(); spriteram_handle.ReleaseGCHandle();
if (value == null)
return;
spriteram_src = value; spriteram_src = value;
spriteramLength = value.Length; spriteramLength = value.Length;
spriteram_src.GetObjectPtr(ref spriteram_handle, ref spriteram); spriteram_src.GetObjectPtr(ref spriteram_handle, ref spriteram);

View File

@ -649,7 +649,7 @@ namespace MAME.Core
delta -= analog.delta * 0x200; delta -= analog.delta * 0x200;
analog.lastdigital = 1; analog.lastdigital = 1;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
keypressed = true; keypressed = true;
delta += analog.delta * 0x200; delta += analog.delta * 0x200;
@ -684,7 +684,7 @@ namespace MAME.Core
delta -= analog.delta * 0x200; delta -= analog.delta * 0x200;
analog.lastdigital = 1; analog.lastdigital = 1;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
keypressed = true; keypressed = true;
delta += analog.delta * 0x200; delta += analog.delta * 0x200;

View File

@ -18,49 +18,212 @@ namespace MAME.Core
public bool IsTriggered; public bool IsTriggered;
public bool WasPressed; public bool WasPressed;
}; };
private static Dictionary<MotionKey, KeyState> m_KeyStates = new Dictionary<MotionKey, KeyState>(); private static Dictionary<ulong, KeyState> m_KeyStates = new Dictionary<ulong, KeyState>();
static MotionKey[] mKeyName; static ulong[] mKeysValue;
public static void InitializeInput(IKeyboard ikb) public static void InitializeInput(IKeyboard ikb)
{ {
mKeyboard = ikb; mKeyboard = ikb;
List<MotionKey> temp = new List<MotionKey>(); List<ulong> temp = new List<ulong>();
foreach (MotionKey mkey in Enum.GetValues(typeof(MotionKey)))
{ #region m_KeyStates
//if (mkey > MotionKey.FinalKey) m_KeyStates[MotionKey.None] = new KeyState();
// break; m_KeyStates[MotionKey.P1_INSERT_COIN] = new KeyState();
m_KeyStates[mkey] = new KeyState(); m_KeyStates[MotionKey.P1_GAMESTART] = new KeyState();
temp.Add(mkey); m_KeyStates[MotionKey.P1_UP] = new KeyState();
} m_KeyStates[MotionKey.P1_DOWN] = new KeyState();
mKeyName = temp.ToArray(); m_KeyStates[MotionKey.P1_LEFT] = new KeyState();
m_KeyStates[MotionKey.P1_RIGHT] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_1] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_2] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_3] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_4] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_5] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_6] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_E] = new KeyState();
m_KeyStates[MotionKey.P1_BTN_F] = new KeyState();
m_KeyStates[MotionKey.P2_INSERT_COIN] = new KeyState();
m_KeyStates[MotionKey.P2_GAMESTART] = new KeyState();
m_KeyStates[MotionKey.P2_UP] = new KeyState();
m_KeyStates[MotionKey.P2_DOWN] = new KeyState();
m_KeyStates[MotionKey.P2_LEFT] = new KeyState();
m_KeyStates[MotionKey.P2_RIGHT] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_1] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_2] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_3] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_4] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_5] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_6] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_E] = new KeyState();
m_KeyStates[MotionKey.P2_BTN_F] = new KeyState();
m_KeyStates[MotionKey.P3_INSERT_COIN] = new KeyState();
m_KeyStates[MotionKey.P3_GAMESTART] = new KeyState();
m_KeyStates[MotionKey.P3_UP] = new KeyState();
m_KeyStates[MotionKey.P3_DOWN] = new KeyState();
m_KeyStates[MotionKey.P3_LEFT] = new KeyState();
m_KeyStates[MotionKey.P3_RIGHT] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_1] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_2] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_3] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_4] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_5] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_6] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_E] = new KeyState();
m_KeyStates[MotionKey.P3_BTN_F] = new KeyState();
m_KeyStates[MotionKey.P4_INSERT_COIN] = new KeyState();
m_KeyStates[MotionKey.P4_GAMESTART] = new KeyState();
m_KeyStates[MotionKey.P4_UP] = new KeyState();
m_KeyStates[MotionKey.P4_DOWN] = new KeyState();
m_KeyStates[MotionKey.P4_LEFT] = new KeyState();
m_KeyStates[MotionKey.P4_RIGHT] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_1] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_2] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_3] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_4] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_5] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_6] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_E] = new KeyState();
m_KeyStates[MotionKey.P4_BTN_F] = new KeyState();
m_KeyStates[MotionKey.EMU_PAUSED] = new KeyState();
m_KeyStates[MotionKey.Escape] = new KeyState();
m_KeyStates[MotionKey.LeftShift] = new KeyState();
m_KeyStates[MotionKey.RightShift] = new KeyState();
m_KeyStates[MotionKey.FinalKey] = new KeyState();
m_KeyStates[MotionKey.F10] = new KeyState();
m_KeyStates[MotionKey.F9] = new KeyState();
m_KeyStates[MotionKey.F8] = new KeyState();
m_KeyStates[MotionKey.F7] = new KeyState();
m_KeyStates[MotionKey.F6] = new KeyState();
m_KeyStates[MotionKey.F5] = new KeyState();
m_KeyStates[MotionKey.F4] = new KeyState();
m_KeyStates[MotionKey.F3] = new KeyState();
m_KeyStates[MotionKey.F2] = new KeyState();
m_KeyStates[MotionKey.F1] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_Q] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_N] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_R] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_T] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_M] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_V] = new KeyState();
m_KeyStates[MotionKey.UNKNOW_B] = new KeyState();
temp.Add(MotionKey.None);
temp.Add(MotionKey.P1_INSERT_COIN);
temp.Add(MotionKey.P1_GAMESTART);
temp.Add(MotionKey.P1_UP);
temp.Add(MotionKey.P1_DOWN);
temp.Add(MotionKey.P1_LEFT);
temp.Add(MotionKey.P1_RIGHT);
temp.Add(MotionKey.P1_BTN_1);
temp.Add(MotionKey.P1_BTN_2);
temp.Add(MotionKey.P1_BTN_3);
temp.Add(MotionKey.P1_BTN_4);
temp.Add(MotionKey.P1_BTN_5);
temp.Add(MotionKey.P1_BTN_6);
temp.Add(MotionKey.P1_BTN_E);
temp.Add(MotionKey.P1_BTN_F);
temp.Add(MotionKey.P2_INSERT_COIN);
temp.Add(MotionKey.P2_GAMESTART);
temp.Add(MotionKey.P2_UP);
temp.Add(MotionKey.P2_DOWN);
temp.Add(MotionKey.P2_LEFT);
temp.Add(MotionKey.P2_RIGHT);
temp.Add(MotionKey.P2_BTN_1);
temp.Add(MotionKey.P2_BTN_2);
temp.Add(MotionKey.P2_BTN_3);
temp.Add(MotionKey.P2_BTN_4);
temp.Add(MotionKey.P2_BTN_5);
temp.Add(MotionKey.P2_BTN_6);
temp.Add(MotionKey.P2_BTN_E);
temp.Add(MotionKey.P2_BTN_F);
temp.Add(MotionKey.P3_INSERT_COIN);
temp.Add(MotionKey.P3_GAMESTART);
temp.Add(MotionKey.P3_UP);
temp.Add(MotionKey.P3_DOWN);
temp.Add(MotionKey.P3_LEFT);
temp.Add(MotionKey.P3_RIGHT);
temp.Add(MotionKey.P3_BTN_1);
temp.Add(MotionKey.P3_BTN_2);
temp.Add(MotionKey.P3_BTN_3);
temp.Add(MotionKey.P3_BTN_4);
temp.Add(MotionKey.P3_BTN_5);
temp.Add(MotionKey.P3_BTN_6);
temp.Add(MotionKey.P3_BTN_E);
temp.Add(MotionKey.P3_BTN_F);
temp.Add(MotionKey.P4_INSERT_COIN);
temp.Add(MotionKey.P4_GAMESTART);
temp.Add(MotionKey.P4_UP);
temp.Add(MotionKey.P4_DOWN);
temp.Add(MotionKey.P4_LEFT);
temp.Add(MotionKey.P4_RIGHT);
temp.Add(MotionKey.P4_BTN_1);
temp.Add(MotionKey.P4_BTN_2);
temp.Add(MotionKey.P4_BTN_3);
temp.Add(MotionKey.P4_BTN_4);
temp.Add(MotionKey.P4_BTN_5);
temp.Add(MotionKey.P4_BTN_6);
temp.Add(MotionKey.P4_BTN_E);
temp.Add(MotionKey.P4_BTN_F);
temp.Add(MotionKey.EMU_PAUSED);
temp.Add(MotionKey.Escape);
temp.Add(MotionKey.LeftShift);
temp.Add(MotionKey.RightShift);
temp.Add(MotionKey.FinalKey);
temp.Add(MotionKey.F10);
temp.Add(MotionKey.F9);
temp.Add(MotionKey.F8);
temp.Add(MotionKey.F7);
temp.Add(MotionKey.F6);
temp.Add(MotionKey.F5);
temp.Add(MotionKey.F4);
temp.Add(MotionKey.F3);
temp.Add(MotionKey.F2);
temp.Add(MotionKey.F1);
temp.Add(MotionKey.UNKNOW_Q);
temp.Add(MotionKey.UNKNOW_N);
temp.Add(MotionKey.UNKNOW_R);
temp.Add(MotionKey.UNKNOW_T);
temp.Add(MotionKey.UNKNOW_M);
temp.Add(MotionKey.UNKNOW_V);
temp.Add(MotionKey.UNKNOW_B);
mKeysValue = temp.ToArray();
#endregion
} }
public static bool IsPressed(MotionKey key) public static bool IsPressed(ulong key)
{ {
return m_KeyStates[key].IsPressed; return m_KeyStates[key].IsPressed;
} }
public static bool IsTriggered(MotionKey key) public static bool IsTriggered(ulong key)
{ {
return m_KeyStates[key].IsTriggered; return m_KeyStates[key].IsTriggered;
} }
public static void Update() public static void Update()
{ {
for (byte i = 0; i < mKeyName.Length; i++) ulong currKeys = mKeyboard.GetPressedKeys();
for (byte i = 0; i < mKeysValue.Length; i++)
{ {
m_KeyStates[mKeyName[i]].IsPressed = false; //m_KeyStates[mKeyName[i]].IsPressed = false;
m_KeyStates[mKeysValue[i]].IsPressed = (currKeys & (ulong)mKeysValue[i]) > 0;
} }
//等待放行帧 //等待放行帧
Machine.mainMotion.WaitNextFrame(); Machine.mainMotion.WaitNextFrame();
foreach (MotionKey key in mKeyboard.GetPressedKeys()) //foreach (MotionKey key in mKeyboard.GetPressedKeys())
//{
// m_KeyStates[key].IsPressed = true;
//}
for (int i = 0; i < mKeysValue.Length; i++)
{ {
m_KeyStates[key].IsPressed = true; ulong key = mKeysValue[i];
}
for (int i = 0; i < mKeyName.Length; i++)
{
MotionKey key = mKeyName[i];
if (m_KeyStates[key].IsPressed) if (m_KeyStates[key].IsPressed)
{ {
if (m_KeyStates[key].WasPressed) if (m_KeyStates[key].WasPressed)

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using UnityEngine;
namespace MAME.Core namespace MAME.Core
{ {

View File

@ -1,10 +1,4 @@
using MAME.Core; namespace MAME.Core
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using UnityEngine.UIElements;
namespace MAME.Core
{ {
/// <summary> /// <summary>
/// 原依赖Form的内容 /// 原依赖Form的内容

View File

@ -55,6 +55,8 @@ namespace MAME.Core
set set
{ {
scrollx_handle.ReleaseGCHandle(); scrollx_handle.ReleaseGCHandle();
if (value == null)
return;
scrollx_src = value; scrollx_src = value;
scrollxLength = value.Length; scrollxLength = value.Length;
scrollx_src.GetObjectPtr(ref scrollx_handle, ref scrollx); scrollx_src.GetObjectPtr(ref scrollx_handle, ref scrollx);
@ -73,6 +75,8 @@ namespace MAME.Core
set set
{ {
scrolly_handle.ReleaseGCHandle(); scrolly_handle.ReleaseGCHandle();
if (value == null)
return;
scrolly_src = value; scrolly_src = value;
scrollyLength = value.Length; scrollyLength = value.Length;
scrolly_src.GetObjectPtr(ref scrolly_handle, ref scrolly); scrolly_src.GetObjectPtr(ref scrolly_handle, ref scrolly);

View File

@ -300,7 +300,7 @@ namespace MAME.Core
{ {
short1 |= 0x0020; short1 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0200; short0 &= ~0x0200;
} }
@ -324,7 +324,7 @@ namespace MAME.Core
{ {
short1 |= 0x0080; short1 |= 0x0080;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short0 &= ~0x0004; short0 &= ~0x0004;
} }
@ -380,7 +380,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= ~0x0400; short0 &= ~0x0400;
} }
@ -404,7 +404,7 @@ namespace MAME.Core
{ {
short1 |= unchecked((short)0x8000); short1 |= unchecked((short)0x8000);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short0 &= ~0x0100; short0 &= ~0x0100;
} }
@ -511,7 +511,7 @@ namespace MAME.Core
{ {
short1 |= 0x0200; short1 |= 0x0200;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short1 &= ~0x0400; short1 &= ~0x0400;
} }
@ -535,7 +535,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short1 &= ~0x4000; short1 &= ~0x4000;
} }
@ -591,7 +591,7 @@ namespace MAME.Core
{ {
short2 |= 0x0200; short2 |= 0x0200;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short2 &= ~0x0400; short2 &= ~0x0400;
} }
@ -615,7 +615,7 @@ namespace MAME.Core
{ {
short2 |= 0x2000; short2 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short2 &= ~0x4000; short2 &= ~0x4000;
} }
@ -722,7 +722,7 @@ namespace MAME.Core
{ {
sbyte1 &= ~0x02; sbyte1 &= ~0x02;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte1 |= 0x04; sbyte1 |= 0x04;
} }
@ -746,7 +746,7 @@ namespace MAME.Core
{ {
sbyte2 &= ~0x02; sbyte2 &= ~0x02;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
sbyte2 |= 0x04; sbyte2 |= 0x04;
} }
@ -802,7 +802,7 @@ namespace MAME.Core
{ {
sbyte3 &= ~0x02; sbyte3 &= ~0x02;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte3 |= 0x04; sbyte3 |= 0x04;
} }
@ -826,7 +826,7 @@ namespace MAME.Core
{ {
sbyte4 |= 0x02; sbyte4 |= 0x02;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
sbyte4 |= 0x04; sbyte4 |= 0x04;
} }

View File

@ -86,7 +86,7 @@ namespace MAME.Core
{ {
short1 |= 0x20; short1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short1 &= ~0x40; short1 &= ~0x40;
} }
@ -110,7 +110,7 @@ namespace MAME.Core
{ {
short2 |= 0x02; short2 |= 0x02;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short2 &= ~0x04; short2 &= ~0x04;
} }
@ -166,7 +166,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short1 &= ~0x4000; short1 &= ~0x4000;
} }
@ -190,7 +190,7 @@ namespace MAME.Core
{ {
short2 |= 0x20; short2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short2 &= ~0x40; short2 &= ~0x40;
} }
@ -430,7 +430,7 @@ namespace MAME.Core
{ {
short1 |= 0x20; short1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short1 &= ~0x40; short1 &= ~0x40;
} }
@ -454,7 +454,7 @@ namespace MAME.Core
{ {
short2 |= 0x0200; short2 |= 0x0200;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short2 &= ~0x0400; short2 &= ~0x0400;
} }
@ -510,7 +510,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short1 &= ~0x4000; short1 &= ~0x4000;
} }
@ -534,7 +534,7 @@ namespace MAME.Core
{ {
short2 |= 0x2000; short2 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short2 &= ~0x4000; short2 &= ~0x4000;
} }
@ -609,7 +609,7 @@ namespace MAME.Core
{ {
short1 |= 0x20; short1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short1 &= ~0x40; short1 &= ~0x40;
} }
@ -641,7 +641,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short1 &= ~0x4000; short1 &= ~0x4000;
} }
@ -756,7 +756,7 @@ namespace MAME.Core
{ {
short0 |= 0x0020; short0 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0040; short0 &= ~0x0040;
} }
@ -780,7 +780,7 @@ namespace MAME.Core
{ {
short1 |= 0x0002; short1 |= 0x0002;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short1 &= ~0x0004; short1 &= ~0x0004;
} }
@ -836,7 +836,7 @@ namespace MAME.Core
{ {
short0 |= 0x2000; short0 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= ~0x4000; short0 &= ~0x4000;
} }
@ -860,7 +860,7 @@ namespace MAME.Core
{ {
short1 |= 0x0020; short1 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short2 &= ~0x4000; short2 &= ~0x4000;
} }
@ -975,7 +975,7 @@ namespace MAME.Core
{ {
short0 |= 0x0020; short0 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0040; short0 &= ~0x0040;
} }
@ -999,7 +999,7 @@ namespace MAME.Core
{ {
short1 |= 0x0002; short1 |= 0x0002;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
short1 &= ~0x0004; short1 &= ~0x0004;
} }
@ -1063,7 +1063,7 @@ namespace MAME.Core
{ {
short0 |= 0x2000; short0 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= ~0x4000; short0 &= ~0x4000;
} }
@ -1087,7 +1087,7 @@ namespace MAME.Core
{ {
short1 |= 0x0020; short1 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
short2 &= ~0x4000; short2 &= ~0x4000;
} }
@ -1194,7 +1194,7 @@ namespace MAME.Core
{ {
short0 |= 0x0020; short0 |= 0x0020;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0040; short0 &= ~0x0040;
} }
@ -1250,7 +1250,7 @@ namespace MAME.Core
{ {
short0 |= 0x2000; short0 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= ~0x4000; short0 &= ~0x4000;
} }
@ -1327,7 +1327,7 @@ namespace MAME.Core
{ {
short0 |= 0x0004; short0 |= 0x0004;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0002; short0 &= ~0x0002;
} }
@ -1359,7 +1359,7 @@ namespace MAME.Core
{ {
short0 |= 0x0400; short0 |= 0x0400;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= ~0x0200; short0 &= ~0x0200;
} }

View File

@ -87,7 +87,7 @@ namespace MAME.Core
{ {
sbyte0 |= 0x40; sbyte0 |= 0x40;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte2 &= ~0x08; sbyte2 &= ~0x08;
} }
@ -111,7 +111,7 @@ namespace MAME.Core
{ {
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
} }
@ -167,7 +167,7 @@ namespace MAME.Core
{ {
sbyte2 |= unchecked((sbyte)0x80); sbyte2 |= unchecked((sbyte)0x80);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte1 &= unchecked((sbyte)~0x80); sbyte1 &= unchecked((sbyte)~0x80);
} }
@ -191,7 +191,7 @@ namespace MAME.Core
{ {
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
} }

View File

@ -90,7 +90,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte1 &= ~0x40; sbyte1 &= ~0x40;
} }
@ -146,7 +146,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte2 &= ~0x40; sbyte2 &= ~0x40;
} }
@ -237,7 +237,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
//sbyte1 &= ~0x04; //sbyte1 &= ~0x04;
} }
@ -293,7 +293,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
//sbyte1 &= ~0x40; //sbyte1 &= ~0x40;
} }
@ -400,7 +400,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
//sbyte1 &= ~0x04; //sbyte1 &= ~0x04;
} }
@ -456,7 +456,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
//sbyte1 &= ~0x40; //sbyte1 &= ~0x40;
} }
@ -563,7 +563,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte1 &= ~0x40; sbyte1 &= ~0x40;
} }
@ -627,7 +627,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte2 &= ~0x40; sbyte2 &= ~0x40;
} }
@ -905,7 +905,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
//sbyte1 &= ~0x04; //sbyte1 &= ~0x04;
} }
@ -961,7 +961,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
//sbyte1 &= ~0x40; //sbyte1 &= ~0x40;
} }
@ -1076,7 +1076,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
//sbyte1 &= ~0x04; //sbyte1 &= ~0x04;
} }
@ -1140,7 +1140,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
//sbyte1 &= ~0x40; //sbyte1 &= ~0x40;
} }
@ -1247,7 +1247,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
//sbyte1 &= ~0x04; //sbyte1 &= ~0x04;
} }
@ -1303,7 +1303,7 @@ namespace MAME.Core
{ {
sbyte2 |= 0x20; sbyte2 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
//sbyte1 &= ~0x40; //sbyte1 &= ~0x40;
} }

View File

@ -65,6 +65,8 @@ namespace MAME.Core
set set
{ {
samplesrom_handle.ReleaseGCHandle(); samplesrom_handle.ReleaseGCHandle();
if (value == null)
return;
samplesrom_src = value; samplesrom_src = value;
samplesromLength = value.Length; samplesromLength = value.Length;
samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom); samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom);
@ -121,6 +123,8 @@ namespace MAME.Core
set set
{ {
gfx3rom_handle.ReleaseGCHandle(); gfx3rom_handle.ReleaseGCHandle();
if (value == null)
return;
gfx3rom_src = value; gfx3rom_src = value;
gfx3romLength = value.Length; gfx3romLength = value.Length;
gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom); gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom);

View File

@ -86,7 +86,7 @@ namespace MAME.Core
{ {
byte0 |= 0x20; byte0 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
byte0 &= unchecked((byte)~0x40); byte0 &= unchecked((byte)~0x40);
} }
@ -142,7 +142,7 @@ namespace MAME.Core
{ {
byte1 |= 0x20; byte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
byte1 &= unchecked((byte)~0x40); byte1 &= unchecked((byte)~0x40);
} }
@ -217,7 +217,7 @@ namespace MAME.Core
{ {
byte0 |= 0x20; byte0 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
byte0 &= unchecked((byte)~0x40); byte0 &= unchecked((byte)~0x40);
} }
@ -241,7 +241,7 @@ namespace MAME.Core
{ {
byte1 |= 0x20; byte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
byte1 &= unchecked((byte)~0x40); byte1 &= unchecked((byte)~0x40);
} }
@ -350,7 +350,7 @@ namespace MAME.Core
{ {
byte01 &= unchecked((byte)~0x02); byte01 &= unchecked((byte)~0x02);
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
byte01 |= 0x04; byte01 |= 0x04;
} }
@ -374,7 +374,7 @@ namespace MAME.Core
{ {
byte00 &= unchecked((byte)~0x02); byte00 &= unchecked((byte)~0x02);
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
byte00 |= 0x04; byte00 |= 0x04;
} }
@ -430,7 +430,7 @@ namespace MAME.Core
{ {
byte03 &= unchecked((byte)~0x02); byte03 &= unchecked((byte)~0x02);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
byte03 |= 0x04; byte03 |= 0x04;
} }
@ -454,7 +454,7 @@ namespace MAME.Core
{ {
byte02 &= unchecked((byte)~0x02); byte02 &= unchecked((byte)~0x02);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
byte02 |= 0x04; byte02 |= 0x04;
} }

View File

@ -89,7 +89,7 @@ namespace MAME.Core
{ {
short0 |= 0x2000; short0 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
} }
@ -113,7 +113,7 @@ namespace MAME.Core
{ {
short0 |= unchecked((short)0x8000); short0 |= unchecked((short)0x8000);
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
} }
@ -169,7 +169,7 @@ namespace MAME.Core
{ {
short1 |= 0x2000; short1 |= 0x2000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
} }
@ -194,7 +194,7 @@ namespace MAME.Core
short1 |= unchecked((short)0x8000); short1 |= unchecked((short)0x8000);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
} }

View File

@ -86,7 +86,7 @@ namespace MAME.Core
{ {
short0 |= 0x0040; short0 |= 0x0040;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
short0 &= ~0x0080; short0 &= ~0x0080;
} }
@ -110,7 +110,7 @@ namespace MAME.Core
{ {
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.O)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.O))
{ {
} }
@ -166,7 +166,7 @@ namespace MAME.Core
{ {
short0 |= 0x4000; short0 |= 0x4000;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
short0 &= unchecked((short)~0x8000); short0 &= unchecked((short)~0x8000);
} }
@ -190,7 +190,7 @@ namespace MAME.Core
{ {
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_F))//if (Keyboard.IsPressed(Corekey.NumPad6)) if (Keyboard.IsPressed(MotionKey.P2_BTN_F))//if (Keyboard.IsPressed(Corekey.NumPad6))
{ {
} }

View File

@ -85,6 +85,8 @@ namespace MAME.Core
set set
{ {
samplesrom_handle.ReleaseGCHandle(); samplesrom_handle.ReleaseGCHandle();
if (value == null)
return;
samplesrom_src = value; samplesrom_src = value;
samplesromLength = value.Length; samplesromLength = value.Length;
samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom); samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom);

View File

@ -90,7 +90,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x02; sbyte1 |= 0x02;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte1 &= ~0x04; sbyte1 &= ~0x04;
} }
@ -146,7 +146,7 @@ namespace MAME.Core
{ {
sbyte1 |= 0x20; sbyte1 |= 0x20;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte1 &= ~0x40; sbyte1 &= ~0x40;
} }
@ -253,7 +253,7 @@ namespace MAME.Core
{ {
sbyte0 |= 0x02; sbyte0 |= 0x02;
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
sbyte0 &= ~0x04; sbyte0 &= ~0x04;
} }
@ -309,7 +309,7 @@ namespace MAME.Core
{ {
sbyte0 |= 0x10; sbyte0 |= 0x10;
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
sbyte0 &= ~0x20; sbyte0 &= ~0x20;
} }

View File

@ -54,7 +54,7 @@ namespace MAME.Core
{ {
byte0 &= unchecked((byte)~0x10); byte0 &= unchecked((byte)~0x10);
} }
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L)) if (Keyboard.IsPressed(MotionKey.P1_BTN_E))//if (Keyboard.IsPressed(Corekey.L))
{ {
byte0 |= 0x01; byte0 |= 0x01;
} }
@ -86,7 +86,7 @@ namespace MAME.Core
{ {
byte1 &= unchecked((byte)~0x10); byte1 &= unchecked((byte)~0x10);
} }
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3)) if (Keyboard.IsPressed(MotionKey.P2_BTN_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{ {
byte1 |= 0x01; byte1 |= 0x01;
} }

View File

@ -2,6 +2,6 @@
{ {
public interface IKeyboard public interface IKeyboard
{ {
MotionKey[] GetPressedKeys(); ulong GetPressedKeys();
} }
} }

View File

@ -1,62 +1,278 @@
using System; using System;
using System.Collections.Generic;
using UnityEngine;
namespace MAME.Core namespace MAME.Core
{ {
[Flags] public static class MotionKey
public enum MotionKey : long
{ {
None = (0),
P1_INSERT_COIN = (1),
P1_GAMESTART = (1 << 1),
P1_UP = (1 << 2),
P1_DOWN = (1 << 3),
P1_LEFT = (1 << 4),
P1_RIGHT = (1 << 5),
P1_BTN_1 = (1 << 6),
P1_BTN_2 = (1 << 7),
P1_BTN_3 = (1 << 8),
P1_BTN_4 = (1 << 9),
P1_BTN_5 = (1 << 10),
P1_BTN_6 = (1 << 11),
P1_UNKNOW_E = (1 << 12),
P1_UNKNOW_F = (1 << 13),
P2_INSERT_COIN = (1 << 14),
P2_GAMESTART = (1 << 15),
P2_UP = (1 << 16),
P2_DOWN = (1 << 17),
P2_LEFT = (1 << 18),
P2_RIGHT = (1 << 19),
P2_BTN_1 = (1 << 20),
P2_BTN_2 = (1 << 21),
P2_BTN_3 = (1 << 22),
P2_BTN_4 = (1 << 23),
P2_BTN_5 = (1 << 24),
P2_BTN_6 = (1 << 25),
P2_UNKNOW_E = (1 << 26),
P2_UNKNOW_F = (1 << 27),
Escape = (1 << 28),
LeftShift = (1 << 29),
RightShift = (1 << 30),
FinalKey = (1 << 31),
EMU_PAUSED = 1<< 31, public const ulong None = (0L);
F10 = 1<< 31, public const ulong P1_INSERT_COIN = (1L);
F9 = 1<< 31, public const ulong P1_GAMESTART = (1L << 1);
F8 = 1<< 31, public const ulong P1_UP = (1L << 2);
F7 = 1<< 31, public const ulong P1_DOWN = (1L << 3);
F6 = 1<< 31, public const ulong P1_LEFT = (1L << 4);
F5 = 1<< 31, public const ulong P1_RIGHT = (1L << 5);
F4 = 1<< 31, public const ulong P1_BTN_1 = (1L << 6);
F3 = 1<< 31, public const ulong P1_BTN_2 = (1L << 7);
F2 = 1<< 31, public const ulong P1_BTN_3 = (1L << 8);
F1 = 1<< 31, public const ulong P1_BTN_4 = (1L << 9);
UNKNOW_Q = 1<< 31, public const ulong P1_BTN_5 = (1L << 10);
UNKNOW_N = 1<< 31, public const ulong P1_BTN_6 = (1L << 11);
UNKNOW_R = 1<< 31, public const ulong P1_BTN_E = (1L << 12);
UNKNOW_T = 1<< 31, public const ulong P1_BTN_F = (1L << 13);
UNKNOW_M = 1<< 31,
UNKNOW_V = 1<< 31,
UNKNOW_B = 1<< 31 public const ulong P2_INSERT_COIN = (1L << (16));
public const ulong P2_GAMESTART = (1L << (16 + 1));
public const ulong P2_UP = (1L << (16 + 2));
public const ulong P2_DOWN = (1L << (16 + 3));
public const ulong P2_LEFT = (1L << (16 + 4));
public const ulong P2_RIGHT = (1L << (16 + 5));
public const ulong P2_BTN_1 = (1L << (16 + 6));
public const ulong P2_BTN_2 = (1L << (16 + 7));
public const ulong P2_BTN_3 = (1L << (16 + 8));
public const ulong P2_BTN_4 = (1L << (16 + 9));
public const ulong P2_BTN_5 = (1L << (16 + 10));
public const ulong P2_BTN_6 = (1L << (16 + 11));
public const ulong P2_BTN_E = (1L << (16 + 12));
public const ulong P2_BTN_F = (1L << (16 + 13));
public const ulong P3_INSERT_COIN = (1L << (32));
public const ulong P3_GAMESTART = (1L << (32 + 1));
public const ulong P3_UP = (1L << (32 + 2));
public const ulong P3_DOWN = (1L << (32 + 3));
public const ulong P3_LEFT = (1L << (32 + 4));
public const ulong P3_RIGHT = (1L << (32 + 5));
public const ulong P3_BTN_1 = (1L << (32 + 6));
public const ulong P3_BTN_2 = (1L << (32 + 7));
public const ulong P3_BTN_3 = (1L << (32 + 8));
public const ulong P3_BTN_4 = (1L << (32 + 9));
public const ulong P3_BTN_5 = (1L << (32 + 10));
public const ulong P3_BTN_6 = (1L << (32 + 11));
public const ulong P3_BTN_E = (1L << (32 + 12));
public const ulong P3_BTN_F = (1L << (32 + 13));
public const ulong P4_INSERT_COIN = (1L << (48));
public const ulong P4_GAMESTART = (1L << (48 + 1));
public const ulong P4_UP = (1L << (48 + 2));
public const ulong P4_DOWN = (1L << (48 + 3));
public const ulong P4_LEFT = (1L << (48 + 4));
public const ulong P4_RIGHT = (1L << (48 + 5));
public const ulong P4_BTN_1 = (1L << (48 + 6));
public const ulong P4_BTN_2 = (1L << (48 + 7));
public const ulong P4_BTN_3 = (1L << (48 + 8));
public const ulong P4_BTN_4 = (1L << (48 + 9));
public const ulong P4_BTN_5 = (1L << (48 + 10));
public const ulong P4_BTN_6 = (1L << (48 + 11));
public const ulong P4_BTN_E = (1L << (48 + 12));
public const ulong P4_BTN_F = (1L << (48 + 13));
//预留按键
//(1L << 14)
//(1L << 15)
//(1L << (16 + 14))
//(1L << (16 + 15))
//(1L << (32 + 14))
//(1L << (32 + 15))
//(1L << (48 + 14))
//这个应该是不能用了-->(1L << (48 + 15))
public const ulong EMU_PAUSED = (1L << 14);
public const ulong Escape = (1L << 15);
public const ulong LeftShift = (1L << (16 + 14));
public const ulong RightShift = (1L << (16 + 15));
public const ulong FinalKey = (1L << (32 + 14));
public const ulong F10 = (1L << (32 + 14));
public const ulong F9 = (1L << (32 + 14));
public const ulong F8 = (1L << (32 + 14));
public const ulong F7 = (1L << (32 + 14));
public const ulong F6 = (1L << (32 + 14));
public const ulong F5 = (1L << (32 + 14));
public const ulong F4 = (1L << (32 + 14));
public const ulong F3 = (1L << (32 + 14));
public const ulong F2 = (1L << (32 + 14));
public const ulong F1 = (1L << (32 + 14));
public const ulong UNKNOW_Q = (1L << (32 + 14));
public const ulong UNKNOW_N = (1L << (32 + 14));
public const ulong UNKNOW_R = (1L << (32 + 14));
public const ulong UNKNOW_T = (1L << (32 + 14));
public const ulong UNKNOW_M = (1L << (32 + 14));
public const ulong UNKNOW_V = (1L << (32 + 14));
public const ulong UNKNOW_B = (1L << (32 + 14));
public readonly static ulong[] AllNeedCheckList = new ulong[]
{
None,
P1_INSERT_COIN,
P1_GAMESTART,
P1_UP,
P1_DOWN,
P1_LEFT,
P1_RIGHT,
P1_BTN_1,
P1_BTN_2,
P1_BTN_3,
P1_BTN_4,
P1_BTN_5,
P1_BTN_6,
P1_BTN_E,
P1_BTN_F,
P2_INSERT_COIN,
P2_GAMESTART,
P2_UP,
P2_DOWN,
P2_LEFT,
P2_RIGHT,
P2_BTN_1,
P2_BTN_2,
P2_BTN_3,
P2_BTN_4,
P2_BTN_5,
P2_BTN_6,
P2_BTN_E,
P2_BTN_F,
P3_INSERT_COIN,
P3_GAMESTART,
P3_UP,
P3_DOWN,
P3_LEFT,
P3_RIGHT,
P3_BTN_1,
P3_BTN_2,
P3_BTN_3,
P3_BTN_4,
P3_BTN_5,
P3_BTN_6,
P3_BTN_E,
P3_BTN_F,
P4_INSERT_COIN,
P4_GAMESTART,
P4_UP,
P4_DOWN,
P4_LEFT,
P4_RIGHT,
P4_BTN_1,
P4_BTN_2,
P4_BTN_3,
P4_BTN_4,
P4_BTN_5,
P4_BTN_6,
P4_BTN_E,
P4_BTN_F,
EMU_PAUSED,
Escape,
LeftShift,
RightShift,
FinalKey,
F10,
F9,
F8,
F7,
F6,
F5,
F4,
F3,
F2,
F1,
UNKNOW_Q,
UNKNOW_N,
UNKNOW_R,
UNKNOW_T,
UNKNOW_M,
UNKNOW_V,
UNKNOW_B,
};
public static string GetKeyName(ulong key)
{
switch (key)
{
case MotionKey.None: return "None";
case MotionKey.P1_INSERT_COIN: return "P1_INSERT_COIN";
case MotionKey.P1_GAMESTART: return "P1_GAMESTART";
case MotionKey.P1_UP: return "P1_UP";
case MotionKey.P1_DOWN: return "P1_DOWN";
case MotionKey.P1_LEFT: return "P1_LEFT";
case MotionKey.P1_RIGHT: return "P1_RIGHT";
case MotionKey.P1_BTN_1: return "P1_BTN_1";
case MotionKey.P1_BTN_2: return "P1_BTN_2";
case MotionKey.P1_BTN_3: return "P1_BTN_3";
case MotionKey.P1_BTN_4: return "P1_BTN_4";
case MotionKey.P1_BTN_5: return "P1_BTN_5";
case MotionKey.P1_BTN_6: return "P1_BTN_6";
case MotionKey.P1_BTN_E: return "P1_BTN_E";
case MotionKey.P1_BTN_F: return "P1_BTN_F";
case MotionKey.P2_INSERT_COIN: return "P2_INSERT_COIN";
case MotionKey.P2_GAMESTART: return "P2_GAMESTART";
case MotionKey.P2_UP: return "P2_UP";
case MotionKey.P2_DOWN: return "P2_DOWN";
case MotionKey.P2_LEFT: return "P2_LEFT";
case MotionKey.P2_RIGHT: return "P2_RIGHT";
case MotionKey.P2_BTN_1: return "P2_BTN_1";
case MotionKey.P2_BTN_2: return "P2_BTN_2";
case MotionKey.P2_BTN_3: return "P2_BTN_3";
case MotionKey.P2_BTN_4: return "P2_BTN_4";
case MotionKey.P2_BTN_5: return "P2_BTN_5";
case MotionKey.P2_BTN_6: return "P2_BTN_6";
case MotionKey.P2_BTN_E: return "P2_BTN_E";
case MotionKey.P2_BTN_F: return "P2_BTN_F";
case MotionKey.P3_INSERT_COIN: return "P3_INSERT_COIN";
case MotionKey.P3_GAMESTART: return "P3_GAMESTART";
case MotionKey.P3_UP: return "P3_UP";
case MotionKey.P3_DOWN: return "P3_DOWN";
case MotionKey.P3_LEFT: return "P3_LEFT";
case MotionKey.P3_RIGHT: return "P3_RIGHT";
case MotionKey.P3_BTN_1: return "P3_BTN_1";
case MotionKey.P3_BTN_2: return "P3_BTN_2";
case MotionKey.P3_BTN_3: return "P3_BTN_3";
case MotionKey.P3_BTN_4: return "P3_BTN_4";
case MotionKey.P3_BTN_5: return "P3_BTN_5";
case MotionKey.P3_BTN_6: return "P3_BTN_6";
case MotionKey.P3_BTN_E: return "P3_BTN_E";
case MotionKey.P3_BTN_F: return "P3_BTN_F";
case MotionKey.P4_INSERT_COIN: return "P4_INSERT_COIN";
case MotionKey.P4_GAMESTART: return "P4_GAMESTART";
case MotionKey.P4_UP: return "P4_UP";
case MotionKey.P4_DOWN: return "P4_DOWN";
case MotionKey.P4_LEFT: return "P4_LEFT";
case MotionKey.P4_RIGHT: return "P4_RIGHT";
case MotionKey.P4_BTN_1: return "P4_BTN_1";
case MotionKey.P4_BTN_2: return "P4_BTN_2";
case MotionKey.P4_BTN_3: return "P4_BTN_3";
case MotionKey.P4_BTN_4: return "P4_BTN_4";
case MotionKey.P4_BTN_5: return "P4_BTN_5";
case MotionKey.P4_BTN_6: return "P4_BTN_6";
case MotionKey.P4_BTN_E: return "P4_BTN_E";
case MotionKey.P4_BTN_F: return "P4_BTN_F";
case MotionKey.EMU_PAUSED: return "EMU_PAUSED";
case MotionKey.Escape: return "Escape";
case MotionKey.LeftShift: return "LeftShift";
case MotionKey.RightShift: return "RightShift";
case MotionKey.FinalKey: return "FinalKey";
default: return "None";
//case MotionKey.F10:return "F10";
//case MotionKey.F9:return "F9";
//case MotionKey.F8:return "F8";
//case MotionKey.F7:return "F7";
//case MotionKey.F6:return "F6";
//case MotionKey.F5:return "F5";
//case MotionKey.F4:return "F4";
//case MotionKey.F3:return "F3";
//case MotionKey.F2:return "F2";
//case MotionKey.F1:return "F1";
//case MotionKey.UNKNOW_Q:return "UNKNOW_Q";
//case MotionKey.UNKNOW_N:return "UNKNOW_N";
//case MotionKey.UNKNOW_R:return "UNKNOW_R";
//case MotionKey.UNKNOW_T:return "UNKNOW_T";
//case MotionKey.UNKNOW_M:return "UNKNOW_M";
//case MotionKey.UNKNOW_V:return "UNKNOW_V";
//case MotionKey.UNKNOW_B: return "UNKNOW_B";
}
}
//EMU_PAUSED = (1 << 36), //EMU_PAUSED = (1 << 36),
//F10 = (1 << 37), //F10 = (1 << 37),
@ -133,5 +349,139 @@ namespace MAME.Core
//EMU_PAUSED, //EMU_PAUSED,
} }
//[Flags]
//public enum MotionKey : long
//{
// None = (0),
// P1_INSERT_COIN = (1),
// P1_GAMESTART = (1 << 1),
// P1_UP = (1 << 2),
// P1_DOWN = (1 << 3),
// P1_LEFT = (1 << 4),
// P1_RIGHT = (1 << 5),
// P1_BTN_1 = (1 << 6),
// P1_BTN_2 = (1 << 7),
// P1_BTN_3 = (1 << 8),
// P1_BTN_4 = (1 << 9),
// P1_BTN_5 = (1 << 10),
// P1_BTN_6 = (1 << 11),
// P1_UNKNOW_E = (1 << 12),
// P1_UNKNOW_F = (1 << 13),
// P2_INSERT_COIN = (1 << 14),
// P2_GAMESTART = (1 << 15),
// P2_UP = (1 << 16),
// P2_DOWN = (1 << 17),
// P2_LEFT = (1 << 18),
// P2_RIGHT = (1 << 19),
// P2_BTN_1 = (1 << 20),
// P2_BTN_2 = (1 << 21),
// P2_BTN_3 = (1 << 22),
// P2_BTN_4 = (1 << 23),
// P2_BTN_5 = (1 << 24),
// P2_BTN_6 = (1 << 25),
// P2_UNKNOW_E = (1 << 26),
// P2_UNKNOW_F = (1 << 27),
// Escape = (1 << 28),
// LeftShift = (1 << 29),
// RightShift = (1 << 30),
// FinalKey = (1 << 31),
// EMU_PAUSED = 1<< 31,
// F10 = 1<< 31,
// F9 = 1<< 31,
// F8 = 1<< 31,
// F7 = 1<< 31,
// F6 = 1<< 31,
// F5 = 1<< 31,
// F4 = 1<< 31,
// F3 = 1<< 31,
// F2 = 1<< 31,
// F1 = 1<< 31,
// UNKNOW_Q = 1<< 31,
// UNKNOW_N = 1<< 31,
// UNKNOW_R = 1<< 31,
// UNKNOW_T = 1<< 31,
// UNKNOW_M = 1<< 31,
// UNKNOW_V = 1<< 31,
// UNKNOW_B = 1<< 31
// //EMU_PAUSED = (1 << 36),
// //F10 = (1 << 37),
// //F9 = (1 << 38),
// //F8 = (1 << 39),
// //F7 = (1 << 40),
// //F6 = (1 << 41),
// //F5 = (1 << 42),
// //F4 = (1 << 43),
// //F3 = (1 << 44),
// //F2 = (1 << 45),
// //F1 = (1 << 46),
// //UNKNOW_Q = (1 << 47),
// //UNKNOW_N = (1 << 48),
// //UNKNOW_R = (1 << 49),
// //UNKNOW_T = (1 << 50),
// //UNKNOW_M = (1 << 51),
// //UNKNOW_V = (1 << 52),
// //UNKNOW_B = (1 << 53),
// //None = 0,
// //P1_INSERT_COIN = 1,
// //P1_GAMESTART = 2 << 1,
// //P1_UP = 4,
// //P1_DOWN = 8,
// //P1_LEFT = 16,
// //P1_RIGHT = 32,
// //P1_BTN_1 = 64,
// //P1_BTN_2 = 128,
// //P1_BTN_3 = 256,
// //P1_BTN_4 = 512,
// //P1_BTN_5 = 1024,
// //P1_BTN_6 = 4096,
// //P1_UNKNOW_E = 8192,
// //P1_UNKNOW_F,
// //P2_INSERT_COIN,
// //P2_GAMESTART,
// //P2_UP,
// //P2_DOWN,
// //P2_LEFT,
// //P2_RIGHT,
// //P2_BTN_1,
// //P2_BTN_2,
// //P2_BTN_3,
// //P2_BTN_4,
// //P2_BTN_5,
// //P2_BTN_6,
// //P2_UNKNOW_E,
// //P2_UNKNOW_F,
// //UNKNOW_Q,
// //UNKNOW_N,
// //UNKNOW_R,
// //UNKNOW_T,
// //UNKNOW_M,
// //UNKNOW_V,
// //UNKNOW_B,
// //F10,
// //F9,
// //F8,
// //F7,
// //F6,
// //F5,
// //F4,
// //F3,
// //F2,
// //F1,
// //Escape,
// //LeftShift,
// //RightShift,
// ///// <summary>
// ///// 用于标记最后一个
// ///// </summary>
// //FinalKey,
// //EMU_PAUSED,
//}
} }

View File

@ -21,6 +21,8 @@ namespace MAME.Core
set set
{ {
source_handle.ReleaseGCHandle(); source_handle.ReleaseGCHandle();
if (value == null)
return;
source_src = value; source_src = value;
sourceLength = value.Length; sourceLength = value.Length;
source_src.GetObjectPtr(ref source_handle, ref source); source_src.GetObjectPtr(ref source_handle, ref source);

View File

@ -213,6 +213,38 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 97142682492627208, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 97142682492627208, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 97142682492627208, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 97142682492627208, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1553850566392038418, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1553850566392038418, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1553850566392038418, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1553850566392038418, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319444242429640, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} - target: {fileID: 3471319444242429640, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
@ -267,19 +299,95 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} - target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: bQuickTestRom propertyPath: bQuickTestRom
value: 0 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} - target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: mQuickTestRom propertyPath: mQuickTestRom
value: 1944 value: kof10th
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} - target: {fileID: 3471319444260926877, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: mChangeRomName propertyPath: mChangeRomName
value: opwolf value: opwolf
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3471319444260926879, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319445208116032, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319445208116032, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319445208116032, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319445208116032, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3471319445309129982, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} - target: {fileID: 3471319445309129982, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4817073881051249870, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4817073881051249870, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4817073881051249870, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4817073881051249870, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6218974894225195416, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6218974894225195416, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6847488682063653578, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6847488682063653578, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6847488682063653578, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6847488682063653578, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635128341793952131, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635128341793952131, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635128341793952131, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635128341793952131, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 1cb6308e67105bf48aea153ebcdb2d76, type: 3}

View File

@ -110,7 +110,7 @@ public class UMAME : MonoBehaviour
void LoadGame(bool bReplay = false) void LoadGame(bool bReplay = false)
{ {
//Application.targetFrameRate = 60; Application.targetFrameRate = 60;
mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8); mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8);
mChangeRomName = HadGameList[optionDropdown.value].Name; mChangeRomName = HadGameList[optionDropdown.value].Name;

View File

@ -1,6 +1,7 @@
using MAME.Core; using MAME.Core;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using UnityEngine; using UnityEngine;
public class UniKeyboard : MonoBehaviour, IKeyboard public class UniKeyboard : MonoBehaviour, IKeyboard
@ -22,13 +23,14 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
public List<UILongClickButton> mUIBtns = new List<UILongClickButton>(); public List<UILongClickButton> mUIBtns = new List<UILongClickButton>();
#endregion #endregion
public static Dictionary<KeyCode, MotionKey> dictKeyCfgs = new Dictionary<KeyCode, MotionKey>(); public static Dictionary<KeyCode, ulong> dictKeyCfgs = new Dictionary<KeyCode, ulong>();
public static KeyCode[] CheckList;
bool bReplayMode; bool bReplayMode;
PlayMode mPlayMode; PlayMode mPlayMode;
ReplayMode mReplayMode; ReplayMode mReplayMode;
ulong last_CurryInpuAllData_test = 0; ulong last_CurryInpuAllData_test = 0;
public static KeyCode[] CheckList;
void Awake() void Awake()
{ {
mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>(); mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>();
@ -72,27 +74,15 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
Init(false); Init(false);
} }
public MotionKey[] GetPressedKeys() public ulong GetPressedKeys()
{ {
MotionKey[] currkey;
ulong InputData; ulong InputData;
if (!bReplayMode) if (!bReplayMode)
currkey = mPlayMode.GetPressedKeys(out InputData); InputData = mPlayMode.GetPressedKeys();
else else
currkey = mReplayMode.GetPressedKeys(out InputData); InputData = mReplayMode.GetPressedKeys();
#if UNITY_EDITOR
if (last_CurryInpuAllData_test != InputData) return InputData;
{
string TempStr = "";
foreach (var item in currkey)
{
TempStr += $"{item.ToString()}|";
}
Debug.Log($"{UMAME.instance.mUniVideoPlayer.mFrame} | {EmuTimer.get_current_time().attoseconds} |{EmuTimer.get_current_time().seconds} | {InputData} | {TempStr}");
last_CurryInpuAllData_test = InputData;
}
#endif
return currkey;
} }
public void UpdateInputKey() public void UpdateInputKey()
@ -157,13 +147,9 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
} }
public class PlayMode public class PlayMode
{ {
Dictionary<KeyCode, MotionKey> dictKeyCfgs => UniKeyboard.dictKeyCfgs;
UniKeyboard mUniKeyboard; UniKeyboard mUniKeyboard;
KeyCode[] CheckList => UniKeyboard.CheckList;
ulong tempInputAllData = 0; ulong tempInputAllData = 0;
List<MotionKey> temp = new List<MotionKey>();
public ulong CurryInpuAllData = 0; public ulong CurryInpuAllData = 0;
public MotionKey[] mCurrKey = new MotionKey[0];
public PlayMode(UniKeyboard uniKeyboard) public PlayMode(UniKeyboard uniKeyboard)
{ {
@ -173,13 +159,12 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
public void UpdateLogic() public void UpdateLogic()
{ {
tempInputAllData = 0; tempInputAllData = 0;
temp.Clear();
for (int i = 0; i < CheckList.Length; i++) for (int i = 0; i < CheckList.Length; i++)
{ {
if (Input.GetKey(CheckList[i])) if (Input.GetKey(CheckList[i]))
{ {
MotionKey mk = dictKeyCfgs[CheckList[i]]; ulong mk = dictKeyCfgs[CheckList[i]];
temp.Add(mk);
tempInputAllData |= (ulong)mk; tempInputAllData |= (ulong)mk;
} }
} }
@ -190,110 +175,90 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
{ {
for (int j = 0; j < mUniKeyboard.mUIBtns[i].Key.Length; j++) for (int j = 0; j < mUniKeyboard.mUIBtns[i].Key.Length; j++)
{ {
MotionKey mk = (MotionKey)mUniKeyboard.mUIBtns[i].Key[j]; ulong mk = (ulong)mUniKeyboard.mUIBtns[i].Key[j];
temp.Add(mk);
tempInputAllData |= (ulong)mk; tempInputAllData |= (ulong)mk;
} }
} }
} }
Vector2Int inputV2 = mUniKeyboard.mJoystick.RawInputV2; Vector2Int inputV2 = mUniKeyboard.mJoystick.RawInputV2;
//Debug.Log($"{inputV2.x},{inputV2.y}");
if (inputV2.x > 0) if (inputV2.x > 0)
{ {
temp.Add(MotionKey.P1_RIGHT);
tempInputAllData |= (ulong)MotionKey.P1_RIGHT; tempInputAllData |= (ulong)MotionKey.P1_RIGHT;
} }
else if (inputV2.x < 0) else if (inputV2.x < 0)
{ {
temp.Add(MotionKey.P1_LEFT);
tempInputAllData |= (ulong)MotionKey.P1_LEFT; tempInputAllData |= (ulong)MotionKey.P1_LEFT;
} }
if (inputV2.y > 0) if (inputV2.y > 0)
{ {
temp.Add(MotionKey.P1_UP);
tempInputAllData |= (ulong)MotionKey.P1_UP; tempInputAllData |= (ulong)MotionKey.P1_UP;
} }
else if (inputV2.y < 0) else if (inputV2.y < 0)
{ {
temp.Add(MotionKey.P1_DOWN);
tempInputAllData |= (ulong)MotionKey.P1_DOWN; tempInputAllData |= (ulong)MotionKey.P1_DOWN;
} }
CurryInpuAllData = tempInputAllData; CurryInpuAllData = tempInputAllData;
mCurrKey = temp.ToArray();
} }
public MotionKey[] GetPressedKeys(out ulong InputData) public ulong GetPressedKeys()
{ {
//UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData);
UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData); UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData);
InputData = CurryInpuAllData;
return mCurrKey; #if UNITY_EDITOR
string ShowKeyNames = string.Empty;
foreach (string keyname in GetInputpDataToMotionKey(CurryInpuAllData))
{
ShowKeyNames += keyname + " |";
}
Debug.Log("GetPressedKeys=>" + ShowKeyNames);
#endif
return CurryInpuAllData;
} }
} }
public class ReplayMode public class ReplayMode
{ {
public MotionKey[] mCurrKey = new MotionKey[0];
MotionKey[] ReplayCheckKey;
ulong currInputData; ulong currInputData;
List<MotionKey> temp = new List<MotionKey>();
public ReplayMode() public ReplayMode()
{ {
ReplayCheckKey = dictKeyCfgs.Values.ToArray(); currInputData = 0;
} }
public MotionKey[] GetPressedKeys(out ulong InputData) public ulong GetPressedKeys()
{ {
//Óб仯 //Óб仯
//if (UMAME.instance.mReplayReader.NextFrame(out AxiReplay.ReplayStep stepData))
int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame; int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
//if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out AxiReplay.ReplayStep stepData))
//{
// temp.Clear();
// //ÓÐÊý¾Ý
// for (int i = 0; i < ReplayCheckKey.Length; i++)
// {
// if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
// temp.Add(ReplayCheckKey[i]);
// }
// mCurrKey = temp.ToArray();
//}
AxiReplay.ReplayStep stepData; AxiReplay.ReplayStep stepData;
if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData)) if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
{ {
temp.Clear(); #if UNITY_EDITOR
//List<MotionKey> temp = new List<MotionKey>(); string ShowKeyNames = string.Empty;
//temp.Clear(); foreach (string keyname in GetInputpDataToMotionKey(stepData.InPut))
////ÓÐÊý¾Ý
//for (int i = 0; i < ReplayCheckKey.Length; i++)
//{
// if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
// temp.Add(ReplayCheckKey[i]);
//}
//mCurrKey = temp.ToArray();
foreach (MotionKey key in GetStepDataToMotionKey(stepData))
{ {
temp.Add(key); ShowKeyNames += keyname + " |";
} }
mCurrKey = temp.ToArray(); Debug.Log("GetPressedKeys=>" + ShowKeyNames);
#endif
currInputData = stepData.InPut; currInputData = stepData.InPut;
} }
InputData = currInputData; return currInputData;
return mCurrKey;
}
IEnumerable<MotionKey> GetStepDataToMotionKey(AxiReplay.ReplayStep stepData)
{
//ÓÐÊý¾Ý
for (int i = 0; i < ReplayCheckKey.Length; i++)
{
if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
yield return ReplayCheckKey[i];
}
} }
} }
public static IEnumerable<string> GetInputpDataToMotionKey(ulong inputdata)
{
if (inputdata == 0)
yield break;
for (int i = 0; i < MotionKey.AllNeedCheckList.Length; i++)
{
if ((inputdata & MotionKey.AllNeedCheckList[i]) > 0)
yield return MotionKey.GetKeyName(MotionKey.AllNeedCheckList[i]);
}
}
#endregion #endregion
} }

View File

@ -64,8 +64,6 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
void Update() void Update()
{ {
if (!bInit) return; if (!bInit) return;
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
m_rawBufferWarper.Apply();
} }
public void SubmitVideo(int[] data, long frame_number) public void SubmitVideo(int[] data, long frame_number)
@ -79,6 +77,8 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
//mFrameData = data; //mFrameData = data;
//Debug.Log($"frame_number -> {frame_number}"); //Debug.Log($"frame_number -> {frame_number}");
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
m_rawBufferWarper.Apply();
} }
public byte[] GetScreenImg() public byte[] GetScreenImg()