归档编译通过

This commit is contained in:
sin365 2024-07-24 18:36:14 +08:00
parent 3ba76b07ee
commit 5ac30ca622
53 changed files with 1938 additions and 374 deletions

25
MAME.Core.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35027.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAME.Core", "MAME.Core\MAME.Core.csproj", "{954965B1-EF86-4957-8126-BE4FCB7E101A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{954965B1-EF86-4957-8126-BE4FCB7E101A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{954965B1-EF86-4957-8126-BE4FCB7E101A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{954965B1-EF86-4957-8126-BE4FCB7E101A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{954965B1-EF86-4957-8126-BE4FCB7E101A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1E095E89-39DD-4C74-9ED3-D44222CA95CF}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,142 @@
using cpu.m68000;
using cpu.nec;
using mame;
using System;
using System.Collections.Generic;
using System.Text;
namespace MAME.Core.Common
{
public partial class cheatForm
{
public enum LockState
{
LOCK_NONE = 0,
LOCK_SECOND,
LOCK_FRAME,
}
private mainForm _myParentForm;
public LockState lockState = LockState.LOCK_NONE;
public List<int[]> lsCheatdata1;
public List<int[]> lsCheatdata2;
private string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" };
public Func<int, byte> CheatReadByte;
public Action<int, byte> CheatWriteByte;
#region
List<string> mTxList_tbResult = new List<string>();
#endregion
public cheatForm(mainForm form)
{
this._myParentForm = form;
cheatForm_Load();
}
private void cheatForm_Load()
{
switch (Machine.sBoard)
{
case "CPS-1":
case "CPS-1(QSound)":
case "CPS2":
case "Data East":
case "Tehkan":
case "Neo Geo":
case "Taito B":
case "Konami 68000":
case "Capcom":
CheatReadByte = (int i1) => { return Memory.mainram[i1]; };
CheatWriteByte = (int i1, byte b1) => { Memory.mainram[i1] = b1; };
break;
case "Namco System 1":
CheatReadByte = (int i1) => { return Namcos1.N0ReadMemory((ushort)i1); };
CheatWriteByte = (int i1, byte b1) => { Namcos1.N0WriteMemory((ushort)i1, b1); };
break;
case "IGS011":
CheatReadByte = (int i1) => { return (byte)MC68000.m1.ReadByte(i1); };
CheatWriteByte = (int i1, byte b1) => { MC68000.m1.WriteByte(i1, (sbyte)b1); };
break;
case "PGM":
CheatReadByte = (int i1) => { return (byte)MC68000.m1.ReadByte(i1); };
CheatWriteByte = (int i1, byte b1) => { MC68000.m1.WriteByte(i1, (sbyte)b1); };
break;
case "M72":
case "M92":
CheatReadByte = (int i1) => { return Nec.nn1[0].ReadByte(i1); };
CheatWriteByte = (int i1, byte b1) => { Nec.nn1[0].WriteByte(i1, b1); };
break;
}
}
private void GetCheatdata()
{
// lsCheatdata1 = new List<int[]>();
// lsCheatdata2 = new List<int[]>();
// int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3;
// string[] ss1, ss2, ss3;
// foreach (ListViewItem item1 in listViewControl1.myListView.Items)
// {
// if (item1.Checked)
// {
// i1 = listViewControl1.myListView.Items.IndexOf(item1);
// i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text);
// ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries);
// n3 = ss1.Length;
// for (i3 = 0; i3 < n3; i3++)
// {
// ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries);
// iValue2 = Convert.ToInt32(ss3[1], 16);
// if (ss3[0].IndexOf("$") >= 0)
// {
// ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 });
// }
// else if (ss3[0].IndexOf("+") >= 0)
// {
// ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// iAddress = iOffsetAddress1 + iOffsetAddress2;
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// else
// {
// iAddress = Convert.ToInt32(ss3[0], 16);
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// }
// }
// }
}
public void ApplyCheat()
{
int iAddress, iValue1;
foreach (int[] ii1 in lsCheatdata1)
{
//iAddress = bbMem[ii1[0]] * 0x100 + bbMem[ii1[0] + 1] + ii1[1];
//iValue1 = bbMem[iAddress];
//bbMem[iAddress] = (byte)ii1[2];
iAddress = CheatReadByte(ii1[0]) * 0x100 + CheatReadByte(ii1[0] + 1) + ii1[1];
iValue1 = CheatReadByte(iAddress);
CheatWriteByte(iAddress, (byte)ii1[2]);
if (iValue1 != ii1[2])
{
mTxList_tbResult.Add(iAddress.ToString("X4") + " " + iValue1.ToString("X2") + " " + ii1[2].ToString("X2") + "\r\n");
}
}
foreach (int[] ii1 in lsCheatdata2)
{
iAddress = ii1[0];
//iValue1 = bbMem[iAddress];
//bbMem[ii1[0]] = (byte)ii1[1];
iValue1 = CheatReadByte(iAddress);
CheatWriteByte(ii1[0], (byte)ii1[1]);
if (iValue1 != ii1[1])
{
mTxList_tbResult.Add(ii1[0].ToString("X4") + " " + iValue1.ToString("X2") + " " + ii1[1].ToString("X2") + "\r\n");
}
}
}
}
}

298
MAME.Core/Common/cpsForm.cs Normal file
View File

@ -0,0 +1,298 @@
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using static System.Net.Mime.MediaTypeNames;
using static System.Net.WebRequestMethods;
namespace MAME.Core.Common
{
public partial class cpsForm
{
private mainForm _myParentForm;
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
#region
public bool cbLockpal = false;
public bool cbRowscroll = false;
public string tbInput = string.Empty;
public bool cbL0 = false;
public bool cbL1 = false;
public bool cbL2 = false;
public bool cbL3 = false;
public string tbFile = string.Empty;
public string tbPoint = string.Empty;
public int cbLayer = 0;
public string tbCode = string.Empty;
public string tbColor = string.Empty;
public string tbScroll1x = string.Empty;
public string tbScroll1y = string.Empty;
public string tbScroll2x = string.Empty;
public string tbScroll2y = string.Empty;
public string tbScroll3x = string.Empty;
public string tbScroll3y = string.Empty;
public string tbScrollsx = string.Empty;
public string tbScrollsy = string.Empty;
public List<string> tbResult = new List<string>();
#endregion
public cpsForm(mainForm form)
{
this._myParentForm = form;
}
private void cpsForm_Load(object sender, EventArgs e)
{
cbL0 = true;
cbL1 = true;
cbL2 = true;
cbL3 = true;
tbFile = "00";
tbPoint = "512,512,0,256";
cbLayer = 0;
tbCode = "0000";
tbColor = "00";
}
private void GetData()
{
tbScroll1x = CPS.scroll1x.ToString("X4");
tbScroll1y = CPS.scroll1y.ToString("X4");
tbScroll2x = CPS.scroll2x.ToString("X4");
tbScroll2y = CPS.scroll2y.ToString("X4");
tbScroll3x = CPS.scroll3x.ToString("X4");
tbScroll3y = CPS.scroll3y.ToString("X4");
tbScrollsx = CPS.scrollxSG.ToString();
tbScrollsy = CPS.scrollySG.ToString();
}
private Bitmap GetTile0(int gfxset, int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 4;
width = 0x200;
height = 0x200;
tilewidth = 8;
tileheight = 8;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x80 + gfxset * 8 + i1 + i2 * 16;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private Bitmap GetTile1(int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 2;
width = 0x200;
height = 0x200;
tilewidth = 16;
tileheight = 16;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x40 * 4 + i1 + i2 * 16;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private Bitmap GetTile2(int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 1;
width = 0x200;
height = 0x200;
tilewidth = 32;
tileheight = 32;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x40 * 16 + i1 + i2 * 16 * 2;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private void DumpRam()
{
BinaryWriter bw1 = new BinaryWriter(new FileStream("dump1.dat", FileMode.Create));
bw1.Write(Memory.mainram, 0, 0x10000);
bw1.Close();
BinaryWriter bw2 = new BinaryWriter(new FileStream("dump2.dat", FileMode.Create));
bw2.Write(CPS.gfxram, 0, 0x30000);
bw2.Close();
BinaryWriter bw3 = new BinaryWriter(new FileStream("dump3.dat", FileMode.Create));
int i;
for (i = 0; i < 0x20; i++)
{
bw3.Write(CPS.cps_a_regs[i]);
}
for (i = 0; i < 0x20; i++)
{
bw3.Write(CPS.cps_b_regs[i]);
}
bw3.Close();
}
private void WriteRam()
{
byte[] bb1 = new byte[0x10000], bb2 = new byte[0x30000], bb3 = new byte[0x80];
BinaryReader br1 = new BinaryReader(new FileStream("dump1.dat", FileMode.Open));
br1.Read(bb1, 0, 0x10000);
br1.Close();
Array.Copy(bb1, Memory.mainram, 0x10000);
BinaryReader br2 = new BinaryReader(new FileStream("dump2.dat", FileMode.Open));
br2.Read(bb2, 0, 0x30000);
br2.Close();
Array.Copy(bb2, CPS.gfxram, 0x30000);
BinaryReader br3 = new BinaryReader(new FileStream("dump3.dat", FileMode.Open));
br3.Read(bb3, 0, 0x80);
br3.Close();
int i;
for (i = 0; i < 0x20; i++)
{
CPS.cps_a_regs[i] = (ushort)(bb3[i * 2] + bb3[i * 2 + 1] * 0x100);
}
for (i = 0; i < 0x20; i++)
{
CPS.cps_b_regs[i] = (ushort)(bb3[0x40 + i * 2] + bb3[0x40 + i * 2 + 1] * 0x100);
}
}
}
}

View File

@ -0,0 +1,28 @@
using mame;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public class konami68000Form
{
private mainForm _myParentForm;
private int locationX, locationY;
#region
public bool cbT0 = false;
public bool cbT1 = false;
public bool cbT2 = false;
public bool cbSprite = false;
public Bitmap pictureBox1;
public string tbSprite;
#endregion
public konami68000Form(mainForm form)
{
this._myParentForm = form;
tbSprite = "0000-4000";
}
}
}

View File

@ -0,0 +1,200 @@
using cpu.m68000;
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public class m68000Form
{
private mainForm _myParentForm;
private string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" };
private bool bLogNew, bNew;
public static int iStatus, iRAddress, iWAddress, iROp, iWOp, iValue;
private int PPCTill, PPC, Addr;
private ulong CyclesTill, TotalExecutedCycles;
private List<int> lsAddr = new List<int>();
private List<int> lsPPC = new List<int>();
#region
string[] mTxList_tbDs;
string[] mTxList_tbAs;
Boolean[] mBList_cbDs;
Boolean[] mBList_cbAs;
List<Boolean> mBList_lsCB;
string mTx_tbPPC = string.Empty;
string mTx_tbOP = string.Empty;
Boolean b_cbS = false;
Boolean b_cbM = false;
Boolean b_cbX = false;
Boolean b_cbN = false;
Boolean b_cbZ = false;
Boolean b_cbV = false;
Boolean b_cbC = false;
Boolean b_cbPC = false;
Boolean b_cbTotal = false;
Boolean b_cbLog = false;
string mTx_tbIML = string.Empty;
string mTx_tbUSP = string.Empty;
string mTx_tbSSP = string.Empty;
string mTx_tbCycles = string.Empty;
string mTx_tbPC = string.Empty;
string mTx_tbDisassemble = string.Empty;
List<string> mTxList_tbResult = new List<string>();
public string mTx_tsslStatus = string.Empty;
#endregion
public enum M68000State
{
M68000_NONE = 0,
M68000_RUN,
M68000_STEP,
M68000_STEP2,
M68000_STEP3,
M68000_STOP,
}
public static M68000State m68000State, m68000FState;
public m68000Form(mainForm form)
{
this._myParentForm = form;
int i;
mTxList_tbDs = new string[8];
mTxList_tbAs = new string[8];
mBList_cbDs = new bool[8];
mBList_cbAs = new bool[8];
for (i = 0; i < 8; i++)
{
mTxList_tbDs[i] = string.Empty;
mBList_cbDs[i] = false;
mTxList_tbAs[i] = string.Empty;
mBList_cbAs[i] = false;
}
b_cbPC = false;
b_cbTotal = false;
mBList_lsCB = new List<bool>();
for (i = 0; i < 8; i++)
{
mBList_lsCB.Add(mBList_cbDs[i]);
mBList_lsCB.Add(mBList_cbAs[i]);
}
mBList_lsCB.Add(b_cbPC);
}
public void GetData()
{
int i;
string sDisassemble, sDisassemble2 = "";
for (i = 0; i < 8; i++)
{
mTxList_tbDs[i] = MC68000.m1.D[i].u32.ToString("X8");
mTxList_tbAs[i] = MC68000.m1.A[i].u32.ToString("X8");
}
mTx_tbPPC = MC68000.m1.PPC.ToString("X6");
mTx_tbOP = MC68000.m1.op.ToString("X4");
b_cbS = MC68000.m1.S;
b_cbM = MC68000.m1.M;
b_cbX = MC68000.m1.X;
b_cbN = MC68000.m1.N;
b_cbZ = MC68000.m1.Z;
b_cbV = MC68000.m1.V;
b_cbC = MC68000.m1.C;
mTx_tbIML = MC68000.m1.InterruptMaskLevel.ToString();
mTx_tbUSP = MC68000.m1.usp.ToString("X8");
mTx_tbSSP = MC68000.m1.ssp.ToString("X8");
mTx_tbCycles = MC68000.m1.TotalExecutedCycles.ToString("X16");
mTx_tbPC = MC68000.m1.PC.ToString("X6");
sDisassemble = MC68000.m1.Disassemble(MC68000.m1.PPC).ToString();
mTx_tbDisassemble = sDisassemble;
sDisassemble2 = sDisassemble;
foreach (bool cb in mBList_lsCB)
{
if (cb)
{
//sDisassemble2 += " " + cb + cb.TB.Text;
sDisassemble2 += " " + cb + cb;
}
}
if (b_cbTotal)
{
sDisassemble2 = MC68000.m1.TotalExecutedCycles.ToString("X") + " " + sDisassemble2;
}
mTxList_tbResult.Add(sDisassemble2 + "\r\n");
}
public void m68000_start_debug()
{
if (bLogNew && lsPPC.IndexOf(MC68000.m1.PPC) < 0)
{
m68000FState = m68000State;
m68000State = M68000State.M68000_STOP;
lsPPC.Add(MC68000.m1.PPC);
mTxList_tbResult.Add(MC68000.m1.Disassemble(MC68000.m1.PPC).ToString() + "\r\n");
m68000State = m68000FState;
}
PPC = MC68000.m1.PPC;
TotalExecutedCycles = MC68000.m1.TotalExecutedCycles;
if (iStatus == 1)
{
iStatus = 0;
}
if (m68000State == M68000State.M68000_STEP2)
{
if (MC68000.m1.PPC == PPCTill)
{
m68000State = M68000State.M68000_STOP;
}
}
if (m68000State == M68000State.M68000_STEP3)
{
if (MC68000.m1.TotalExecutedCycles >= CyclesTill)
{
m68000State = M68000State.M68000_STOP;
}
}
if (b_cbLog == true && (m68000State == M68000State.M68000_STEP2 || m68000State == M68000State.M68000_STEP3))
{
GetData();
}
if (m68000State == M68000State.M68000_STOP)
{
GetData();
mTx_tsslStatus = "m68000 stop";
}
while (m68000State == M68000State.M68000_STOP)
{
}
}
public void m68000_stop_debug()
{
if (iStatus == 1)
{
GetData();
m68000State = M68000State.M68000_STOP;
mTx_tsslStatus = "m68000 stop";
iStatus = 2;
}
if (m68000State == M68000State.M68000_STEP)
{
m68000State = M68000State.M68000_STOP;
mTx_tsslStatus = "m68000 stop";
}
if (iStatus == 0)
{
/*if(Memory.mainram[0xd1b]==0x05)
{
iStatus = 1;
GetData();
m68000State = M68000State.M68000_STOP;
tsslStatus.Text = "m68000 stop";
}*/
}
}
}
}

View File

@ -0,0 +1,111 @@
using cpu.m6809;
using mame;
using System;
using System.Collections.Generic;
using System.Globalization;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public partial class m6809Form
{
private mainForm _myParentForm;
//private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
private int PPCTill;
private ulong CyclesTill;
private List<ushort> lPPC = new List<ushort>();
public static CPUState m6809State, m6809FState;
#region
public List<string> tbResult = new List<string>();
public string tsslStatus = string.Empty;
public string tbD = string.Empty;
public string tbDp = string.Empty;
public string tbU = string.Empty;
public string tbS = string.Empty;
public string tbX = string.Empty;
public string tbY = string.Empty;
public string tbCc = string.Empty;
public string tbIrqstate0 = string.Empty;
public string tbIrqstate1 = string.Empty;
public string tbIntstate = string.Empty;
public string tbNmistate = string.Empty;
public string tbPPC = string.Empty;
public string tbCycles = string.Empty;
public string tbDisassemble = string.Empty;
#endregion
public m6809Form(mainForm form)
{
this._myParentForm = form;
}
public void GetData()
{
int reg, offset;
reg = M6809.mm1[0].PPC.LowWord / 0x2000;
offset = M6809.mm1[0].PPC.LowWord & 0x1fff;
tbD = M6809.mm1[0].D.LowWord.ToString("X4");
tbDp = M6809.mm1[0].DP.LowWord.ToString("X4");
tbU = M6809.mm1[0].U.LowWord.ToString("X4");
tbS = M6809.mm1[0].S.LowWord.ToString("X4");
tbX = M6809.mm1[0].X.LowWord.ToString("X4");
tbY = M6809.mm1[0].Y.LowWord.ToString("X4");
tbCc = M6809.mm1[0].CC.ToString("X2");
tbIrqstate0 = M6809.mm1[0].irq_state[0].ToString("X2");
tbIrqstate1 = M6809.mm1[0].irq_state[1].ToString("X2");
tbIntstate = M6809.mm1[0].int_state.ToString("X2");
tbNmistate = M6809.mm1[0].nmi_state.ToString("X2");
tbPPC = (Namcos1.user1rom_offset[0, reg] + offset).ToString("X6");
tbCycles = M6809.mm1[0].TotalExecutedCycles.ToString("X16");
tbDisassemble = M6809.mm1[0].m6809_dasm(M6809.mm1[0].PPC.LowWord);
}
public void m6809_start_debug()
{
if (bLogNew && lPPC.IndexOf(M6809.mm1[0].PPC.LowWord) < 0)
{
m6809FState = m6809State;
m6809State = CPUState.STOP;
lPPC.Add(M6809.mm1[0].PPC.LowWord);
tbResult.Add(M6809.mm1[0].PPC.LowWord.ToString("X4") + ": ");
m6809State = m6809FState;
}
if (m6809State == CPUState.STEP2)
{
if (M6809.mm1[0].PPC.LowWord == PPCTill)
{
m6809State = CPUState.STOP;
}
}
if (m6809State == CPUState.STEP3)
{
if (M6809.mm1[0].TotalExecutedCycles >= CyclesTill)
{
m6809State = CPUState.STOP;
}
}
if (m6809State == CPUState.STOP)
{
GetData();
tsslStatus = "m6809 stop";
}
while (m6809State == CPUState.STOP)
{
Video.video_frame_update();
//??
//Application.DoEvents();
}
}
public void m6809_stop_debug()
{
if (m6809State == CPUState.STEP)
{
m6809State = CPUState.STOP;
tsslStatus = "m6809 stop";
}
}
}
}

View File

@ -0,0 +1,513 @@
using mame;
using MAME.Core.run_interface;
using System.IO;
using System.Security.Cryptography;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Drawing;
namespace MAME.Core.Common
{
public class mainForm
{
public string tsslStatus;
public cheatForm cheatform;
public m68000Form m68000form;
public z80Form z80form;
public m6809Form m6809form;
public cpsForm cpsform;
public neogeoForm neogeoform;
public konami68000Form konami68000form;
public string sSelect;
public static IResources resource;
public mainForm()
{
neogeoform = new neogeoForm(this);
cheatform = new cheatForm(this);
m68000form = new m68000Form(this);
m6809form = new m6809Form(this);
z80form = new z80Form(this);
cpsform = new cpsForm(this);
konami68000form = new konami68000Form(this);
}
public void Init(IVideoPlayer Ivp,ISoundPlayer isp,IResources iRes)
{
Video.BindFunc(Ivp);
Sound.BindFunc(isp);
resource = iRes;
StreamReader sr1 = new StreamReader("mame.ini");
sr1.ReadLine();
sSelect = sr1.ReadLine();
sr1.Close();
RomInfo.Rom = new RomInfo();
//TODO Wavebuffer
//desc1.BufferBytes = 0x9400;
Keyboard.InitializeInput(this);
Mouse.InitialMouse(this);
}
public void LoadRom(string Name)
{
RomInfo.Rom = RomInfo.GetRomByName(Name);
if (RomInfo.Rom == null)
{
Console.WriteLine("Not Found");
return;
}
mame.Timer.lt = new List<mame.Timer.emu_timer>();
sSelect = RomInfo.Rom.Name;
Machine.FORM = this;
Machine.rom = RomInfo.Rom;
Machine.sName = Machine.rom.Name;
Machine.sParent = Machine.rom.Parent;
Machine.sBoard = Machine.rom.Board;
Machine.sDirection = Machine.rom.Direction;
Machine.sDescription = Machine.rom.Description;
Machine.sManufacturer = Machine.rom.Manufacturer;
Machine.lsParents = RomInfo.GetParents(Machine.sName);
int i;
switch (Machine.sBoard)
{
case "CPS-1":
case "CPS-1(QSound)":
case "CPS2":
Video.nMode = 3;
itemSelect();
CPS.CPSInit();
CPS.GDIInit();
break;
case "Data East":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Dataeast.DataeastInit();
Dataeast.GDIInit();
break;
case "Tehkan":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Tehkan.PbactionInit();
Tehkan.GDIInit();
break;
case "Neo Geo":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Neogeo.NeogeoInit();
Neogeo.GDIInit();
break;
case "SunA8":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
SunA8.SunA8Init();
SunA8.GDIInit();
break;
case "Namco System 1":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Namcos1.Namcos1Init();
Namcos1.GDIInit();
break;
case "IGS011":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
IGS011.IGS011Init();
IGS011.GDIInit();
break;
case "PGM":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
PGM.PGMInit();
PGM.GDIInit();
break;
case "M72":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
M72.M72Init();
M72.GDIInit();
break;
case "M92":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
M92.M92Init();
M92.GDIInit();
break;
case "Taito":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Taito.TaitoInit();
Taito.GDIInit();
break;
case "Taito B":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Taitob.TaitobInit();
Taitob.GDIInit();
break;
case "Konami 68000":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Konami68000.Konami68000Init();
Konami68000.GDIInit();
break;
case "Capcom":
Video.nMode = 1;
Video.iMode = 0;
itemSelect();
Capcom.CapcomInit();
Capcom.GDIInit();
break;
}
if (Machine.bRom)
{
Console.Write("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
Mame.init_machine(this);
Generic.nvram_load();
}
else
{
Console.Write("error rom");
}
}
private void itemSelect()
{
switch (Machine.sBoard)
{
case "CPS-1":
case "CPS-1(QSound)":
case "CPS2":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 0;
Video.width = 512;
Video.height = 512;
}
else if (Video.iMode == 1)
{
Video.offsetx = 0;
Video.offsety = 256;
Video.width = 512;
Video.height = 256;
}
else if (Video.iMode == 2)
{
Video.offsetx = 64;
Video.offsety = 272;
Video.width = 384;
Video.height = 224;
}
break;
case "Data East":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 256;
Video.height = 224;
}
break;
case "Tehkan":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 256;
Video.height = 224;
}
break;
case "Neo Geo":
if (Video.iMode == 0)
{
Video.offsetx = 30;
Video.offsety = 16;
Video.width = 320;
Video.height = 224;
}
break;
case "SunA8":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 256;
Video.height = 224;
}
break;
case "Namco System 1":
if (Video.iMode == 0)
{
Video.offsetx = 73;
Video.offsety = 16;
Video.width = 288;
Video.height = 224;
}
break;
case "IGS011":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 0;
Video.width = 512;
Video.height = 240;
}
break;
case "PGM":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 0;
Video.width = 448;
Video.height = 224;
}
break;
case "M72":
if (Video.iMode == 0)
{
Video.offsetx = 64;
Video.offsety = 0;
Video.width = 384;
Video.height = 256;
}
break;
case "M92":
if (Video.iMode == 0)
{
Video.offsetx = 80;
Video.offsety = 8;
Video.width = 320;
Video.height = 240;
}
break;
case "Taito":
if (Video.iMode == 0)
{
switch (Machine.sName)
{
case "tokio":
case "tokioo":
case "tokiou":
case "tokiob":
case "bublbobl":
case "bublbobl1":
case "bublboblr":
case "bublboblr1":
case "boblbobl":
case "sboblbobl":
case "sboblbobla":
case "sboblboblb":
case "sboblbobld":
case "sboblboblc":
case "bub68705":
case "dland":
case "bbredux":
case "bublboblb":
case "bublcave":
case "boblcave":
case "bublcave11":
case "bublcave10":
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 256;
Video.height = 224;
break;
case "opwolf":
case "opwolfa":
case "opwolfj":
case "opwolfu":
case "opwolfb":
case "opwolfp":
Video.offsetx = 0;
Video.offsety = 8;
Video.width = 320;
Video.height = 240;
break;
}
}
break;
case "Taito B":
if (Video.iMode == 0)
{
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 320;
Video.height = 224;
}
break;
case "Konami 68000":
if (Video.iMode == 0)
{
switch (Machine.sName)
{
case "cuebrick":
case "mia":
case "mia2":
case "tmnt2":
case "tmnt2a":
case "tmht22pe":
case "tmht24pe":
case "tmnt22pu":
case "qgakumon":
Video.offsetx = 104;
Video.offsety = 16;
Video.width = 304;
Video.height = 224;
break;
case "tmnt":
case "tmntu":
case "tmntua":
case "tmntub":
case "tmht":
case "tmhta":
case "tmhtb":
case "tmntj":
case "tmnta":
case "tmht2p":
case "tmht2pa":
case "tmnt2pj":
case "tmnt2po":
case "lgtnfght":
case "lgtnfghta":
case "lgtnfghtu":
case "trigon":
case "blswhstl":
case "blswhstla":
case "detatwin":
Video.offsetx = 96;
Video.offsety = 16;
Video.width = 320;
Video.height = 224;
break;
case "punkshot":
case "punkshot2":
case "punkshotj":
case "glfgreat":
case "glfgreatj":
case "ssriders":
case "ssriderseaa":
case "ssridersebd":
case "ssridersebc":
case "ssridersuda":
case "ssridersuac":
case "ssridersuab":
case "ssridersubc":
case "ssridersadd":
case "ssridersabd":
case "ssridersjad":
case "ssridersjac":
case "ssridersjbd":
case "thndrx2":
case "thndrx2a":
case "thndrx2j":
case "prmrsocr":
case "prmrsocrj":
Video.offsetx = 112;
Video.offsety = 16;
Video.width = 288;
Video.height = 224;
break;
}
}
break;
case "Capcom":
if (Video.iMode == 0)
{
switch (Machine.sName)
{
case "gng":
case "gnga":
case "gngbl":
case "gngprot":
case "gngblita":
case "gngc":
case "gngt":
case "makaimur":
case "makaimurc":
case "makaimurg":
case "diamond":
Video.offsetx = 0;
Video.offsety = 16;
Video.width = 256;
Video.height = 224;
break;
case "sf":
case "sfua":
case "sfj":
case "sfjan":
case "sfan":
case "sfp":
Video.offsetx = 64;
Video.offsety = 16;
Video.width = 384;
Video.height = 224;
break;
}
}
break;
}
switch (Machine.sDirection)
{
case "":
case "180":
TempWidth = Video.width + 38;
TempHeight = Video.height + 108;
break;
case "90":
case "270":
TempWidth = Video.height + 38;
TempHeight = Video.width + 108;
break;
}
ResizeMain();
}
int TempWidth = 0;
int TempHeight = 0;
private void ResizeMain()
{
int deltaX, deltaY;
//switch (Machine.sDirection)
//{
// case "":
// case "180":
// deltaX = TempWidth - (Video.width + 38);
// deltaY = TempHeight - (Video.height + 108);
// pictureBox1.Width = Video.width + deltaX;
// pictureBox1.Height = Video.height + deltaY;
// break;
// case "90":
// case "270":
// deltaX = TempWidth - (Video.height + 38);
// deltaY = TempHeight - (Video.width + 108);
// pictureBox1.Width = Video.height + deltaX;
// pictureBox1.Height = Video.width + deltaY;
// break;
//}
//TODO reset 宽高
}
}
}

View File

@ -0,0 +1,99 @@
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public partial class neogeoForm
{
private mainForm _myParentForm;
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
public List<string> tbResult;
public string tbSprite = string.Empty;
public string tbPoint = string.Empty;
public string tbFile = string.Empty;
public string tbSOffset = string.Empty;
public string tbPensoffset = string.Empty;
public Bitmap pictureBox1;
#region
bool cbL0 = false;
bool cbL1 = false;
#endregion
public neogeoForm(mainForm form)
{
this._myParentForm = form;
tbResult = new List<string>();
neogeoForm_Load();
}
private void neogeoForm_Load()
{
cbL0 = true;
cbL1 = true;
tbSprite = "000-17C";
tbFile = "00";
tbPoint = "350,240,30,16";
tbSOffset = "01cb0600";
tbPensoffset = "ed0";
}
private void DumpRam()
{
int i, j;
BinaryWriter bw1 = new BinaryWriter(new FileStream("dump1.dat", FileMode.Create));
bw1.Write(Memory.mainram, 0, 0x10000);
bw1.Close();
BinaryWriter bw2 = new BinaryWriter(new FileStream("dump2.dat", FileMode.Create));
bw2.Write(Neogeo.mainram2, 0, 0x10000);
bw2.Close();
BinaryWriter bw3 = new BinaryWriter(new FileStream("dump3.dat", FileMode.Create));
for (i = 0; i < 0x10000; i++)
{
bw3.Write(Neogeo.neogeo_videoram[i]);
}
BinaryWriter bw4 = new BinaryWriter(new FileStream("dump4.dat", FileMode.Create));
for (i = 0; i < 2; i++)
{
for (j = 0; j < 0x1000; j++)
{
bw4.Write(Neogeo.palettes[i, j]);
}
}
}
private void WriteRam()
{
int i, j;
byte[] bb1 = new byte[0x10000], bb2 = new byte[0x10000], bb3 = new byte[0x20000], bb4 = new byte[0x4000];
BinaryReader br1 = new BinaryReader(new FileStream("dump1.dat", FileMode.Open));
br1.Read(bb1, 0, 0x10000);
br1.Close();
Array.Copy(bb1, Memory.mainram, 0x10000);
BinaryReader br2 = new BinaryReader(new FileStream("dump2.dat", FileMode.Open));
br2.Read(bb2, 0, 0x10000);
br2.Close();
Array.Copy(bb2, Neogeo.mainram2, 0x10000);
BinaryReader br3 = new BinaryReader(new FileStream("dump3.dat", FileMode.Open));
br3.Read(bb3, 0, 0x20000);
br3.Close();
for (i = 0; i < 0x10000; i++)
{
Neogeo.neogeo_videoram[i] = (ushort)(bb3[i * 2] + bb3[i * 2 + 1] * 0x100);
}
BinaryReader br4 = new BinaryReader(new FileStream("dump4.dat", FileMode.Open));
br4.Read(bb4, 0, 0x4000);
br4.Close();
for (i = 0; i < 2; i++)
{
for (j = 0; j < 0x1000; j++)
{
Neogeo.palettes[i, j] = (ushort)(bb4[i * 0x2000 + j * 2] + bb4[i * 0x2000 + j * 2 + 1] * 0x100);
}
}
}
}
}

137
MAME.Core/Common/z80Form.cs Normal file
View File

@ -0,0 +1,137 @@
using cpu.z80;
using System;
using System.Collections.Generic;
using System.Globalization;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public enum CPUState
{
NONE = 0,
RUN,
STEP,
STEP2,
STEP3,
STOP,
}
public partial class z80Form
{
private mainForm _myParentForm;
private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
private int PPCTill;
private ulong CyclesTill;
private List<ushort> lPPC = new List<ushort>();
#region
string mTx_tbAF = string.Empty;
string mTx_tbBC = string.Empty;
string mTx_tbDE = string.Empty;
string mTx_tbHL = string.Empty;
string mTx_tbShadowAF = string.Empty;
string mTx_tbShadowBC = string.Empty;
string mTx_tbShadowDE = string.Empty;
string mTx_tbShadowHL = string.Empty;
string mTx_tbI = string.Empty;
string mTx_tbR = string.Empty;
string mTx_tbIX = string.Empty;
string mTx_tbIY = string.Empty;
string mTx_tbSP = string.Empty;
string mTx_tbRPC = string.Empty;
string mTx_tbPPC = string.Empty;
string mTx_tbR2 = string.Empty;
string mTx_tbWZ = string.Empty;
string mTx_tbCycles = string.Empty;
string mTx_tbDisassemble = string.Empty;
public string mTx_tsslStatus = string.Empty;
List<string> mTxList_tbResult = new List<string>();
#endregion
public enum Z80AState
{
Z80A_NONE = 0,
Z80A_RUN,
Z80A_STEP,
Z80A_STEP2,
Z80A_STEP3,
Z80A_STOP,
}
public static Z80AState z80State, z80FState;
public z80Form(mainForm form)
{
this._myParentForm = form;
disassembler = new Disassembler();
Disassembler.GenerateOpcodeSizes();
}
public void GetData()
{
string sDisassemble;
mTx_tbAF = Z80A.zz1[0].RegisterAF.ToString("X4");
mTx_tbBC = Z80A.zz1[0].RegisterBC.ToString("X4");
mTx_tbDE = Z80A.zz1[0].RegisterDE.ToString("X4");
mTx_tbHL = Z80A.zz1[0].RegisterHL.ToString("X4");
mTx_tbShadowAF = Z80A.zz1[0].RegisterShadowAF.ToString("X4");
mTx_tbShadowBC = Z80A.zz1[0].RegisterShadowBC.ToString("X4");
mTx_tbShadowDE = Z80A.zz1[0].RegisterShadowDE.ToString("X4");
mTx_tbShadowHL = Z80A.zz1[0].RegisterShadowHL.ToString("X4");
mTx_tbI = Z80A.zz1[0].RegisterI.ToString("X2");
mTx_tbR = Z80A.zz1[0].RegisterR.ToString("X2");
mTx_tbIX = Z80A.zz1[0].RegisterIX.ToString("X4");
mTx_tbIY = Z80A.zz1[0].RegisterIY.ToString("X4");
mTx_tbSP = Z80A.zz1[0].RegisterSP.ToString("X4");
mTx_tbRPC = Z80A.zz1[0].RegisterPC.ToString("X4");
mTx_tbPPC = Z80A.zz1[0].PPC.ToString("X4");
mTx_tbR2 = Z80A.zz1[0].RegisterR2.ToString("X2");
mTx_tbWZ = Z80A.zz1[0].RegisterWZ.ToString("X4");
mTx_tbCycles = Z80A.zz1[0].TotalExecutedCycles.ToString("X16");
sDisassemble = disassembler.GetDisassembleInfo(Z80A.zz1[0].PPC);
mTx_tbDisassemble = sDisassemble;
mTxList_tbResult.Add(sDisassemble + "\r\n");
}
public void z80_start_debug()
{
if (bLogNew && lPPC.IndexOf(Z80A.zz1[0].PPC) < 0)
{
z80FState = z80State;
z80State = Z80AState.Z80A_STOP;
lPPC.Add(Z80A.zz1[0].PPC);
mTxList_tbResult.Add(Z80A.zz1[0].PPC.ToString("X4") + ": " + disassembler.GetDisassembleInfo(Z80A.zz1[0].PPC) + "\r\n");
z80State = z80FState;
}
if (z80State == Z80AState.Z80A_STEP2)
{
if (Z80A.zz1[0].PPC == PPCTill)
{
z80State = Z80AState.Z80A_STOP;
}
}
if (z80State == Z80AState.Z80A_STEP3)
{
if (Z80A.zz1[0].TotalExecutedCycles >= CyclesTill)
{
z80State = Z80AState.Z80A_STOP;
}
}
if (z80State == Z80AState.Z80A_STOP)
{
GetData();
mTx_tsslStatus = "z80 stop";
}
while (z80State == Z80AState.Z80A_STOP)
{
}
}
public void z80_stop_debug()
{
if (z80State == Z80AState.Z80A_STEP)
{
z80State = Z80AState.Z80A_STOP;
mTx_tsslStatus = "z80 stop";
}
}
}
}

View File

@ -2,6 +2,11 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ImageProcessor.Core" Version="1.1.0" />
</ItemGroup>
</Project>

View File

@ -11,9 +11,6 @@
//please note that however much youre tempted to, timings can't be put in a table here because they depend on how the instruction executes at runtime
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.z80
{

View File

@ -5,6 +5,7 @@ using cpu.m6805;
using cpu.m6809;
using cpu.nec;
using cpu.z80;
using MAME.Core.Common;
using System;
using System.IO;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
@ -47,27 +43,27 @@ namespace mame
bitmapGDI.UnlockBits(bitmapData);
if (Wintime.osd_ticks() < popup_text_end)
{
Machine.FORM.tsslStatus.Text = sDrawText;
Machine.FORM.tsslStatus = sDrawText;
}
else
{
popup_text_end = 0;
if (Mame.paused)
{
Machine.FORM.tsslStatus.Text = "pause";
Machine.FORM.tsslStatus = "pause";
}
else
{
switch (Mame.playState)
{
case Mame.PlayState.PLAY_RECORDRUNNING:
Machine.FORM.tsslStatus.Text = "record";
Machine.FORM.tsslStatus = "record";
break;
case Mame.PlayState.PLAY_REPLAYRUNNING:
Machine.FORM.tsslStatus.Text = "replay";
Machine.FORM.tsslStatus = "replay";
break;
default:
Machine.FORM.tsslStatus.Text = "run";
Machine.FORM.tsslStatus = "run";
break;
}
}
@ -87,7 +83,8 @@ namespace mame
bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone);
break;
}
Machine.FORM.pictureBox1.Image = bbmp[iMode];
//Machine.FORM.pictureBox1.Image = bbmp[iMode];
SubmitVideo(bbmp[iMode]);
}
catch
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,5 @@
using System;
using MAME.Core;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
namespace mame
{

View File

@ -1,26 +1,18 @@
using Microsoft.DirectX.DirectInput;
using System.Runtime.InteropServices;
using System;
using ui;
using DIDevice = Microsoft.DirectX.DirectInput.Device;
using MAME.Core;
using MAME.Core.Common;
namespace mame
{
public class Keyboard
{
public static bool bF10;
public static DIDevice dIDevice;
// 需要引入的Windows API函数声明此处省略具体实现
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern IntPtr SetupDiGetClassDevs(ref Guid ClassGuid, string Enumerator, IntPtr hwndParent, uint Flags);
//public static DIDevice dIDevice;
public static void InitializeInput(mainForm form1)
{
dIDevice = new DIDevice(SystemGuid.Keyboard);
dIDevice.SetCooperativeLevel(form1, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
dIDevice.Acquire();
//dIDevice = new DIDevice(SystemGuid.Keyboard);
//dIDevice.SetCooperativeLevel(form1, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
//dIDevice.Acquire();
}
struct KeyState
{
@ -39,7 +31,8 @@ namespace mame
}
public static void Update()
{
for (int i = 0; i < 256; i++)
//TODO
/*for (int i = 0; i < 256; i++)
{
m_KeyStates[i].IsPressed = false;
}
@ -67,6 +60,7 @@ namespace mame
m_KeyStates[i].IsTriggered = false;
}
}
*/
}
}
}

View File

@ -1,9 +1,6 @@
using System;
using MAME.Core.Common;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using ui;
namespace mame
{

View File

@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MAME.Core;
using MAME.Core.Common;
using MAME.Core.run_interface;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.DirectX.DirectInput;
using ui;
namespace mame
{
public class Mame
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
public enum PlayState
{
PLAY_RUNNING = 0,
@ -28,7 +24,6 @@ namespace mame
PLAY_REPLAYEND,
}
public static PlayState playState;
public static IntPtr handle1, handle2, handle3, handle4;
public static bool is_foreground;
public static bool paused, exit_pending;
public static Timer.emu_timer soft_reset_timer;
@ -137,51 +132,22 @@ namespace mame
}
public static void init_machine(mainForm form)
{
//fileio_init();
//config_init();
Inptport.input_init();
//output_init();
Palette.palette_init();
//render_init();
//ui_init();
Generic.generic_machine_init();
Timer.timer_init();
soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false);
Window.osd_init(form);
//time(&mame->base_time);
Inptport.input_port_init();
//if (newbase != 0)
// mame->base_time = newbase;
/* intialize UI input */
//ui_input_init();
//rom_init();
//memory_init();
Cpuexec.cpuexec_init();
Watchdog.watchdog_init();
Cpuint.cpuint_init();
//cps1_gfx_decode();
//device_list_start();
Machine.driver_init();
Video.video_init();
Tilemap.tilemap_init();
Crosshair.crosshair_init();
Sound.sound_init();
State.state_init();
Machine.machine_start();
}
public static void mame_pause(bool pause)
@ -210,15 +176,8 @@ namespace mame
}
private static void handle_save()
{
handle2 = GetForegroundWindow();
if (handle1 == handle2)
{
is_foreground = true;
}
else
{
is_foreground = false;
}
//是否焦点
is_foreground = true;
if (is_foreground)
{
Video.sDrawText = "Select position to save to";
@ -260,15 +219,8 @@ namespace mame
}
private static void handle_load()
{
handle2 = GetForegroundWindow();
if (handle1 == handle2)
{
is_foreground = true;
}
else
{
is_foreground = false;
}
//是否焦点
bool is_foreground = true;
if (is_foreground)
{
Video.sDrawText = "Select position to load from";
@ -323,15 +275,8 @@ namespace mame
}
private static void handle_record()
{
handle2 = GetForegroundWindow();
if (handle1 == handle2)
{
is_foreground = true;
}
else
{
is_foreground = false;
}
//是否焦点
bool is_foreground = true;
if (is_foreground)
{
if (playState == PlayState.PLAY_RECORDSTART)
@ -393,15 +338,8 @@ namespace mame
}
private static void handle_replay()
{
handle2 = GetForegroundWindow();
if (handle1 == handle2)
{
is_foreground = true;
}
else
{
is_foreground = false;
}
//是否焦点
bool is_foreground = true;
if (is_foreground)
{
if (playState == PlayState.PLAY_REPLAYSTART)

View File

@ -1,33 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using DIDevice = Microsoft.DirectX.DirectInput.Device;
using ui;
using MAME.Core.Common;
namespace mame
{
public class Mouse
{
public static DIDevice mouseDevice;
//public static DIDevice mouseDevice;
public static int deltaX, deltaY, oldX, oldY;
public static byte[] buttons;
public static void InitialMouse(mainForm form1)
{
mouseDevice = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Mouse);
mouseDevice.Properties.AxisModeAbsolute = true;
mouseDevice.SetCooperativeLevel(form1, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
mouseDevice.Acquire();
//mouseDevice = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Mouse);
//mouseDevice.Properties.AxisModeAbsolute = true;
//mouseDevice.SetCooperativeLevel(form1, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
//mouseDevice.Acquire();
}
public static void Update()
{
MouseState mouseState = mouseDevice.CurrentMouseState;
deltaX = mouseState.X - oldX;
deltaY = mouseState.Y - oldY;
oldX = mouseState.X;
oldY = mouseState.Y;
buttons = mouseState.GetMouseButtons();
//TODO
//MouseState mouseState = mouseDevice.CurrentMouseState;
//deltaX = mouseState.X - oldX;
//deltaY = mouseState.Y - oldY;
//oldX = mouseState.X;
//oldY = mouseState.Y;
//buttons = mouseState.GetMouseButtons();
}
}
}

View File

@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using MAME.Core;
using MAME.Core.Common;
using System;
using System.Runtime.InteropServices;
using Microsoft.DirectX.DirectInput;
using ui;
namespace mame
{
@ -182,15 +177,16 @@ namespace mame
}
public static void handler_ingame()
{
Mame.handle2 = GetForegroundWindow();
if (Mame.handle1 == Mame.handle2)
{
Mame.is_foreground = true;
}
else
{
Mame.is_foreground = false;
}
//Mame.handle2 = GetForegroundWindow();
//if (Mame.handle1 == Mame.handle2)
//{
// Mame.is_foreground = true;
//}
//else
//{
// Mame.is_foreground = false;
//}
Mame.is_foreground = true;
bool is_paused = Mame.mame_is_paused();
if (single_step)
{
@ -260,9 +256,9 @@ namespace mame
public static void cpurun()
{
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
Machine.FORM.m68000form.tsslStatus.Text = "run";
Machine.FORM.m68000form.mTx_tsslStatus = "run";
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Machine.FORM.z80form.tsslStatus.Text = "run";
Machine.FORM.z80form.mTx_tsslStatus = "run";
}
private static double ui_get_line_height()
{

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using MAME.Core.run_interface;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
@ -64,6 +60,24 @@ namespace mame
private static int NEOGEO_VBEND = 0x010;
private static int NEOGEO_VBSTART = 0x0f0;//240
private static int NEOGEO_VBLANK_RELOAD_HPOS = 0x11f;//287
#region
static Action<Bitmap> Act_SubmitVideo;
public static void BindFunc(IVideoPlayer Ivp)
{
Act_SubmitVideo -= Act_SubmitVideo;
Act_SubmitVideo += Ivp.SubmitVideo;
}
static void SubmitVideo(Bitmap Bitmap)
{
Act_SubmitVideo?.Invoke(Bitmap);
}
#endregion
public static void video_init()
{
Wintime.wintime_init();
@ -878,7 +892,7 @@ namespace mame
Mouse.Update();
Inptport.frame_update_callback();
UI.ui_update_and_render();
if(Machine.FORM.cheatform.lockState == ui.cheatForm.LockState.LOCK_FRAME)
if(Machine.FORM.cheatform.lockState == MAME.Core.Common.cheatForm.LockState.LOCK_FRAME)
{
Machine.FORM.cheatform.ApplyCheat();
}
@ -1041,4 +1055,5 @@ namespace mame
screenstate.frame_number = reader.ReadInt64();
}
}
}

View File

@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MAME.Core.Common;
using System;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using ui;
namespace mame
{
@ -16,50 +10,10 @@ namespace mame
private static mainForm _myParentForm;
[DllImport("kernel32.dll ")]
private static extern uint GetTickCount();
[DllImport("user32.dll", EntryPoint="GetWindowRect")]
private static extern int GetWindowRect(IntPtr hwnd, out RECT lpRect);
[DllImport("user32.dll", EntryPoint="GetCursorPos")]
public static extern bool GetCursorPos(ref Point lpPoint);
[DllImport("user32.dll", EntryPoint = "ClipCursor")]
private static extern bool ClipCursor(ref RECT lpRect);
[DllImport("user32.dll", EntryPoint = "GetDesktopWindow", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll", EntryPoint = "SetCursorPos")]
private static extern int SetCursorPos(int x, int y);
public static bool input_enabled,input_paused, mouse_enabled, lightgun_enabled;
public static uint last_poll, last_event_check;
private static bool _CursorShown = true;
public static bool CursorShown
{
get
{
return _CursorShown;
}
set
{
if (value == _CursorShown)
{
return;
}
if (value)
{
_myParentForm.Invoke((MethodInvoker)delegate
{
Cursor.Show();
});
}
else
{
_myParentForm.Invoke((MethodInvoker)delegate
{
Cursor.Hide();
});
}
_CursorShown = value;
}
}
public static void osd_update(bool skip_redraw)
{
if (!skip_redraw)
@ -73,7 +27,6 @@ namespace mame
public static void winwindow_process_events(bool ingame)
{
last_event_check = GetTickCount();
winwindow_update_cursor_state();
}
public static void wininput_poll()
{
@ -92,32 +45,6 @@ namespace mame
}
winwindow_process_events(true);
}
public static void winwindow_update_cursor_state()
{
Point saved_cursor_pos = new Point(-1, -1);
RECT bounds4;
Mame.handle2 = GetForegroundWindow();
if (Mame.handle1 == Mame.handle2 && (!Mame.mame_is_paused() && wininput_should_hide_mouse()))
{
RECT bounds;
CursorShown = false;
GetCursorPos(ref saved_cursor_pos);
GetWindowRect(Mame.handle3, out bounds);
ClipCursor(ref bounds);
}
else
{
CursorShown = true;
Mame.handle4 = GetDesktopWindow();
GetWindowRect(Mame.handle4, out bounds4);
ClipCursor(ref bounds4);
if (saved_cursor_pos.X != -1 || saved_cursor_pos.Y != -1)
{
SetCursorPos(saved_cursor_pos.X, saved_cursor_pos.Y);
saved_cursor_pos.X = saved_cursor_pos.Y = -1;
}
}
}
public static void osd_init(mainForm form)
{
_myParentForm = form;

167
MAME.Core/key.cs Normal file
View File

@ -0,0 +1,167 @@
namespace MAME.Core
{
public enum Key
{
Next = 209,
Right = 205,
Left = 203,
Convert = 121,
Decimal = 83,
N = 49,
Q = 16,
Circumflex = 144,
PageDown = 209,
DownArrow = 208,
RightArrow = 205,
LeftArrow = 203,
PageUp = 201,
UpArrow = 200,
RightAlt = 184,
NumPadSlash = 181,
NumPadPeriod = 83,
NumPadPlus = 78,
NumPadMinus = 74,
CapsLock = 58,
LeftAlt = 56,
NumPadStar = 55,
BackSpace = 14,
MediaSelect = 237,
Mail = 236,
MyComputer = 235,
WebBack = 234,
WebForward = 233,
WebStop = 232,
WebRefresh = 231,
WebFavorites = 230,
WebSearch = 229,
Wake = 227,
Sleep = 223,
Power = 222,
Apps = 221,
RightWindows = 220,
LeftWindows = 219,
Delete = 211,
Insert = 210,
Down = 208,
End = 207,
Prior = 201,
Up = 200,
Home = 199,
Pause = 197,
RightMenu = 184,
SysRq = 183,
Divide = 181,
NumPadComma = 179,
WebHome = 178,
VolumeUp = 176,
VolumeDown = 174,
MediaStop = 164,
PlayPause = 162,
Calculator = 161,
Mute = 160,
RightControl = 157,
NumPadEnter = 156,
NextTrack = 153,
Unlabeled = 151,
AX = 150,
Stop = 149,
Kanji = 148,
Underline = 147,
Colon = 146,
At = 145,
PrevTrack = 144,
NumPadEquals = 141,
AbntC2 = 126,
Yen = 125,
NoConvert = 123,
AbntC1 = 115,
Kana = 112,
F15 = 102,
F14 = 101,
F13 = 100,
F12 = 88,
F11 = 87,
OEM102 = 86,
NumPad0 = 82,
NumPad3 = 81,
NumPad2 = 80,
NumPad1 = 79,
Add = 78,
NumPad6 = 77,
NumPad5 = 76,
NumPad4 = 75,
Subtract = 74,
NumPad9 = 73,
NumPad8 = 72,
NumPad7 = 71,
Numlock = 69,
F10 = 68,
F9 = 67,
F8 = 66,
F7 = 65,
F6 = 64,
F5 = 63,
F4 = 62,
F3 = 61,
F2 = 60,
F1 = 59,
Capital = 58,
Space = 57,
LeftMenu = 56,
Multiply = 55,
RightShift = 54,
Slash = 53,
Period = 52,
Comma = 51,
M = 50,
B = 48,
V = 47,
C = 46,
X = 45,
BackSlash = 43,
LeftShift = 42,
Grave = 41,
Apostrophe = 40,
SemiColon = 39,
L = 38,
K = 37,
J = 36,
H = 35,
G = 34,
F = 33,
D = 32,
S = 31,
A = 30,
LeftControl = 29,
Return = 28,
RightBracket = 27,
LeftBracket = 26,
P = 25,
O = 24,
I = 23,
U = 22,
Y = 21,
T = 20,
R = 19,
E = 18,
W = 17,
Tab = 15,
Back = 14,
Equals = 13,
Minus = 12,
D0 = 11,
D9 = 10,
D8 = 9,
D7 = 8,
D6 = 7,
D5 = 6,
D4 = 5,
D3 = 4,
D2 = 3,
D1 = 2,
Z = 44,
Escape = 1,
Scroll = 70
}
}

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
@ -73,7 +71,7 @@ namespace mame
}
public static void GetData()
{
string[] ss1 = Machine.FORM.cpsform.tbInput.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
string[] ss1 = Machine.FORM.cpsform.tbInput.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
int n1 = ss1.Length;
int i1, iR, iG, iB;
int bright;
@ -90,7 +88,7 @@ namespace mame
baseTilemap1G = (cps_a_regs[2] * 0x100) & 0x3ffff;
baseTilemap2G = (cps_a_regs[3] * 0x100) & 0x3ffff;
basePaletteG = (cps_a_regs[5] * 0x100) & 0x3ffff;
if (!Machine.FORM.cpsform.cbLockpal.Checked)
if (!Machine.FORM.cpsform.cbLockpal)
{
for (i1 = 0; i1 < nColorG * 2; i1++)
{
@ -122,7 +120,7 @@ namespace mame
cc1G[startpage * 0x200 + i1] = Color.FromArgb(iR, iG, iB);
}
}
if (Machine.FORM.cpsform.cbRowscroll.Checked == true)
if (Machine.FORM.cpsform.cbRowscroll == true)
{
videocontrolG = cps_a_regs[0x22 / 2];
}
@ -691,7 +689,7 @@ namespace mame
rows = iAttr / 256 / 16 + 1;
if (lsColor.IndexOf(iColor) < 0)
{
Machine.FORM.cpsform.tbResult.AppendText(iColor.ToString() + ",");
Machine.FORM.cpsform.tbResult.Add(iColor.ToString() + ",");
lsColor.Add(iColor);
}
if (Array.IndexOf(iiCutColorG, iColor) >= 0)
@ -1122,7 +1120,7 @@ namespace mame
}
public static Bitmap GetAllGDI()
{
string[] ss1 = Machine.FORM.cpsform.tbPoint.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
string[] ss1 = Machine.FORM.cpsform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
int width, height;
width = int.Parse(ss1[0]);
height = int.Parse(ss1[1]);

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using ui;
using cpu.z80;
using cpu.z80;
namespace mame
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ui;
namespace mame
namespace mame
{
public partial class CPS
{

View File

@ -1,8 +1,5 @@
using System;
using MAME.Core;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
{
@ -1047,7 +1044,7 @@ namespace mame
string[] ss1, ss2, ss3;
int i1, i2, i3, i4, n1, n2;
lSprite.Clear();
ss1 = Machine.FORM.konami68000form.tbSprite.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
ss1 = Machine.FORM.konami68000form.tbSprite.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
n1 = ss1.Length;
for (i1 = 0; i1 < n1; i1++)
{
@ -1068,7 +1065,7 @@ namespace mame
lSprite.Add(i2);
}
}
ss3 = Machine.FORM.neogeoform.tbPoint.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
ss3 = Machine.FORM.neogeoform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
Bitmap bm1 = new Bitmap(0x200, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
Color c1 = Color.FromArgb((int)Palette.entry_color[16 * bg_colorbase]);

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MAME.Core.Common;
namespace mame
{
@ -38,7 +39,7 @@ namespace mame
gfx2rom = Machine.GetRom("gfx2.rom");
gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom"));
user1rom = Machine.GetRom("user1.rom");
mcurom = Properties.Resources.mcu;
mcurom = mainForm.resource.Get_mcu();
voicerom = new byte[0xc0000];
byte[] bb1 = Machine.GetRom("voice.rom");
Array.Copy(bb1, voicerom, bb1.Length);

View File

@ -59,7 +59,7 @@ namespace mame
zoom_x = (zoom_control >> 8) & 0x0f;
rows = y_control & 0x3f;
}
Machine.FORM.neogeoform.tbResult.AppendText(sprite_number.ToString("X3") + " " + x_2.ToString("X4") + " " + y_control.ToString("X4") + " " + code_2.ToString("X4") + " " + zoom_control.ToString("X4") + "\r\n");
Machine.FORM.neogeoform.tbResult.Add(sprite_number.ToString("X3") + " " + x_2.ToString("X4") + " " + y_control.ToString("X4") + " " + code_2.ToString("X4") + " " + zoom_control.ToString("X4") + "\r\n");
if (((x >= 0x140) && (x <= 0x1f0)) || rows == 0)
continue;
if (x == 0)
@ -243,7 +243,7 @@ namespace mame
string[] ss1, ss2, ss3;
int i1, i2, i3, i4, n1, n2, width, height;
lSprite.Clear();
ss1 = Machine.FORM.neogeoform.tbSprite.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
ss1 = Machine.FORM.neogeoform.tbSprite.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
n1 = ss1.Length;
for (i1 = 0; i1 < n1; i1++)
{
@ -264,7 +264,7 @@ namespace mame
lSprite.Add(i2);
}
}
ss3 = Machine.FORM.neogeoform.tbPoint.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
ss3 = Machine.FORM.neogeoform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
width = int.Parse(ss3[0]);
height = int.Parse(ss3[1]);
Bitmap bm1 = new Bitmap(width, height), bm2;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using ui;
using cpu.m68000;
using MAME.Core.Common;
namespace mame
{

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MAME.Core.run_interface;
using MAME.Core.Common;
namespace mame
{
@ -43,10 +45,10 @@ namespace mame
Memory.audioram = new byte[0x800];
Machine.bRom = true;
dsw = 0xff;
fixedbiosrom = Properties.Resources.sfix;
zoomyrom = Properties.Resources._000_lo;
audiobiosrom = Properties.Resources.sm1;
mainbiosrom = Properties.Resources.mainbios;
fixedbiosrom = mainForm.resource.Get_sfix();
zoomyrom = mainForm.resource.Get__000_lo();
audiobiosrom = mainForm.resource.Get_sm1();
mainbiosrom = mainForm.resource.Get_mainbios();
Memory.mainrom = Machine.GetRom("maincpu.rom");
Memory.audiorom = Machine.GetRom("audiocpu.rom");
fixedrom = Machine.GetRom("fixed.rom");

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

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

View File

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
namespace mame
{
public partial class SunA8
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,4 +1,5 @@
using System.Drawing;
using System.Drawing.Imaging;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX.DirectInput;
using MAME.Core;
namespace mame
{

View File

@ -0,0 +1,14 @@
namespace MAME.Core.run_interface
{
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();
}
}

View File

@ -0,0 +1,9 @@
namespace MAME.Core.run_interface
{
public interface ISoundPlayer
{
void BufferWirte(int Off, byte[] Data);
void SetVolume(int Vol);
void GetCurrentPosition(out int play_position, out int write_position);
}
}

View File

@ -0,0 +1,9 @@
using System.Drawing;
namespace MAME.Core.run_interface
{
public interface IVideoPlayer
{
void SubmitVideo(Bitmap Bitmap);
}
}

View File

@ -1,4 +1,4 @@
using Microsoft.DirectX.DirectSound;
using MAME.Core.run_interface;
using System;
namespace mame
@ -11,15 +11,50 @@ namespace mame
private static int sound_muted;
public static ushort[] latched_value, utempdata;
public static Action sound_update;
public static SecondaryBuffer buf2;
//public static SecondaryBuffer buf2;
private static int stream_buffer_in;
#region
static Action<int, byte[]> Act_BufferWirte;
static Action<int> Act_SetVolume;
public delegate void DGetCurrentPosition(out int play_position, out int write_position);
public static event DGetCurrentPosition Act_DGetCurrentPosition;
public static void BindFunc(ISoundPlayer Isp)
{
Act_BufferWirte -= Act_BufferWirte;
Act_SetVolume -= Act_SetVolume;
Act_DGetCurrentPosition -= Act_DGetCurrentPosition;
Act_BufferWirte += Isp.BufferWirte;
Act_SetVolume += Isp.SetVolume;
Act_DGetCurrentPosition += Isp.GetCurrentPosition;
}
static void BufferWirte(int Off, byte[] Data)
{
Act_BufferWirte?.Invoke(Off, Data);
}
public static void SetVolume(int Vol)
{
Act_SetVolume?.Invoke(Vol);
}
static void GetCurrentPosition(out int play_position, out int write_position)
{
play_position = 0;
write_position = 0;
Act_DGetCurrentPosition?.Invoke(out play_position, out write_position);
}
#endregion
public static void sound_init()
{
leftmix = new int[0x3c0];
rightmix = new int[0x3c0];
finalmixb = new byte[0xf00];
sound_muted = 0;
buf2.Play(0, BufferPlayFlags.Looping);
//buf2.Play(0, BufferPlayFlags.Looping);
last_update_second = 0;
//WavWrite.CreateSoundFile(@"\VS2008\compare1\compare1\bin\Debug\2.wav");
Atime update_frequency = new Atime(0, Attotime.ATTOSECONDS_PER_SECOND / 50);
@ -657,12 +692,14 @@ namespace mame
if (pause)
{
sound_muted |= 0x02;
Sound.buf2.Volume = -10000;
//buf2.Volume = -10000;
Sound.SetVolume(-10000);
}
else
{
sound_muted &= ~0x02;
Sound.buf2.Volume = 0;
//Sound.buf2.Volume = 0;
Sound.SetVolume(0);
}
//osd_set_mastervolume(sound_muted ? -32 : 0);
}
@ -1694,7 +1731,8 @@ namespace mame
int stream_in;
byte[] buffer1, buffer2;
int length1, length2;
buf2.GetCurrentPosition(out play_position, out write_position);
//buf2.GetCurrentPosition(out play_position, out write_position);
GetCurrentPosition(out play_position, out write_position);
if (write_position < play_position)
{
write_position += 0x9400;
@ -1721,7 +1759,8 @@ namespace mame
length2 = 0;
buffer1 = new byte[length1];
Array.Copy(buffer, buffer1, length1);
buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
//buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
BufferWirte(stream_buffer_in, buffer1);
stream_buffer_in = stream_buffer_in + 0xf00;
}
else if (stream_buffer_in + 0xf00 == 0x9400)
@ -1730,7 +1769,8 @@ namespace mame
length2 = 0;
buffer1 = new byte[length1];
Array.Copy(buffer, buffer1, length1);
buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
//buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
BufferWirte(stream_buffer_in, buffer1);
stream_buffer_in = 0;
}
else if (stream_buffer_in + 0xf00 > 0x9400)
@ -1741,8 +1781,10 @@ namespace mame
buffer2 = new byte[length2];
Array.Copy(buffer, buffer1, length1);
Array.Copy(buffer, length1, buffer2, 0, length2);
buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
buf2.Write(0, buffer2, LockFlag.None);
//buf2.Write(stream_buffer_in, buffer1, LockFlag.None);
BufferWirte(stream_buffer_in, buffer1);
//buf2.Write(0, buffer2, LockFlag.None);
BufferWirte(0, buffer2);
stream_buffer_in = length2;
}
}