抽象Input|bios加载修正|接口规范

This commit is contained in:
sin365 2024-07-30 17:36:13 +08:00
parent 3816e73e5e
commit c1e030026f
8 changed files with 36 additions and 22 deletions

View File

@ -67,14 +67,26 @@ namespace MAME.Core.Common
private void LoadROMXML() private void LoadROMXML()
{ {
XElement xe = XElement.Parse(resource.Get_mame_xml()); XElement xe = XElement.Parse(resource.mame);
IEnumerable<XElement> elements = from ele in xe.Elements("game") select ele; IEnumerable<XElement> elements = from ele in xe.Elements("game") select ele;
showInfoByElements(elements); showInfoByElements(elements);
} }
public Dictionary<string, RomInfo> GetGameList()
{
return RomInfo.dictName2Rom;
}
public void GetGameScreenSize(out int _width, out int _height)
{
_width = Video.fullwidth;
_height = Video.fullheight;
}
private void showInfoByElements(IEnumerable<XElement> elements) private void showInfoByElements(IEnumerable<XElement> elements)
{ {
RomInfo.romList = new List<RomInfo>(); RomInfo.romList = new List<RomInfo>();
RomInfo.dictName2Rom = new Dictionary<string, RomInfo>();
foreach (var ele in elements) foreach (var ele in elements)
{ {
RomInfo rom = new RomInfo(); RomInfo rom = new RomInfo();
@ -86,6 +98,7 @@ namespace MAME.Core.Common
rom.Year = ele.Element("year").Value; rom.Year = ele.Element("year").Value;
rom.Manufacturer = ele.Element("manufacturer").Value; rom.Manufacturer = ele.Element("manufacturer").Value;
RomInfo.romList.Add(rom); 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 })); //loadform.listView1.Items.Add(new ListViewItem(new string[] { rom.Description, rom.Year, rom.Name, rom.Parent, rom.Direction, rom.Manufacturer, rom.Board }));
} }
} }

View File

@ -22,7 +22,7 @@ namespace mame
mKeyboard = ikb; mKeyboard = ikb;
} }
public static bool IsPressed(MotionKey key) public static bool IsPressed(MotionKey key)
{ {
return m_KeyStates[(int)key].IsPressed; return m_KeyStates[(int)key].IsPressed;
} }
@ -42,7 +42,7 @@ namespace mame
{ {
m_KeyStates[(int)key].IsPressed = true; 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) if (m_KeyStates[i].IsPressed)
{ {

View File

@ -5,6 +5,7 @@ namespace mame
public class RomInfo public class RomInfo
{ {
public static List<RomInfo> romList; public static List<RomInfo> romList;
public static Dictionary<string,RomInfo> dictName2Rom;
public static RomInfo Rom; public static RomInfo Rom;
public string Name, Board; public string Name, Board;
public string Parent; public string Parent;

View File

@ -36,7 +36,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.Get_mcu(); mcurom = mainMotion.resource.mcu;
voicerom = new byte[0xc0000]; voicerom = new byte[0xc0000];
byte[] bb1 = Machine.GetRom("voice.rom"); byte[] bb1 = Machine.GetRom("voice.rom");
Array.Copy(bb1, voicerom, bb1.Length); Array.Copy(bb1, voicerom, bb1.Length);

View File

@ -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.Get_sfix(); fixedbiosrom = mainMotion.resource.sfix;
zoomyrom = mainMotion.resource.Get__000_lo(); zoomyrom = mainMotion.resource._000_lo;
audiobiosrom = mainMotion.resource.Get_sm1(); audiobiosrom = mainMotion.resource.sm1;
mainbiosrom = mainMotion.resource.Get_mainbios(); mainbiosrom = mainMotion.resource.mainbios;
Memory.mainrom = Machine.GetRom("maincpu.rom"); Memory.mainrom = Machine.GetRom("maincpu.rom");
Memory.audiorom = Machine.GetRom("audiocpu.rom"); Memory.audiorom = Machine.GetRom("audiocpu.rom");
fixedrom = Machine.GetRom("fixed.rom"); fixedrom = Machine.GetRom("fixed.rom");

View File

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

View File

@ -2,14 +2,16 @@
{ {
public interface IResources public interface IResources
{ {
byte[] Get_sfix(); byte[] mcu { get; }
byte[] Get__000_lo(); byte[] sfix { get; }
byte[] Get_sm1(); byte[] _000_lo { get; }
byte[] Get_mainbios(); byte[] sm1 { get; }
byte[] Get_pgmmainbios(); byte[] mainbios { get; }
byte[] Get_pgmvideobios(); byte[] pgmmainbios { get; }
byte[] Get_pgmaudiobios(); byte[] pgmvideobios { get; }
byte[] Get_mcu(); byte[] pgmaudiobios { get; }
string Get_mame_xml(); byte[] _1 { get; }
byte[] readme { get; }
string mame { get; }
} }
} }

View File

@ -2,7 +2,6 @@
{ {
public interface IVideoPlayer public interface IVideoPlayer
{ {
void SubmitVideo(int[] data); void SubmitVideo(int[] data);
} }
} }