diff --git a/MAME.Core/Properties/PublishProfiles/FolderProfile.pubxml.user b/MAME.Core/Properties/PublishProfiles/FolderProfile.pubxml.user
index 78cdec2..c473ac9 100644
--- a/MAME.Core/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/MAME.Core/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-08-28T08:12:23.3416224Z||;True|2024-08-28T13:18:21.7983285+08:00||;True|2024-08-28T12:54:14.9742502+08:00||;True|2024-08-28T12:09:37.5280942+08:00||;True|2024-08-28T12:07:03.6717540+08:00||;True|2024-08-07T18:02:59.4096796+08:00||;False|2024-08-07T18:02:44.0239078+08:00||;True|2024-07-31T17:00:23.0585720+08:00||;True|2024-07-31T17:00:19.8123170+08:00||;True|2024-07-30T20:51:40.9773933+08:00||;True|2024-07-30T17:04:12.3440051+08:00||;True|2024-07-30T17:01:28.0849009+08:00||;True|2024-07-30T10:36:57.5301145+08:00||;
+ True|2024-08-30T07:41:53.2597006Z||;True|2024-08-29T17:00:35.4694695+08:00||;True|2024-08-29T16:40:23.7314446+08:00||;True|2024-08-29T16:17:16.6219882+08:00||;False|2024-08-29T15:55:34.5778980+08:00||;True|2024-08-29T15:34:15.1410739+08:00||;False|2024-08-29T15:31:15.0815441+08:00||;False|2024-08-29T15:29:46.6749330+08:00||;False|2024-08-29T15:27:48.9116490+08:00||;False|2024-08-29T15:27:23.2208875+08:00||;True|2024-08-28T16:12:23.3416224+08:00||;True|2024-08-28T13:18:21.7983285+08:00||;True|2024-08-28T12:54:14.9742502+08:00||;True|2024-08-28T12:09:37.5280942+08:00||;True|2024-08-28T12:07:03.6717540+08:00||;True|2024-08-07T18:02:59.4096796+08:00||;False|2024-08-07T18:02:44.0239078+08:00||;True|2024-07-31T17:00:23.0585720+08:00||;True|2024-07-31T17:00:19.8123170+08:00||;True|2024-07-30T20:51:40.9773933+08:00||;True|2024-07-30T17:04:12.3440051+08:00||;True|2024-07-30T17:01:28.0849009+08:00||;True|2024-07-30T10:36:57.5301145+08:00||;
\ No newline at end of file
diff --git a/MAME.Core/emu/Keyboard.cs b/MAME.Core/emu/Keyboard.cs
index 4732629..59763b9 100644
--- a/MAME.Core/emu/Keyboard.cs
+++ b/MAME.Core/emu/Keyboard.cs
@@ -1,4 +1,6 @@
using MAME.Core;
+using System;
+using System.Collections.Generic;
namespace MAME.Core
{
@@ -8,60 +10,100 @@ namespace MAME.Core
static IKeyboard mKeyboard;
- struct KeyState
+ //const int CheckMaxEnumIdx = 33;
+
+ class KeyState
{
public bool IsPressed;
public bool IsTriggered;
public bool WasPressed;
};
- private static KeyState[] m_KeyStates = new KeyState[(byte)MotionKey.FinalKey];
+ private static Dictionary m_KeyStates = new Dictionary();
- MotionKey[] mKeyName;
+ static MotionKey[] mKeyName;
public static void InitializeInput(IKeyboard ikb)
{
mKeyboard = ikb;
+ List temp = new List();
+ foreach (MotionKey mkey in Enum.GetValues(typeof(MotionKey)))
+ {
+ //if (mkey > MotionKey.FinalKey)
+ // break;
+ m_KeyStates[mkey] = new KeyState();
+ temp.Add(mkey);
+ }
+ mKeyName = temp.ToArray();
}
public static bool IsPressed(MotionKey key)
{
- return m_KeyStates[(int)key].IsPressed;
+ return m_KeyStates[key].IsPressed;
}
public static bool IsTriggered(MotionKey key)
{
- return m_KeyStates[(int)key].IsTriggered;
+ return m_KeyStates[key].IsTriggered;
}
public static void Update()
{
- byte finalIndex = (byte)MotionKey.FinalKey;
- for (byte i = 0; i < finalIndex; i++)
+ for (byte i = 0; i < mKeyName.Length; i++)
{
- m_KeyStates[i].IsPressed = false;
+ m_KeyStates[mKeyName[i]].IsPressed = false;
}
foreach (MotionKey key in mKeyboard.GetPressedKeys())
{
- m_KeyStates[(int)key].IsPressed = true;
+ m_KeyStates[key].IsPressed = true;
}
- for (int i = 0; i < finalIndex; i++)
+ for (int i = 0; i < mKeyName.Length; i++)
{
- if (m_KeyStates[i].IsPressed)
+ MotionKey key = mKeyName[i];
+ if (m_KeyStates[key].IsPressed)
{
- if (m_KeyStates[i].WasPressed)
+ if (m_KeyStates[key].WasPressed)
{
- m_KeyStates[i].IsTriggered = false;
+ m_KeyStates[key].IsTriggered = false;
}
else
{
- m_KeyStates[i].WasPressed = true;
- m_KeyStates[i].IsTriggered = true;
+ m_KeyStates[key].WasPressed = true;
+ m_KeyStates[key].IsTriggered = true;
}
}
else
{
- m_KeyStates[i].WasPressed = false;
- m_KeyStates[i].IsTriggered = false;
+ m_KeyStates[key].WasPressed = false;
+ m_KeyStates[key].IsTriggered = false;
}
}
+ //byte finalIndex = CheckMaxEnumIdx;
+ //for (byte i = 0; i < finalIndex; i++)
+ //{
+ // m_KeyStates[i].IsPressed = false;
+ //}
+ //foreach (MotionKey key in mKeyboard.GetPressedKeys())
+ //{
+ // m_KeyStates[(int)key].IsPressed = true;
+ //}
+ //for (int i = 0; i < finalIndex; i++)
+ //{
+ // if (m_KeyStates[i].IsPressed)
+ // {
+ // if (m_KeyStates[i].WasPressed)
+ // {
+ // m_KeyStates[i].IsTriggered = false;
+ // }
+ // else
+ // {
+ // m_KeyStates[i].WasPressed = true;
+ // m_KeyStates[i].IsTriggered = true;
+ // }
+ // }
+ // else
+ // {
+ // m_KeyStates[i].WasPressed = false;
+ // m_KeyStates[i].IsTriggered = false;
+ // }
+ //}
}
}
diff --git a/MAME.Core/emu/Video.cs b/MAME.Core/emu/Video.cs
index 83c89e5..4b175bb 100644
--- a/MAME.Core/emu/Video.cs
+++ b/MAME.Core/emu/Video.cs
@@ -72,7 +72,7 @@ namespace MAME.Core
#region 抽象出去
- static Action Act_SubmitVideo;
+ static Action Act_SubmitVideo;
public static void BindFunc(IVideoPlayer Ivp)
{
@@ -81,9 +81,9 @@ namespace MAME.Core
Act_SubmitVideo += Ivp.SubmitVideo;
}
- static void SubmitVideo(int[] Bitmap)
+ static void SubmitVideo(int[] Bitmap, long frame_number)
{
- Act_SubmitVideo.Invoke(Bitmap);
+ Act_SubmitVideo.Invoke(Bitmap, frame_number);
}
#endregion
diff --git a/MAME.Core/emu/Gdi.cs b/MAME.Core/emu/VideoSubmit.cs
similarity index 98%
rename from MAME.Core/emu/Gdi.cs
rename to MAME.Core/emu/VideoSubmit.cs
index 6f97cc4..6ec08a1 100644
--- a/MAME.Core/emu/Gdi.cs
+++ b/MAME.Core/emu/VideoSubmit.cs
@@ -165,7 +165,7 @@ namespace MAME.Core
//Machine.mainMotion.pictureBox1.Image = bbmp[iMode];
//AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor,Video.bitmapcolorRect, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height));
- SubmitVideo(Video.bitmapcolorRect);
+ SubmitVideo(Video.bitmapcolorRect, Video.screenstate.frame_number);
//SubmitVideo(Video.bitmapcolor);
}
catch (Exception ex)
diff --git a/MAME.Core/run_interface/IVideoPlayer.cs b/MAME.Core/run_interface/IVideoPlayer.cs
index eddc082..36febae 100644
--- a/MAME.Core/run_interface/IVideoPlayer.cs
+++ b/MAME.Core/run_interface/IVideoPlayer.cs
@@ -2,6 +2,6 @@
{
public interface IVideoPlayer
{
- void SubmitVideo(int[] data);
+ void SubmitVideo(int[] data,long frame_number);
}
}
diff --git a/MAME.Core/run_interface/MotionKey.cs b/MAME.Core/run_interface/MotionKey.cs
index 7138755..5c1424a 100644
--- a/MAME.Core/run_interface/MotionKey.cs
+++ b/MAME.Core/run_interface/MotionKey.cs
@@ -1,59 +1,117 @@
-namespace MAME.Core
+using System;
+
+namespace MAME.Core
{
- public enum MotionKey : byte
+ [Flags]
+ public enum MotionKey : long
{
- EMU_PAUSED = 0,
- 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_UNKNOW_E,
- 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,
- ///
- /// 用于标记最后一个
- ///
- FinalKey
+ 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 << 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,
+ /////
+ ///// 用于标记最后一个
+ /////
+ //FinalKey,
+
+
+
+ //EMU_PAUSED,
}
}