From c1e030026f3c3cd36eb62f1dd192af907108d67e Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Tue, 30 Jul 2024 17:36:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E8=B1=A1Input|bios=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3|=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAME.Core/Motion/mainMotion.cs | 15 ++++++++++++++- MAME.Core/emu/Keyboard.cs | 4 ++-- MAME.Core/emu/RomInfo.cs | 1 + MAME.Core/mame/namcos1/Namcos1.cs | 2 +- MAME.Core/mame/neogeo/Neogeo.cs | 8 ++++---- MAME.Core/mame/pgm/PGM.cs | 7 +++---- MAME.Core/run_interface/IResources.cs | 20 +++++++++++--------- MAME.Core/run_interface/IVideoPlayer.cs | 1 - 8 files changed, 36 insertions(+), 22 deletions(-) diff --git a/MAME.Core/Motion/mainMotion.cs b/MAME.Core/Motion/mainMotion.cs index 13d85eb..f9b2160 100644 --- a/MAME.Core/Motion/mainMotion.cs +++ b/MAME.Core/Motion/mainMotion.cs @@ -67,14 +67,26 @@ namespace MAME.Core.Common private void LoadROMXML() { - XElement xe = XElement.Parse(resource.Get_mame_xml()); + XElement xe = XElement.Parse(resource.mame); IEnumerable elements = from ele in xe.Elements("game") select ele; showInfoByElements(elements); } + public Dictionary GetGameList() + { + return RomInfo.dictName2Rom; + } + + public void GetGameScreenSize(out int _width, out int _height) + { + _width = Video.fullwidth; + _height = Video.fullheight; + } + private void showInfoByElements(IEnumerable elements) { RomInfo.romList = new List(); + RomInfo.dictName2Rom = new Dictionary(); foreach (var ele in elements) { RomInfo rom = new RomInfo(); @@ -86,6 +98,7 @@ namespace MAME.Core.Common rom.Year = ele.Element("year").Value; rom.Manufacturer = ele.Element("manufacturer").Value; RomInfo.romList.Add(rom); + RomInfo.dictName2Rom[rom.Name] = rom; //loadform.listView1.Items.Add(new ListViewItem(new string[] { rom.Description, rom.Year, rom.Name, rom.Parent, rom.Direction, rom.Manufacturer, rom.Board })); } } diff --git a/MAME.Core/emu/Keyboard.cs b/MAME.Core/emu/Keyboard.cs index a8f80c1..05cdc50 100644 --- a/MAME.Core/emu/Keyboard.cs +++ b/MAME.Core/emu/Keyboard.cs @@ -22,7 +22,7 @@ namespace mame mKeyboard = ikb; } - public static bool IsPressed(MotionKey key) + public static bool IsPressed(MotionKey key) { return m_KeyStates[(int)key].IsPressed; } @@ -42,7 +42,7 @@ namespace mame { m_KeyStates[(int)key].IsPressed = true; } - for (int i = 0; i < 256; i++) + for (int i = 0; i < finalIndex; i++) { if (m_KeyStates[i].IsPressed) { diff --git a/MAME.Core/emu/RomInfo.cs b/MAME.Core/emu/RomInfo.cs index d3fb5e2..9c8f350 100644 --- a/MAME.Core/emu/RomInfo.cs +++ b/MAME.Core/emu/RomInfo.cs @@ -5,6 +5,7 @@ namespace mame public class RomInfo { public static List romList; + public static Dictionary dictName2Rom; public static RomInfo Rom; public string Name, Board; public string Parent; diff --git a/MAME.Core/mame/namcos1/Namcos1.cs b/MAME.Core/mame/namcos1/Namcos1.cs index d5c3aa2..b9a2a6d 100644 --- a/MAME.Core/mame/namcos1/Namcos1.cs +++ b/MAME.Core/mame/namcos1/Namcos1.cs @@ -36,7 +36,7 @@ namespace mame gfx2rom = Machine.GetRom("gfx2.rom"); gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom")); user1rom = Machine.GetRom("user1.rom"); - mcurom = mainMotion.resource.Get_mcu(); + mcurom = mainMotion.resource.mcu; voicerom = new byte[0xc0000]; byte[] bb1 = Machine.GetRom("voice.rom"); Array.Copy(bb1, voicerom, bb1.Length); diff --git a/MAME.Core/mame/neogeo/Neogeo.cs b/MAME.Core/mame/neogeo/Neogeo.cs index 086a0e3..4b21426 100644 --- a/MAME.Core/mame/neogeo/Neogeo.cs +++ b/MAME.Core/mame/neogeo/Neogeo.cs @@ -41,10 +41,10 @@ namespace mame Memory.audioram = new byte[0x800]; Machine.bRom = true; dsw = 0xff; - fixedbiosrom = mainMotion.resource.Get_sfix(); - zoomyrom = mainMotion.resource.Get__000_lo(); - audiobiosrom = mainMotion.resource.Get_sm1(); - mainbiosrom = mainMotion.resource.Get_mainbios(); + fixedbiosrom = mainMotion.resource.sfix; + zoomyrom = mainMotion.resource._000_lo; + audiobiosrom = mainMotion.resource.sm1; + mainbiosrom = mainMotion.resource.mainbios; Memory.mainrom = Machine.GetRom("maincpu.rom"); Memory.audiorom = Machine.GetRom("audiocpu.rom"); fixedrom = Machine.GetRom("fixed.rom"); diff --git a/MAME.Core/mame/pgm/PGM.cs b/MAME.Core/mame/pgm/PGM.cs index 011d3c6..fd320e9 100644 --- a/MAME.Core/mame/pgm/PGM.cs +++ b/MAME.Core/mame/pgm/PGM.cs @@ -1,7 +1,6 @@ using cpu.m68000; using MAME.Core.Common; using System; -using System.IO; namespace mame { @@ -16,9 +15,9 @@ namespace mame public static void PGMInit() { Machine.bRom = true; - mainbiosrom = mainMotion.resource.Get_pgmmainbios(); - videobios = mainMotion.resource.Get_pgmvideobios(); - audiobios = mainMotion.resource.Get_pgmaudiobios(); + mainbiosrom = mainMotion.resource.pgmmainbios; + videobios = mainMotion.resource.pgmvideobios; + audiobios = mainMotion.resource.pgmaudiobios; ICS2115.icsrom = audiobios; byte[] bb1, bb2; int i3, n1, n2, n3; diff --git a/MAME.Core/run_interface/IResources.cs b/MAME.Core/run_interface/IResources.cs index 96b708e..1d8a104 100644 --- a/MAME.Core/run_interface/IResources.cs +++ b/MAME.Core/run_interface/IResources.cs @@ -2,14 +2,16 @@ { public interface IResources { - byte[] Get_sfix(); - byte[] Get__000_lo(); - byte[] Get_sm1(); - byte[] Get_mainbios(); - byte[] Get_pgmmainbios(); - byte[] Get_pgmvideobios(); - byte[] Get_pgmaudiobios(); - byte[] Get_mcu(); - string Get_mame_xml(); + byte[] mcu { get; } + byte[] sfix { get; } + byte[] _000_lo { get; } + byte[] sm1 { get; } + byte[] mainbios { get; } + byte[] pgmmainbios { get; } + byte[] pgmvideobios { get; } + byte[] pgmaudiobios { get; } + byte[] _1 { get; } + byte[] readme { get; } + string mame { get; } } } diff --git a/MAME.Core/run_interface/IVideoPlayer.cs b/MAME.Core/run_interface/IVideoPlayer.cs index 1d99441..aadd4b0 100644 --- a/MAME.Core/run_interface/IVideoPlayer.cs +++ b/MAME.Core/run_interface/IVideoPlayer.cs @@ -2,7 +2,6 @@ { public interface IVideoPlayer { - void SubmitVideo(int[] data); } }