脱离Windows,并跨平台

This commit is contained in:
sin365 2024-07-29 10:46:59 +08:00
parent 68e785525d
commit 140de72f79
218 changed files with 3403 additions and 10515 deletions

View File

@ -0,0 +1,455 @@
using System;
namespace MAME.Core.AxiBitmap
{
public struct AxiColor
{
public byte r, g, b, a;
// 构造函数
public AxiColor(byte _r, byte _g, byte _b)
{
r = _r;
g = _g;
b = _b;
a = 255;
}
public AxiColor(byte _r, byte _g, byte _b, byte _a)
{
r = _r;
g = _g;
b = _b;
a = _a;
}
public static AxiColor FromArgb(int argb)
{
byte a = (byte)((argb >> 24) & 0xFF);
byte r = (byte)((argb >> 16) & 0xFF);
byte g = (byte)((argb >> 8) & 0xFF);
byte b = (byte)(argb & 0xFF);
return new AxiColor { r = r, g = g, b = b, a = a };
}
public static int ToArgb(AxiColor color)
{
return (color.a << 24) | (color.r << 16) | (color.g << 8) | color.b;
}
#region
public static AxiColor Transparent => new AxiColor(0, 0, 0, 0);
public static AxiColor AliceBlue => new AxiColor(240, 248, 255);
public static AxiColor AntiqueWhite => new AxiColor(250, 235, 215);
public static AxiColor Aqua => new AxiColor(0, 255, 255);
public static AxiColor Aquamarine => new AxiColor(127, 255, 212);
public static AxiColor Azure => new AxiColor(240, 255, 255);
public static AxiColor Beige => new AxiColor(245, 245, 220);
public static AxiColor Bisque => new AxiColor(255, 228, 196);
public static AxiColor Black => new AxiColor(0, 0, 0);
public static AxiColor BlanchedAlmond => new AxiColor(255, 235, 205);
public static AxiColor Blue => new AxiColor(0, 0, 255);
public static AxiColor BlueViolet => new AxiColor(138, 43, 226);
public static AxiColor Brown => new AxiColor(165, 42, 42);
public static AxiColor BurlyWood => new AxiColor(222, 184, 135);
public static AxiColor CadetBlue => new AxiColor(95, 158, 160);
public static AxiColor Chartreuse => new AxiColor(127, 255, 0);
public static AxiColor Chocolate => new AxiColor(210, 105, 30);
public static AxiColor Coral => new AxiColor(255, 127, 80);
public static AxiColor CornflowerBlue => new AxiColor(100, 149, 237);
public static AxiColor Cornsilk => new AxiColor(255, 248, 220);
public static AxiColor Crimson => new AxiColor(220, 20, 60);
public static AxiColor Cyan => new AxiColor(0, 255, 255);
public static AxiColor DarkBlue => new AxiColor(0, 0, 139);
public static AxiColor DarkCyan => new AxiColor(0, 139, 139);
public static AxiColor DarkGoldenrod => new AxiColor(184, 134, 11);
public static AxiColor DarkGray => new AxiColor(169, 169, 169);
public static AxiColor DarkGreen => new AxiColor(0, 100, 0);
public static AxiColor DarkKhaki => new AxiColor(189, 183, 107);
public static AxiColor DarkMagenta => new AxiColor(139, 0, 139);
public static AxiColor DarkOliveGreen => new AxiColor(85, 107, 47);
public static AxiColor DarkOrange => new AxiColor(255, 140, 0);
public static AxiColor DarkOrchid => new AxiColor(153, 50, 204);
public static AxiColor DarkRed => new AxiColor(139, 0, 0);
public static AxiColor DarkSalmon => new AxiColor(233, 150, 122);
public static AxiColor DarkSeaGreen => new AxiColor(143, 188, 143);
public static AxiColor DarkSlateBlue => new AxiColor(72, 61, 139);
public static AxiColor DarkSlateGray => new AxiColor(47, 79, 79);
public static AxiColor DarkViolet => new AxiColor(148, 0, 211);
public static AxiColor DeepPink => new AxiColor(255, 20, 147);
public static AxiColor DeepSkyBlue => new AxiColor(0, 191, 255);
public static AxiColor DimGray => new AxiColor(105, 105, 105);
public static AxiColor DodgerBlue => new AxiColor(30, 144, 255);
public static AxiColor FireBrick => new AxiColor(178, 34, 34);
public static AxiColor FloralWhite => new AxiColor(255, 250, 240);
public static AxiColor ForestGreen => new AxiColor(34, 139, 34);
public static AxiColor Fuchsia => new AxiColor(255, 0, 255);
public static AxiColor Gainsboro => new AxiColor(220, 220, 220);
public static AxiColor GhostWhite => new AxiColor(248, 248, 255);
public static AxiColor Gold => new AxiColor(255, 215, 0);
public static AxiColor Goldenrod => new AxiColor(218, 165, 32);
public static AxiColor Gray => new AxiColor(128, 128, 128);
public static AxiColor Green => new AxiColor(0, 128, 0);
public static AxiColor GreenYellow => new AxiColor(173, 255, 47);
public static AxiColor Honeydew => new AxiColor(240, 255, 240);
public static AxiColor HotPink => new AxiColor(255, 105, 180);
public static AxiColor IndianRed => new AxiColor(205, 92, 92);
public static AxiColor Indigo => new AxiColor(75, 0, 130);
public static AxiColor Ivory => new AxiColor(255, 255, 240);
public static AxiColor Khaki => new AxiColor(240, 230, 140);
public static AxiColor Lavender => new AxiColor(230, 230, 250);
public static AxiColor LavenderBlush => new AxiColor(255, 240, 245);
public static AxiColor LawnGreen => new AxiColor(124, 252, 0);
public static AxiColor LemonChiffon => new AxiColor(255, 250, 205);
public static AxiColor LightBlue => new AxiColor(173, 216, 230);
public static AxiColor LightCoral => new AxiColor(240, 128, 128);
public static AxiColor LightCyan => new AxiColor(224, 255, 255);
public static AxiColor LightGoldenrodYellow => new AxiColor(250, 250, 210);
public static AxiColor LightGray => new AxiColor(211, 211, 211);
public static AxiColor LightGreen => new AxiColor(144, 238, 144);
public static AxiColor LightPink => new AxiColor(255, 182, 193);
public static AxiColor LightSalmon => new AxiColor(255, 160, 122);
public static AxiColor LightSeaGreen => new AxiColor(32, 178, 170);
public static AxiColor LightSkyBlue => new AxiColor(135, 206, 250);
public static AxiColor LightSlateGray => new AxiColor(119, 136, 153);
public static AxiColor LightYellow => new AxiColor(255, 255, 224);
public static AxiColor Lime => new AxiColor(0, 255, 0);
public static AxiColor LimeGreen => new AxiColor(50, 205, 50);
public static AxiColor Linen => new AxiColor(250, 240, 230);
public static AxiColor Magenta => new AxiColor(255, 0, 255);
public static AxiColor Maroon => new AxiColor(176, 48, 96);
public static AxiColor MediumAquamarine => new AxiColor(102, 205, 170);
public static AxiColor MediumBlue => new AxiColor(0, 0, 205);
public static AxiColor MediumOrchid => new AxiColor(186, 85, 211);
public static AxiColor MediumPurple => new AxiColor(147, 112, 219);
public static AxiColor MediumSeaGreen => new AxiColor(60, 179, 113);
public static AxiColor MediumSlateBlue => new AxiColor(123, 104, 238);
public static AxiColor MediumSpringGreen => new AxiColor(0, 250, 154);
public static AxiColor MediumTurquoise => new AxiColor(72, 209, 204);
public static AxiColor MediumVioletRed => new AxiColor(199, 21, 133);
public static AxiColor MidnightBlue => new AxiColor(25, 25, 112);
public static AxiColor MintCream => new AxiColor(245, 255, 250);
public static AxiColor MistyRose => new AxiColor(255, 228, 225);
public static AxiColor Moccasin => new AxiColor(255, 228, 181);
public static AxiColor NavajoWhite => new AxiColor(255, 222, 173);
public static AxiColor Navy => new AxiColor(0, 0, 128);
public static AxiColor OldLace => new AxiColor(253, 245, 230);
public static AxiColor Olive => new AxiColor(128, 128, 0);
public static AxiColor OliveDrab => new AxiColor(107, 142, 35);
public static AxiColor Orange => new AxiColor(255, 165, 0);
public static AxiColor OrangeRed => new AxiColor(255, 69, 0);
public static AxiColor Orchid => new AxiColor(218, 112, 214);
public static AxiColor PaleGoldenrod => new AxiColor(238, 232, 170);
public static AxiColor PaleGreen => new AxiColor(152, 251, 152);
public static AxiColor PaleTurquoise => new AxiColor(175, 238, 238);
public static AxiColor PaleVioletRed => new AxiColor(219, 112, 147);
public static AxiColor PapayaWhip => new AxiColor(255, 239, 213);
public static AxiColor PeachPuff => new AxiColor(255, 218, 185);
public static AxiColor Peru => new AxiColor(205, 133, 63);
public static AxiColor Pink => new AxiColor(255, 192, 203);
public static AxiColor Plum => new AxiColor(221, 160, 221);
public static AxiColor PowderBlue => new AxiColor(176, 224, 230);
public static AxiColor Purple => new AxiColor(160, 32, 240);
public static AxiColor Red => new AxiColor(255, 0, 0);
public static AxiColor RosyBrown => new AxiColor(188, 143, 143);
public static AxiColor RoyalBlue => new AxiColor(65, 105, 225);
public static AxiColor SaddleBrown => new AxiColor(139, 69, 19);
public static AxiColor Salmon => new AxiColor(250, 128, 114);
public static AxiColor SandyBrown => new AxiColor(244, 164, 96);
public static AxiColor SeaGreen => new AxiColor(46, 139, 87);
public static AxiColor SeaShell => new AxiColor(255, 245, 238);
public static AxiColor Sienna => new AxiColor(160, 82, 45);
public static AxiColor Silver => new AxiColor(192, 192, 192);
public static AxiColor SkyBlue => new AxiColor(135, 206, 235);
public static AxiColor SlateBlue => new AxiColor(106, 90, 205);
public static AxiColor SlateGray => new AxiColor(112, 128, 144);
public static AxiColor Snow => new AxiColor(255, 250, 250);
public static AxiColor SpringGreen => new AxiColor(0, 255, 127);
public static AxiColor SteelBlue => new AxiColor(70, 130, 180);
public static AxiColor Tan => new AxiColor(210, 180, 140);
public static AxiColor Teal => new AxiColor(0, 128, 128);
public static AxiColor Thistle => new AxiColor(216, 191, 216);
public static AxiColor Tomato => new AxiColor(255, 99, 71);
public static AxiColor Turquoise => new AxiColor(64, 224, 208);
public static AxiColor Violet => new AxiColor(238, 130, 238);
public static AxiColor Wheat => new AxiColor(245, 222, 179);
public static AxiColor White => new AxiColor(255, 255, 255);
public static AxiColor WhiteSmoke => new AxiColor(245, 245, 245);
public static AxiColor Yellow => new AxiColor(255, 255, 0);
public static AxiColor YellowGreen => new AxiColor(154, 205, 50);
#endregion
}
public struct Rectangle
{
public int X;
public int Y;
public int Width;
public int Height;
public Rectangle(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public int Right => X + Width;
public int Bottom => Y + Height;
public int Area { get { return Width * Height; } }
public bool Contains(int pointX, int pointY) { return pointX >= X && pointX < X + Width && pointY >= Y && pointY < Y + Height; }
}
public enum RotateFlipType
{
RotateNoneFlipNone = 0,
Rotate90FlipNone = 1,
Rotate180FlipNone = 2,
Rotate270FlipNone = 3,
RotateNoneFlipX = 4,
Rotate90FlipX = 5,
Rotate180FlipX = 6,
Rotate270FlipX = 7,
RotateNoneFlipY = Rotate180FlipX, // 注意FlipY 可以通过FlipX两次来实现但这里为了完整性列出
Rotate90FlipY = 5, // 注意FlipY在这里与FlipX相同角度的旋转结合因为直接FlipY不是90度的倍数
Rotate180FlipY = 6,
Rotate270FlipY = 7,
// 注意上面的FlipY情况实际上在90度旋转的上下文中并不直接对应因为FlipY通常意味着沿Y轴翻转
// 但在这里我们假设FlipX和FlipY在枚举中是为了完整性。在实际应用中您可能只需要处理FlipNone。
}
public class AxiBitmap
{
public AxiColor[] mData;
public int Width;
public int Height;
public AxiBitmap(int width, int height)
{
Width = width;
Height = height;
mData = new AxiColor[width * height];
}
public void SetPixel(int x, int y, AxiColor color)
{
mData[y * Width + x] = color;
}
public AxiColor GetPixel(int x, int y)
{
return mData[y * Width + x];
}
//public AxiBitmap Clone(Rectangle rect)
//{
// // 检查矩形是否超出位图边界
// if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
// {
// throw new ArgumentException("out of");
// }
// AxiBitmap clonedBitmap = new AxiBitmap(rect.Width, rect.Height);
// int srcStartIndex = rect.Y * Width + rect.X;
// for (int y = 0; y < rect.Height; y++)
// {
// Array.Copy(mData, srcStartIndex + y * Width, clonedBitmap.mData, y * rect.Width, rect.Width);
// }
// return clonedBitmap;
//}
}
public static class AxiBitmapEx
{
public static int ToArgb(this AxiColor color)
{
return (color.a << 24) | (color.r << 16) | (color.g << 8) | color.b;
}
//public static AxiBitmap Clone(this AxiBitmap baseBitmap, Rectangle rect)
//{
// unsafe
// {
// if (rect.X < 0 || rect.Right > baseBitmap.Width || rect.Y < 0 || rect.Bottom > baseBitmap.Height)
// {
// throw new ArgumentException("The rectangle is out of the bitmap bounds.");
// }
// AxiBitmap clonedBitmap = new AxiBitmap(rect.Width, rect.Height);
// for (int y = 0; y < rect.Height; y++)
// {
// int srcStartIndex = (rect.Y + y) * baseBitmap.Width * sizeof(AxiColor) + rect.X * sizeof(AxiColor);
// int dstStartIndex = y * rect.Width * sizeof(AxiColor);
// Array.Copy(baseBitmap.mData, srcStartIndex, clonedBitmap.mData, dstStartIndex, rect.Width * sizeof(AxiColor));
// }
// return clonedBitmap;
// }
//}
public static void Clear(this AxiBitmap baseBitmap, AxiColor color)
{
}
public static int[] CloneIntColorArr(int[] baseBitmap, int Width, int Height, Rectangle rect)
{
// 检查矩形是否超出位图边界
if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
{
throw new ArgumentException("out of");
}
//int[] result = new int[Width * Height];
int[] result = new int[rect.Width * rect.Height];
int srcStartIndex = rect.Y * Width + rect.X;
for (int y = 0; y < rect.Height; y++)
{
Array.Copy(baseBitmap, srcStartIndex + y * Width, result, y * rect.Width, rect.Width);
}
return result;
}
//public static int[] CloneIntColorArr(int[] baseBitmap, int Width, int Height, Rectangle rect)
//{
// unsafe
// {
// if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
// {
// throw new ArgumentException("The rectangle is out of the bitmap bounds.");
// }
// int[] result = new int[Width * Height];
// for (int y = 0; y < rect.Height; y++)
// {
// int srcStartIndex = (rect.Y + y) * Width * sizeof(int) + rect.X * sizeof(int);
// int dstStartIndex = y * rect.Width * sizeof(int);
// Array.Copy(baseBitmap, srcStartIndex, result, dstStartIndex, rect.Width * sizeof(int));
// }
// return result;
// }
//}
// DrawImage 方法,用于在当前 AxiBitmap 上绘制另一个 AxiBitmap 的一部分
public static void DrawImage(this AxiBitmap baseBitmap, AxiBitmap source, Rectangle destRect, Rectangle srcRect)
{
if (!source.Contains(srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height))
throw new ArgumentException("Err");
// 遍历源矩形的每个像素
for (int y = srcRect.Y; y < srcRect.Bottom; y++)
{
for (int x = srcRect.X; x < srcRect.Right; x++)
{
// 计算目标位置
int destX = destRect.X + (x - srcRect.X);
int destY = destRect.Y + (y - srcRect.Y);
// 确保目标位置在当前位图范围内(如果需要)
// if (destX < 0 || destX >= Width || destY < 0 || destY >= Height)
// continue; // 或者抛出异常,取决于你的需求
// 获取源像素并设置到目标位置
AxiColor sourceColor = source.GetPixel(x, y);
baseBitmap.SetPixel(destX, destY, sourceColor);
// 如果需要处理透明度混合,则在这里添加代码
// 注意:你的 AxiColor 已经包含了 alpha 通道,但 SetPixel 并没有使用它
// 你可能需要实现一个混合像素的方法,比如 BlendPixels
}
}
}
// 辅助方法,用于检查一个点是否在位图范围内
private static bool Contains(this AxiBitmap baseBitmap, int x, int y, int width, int height)
{
return x >= 0 && x + width <= baseBitmap.Width && y >= 0 && y + height <= baseBitmap.Height;
}
// ... 其他省略 ...
public static void RotateFlip(this AxiBitmap baseBitmap, RotateFlipType rotateFlipType)
{
// 先处理旋转部分
switch (rotateFlipType)
{
case RotateFlipType.Rotate90FlipNone:
Rotate90(baseBitmap);
break;
case RotateFlipType.Rotate180FlipNone:
Rotate180(baseBitmap);
break;
case RotateFlipType.Rotate270FlipNone:
Rotate270(baseBitmap);
break;
// 如果需要处理FlipX或FlipY可以添加额外的case或方法
default:
// 无需旋转或翻转
break;
}
// 注意这里没有处理FlipX或FlipY因为通常它们不是通过旋转来实现的
// 如果需要FlipX或FlipY请添加额外的逻辑
}
private static void Rotate90(this AxiBitmap baseBitmap)
{
int newWidth = baseBitmap.Height;
int newHeight = baseBitmap.Width;
AxiColor[] newData = new AxiColor[baseBitmap.mData.Length];
for (int x = 0; x < baseBitmap.Width; x++)
{
for (int y = 0; y < baseBitmap.Height; y++)
{
int oldIndex = (y * baseBitmap.Width + x);
int newIndex = (newHeight - 1 - x) * newWidth + y;
newData[newIndex] = baseBitmap.mData[oldIndex];
}
}
baseBitmap.mData = newData;
baseBitmap.Width = newWidth;
baseBitmap.Height = newHeight;
}
private static void Rotate180(this AxiBitmap baseBitmap)
{
for (int y = 0; y < baseBitmap.Height / 2; y++)
{
for (int x = 0; x < baseBitmap.Width; x++)
{
int topLeftIndex = y * baseBitmap.Width + x;
int bottomRightIndex = (baseBitmap.Height - 1 - y) * baseBitmap.Width + x;
AxiColor temp = baseBitmap.mData[topLeftIndex];
baseBitmap.mData[topLeftIndex] = baseBitmap.mData[bottomRightIndex];
baseBitmap.mData[bottomRightIndex] = temp;
}
}
}
private static void Rotate270(this AxiBitmap baseBitmap)
{
// Rotate270 可以通过 Rotate90 两次或 Rotate180 后再 Rotate90 来实现
// 这里直接实现 Rotate270 以避免额外的旋转调用
int newWidth = baseBitmap.Height;
int newHeight = baseBitmap.Width;
AxiColor[] newData = new AxiColor[baseBitmap.mData.Length];
for (int x = 0; x < baseBitmap.Width; x++)
{
for (int y = 0; y < baseBitmap.Height; y++)
{
int oldIndex = (y * baseBitmap.Width + x);
int newIndex = y * newWidth + (newWidth - 1 - x);
newData[newIndex] = baseBitmap.mData[oldIndex];
}
}
baseBitmap.mData = newData;
baseBitmap.Width = newWidth;
baseBitmap.Height = newHeight;
}
}
}

View File

@ -1,298 +0,0 @@
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

@ -1,28 +0,0 @@
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,25 @@
using MAME.Core.run_interface;
using System;
namespace mame
{
public static class EmuLogger
{
#region
static Action<string> Act_Log;
public static void BindFunc(ILog ilog)
{
Act_Log -= Act_Log;
Act_Log += ilog.Log;
}
public static void Log(string msg)
{
Act_Log?.Invoke(msg);
}
#endregion
}
}

View File

@ -5,9 +5,4 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ImageProcessor.Core" Version="1.1.0" />
<PackageReference Include="LamarCodeGeneration" Version="6.3.0" />
</ItemGroup>
</Project>

View File

@ -3,11 +3,10 @@ using cpu.nec;
using mame;
using System;
using System.Collections.Generic;
using System.Text;
namespace MAME.Core.Common
{
public partial class cheatForm
public partial class cheatMotion
{
public enum LockState
{
@ -15,7 +14,6 @@ namespace MAME.Core.Common
LOCK_SECOND,
LOCK_FRAME,
}
private mainForm _myParentForm;
public LockState lockState = LockState.LOCK_NONE;
public List<int[]> lsCheatdata1;
public List<int[]> lsCheatdata2;
@ -27,9 +25,8 @@ namespace MAME.Core.Common
#region
List<string> mTxList_tbResult = new List<string>();
#endregion
public cheatForm(mainForm form)
public cheatMotion()
{
this._myParentForm = form;
cheatForm_Load();
}
private void cheatForm_Load()

View File

@ -0,0 +1,38 @@
using System.Collections.Generic;
namespace MAME.Core.Common
{
public partial class cpsMotion
{
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 cpsMotion()
{
}
}
}

View File

@ -0,0 +1,19 @@
namespace MAME.Core.Common
{
public class konami68000Motion
{
private int locationX, locationY;
#region
public bool cbT0 = false;
public bool cbT1 = false;
public bool cbT2 = false;
public bool cbSprite = false;
public string tbSprite;
#endregion
public konami68000Motion()
{
tbSprite = "0000-4000";
}
}
}

View File

@ -1,18 +1,11 @@
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
public class m68000Motion
{
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;
@ -61,9 +54,8 @@ namespace MAME.Core.Common
M68000_STOP,
}
public static M68000State m68000State, m68000FState;
public m68000Form(mainForm form)
public m68000Motion()
{
this._myParentForm = form;
int i;
mTxList_tbDs = new string[8];
mTxList_tbAs = new string[8];

View File

@ -1,16 +1,12 @@
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
public partial class m6809Motion
{
private mainForm _myParentForm;
//private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
@ -38,9 +34,8 @@ namespace MAME.Core.Common
public string tbDisassemble = string.Empty;
#endregion
public m6809Form(mainForm form)
public m6809Motion()
{
this._myParentForm = form;
}
public void GetData()
{

View File

@ -1,52 +1,60 @@
using mame;
using MAME.Core.run_interface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
namespace MAME.Core.Common
{
public class mainForm
public class mainMotion
{
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 cheatMotion cheatmotion;
public m68000Motion m68000motion;
public z80Motion z80motion;
public m6809Motion m6809motion;
public cpsMotion cpsmotion;
public neogeoMotion neogeomotion;
public konami68000Motion konami68000motion;
public string sSelect;
public static Thread t1;
public static IResources resource;
public mainForm()
public mainMotion()
{
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);
neogeomotion = new neogeoMotion();
cheatmotion = new cheatMotion();
m68000motion = new m68000Motion();
m6809motion = new m6809Motion();
z80motion = new z80Motion();
cpsmotion = new cpsMotion();
konami68000motion = new konami68000Motion();
}
public void Init(IResources iRes,
public void Init(
string RomDir,
ILog ilog,
IResources iRes,
IVideoPlayer ivp,
ISoundPlayer isp,
IKeyboard ikb,
IMouse imou)
{
Mame.RomRoot = RomDir;
EmuLogger.BindFunc(ilog);
Video.BindFunc(ivp);
Sound.BindFunc(isp);
resource = iRes;
StreamReader sr1 = new StreamReader("mame.ini");
sr1.ReadLine();
sSelect = sr1.ReadLine();
sr1.Close();
//StreamReader sr1 = new StreamReader("mame.ini");
//sr1.ReadLine();
//sSelect = sr1.ReadLine();
//sr1.Close();
//TODO 上次选择
sSelect = "samsho2";
RomInfo.Rom = new RomInfo();
@ -87,7 +95,7 @@ namespace MAME.Core.Common
RomInfo.Rom = RomInfo.GetRomByName(Name);
if (RomInfo.Rom == null)
{
Console.WriteLine("Not Found");
EmuLogger.Log("Not Found");
return;
}
@ -207,13 +215,13 @@ namespace MAME.Core.Common
}
if (Machine.bRom)
{
Console.Write("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
Mame.init_machine(this);
Generic.nvram_load();
}
else
{
Console.Write("error rom");
EmuLogger.Log("error rom");
}
}

View File

@ -1,17 +1,12 @@
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
public partial class neogeoMotion
{
private mainForm _myParentForm;
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
public List<string> tbResult;
@ -20,15 +15,13 @@ namespace MAME.Core.Common
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)
public neogeoMotion()
{
this._myParentForm = form;
tbResult = new List<string>();
neogeoForm_Load();
}

View File

@ -1,8 +1,5 @@
using cpu.z80;
using System;
using System.Collections.Generic;
using System.Globalization;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
@ -15,9 +12,8 @@ namespace MAME.Core.Common
STEP3,
STOP,
}
public partial class z80Form
public partial class z80Motion
{
private mainForm _myParentForm;
private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
@ -59,9 +55,8 @@ namespace MAME.Core.Common
Z80A_STOP,
}
public static Z80AState z80State, z80FState;
public z80Form(mainForm form)
public z80Motion()
{
this._myParentForm = form;
disassembler = new Disassembler();
Disassembler.GenerateOpcodeSizes();
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.m6502
namespace cpu.m6502
{
public partial class M6502
{

View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6502
{

View File

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

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using mame;
namespace cpu.m6502
{

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6800
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using mame;
namespace cpu.m6800
{

View File

@ -1,9 +1,8 @@
using System;
using System.Runtime.InteropServices;
using System.IO;
using mame;
using System;
using System.Globalization;
using System.Collections.Generic;
using mame;
using System.IO;
using System.Runtime.InteropServices;
namespace cpu.m68000
{
@ -72,14 +71,14 @@ namespace cpu.m68000
return;
if (value == true) // entering supervisor mode
{
//Console.WriteLine("&^&^&^&^& ENTER SUPERVISOR MODE");
//EmuLogger.Log("&^&^&^&^& ENTER SUPERVISOR MODE");
usp = A[7].s32;
A[7].s32 = ssp;
s = true;
}
else
{ // exiting supervisor mode
//Console.WriteLine("&^&^&^&^& LEAVE SUPERVISOR MODE");
//EmuLogger.Log("&^&^&^&^& LEAVE SUPERVISOR MODE");
ssp = A[7].s32;
A[7].s32 = usp;
s = false;
@ -212,7 +211,7 @@ namespace cpu.m68000
public void Step()
{
//Console.WriteLine(Disassemble(PC));
//EmuLogger.Log(Disassemble(PC));
op = (ushort)ReadOpWord(PC); PC += 2;
Opcodes[op]();
@ -410,7 +409,7 @@ namespace cpu.m68000
else
{
//Console.WriteLine("Skipping unrecognized identifier " + args[0]);
//EmuLogger.Log("Skipping unrecognized identifier " + args[0]);
}
}
}

View File

@ -542,7 +542,7 @@ namespace cpu.m68000
int GetIndex()
{
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!");
//EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
// TODO kid chameleon triggers this in startup sequence
short extension = ReadOpWord(PC); PC += 2;
@ -571,7 +571,7 @@ namespace cpu.m68000
int PeekIndex()
{
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!");
//EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
short extension = ReadOpWord(PC);

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6805
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using mame;
namespace cpu.m6805
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.m6809
namespace cpu.m6809
{
public partial class M6809
{

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6809
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using mame;
namespace cpu.m6809
{

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using System;
using System.IO;
using System.Runtime.InteropServices;
using mame;
namespace cpu.nec
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{

View File

@ -6,7 +6,7 @@
//VgMuseum.Z80.Disassembler disasm = new Disassembler();
//ushort pc = RegPC.Word;
//string str = disasm.Disassemble(() => ReadMemory(pc++));
//Console.WriteLine(str);
//EmuLogger.Log(str);
//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

View File

@ -1,7 +1,4 @@
using System.IO;
using mame;
namespace cpu.z80
namespace cpu.z80
{
public partial class Z80A
{

View File

@ -1,5 +1,5 @@
using System.Runtime.InteropServices;
using System;
using System;
using System.Runtime.InteropServices;
namespace cpu.z80
{

View File

@ -1,8 +1,7 @@
using System;
using mame;
using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using mame;
// This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator.
// It is MIT licensed.
@ -279,7 +278,7 @@ namespace cpu.z80
pendingCycles = int.Parse(args[1]);
else
Console.WriteLine("Skipping unrecognized identifier " + args[0]);
EmuLogger.Log("Skipping unrecognized identifier " + args[0]);
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public struct Atime
{

View File

@ -2118,46 +2118,46 @@ namespace mame
case "Neo Geo":
case "PGM":
case "Taito B":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "Tehkan":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break;
case "IGS011":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break;
case "SunA8":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break;
case "Namco System 1":
m6809Form.m6809State = CPUState.RUN;
m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug;
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug;
M6809.mm1[1].debugger_start_cpu_hook_callback = null_callback;
M6809.mm1[1].debugger_stop_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_start_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback;
break;
case "M72":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "M92":
break;
@ -2186,35 +2186,35 @@ namespace mame
case "boblcave":
case "bublcave11":
case "bublcave10":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "opwolf":
case "opwolfa":
case "opwolfj":
case "opwolfu":
case "opwolfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "opwolfb":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2222,17 +2222,17 @@ namespace mame
switch (Machine.sName)
{
case "cuebrick":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break;
default:
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2250,13 +2250,13 @@ namespace mame
case "makaimurc":
case "makaimurg":
case "diamond":
m6809Form.m6809State = CPUState.RUN;
m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "sf":
case "sfua":
@ -2264,14 +2264,14 @@ namespace mame
case "sfjan":
case "sfan":
case "sfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2472,9 +2472,9 @@ namespace mame
cpu[icpu].eatcycles = cpu[icpu].nexteatcycles;
}
Timer.timer_set_global_time(target);
if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatform.lockState == cheatForm.LockState.LOCK_SECOND)
if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatmotion.lockState == cheatMotion.LockState.LOCK_SECOND)
{
Machine.FORM.cheatform.ApplyCheat();
Machine.FORM.cheatmotion.ApplyCheat();
}
}
public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration)

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
namespace mame

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
namespace mame
{

View File

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

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace mame
{

View File

@ -1,27 +1,59 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using MAME.Core.AxiBitmap;
using System;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
using Rectangle = MAME.Core.AxiBitmap.Rectangle;
namespace mame
{
partial class Video
{
public delegate Bitmap drawcrosshairdelegate(Bitmap bm1);
//public delegate Bitmap drawcrosshairdelegate(Bitmap bm1);
//public static drawcrosshairdelegate drawcrosshair;
public delegate int[] drawcrosshairdelegate(int[] bm1);
public static drawcrosshairdelegate drawcrosshair;
public static Bitmap drawcrosshair_null(Bitmap bm1)
//public static Bitmap drawcrosshair_null(Bitmap bm1)
//{
// Bitmap bm2 = bm1;
// return bm2;
//}
public static int[] drawcrosshair_null(int[] bm1)
{
Bitmap bm2 = bm1;
return bm2;
return bm1;
}
//public static Bitmap drawcrosshair_opwolf(Bitmap bm1)
//{
// Bitmap bm2 = bm1;
// Graphics g = Graphics.FromImage(bm2);
// g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel);
// g.Dispose();
// return bm2;
//}
public static Bitmap drawcrosshair_opwolf(Bitmap bm1)
{
Bitmap bm2 = bm1;
Graphics g = Graphics.FromImage(bm2);
g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel);
g.Dispose();
bm2.DrawImage(
MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff),
new Rectangle(Crosshair.global.x[0] - 10,
Crosshair.global.y[0] - 10, 20, 20),
new Rectangle(0, 0, 100, 100));
return bm2;
}
public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
public static int[] drawcrosshair_opwolf(int[] bm1)
{
int[] bm2 = bm1;
//TODO
return bm2;
}
/*
* public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
{
Bitmap result = new Bitmap(bitmap.Width, bitmap.Height);
using (Graphics graphics = Graphics.FromImage(result))
@ -33,42 +65,128 @@ namespace mame
graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imageAttributes);
}
return result;
}*/
/// <summary>
///
/// </summary>
/// <param name="bitmap"></param>
/// <param name="factor"></param>
/// <returns></returns>
public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
{
Bitmap result = new Bitmap(bitmap.Width, bitmap.Height);
for (int y = 0; y < bitmap.Height; y++)
{
for (int x = 0; x < bitmap.Width; x++)
{
Color originalColor = bitmap.GetPixel(x, y);
byte newAlpha = (byte)Math.Min(255, (int)(originalColor.a * factor));
Color newColor = new Color
{
r = originalColor.r,
g = originalColor.g,
b = originalColor.b,
a = newAlpha
};
result.SetPixel(x, y, newColor);
}
}
return result;
}
/// <summary>
///
/// </summary>
/// <param name="bitmap"></param>
/// <param name="factor"></param>
/// <returns></returns>
public static int[] MultiplyAlpha(int[] bitmap, float factor)
{
int[] result = (int[])bitmap.Clone();
for (int i = 0; i < result.Length; i++)
{
Color originalColor = AxiColor.FromArgb(result[i]);
byte newAlpha = (byte)Math.Min(255, (int)(originalColor.a * factor));
Color newColor = new Color
{
r = originalColor.r,
g = originalColor.g,
b = originalColor.b,
a = newAlpha
};
result[i] = AxiColor.ToArgb(newColor);
}
return result;
}
//public static void GDIDraw()
//{
// try
// {
// bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
// Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight);
// bitmapGDI.UnlockBits(bitmapData);
// if (Wintime.osd_ticks() < popup_text_end)
// {
// Machine.FORM.tsslStatus = sDrawText;
// }
// else
// {
// popup_text_end = 0;
// if (Mame.paused)
// {
// Machine.FORM.tsslStatus = "pause";
// }
// else
// {
// switch (Mame.playState)
// {
// case Mame.PlayState.PLAY_RECORDRUNNING:
// Machine.FORM.tsslStatus = "record";
// break;
// case Mame.PlayState.PLAY_REPLAYRUNNING:
// Machine.FORM.tsslStatus = "replay";
// break;
// default:
// Machine.FORM.tsslStatus = "run";
// break;
// }
// }
// }
// //bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb));
// bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height)));
// switch (Machine.sDirection)
// {
// case "":
// break;
// case "90":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate90FlipNone);
// break;
// case "180":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate180FlipNone);
// break;
// case "270":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone);
// break;
// }
// //Machine.FORM.pictureBox1.Image = bbmp[iMode];
// SubmitVideo(bbmp[iMode]);
// }
// catch
// {
// }
//}
public static void GDIDraw()
{
try
{
bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight);
bitmapGDI.UnlockBits(bitmapData);
if (Wintime.osd_ticks() < popup_text_end)
{
Machine.FORM.tsslStatus = sDrawText;
}
else
{
popup_text_end = 0;
if (Mame.paused)
{
Machine.FORM.tsslStatus = "pause";
}
else
{
switch (Mame.playState)
{
case Mame.PlayState.PLAY_RECORDRUNNING:
Machine.FORM.tsslStatus = "record";
break;
case Mame.PlayState.PLAY_REPLAYRUNNING:
Machine.FORM.tsslStatus = "replay";
break;
default:
Machine.FORM.tsslStatus = "run";
break;
}
}
}
bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb));
int[] TempData = AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height));
drawcrosshair(TempData);
//bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height)));
switch (Machine.sDirection)
{
case "":
@ -84,12 +202,45 @@ namespace mame
break;
}
//Machine.FORM.pictureBox1.Image = bbmp[iMode];
SubmitVideo(bbmp[iMode]);
SubmitVideo(Video.bitmapcolor);
}
catch
catch (Exception ex)
{
}
}
public static void CopyDataFrom(AxiBitmap destBitmap, byte[] sourceData, int sourceStride)
{
int pixelCount = destBitmap.Width * destBitmap.Height;
if (sourceData.Length < pixelCount * 4) // 假设每个AxiColor是4字节
throw new ArgumentException("Source data is too small.");
// 注意这里我们假设sourceStride是源数据的每行字节数它可能包含额外的填充字节
// 以确保每行的开始都是4的倍数。但是对于紧密打包的AxiColor数组我们可以忽略它。
for (int y = 0; y < destBitmap.Height; y++)
{
int sourceOffset = y * sourceStride; // 但对于紧密打包的AxiColor这将是 y * (destBitmap.Width * 4)
// 然而由于我们知道sourceData是直接对应于AxiColor的我们可以简化为
sourceOffset = y * destBitmap.Width * 4; // 假设没有行填充
for (int x = 0; x < destBitmap.Width; x++)
{
int index = y * destBitmap.Width + x;
int sourceIndex = sourceOffset + x * 4;
byte r = sourceData[sourceIndex];
byte g = sourceData[sourceIndex + 1];
byte b = sourceData[sourceIndex + 2];
byte a = sourceData[sourceIndex + 3];
destBitmap.mData[index] = new AxiColor { r = r, g = g, b = b, a = a };
}
}
}
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using System;
namespace mame
{

View File

@ -1,5 +1,4 @@
using MAME.Core;
using MAME.Core.Common;
using MAME.Core.Common;
using MAME.Core.run_interface;
namespace mame
@ -10,7 +9,7 @@ namespace mame
static IKeyboard mKeyboard;
public static void InitializeInput(mainForm form1,IKeyboard ikb)
public static void InitializeInput(mainMotion form1, IKeyboard ikb)
{
mKeyboard = ikb;
}

View File

@ -8,7 +8,7 @@ namespace mame
{
public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer;
public static List<string> lsParents;
public static mainForm FORM;
public static mainMotion FORM;
public static RomInfo rom;
public static bool bRom;
public delegate void machine_delegate();
@ -264,16 +264,20 @@ namespace mame
public static byte[] GetNeogeoRom(string sFile)
{
byte[] bb1;
if (File.Exists("roms\\neogeo\\" + sFile))
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/neogeo/", sFile);
if (File.Exists(path))
{
FileStream fs1 = new FileStream("roms\\neogeo\\" + sFile, FileMode.Open);
int n1 = (int)fs1.Length;
bb1 = new byte[n1];
fs1.Read(bb1, 0, n1);
fs1.Close();
EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path);
//FileStream fs1 = new FileStream(path, FileMode.Open);
//int n1 = (int)fs1.Length;
//bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
}
else
{
EmuLogger.Log($"Miss File => {path}");
bb1 = null;
}
return bb1;
@ -284,15 +288,22 @@ namespace mame
int n1;
foreach (string s1 in lsParents)
{
if (File.Exists("roms\\" + s1 + "\\" + sFile))
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/" + s1 + "/", sFile);
if (File.Exists(path))
{
FileStream fs1 = new FileStream("roms\\" + s1 + "\\" + sFile, FileMode.Open);
n1 = (int)fs1.Length;
bb1 = new byte[n1];
fs1.Read(bb1, 0, n1);
fs1.Close();
EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path);
//FileStream fs1 = new FileStream(path, FileMode.Open);
//n1 = (int)fs1.Length;
//bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
break;
}
else
{
EmuLogger.Log($"Miss File => {path}");
}
}
return bb1;
}

View File

@ -1,8 +1,6 @@
using MAME.Core.Common;
using MAME.Core.run_interface;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
namespace mame
@ -29,6 +27,7 @@ namespace mame
public static BinaryReader brRecord = null;
public static BinaryWriter bwRecord = null;
public static bool bPP = true;
public static string RomRoot = string.Empty;
public class AA
{
public int fr;
@ -98,12 +97,12 @@ namespace mame
if (playState == PlayState.PLAY_SAVE)
{
mame_pause(true);
UI.ui_handler_callback = handle_save;
Motion.motion_handler_callback = handle_save;
}
else if (playState == PlayState.PLAY_LOAD)
{
mame_pause(true);
UI.ui_handler_callback = handle_load;
Motion.motion_handler_callback = handle_load;
}
else if (playState == PlayState.PLAY_RESET)
{
@ -113,7 +112,7 @@ namespace mame
else if (playState == PlayState.PLAY_RECORDSTART)
{
mame_pause(true);
UI.ui_handler_callback = handle_record;
Motion.motion_handler_callback = handle_record;
}
else if (playState == PlayState.PLAY_RECORDEND)
{
@ -122,14 +121,14 @@ namespace mame
else if (playState == PlayState.PLAY_REPLAYSTART)
{
mame_pause(true);
UI.ui_handler_callback = handle_replay;
Motion.motion_handler_callback = handle_replay;
}
else if (playState == PlayState.PLAY_REPLAYEND)
{
handle_replay();
}
}
public static void init_machine(mainForm form)
public static void init_machine(mainMotion form)
{
Inptport.input_init();
Palette.palette_init();
@ -153,6 +152,7 @@ namespace mame
{
if (paused == pause)
return;
EmuLogger.Log($"mame_pause->{pause}");
paused = pause;
Window.wininput_pause(paused);
Sound.sound_pause(paused);
@ -187,7 +187,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -208,7 +208,7 @@ namespace mame
Video.sDrawText = "Save to position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -230,7 +230,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -246,7 +246,7 @@ namespace mame
playState = PlayState.PLAY_RUNNING;
Thread.Sleep(500);
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
FileStream fs1 = new FileStream("sta\\" + Machine.sName + "\\" + file + ".sta", FileMode.Open);
@ -264,7 +264,7 @@ namespace mame
fs2.Close();
return;*/
playState = PlayState.PLAY_RUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -288,7 +288,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -318,7 +318,7 @@ namespace mame
Video.sDrawText = "Record to position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RECORDRUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -351,7 +351,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -367,7 +367,7 @@ namespace mame
playState = PlayState.PLAY_RUNNING;
Thread.Sleep(500);
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
if (bwRecord != null)
@ -405,7 +405,7 @@ namespace mame
Video.sDrawText = "Replay from position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_REPLAYRUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public class Memory
{

View File

@ -1,27 +1,26 @@
using MAME.Core.Common;
using MAME.Core.run_interface;
using System;
using System.Runtime.InteropServices;
namespace mame
{
public class UI
/// <summary>
/// 原依赖Form的内容
/// </summary>
public class Motion
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
private static uint UI_FILLCOLOR = Palette.make_argb(0xe0, 0x10, 0x10, 0x30);
public delegate void ui_delegate();
public static ui_delegate ui_handler_callback, ui_update_callback;
public delegate void motion_delegate();
public static motion_delegate motion_handler_callback, motion_update_callback;
public static bool single_step;
public static mainForm mainform;
public static void ui_init(mainForm form1)
//public static mainMotion mainmotion;
public static void init()
{
mainform = form1;
//mainmotion = motion;
}
public static void ui_update_and_render()
{
ui_update_callback();
ui_handler_callback();
motion_update_callback();
motion_handler_callback();
}
public static void ui_updateC()
{
@ -255,10 +254,10 @@ namespace mame
}
public static void cpurun()
{
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
Machine.FORM.m68000form.mTx_tsslStatus = "run";
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Machine.FORM.z80form.mTx_tsslStatus = "run";
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
Machine.FORM.m68000motion.mTx_tsslStatus = "run";
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Machine.FORM.z80motion.mTx_tsslStatus = "run";
}
private static double ui_get_line_height()
{

View File

@ -8,14 +8,15 @@ namespace mame
public static int deltaX, deltaY, oldX, oldY;
public static byte[] buttons;
static IMouse iMouse;
public static void InitialMouse(mainForm form1,IMouse im)
public static void InitialMouse(mainMotion form1, IMouse im)
{
iMouse = im;
}
public static void Update()
{
iMouse.MouseXY(out int X, out int Y);
int X, Y;
iMouse.MouseXY(out X, out Y);
deltaX = X - oldX;
deltaY = Y - oldY;
oldX = X;

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using MAME.Core.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Collections.Generic;
namespace mame
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using System.IO;
namespace mame
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,9 +1,7 @@
using System;
using cpu.m6800;
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using cpu.m6800;
namespace mame
{

View File

@ -1,8 +1,7 @@
using MAME.Core.run_interface;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
namespace mame
{
@ -50,7 +49,7 @@ namespace mame
public static string sDrawText;
public static long popup_text_end;
public static int iMode, nMode;
private static BitmapData bitmapData;
//private static BitmapData bitmapData;
public static int offsetx, offsety, width, height;
public delegate void video_delegate();
public static video_delegate video_update_callback, video_eof_callback;
@ -63,7 +62,7 @@ namespace mame
#region
static Action<Bitmap> Act_SubmitVideo;
static Action<int[]> Act_SubmitVideo;
public static void BindFunc(IVideoPlayer Ivp)
{
@ -72,7 +71,7 @@ namespace mame
Act_SubmitVideo += Ivp.SubmitVideo;
}
static void SubmitVideo(Bitmap Bitmap)
static void SubmitVideo(int[] Bitmap)
{
Act_SubmitVideo?.Invoke(Bitmap);
}
@ -82,7 +81,7 @@ namespace mame
{
Wintime.wintime_init();
global_throttle = true;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
sDrawText = "";
popup_text_end = 0;
popcount = new int[256]{
@ -111,7 +110,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -135,7 +134,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -159,7 +158,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -192,7 +191,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateTehkan;
Motion.motion_update_callback = Motion.ui_updateTehkan;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -213,7 +212,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 6000000) * screenstate.width * screenstate.height);//59.1856060608428Hz
screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateN;
Motion.motion_update_callback = Motion.ui_updateN;
bitmapbaseN = new int[2][];
bitmapbaseN[0] = new int[384 * 264];
bitmapbaseN[1] = new int[384 * 264];
@ -234,7 +233,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -255,7 +254,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60.606060));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateNa;
Motion.motion_update_callback = Motion.ui_updateNa;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -278,7 +277,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateIGS011;
Motion.motion_update_callback = Motion.ui_updateIGS011;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -300,7 +299,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -322,7 +321,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 8000000) * screenstate.width * screenstate.height);
screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c
bitmapbase[1] = new ushort[0x200 * 0x200];//0x11c
@ -343,7 +342,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -354,7 +353,7 @@ namespace mame
break;
case "Taito":
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
switch (Machine.sName)
{
case "tokio":
@ -435,7 +434,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -452,7 +451,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0x34;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -604,7 +603,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -630,7 +629,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -891,10 +890,10 @@ namespace mame
Keyboard.Update();
Mouse.Update();
Inptport.frame_update_callback();
UI.ui_update_and_render();
if(Machine.FORM.cheatform.lockState == MAME.Core.Common.cheatForm.LockState.LOCK_FRAME)
Motion.ui_update_and_render();
if (Machine.FORM.cheatmotion.lockState == MAME.Core.Common.cheatMotion.LockState.LOCK_FRAME)
{
Machine.FORM.cheatform.ApplyCheat();
Machine.FORM.cheatmotion.ApplyCheat();
}
GDIDraw();
if (effective_throttle())

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public class Watchdog
{

View File

@ -1,15 +1,17 @@
using MAME.Core.Common;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace mame
{
public class Window
{
private static mainForm _myParentForm;
[DllImport("kernel32.dll ")]
private static extern uint GetTickCount();
private static mainMotion _myParentForm;
//[DllImport("kernel32.dll ")]
//private static extern uint GetTickCount();
private static uint GetTickCount()
{
return (uint)Wintime._stopwatch.ElapsedMilliseconds;
}
public static bool input_enabled, input_paused, mouse_enabled, lightgun_enabled;
public static uint last_poll, last_event_check;
@ -45,7 +47,7 @@ namespace mame
}
winwindow_process_events(true);
}
public static void osd_init(mainForm form)
public static void osd_init(mainMotion form)
{
_myParentForm = form;
wininput_init();

View File

@ -1,18 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
namespace mame
{
public class Wintime
{
[DllImport("kernel32.dll ")]
public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);
[DllImport("kernel32.dll")]
private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
//[DllImport("kernel32.dll ")]
//public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);
//[DllImport("kernel32.dll")]
//private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
#region
public static Stopwatch _stopwatch = Stopwatch.StartNew();
private static long _lastReportedCount = 0;
public static bool QueryPerformanceCounter(ref long lpPerformanceCount)
{
lpPerformanceCount = _stopwatch.ElapsedTicks;
return true;
}
public static bool QueryPerformanceFrequency(ref long PerformanceFrequency)
{
PerformanceFrequency = Stopwatch.Frequency;
return true;
}
#endregion
public static long ticks_per_second;
public static void wintime_init()
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.m68000;
using cpu.m68000;
namespace mame
{

View File

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

View File

@ -1,6 +1,4 @@
using System.Drawing;
using System.Drawing.Imaging;

namespace mame
{
public partial class Capcom
@ -10,731 +8,5 @@ namespace mame
{
}
public static Bitmap GetBg_gng()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x20;
cols = 0x20;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i3 * rows + i4;
int base_offset = 2 * tile_index;
int attr = gng_bgvideoram[tile_index + 0x400];
color = attr & 0x07;
code = gng_bgvideoram[tile_index] + ((attr & 0xc0) << 2);
code = code % bg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = color * 8;
flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03);
group = (attr & 0x08) >> 3;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx2rom[iOffset];
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetFg_gng()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 8;
tileheight = tilewidth;
rows = 0x20;
cols = 0x20;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i4 * cols + i3;
int base_offset = 2 * tile_index;
int attr = Capcom.gng_fgvideoram[tile_index + 0x400];
color = attr & 0x0f;
code = Capcom.gng_fgvideoram[tile_index] + ((attr & 0xc0) << 2);
code = code % fg_tilemap.total_elements;
pen_data_offset = code * 0x40;
palette_base = 0x80 + color * 4;
flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03);
group = 0;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = gfx1rom[iOffset];
if (iByte != 3)
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite_gng()
{
Bitmap bm1;
int offs;
int i5, i6;
int xdir, ydir, offx, offy,color;
int iByte;
Color c1 = new Color();
bm1 = new Bitmap(256, 256);
for (offs = 0x200 - 4; offs >= 0; offs -= 4)
{
byte attributes = Generic.buffered_spriteram[offs + 1];
int sx = Generic.buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01);
int sy = Generic.buffered_spriteram[offs + 2];
int flipx = attributes & 0x04;
int flipy = attributes & 0x08;
if (Generic.buffered_spriteram[offs] == 0 && Generic.buffered_spriteram[offs + 1] == 0 && Generic.buffered_spriteram[offs + 2] == 0 && Generic.buffered_spriteram[offs + 3] == 0)
{
continue;
}
color=(attributes >> 4) & 3;
if (Generic.flip_screen_get() != 0)
{
sx = 240 - sx;
sy = 240 - sy;
flipx = (flipx == 0 ? 1 : 0);
flipy = (flipy == 0 ? 1 : 0);
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
if (sx + offx + xdir * i5 >= 0 && sx + offx + xdir * i5 < 0x100 && sy + offy + ydir * i6 >= 0 && sy + offy + ydir * i6 < 0x100)
{
iByte = gfx3rom[(Generic.buffered_spriteram[offs] + ((attributes << 2) & 0x300)) * 0x100 + i5 + i6 * 0x10];
if (iByte != 0x0f)
{
c1 = Color.FromArgb((int)Palette.entry_color[0x40 + 0x10 * color + iByte]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c1);
}
}
}
}
}
return bm1;
}
public static Bitmap GetAllGDI_gng()
{
Bitmap bm1 = new Bitmap(0x200, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg_gng();
g.DrawImage(bm2, -(scrollx[0] + 256 * scrollx[1]), 0);
}
if (bSprite)
{
bm2 = GetSprite_gng();
g.DrawImage(bm2, 0, 0);
}
if (bFg)
{
bm2 = GetFg_gng();
g.DrawImage(bm2, -(scrolly[0] + 256 * scrolly[1]), 0);
}
return bm1;
}
public static Bitmap GetBg_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x10;
cols = 0x800;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i3 * rows + i4;
int base_offset = 2 * tile_index;
int attr = gfx5rom[base_offset + 0x10000];
color = gfx5rom[base_offset];
code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1];
code = code % bg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = color * 0x10;
group = 0;
flags = (attr & 0x03) ^ (attributes & 0x03);
pen_data_offset = code * 0x100;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx1rom[iOffset];
if (iByte == 0)
{
c1 = Color.Transparent;
}
else
{
if (palette_base + iByte >= 0x400)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetFg_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x10;
cols = 0x800;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code,color;
int group, flags,attributes=0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i3 * rows + i4;
int base_offset = 0x20000 + 2 * tile_index;
int attr = gfx5rom[base_offset + 0x10000];
color = gfx5rom[base_offset];
code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1];
code = code % fg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = 0x100 + color * 0x10;
group = 0;
flags = (attr & 0x03) ^ (attributes & 0x03);
pen_data_offset = code * 0x100;
palette_base = 0x100+ 0x10 * color;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx2rom[iOffset];
if (iByte == 15)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetTx_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x8;
tileheight = tilewidth;
rows = 0x20;
cols = 0x40;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i4 * cols + i3;
int base_offset = 0x20000 + 2 * tile_index;
code = Capcom.sf_videoram[tile_index];
color = code >> 12;
flags = (((code & 0xc00) >> 10) & 0x03) ^ (attributes & 0x03);
code = (code & 0x3ff) % tx_tilemap.total_elements;
pen_data_offset = code * 0x40;
palette_base = 0x300 + color * 4;
group = 0;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x8 + i1;
iByte = gfx4rom[iOffset];
if (iByte == 3)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite_sf()
{
Bitmap bm1;
int offs;
int i5, i6;
int xdir, ydir, offx, offy;
int iByte1,iByte2,iByte3,iByte4;
Color c11 = new Color(),c12=new Color(),c13=new Color(),c14=new Color();
bm1 = new Bitmap(512,256);
for (offs = 0x1000 - 0x20; offs >= 0; offs -= 0x20)
{
int c = sf_objectram[offs];
int attr = sf_objectram[offs + 1];
int sy = sf_objectram[offs + 2];
int sx = sf_objectram[offs + 3];
int color = attr & 0x000f;
int flipx = attr & 0x0100;
int flipy = attr & 0x0200;
if ((attr & 0x400) != 0)
{
int c1, c2, c3, c4, t;
if (Generic.flip_screen_get() != 0)
{
sx = 480 - sx;
sy = 224 - sy;
flipx = (flipx == 0) ? 1 : 0;
flipy = (flipy == 0) ? 1 : 0;
}
c1 = c;
c2 = c + 1;
c3 = c + 16;
c4 = c + 17;
if (flipx != 0)
{
t = c1; c1 = c2; c2 = t;
t = c3; c3 = c4; c4 = t;
}
if (flipy != 0)
{
t = c1; c1 = c3; c3 = t;
t = c2; c2 = c4; c4 = t;
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
iByte1 = gfx3rom[(sf_invert(c1)) * 0x100 + i5 + i6 * 0x10];
iByte2 = gfx3rom[(sf_invert(c2)) * 0x100 + i5 + i6 * 0x10];
iByte3 = gfx3rom[(sf_invert(c3)) * 0x100 + i5 + i6 * 0x10];
iByte4 = gfx3rom[(sf_invert(c4)) * 0x100 + i5 + i6 * 0x10];
if (iByte1 != 0x0f)
{
c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11);
}
if (iByte2 != 0x0f)
{
c12 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte2]);
bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + offy + ydir * i6, c12);
}
if (iByte3 != 0x0f)
{
bm1.SetPixel(sx + offx + xdir * i5, sy + 16 + offy + ydir * i6, c13);
c13 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte3]);
}
if (iByte4 != 0x0f)
{
c14 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte4]);
bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + 16 + offy + ydir * i6, c14);
}
}
}
}
else
{
if (Generic.flip_screen_get() != 0)
{
sx = 496 - sx;
sy = 240 - sy;
flipx = (flipx == 0) ? 1 : 0;
flipy = (flipy == 0) ? 1 : 0;
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
iByte1 = gfx3rom[(sf_invert(c)) * 0x100 + i5 + i6 * 0x10];
if (iByte1 != 0x0f)
{
c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11);
}
}
}
}
}
return bm1;
}
public static Bitmap GetAllGDI_sf()
{
Bitmap bm1 = new Bitmap(0x200, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg_sf();
g.DrawImage(bm2, -bg_scrollx, 0);
}
if(bFg)
{
bm2 = GetFg_sf();
g.DrawImage(bm2, -fg_scrollx, 0);
}
if(bTx)
{
bm2 = GetTx_sf();
g.DrawImage(bm2, 0,0);
}
if(bSprite)
{
bm2 = GetSprite_sf();
g.DrawImage(bm2, 0,0);
}
return bm1;
}
}
}

View File

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

View File

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

View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using cpu.m6809;
using cpu.z80;
using System.IO;
namespace mame
{

View File

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

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace mame
{

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,17 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
{
public partial class CPS
{
private static int iXAll, iYAll, nBitmap;
private static Bitmap bmAll=new Bitmap(512,512);
//private static Bitmap bmAll=new Bitmap(512,512);
private static List<string> lBitmapHash = new List<string>();
private static int cpsb_addr, cpsb_value, mult_factor1, mult_factor2, mult_result_lo, mult_result_hi;
public static int layercontrol, layer_control, palette_control, in2_addr, in3_addr, out2_addr, bootleg_kludge;
@ -279,10 +274,10 @@ namespace mame
}
public static void video_start_cps()
{
bmAll = new Bitmap(512, 512);
Graphics g = Graphics.FromImage(bmAll);
g.Clear(Color.Magenta);
g.Dispose();
//bmAll = new Bitmap(512, 512);
//Graphics g = Graphics.FromImage(bmAll);
//g.Clear(Color.Magenta);
//g.Dispose();
int i;
ttmap[0].enable = true;
ttmap[1].enable = true;

View File

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

View File

@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
namespace mame
namespace mame
{
public partial class Dataeast
{
@ -14,206 +7,5 @@ namespace mame
{
}
public static Bitmap GetBg()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
tilewidth = 0x8;
tileheight = tilewidth;
rows = 0x20;
cols = rows;
width = tilewidth * cols;
height = width;
int iByte;
int tile_index, attr, color, flipyx, code, flags;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
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++)
{
tile_index = i4 * cols + i3;
code = Generic.videoram[tile_index * 2 + 1] + ((Generic.videoram[tile_index * 2] & 0x0f) << 8);
color = Generic.videoram[tile_index * 2] >> 4;
flags = 0;
palette_base = 0x100 + 0x10 * color;
pen_data_offset = code * 0x40;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = Dataeast.gfx1rom[iOffset];
if (palette_base + iByte < 0x200)
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + (x0 + dx0 * i1)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite()
{
int i, j, offsetx, offsety, xdir, ydir, sx1, code = 0, color = 0;
Bitmap bm1;
Color c1 = new Color();
bm1 = new Bitmap(0x100, 0x100);
int offs;
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 (offs = 0; offs < 0x200; offs += 4)
{
if (Generic.spriteram[offs] != 0xf8)
{
int sx, sy, flipx, flipy;
sx = 240 - Generic.spriteram[offs + 2];
sy = 240 - Generic.spriteram[offs];
flipx = Generic.spriteram[offs + 1] & 0x04;
flipy = Generic.spriteram[offs + 1] & 0x02;
if (Generic.flip_screen_get() != 0)
{
sx = 240 - sx;
sy = 240 - sy;
if (flipx != 0)
{
flipx = 0;
}
else
{
flipx = 1;
}
if (flipy != 0)
{
flipy = 0;
}
else
{
flipy = 1;
}
}
if (flipx != 0)
{
offsetx = 0x0f;
xdir = -1;
}
else
{
offsetx = 0;
xdir = 1;
}
if (flipy != 0)
{
offsety = 0x0f;
ydir = -1;
}
else
{
offsety = 0;
ydir = 1;
}
sx1 = sx;
code = Generic.spriteram[offs + 3] + ((Generic.spriteram[offs + 1] & 1) << 8);
color = (Generic.spriteram[offs + 1] & 0x70) >> 4;
for (i = 0; i < 0x10; i++)
{
for (j = 0; j < 0x10; j++)
{
if (sx1 + offsetx + xdir * j >= 0 && sx1 + offsetx + xdir * j < 0x100 && sy + offsety + ydir * i >= 0 && sy + offsety + ydir * i < 0x100)
{
ushort c = gfx2rom[code * 0x100 + 0x10 * i + j];
if (c != 0)
{
c1 = Color.FromArgb((int)Palette.entry_color[color * 4 + c]);
ptr2 = ptr + ((sy + offsety + ydir * i) * 0x100 + (sx1 + offsetx + xdir * j)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetAllGDI()
{
Bitmap bm1 = new Bitmap(0x100, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg();
g.DrawImage(bm2, 0, 0);
}
if (bSprite)
{
bm2 = GetSprite();
g.DrawImage(bm2, 0, 0);
}
switch (Machine.sDirection)
{
case "":
break;
case "90":
bm1.RotateFlip(RotateFlipType.Rotate90FlipNone);
break;
}
return bm1;
}
}
}

View File

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

View File

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

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.m6502;
using System.IO;
using cpu.m6502;
namespace mame
{

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

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

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 IGS011
{
@ -14,82 +6,5 @@ namespace mame
{
}
public static Bitmap GetBmp(string layer1)
{
int width = 0x200, height = 0xf0;
int x, y, l, scr_addr, pri_addr;
int pri_ram_offset;
pri_ram_offset = (priority & 7) * 0x100;
Color c1 = new Color();
Bitmap bm1;
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 (y = 0; y < 0xef; y++)
{
for (x = 0; x < 0x1ff; x++)
{
scr_addr = x + y * 0x200;
pri_addr = 0xff;
for (l = 0; l < 8; l++)
{
if (layer[l][scr_addr] != 0xff)
{
pri_addr &= ~(1 << l);
}
}
if (layer1 == "normal")
{
l = priority_ram[pri_ram_offset + pri_addr] & 7;
}
else
{
l = int.Parse(layer1);
}
c1 = Color.FromArgb((int)Palette.entry_color[layer[l][scr_addr] | (l << 8)]);
ptr2 = ptr + (y * width + x) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetAllGDI(string layer)
{
Bitmap bm1 = new Bitmap(0x200, 0xf0), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
bm2 = GetBmp(layer);
g.DrawImage(bm2, 0, 0);
/*if (bBg)
{
bm2 = GetBg_sf();
g.DrawImage(bm2, -bg_scrollx, 0);
}
if (bFg)
{
bm2 = GetFg_sf();
g.DrawImage(bm2, -fg_scrollx, 0);
}
if (bTx)
{
bm2 = GetTx_sf();
g.DrawImage(bm2, 0, 0);
}
if (bSprite)
{
bm2 = GetSprite_sf();
g.DrawImage(bm2, 0, 0);
}*/
return bm1;
}
}
}

View File

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

View File

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

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class IGS011
{
@ -100,7 +95,8 @@ namespace mame
{
int i1 = 1;
}
else*/ if(address == 0x800003)
else*/
if (address == 0x800003)
{
result = (sbyte)drgnwrld_igs003_r();
}

View File

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

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.m68000;
using System.IO;
using cpu.m68000;
namespace mame
{

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using System;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 cpu.z80;
namespace mame
namespace mame
{
public partial class Konami68000
{

View File

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

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame
{

View File

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

View File

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

View File

@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
namespace mame
namespace mame
{
public partial class M72
{
@ -14,341 +7,5 @@ namespace mame
{
}
public static void GetData()
{
}
public static Bitmap GetBG()
{
int i1, i2, iOffset, i3, i4, iOffset3 = 0;
int rows, cols, width, height;
int tilewidth, tileheight;
tilewidth = 8;
tileheight = tilewidth;
rows = 0x40;
cols = rows;
width = tilewidth * cols;
height = width;
int iByte;
int iCode, iCode1, iAttr;
int iColor, iFlag, iGroup;
int idx = 0, pri, pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match;
Color c1 = new Color();
Bitmap bm1;
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++)
{
iOffset3 = (i4 * 0x40 + i3) * 2;
iCode = m72_videoram2[iOffset3*2]+m72_videoram2[iOffset3*2+1]*0x100;
iColor = m72_videoram2[(iOffset3 + 1) * 2];
iAttr = m72_videoram2[(iOffset3 + 1) * 2 + 1];
if ((iAttr & 0x01) != 0)
{
pri = 2;
}
else if ((iColor & 0x80) != 0)
{
pri = 1;
}
else
{
pri = 0;
}
iCode1 = iCode % bg_tilemap.total_elements;
pen_data_offset = iCode1 * 0x40;
palette_base = 0x100 + 0x10 * (iColor & 0x0f);
iFlag = (((iColor & 0x60) >> 5) & 3) ^ (bg_tilemap.attributes & 0x03);
if (iFlag == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (iFlag == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (iFlag == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (iFlag == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = M72.gfx21rom[iOffset];
if (iByte == 0)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[0x100 + 0x10 * (iColor & 0x0f) + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetFg()
{
int i1, i2, iOffset, i3, i4, iOffset3 = 0;
int rows, cols, width, height;
int tilewidth, tileheight;
tilewidth = 8;
tileheight = tilewidth;
rows = 0x40;
cols = rows;
width = tilewidth * cols;
height = width;
int iByte;
int iCode, iCode1, iAttr;
int iColor, iFlag, iGroup;
int idx = 0, pri, pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match,y0offset;
Color c1 = new Color();
Bitmap bm1;
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++)
{
iOffset3 = (i4 * 0x40 + i3) * 2;
iCode = m72_videoram1[iOffset3 * 2] + m72_videoram1[iOffset3 * 2 + 1] * 0x100;
iColor = m72_videoram1[(iOffset3 + 1) * 2];
iAttr = m72_videoram1[(iOffset3 + 1) * 2 + 1];
if ((iAttr & 0x01) != 0)
{
pri = 2;
}
else if ((iColor & 0x80) != 0)
{
pri = 1;
}
else
{
pri = 0;
}
if (pri == 0)
{
y0offset = 0;// 0x90;
}
else
{
y0offset = 0;
}
iCode1 = iCode % bg_tilemap.total_elements;
pen_data_offset = iCode1 * 0x40;
palette_base = 0x100 + 0x10 * (iColor & 0x0f);
iFlag = (((iColor & 0x60) >> 5) & 3) ^ (bg_tilemap.attributes & 0x03);
if (iFlag == 0)
{
x0 = tilewidth * i3;
y0 = y0offset + tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (iFlag == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = y0offset + tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (iFlag == 2)
{
x0 = tilewidth * i3;
y0 = y0offset+ tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (iFlag == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = y0offset + tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = M72.gfx21rom[iOffset];
if (iByte == 0)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[0x100 + 0x10 * (iColor & 0x0f) + iByte]);
}
ptr2 = ptr + (((y0 + dy0 * i2)%0x200) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite(int n1,int n2)
{
Bitmap bm1 = new Bitmap(512, 512);
Color c1;
int offs;
int x0, y0, dx0, dy0, i5, i6,startx,starty,xdir,ydir;
offs = 0;
while (offs < 0x400 / 2)
{
int code, color, sx, sy, flipx, flipy, w, h, x, y;
code = m72_spriteram[offs + 1];
color = m72_spriteram[offs + 2] & 0x0f;
sx = -256 + (m72_spriteram[offs + 3] & 0x3ff);
sy = 384 - (m72_spriteram[offs + 0] & 0x1ff);
flipx = m72_spriteram[offs + 2] & 0x0800;
flipy = m72_spriteram[offs + 2] & 0x0400;
w = 1 << ((m72_spriteram[offs + 2] & 0xc000) >> 14);
h = 1 << ((m72_spriteram[offs + 2] & 0x3000) >> 12);
sy -= 16 * h;
if (offs >= n1 && offs <= n2)
{
/*if (flip_screen_get())
{
sx = 512 - 16 * w - sx;
sy = 284 - 16 * h - sy;
flipx = !flipx;
flipy = !flipy;
}*/
if (flipy != 0)
{
starty = 15;
ydir = -1;
}
else
{
starty = 0;
ydir = 1;
}
if (flipx != 0)
{
startx = 15;
xdir = -1;
}
else
{
startx = 0;
xdir = 1;
}
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
int c = code;
if (flipx != 0)
{
c += 8 * (w - 1 - x);
}
else
{
c += 8 * x;
}
if (flipy != 0)
{
c += h - 1 - y;
}
else
{
c += y;
}
for (i5 = 0; i5 < 16; i5++)
{
for (i6 = 0; i6 < 16; i6++)
{
if (sprites1rom[c * 0x100 + i6 * 0x10 + i5] == 0)
{
c1 = Color.Transparent;
}
else
{
if (sx + 16 * x + i5 >= 0 && sx + 0x10 * x + i5 < 0x200)
{
c1 = Color.FromArgb((int)Palette.entry_color[0x10 * color + sprites1rom[c * 0x100 + i6 * 0x10 + i5]]);
bm1.SetPixel((0x200 + sx + 0x10 * x + startx + i5 * xdir) % 0x200, sy + 0x10 * y + starty + i6 * ydir, c1);
}
}
}
}
}
}
}
offs += w * 4;
}
return bm1;
}
public static Bitmap GetAllGDI(int n1, int n2)
{
Bitmap bm1 = new Bitmap(0x200, 0x200), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBG();
g.DrawImage(bm2, 0, 0);
}
if (bFg)
{
bm2 = GetFg();
g.DrawImage(bm2, 0, 0);
}
if (bSprite)
{
bm2 = GetSprite(n1, n2);
g.DrawImage(bm2, -0x40, 0);
}
return bm1;
}
}
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.nec;
namespace mame
{

View File

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

Some files were not shown because too many files have changed in this diff Show More