video 方便尽可能指针化

This commit is contained in:
sin365 2025-01-19 22:45:37 +08:00
parent 81cebcefc0
commit 7a198a5e16
31 changed files with 198 additions and 167 deletions

View File

@ -7,7 +7,7 @@ namespace MAME.Core
/// <summary>
/// 原依赖Form的内容
/// </summary>
public class Motion
public unsafe class Motion
{
private static uint UI_FILLCOLOR = Palette.make_argb(0xe0, 0x10, 0x10, 0x30);
public delegate void motion_delegate();
@ -29,9 +29,9 @@ namespace MAME.Core
// // byte bright = 0xa7;
// // for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// // {
// // red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// // green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// // blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// // red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// // green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// // blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// // Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// // }
// // }
@ -39,7 +39,7 @@ namespace MAME.Core
// // {
// // for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// // {
// // Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// // Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// // }
// // }
// //}
@ -65,10 +65,10 @@ namespace MAME.Core
// {
// //i = y * Video.fullwidth + x;
// i = stepIndex + x;
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
// }
@ -82,7 +82,7 @@ namespace MAME.Core
// {
// //i = y * Video.fullwidth + x;
// i = stepIndex + x;
// Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// }
// }
@ -90,9 +90,9 @@ namespace MAME.Core
//}
public unsafe static void ui_updateC()
{
//fixed (ushort* curbitmapPtr = &Video.bitmapbase[Video.curbitmap][0])
//fixed (ushort* curbitmapPtr = &Video.bitmapbase_Ptrs[Video.curbitmap][0])
//fixed (uint* entry_colorPtr = &Palette.entry_color[0])
//fixed (int* bitmapcolorRectPtr = &Video.bitmapcolorRect[0])
//fixed (int* bitmapcolorRectPtr = &Video.bitmapcolorRect_Ptrunsafe[0])
{
//ushort* curbitmap = curbitmapPtr;
ushort* curbitmap = (ushort*)Video.bitmapbase_Ptrs[Video.curbitmap];
@ -111,9 +111,9 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
@ -121,7 +121,7 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// }
//}
@ -180,11 +180,11 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// if (Video.bitmapbase[Video.curbitmap][i] < 0x100)
// if (Video.bitmapbase_Ptrs[Video.curbitmap][i] < 0x100)
// {
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// else
@ -197,9 +197,9 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// if (Video.bitmapbase[Video.curbitmap][i] < 0x100)
// if (Video.bitmapbase_Ptrs[Video.curbitmap][i] < 0x100)
// {
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// else
// {
@ -230,12 +230,12 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
if (Video.bitmapbase[Video.curbitmap][i] < 0x100)
if (Video.bitmapbase_Ptrs[Video.curbitmap][i] < 0x100)
{
red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
}
else
{
@ -253,20 +253,20 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
if (Video.bitmapbase[Video.curbitmap][i] < 0x100)
if (Video.bitmapbase_Ptrs[Video.curbitmap][i] < 0x100)
{
Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
}
else
{
Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[0];
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[0];
}
}
}
}
}
}
public static void ui_updateN()
public unsafe static void ui_updateN()
{
//不再填充完整画布
//{
@ -277,9 +277,9 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// red = ((Video.bitmapbaseN[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
// green = ((Video.bitmapbaseN[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
// blue = (Video.bitmapbaseN[Video.curbitmap][i] & 0xff) * bright / 0xff;
// red = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
// green = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
// blue = (Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff) * bright / 0xff;
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
@ -287,7 +287,7 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// Video.bitmapcolor[i] = (int)(0xff000000 | (uint)Video.bitmapbaseN[Video.curbitmap][i]);
// Video.bitmapcolor[i] = (int)(0xff000000 | (uint)Video.bitmapbaseN_Ptrs[Video.curbitmap][i]);
// }
// }
//}
@ -312,10 +312,10 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
red = ((Video.bitmapbaseN[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
green = ((Video.bitmapbaseN[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
blue = (Video.bitmapbaseN[Video.curbitmap][i] & 0xff) * bright / 0xff;
Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
red = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
green = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
blue = (Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff) * bright / 0xff;
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
}
}
}
@ -328,7 +328,7 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
Video.bitmapcolorRect[target_i] = (int)(0xff000000 | (uint)Video.bitmapbaseN[Video.curbitmap][i]);
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)(0xff000000 | (uint)Video.bitmapbaseN_Ptrs[Video.curbitmap][i]);
}
}
}
@ -345,9 +345,9 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
@ -355,7 +355,7 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// }
//}
@ -380,10 +380,10 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
}
}
}
@ -396,7 +396,7 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
}
}
}
@ -413,9 +413,9 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
@ -423,7 +423,7 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// }
//}
@ -449,10 +449,10 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
}
}
}
@ -465,7 +465,7 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
}
}
}
@ -482,9 +482,9 @@ namespace MAME.Core
// byte bright = 0xa7;
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
// green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
// blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
// Video.bitmapcolor[i] = (int)Palette.make_argb(0xff, red, green, blue);
// }
// }
@ -492,7 +492,7 @@ namespace MAME.Core
// {
// for (i = 0; i < Video.fullwidth * Video.fullheight; i++)
// {
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
// Video.bitmapcolor[i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
// }
// }
//}
@ -518,10 +518,10 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
red = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
red = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff0000) >> 16) * bright / 0xff);
green = (int)(((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff00) >> 8) * bright / 0xff);
blue = (int)((Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]] & 0xff) * bright / 0xff);
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
}
}
}
@ -534,7 +534,7 @@ namespace MAME.Core
{
//i = y * Video.fullwidth + x;
i = stepIndex + x;
Video.bitmapcolorRect[target_i] = (int)Palette.entry_color[Video.bitmapbase[Video.curbitmap][i]];
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.entry_color[Video.bitmapbase_Ptrs[Video.curbitmap][i]];
}
}
}

View File

@ -19,7 +19,7 @@ namespace MAME.Core
public Atime vblank_end_time;
public long frame_number;
};
partial class Video
unsafe partial class Video
{
public static bool flip_screen_x, flip_screen_y;
public static long frame_number_obj;
@ -37,13 +37,19 @@ namespace MAME.Core
private static uint throttle_history, overall_valid_counter, overall_real_seconds;
private static int[] popcount;
//public static ushort[][] bitmapbase;
public static int[][] bitmapbaseN;
//public static int[][] bitmapbaseN;
//public static int[] bitmapcolor;
/** bitmapcolor的指针管理 **/
public static ushort[][] bitmapbase;
public static ushort[][] bitmapbase; //还有 部分 Array.Copy 在引用
static GCHandle[] bitmapbase_handles;
public static IntPtr[] bitmapbase_Ptrs;
public static ushort*[] bitmapbase_Ptrs;
/** end **/
/** bitmapbaseN的指针管理 **/
public static int[][] bitmapbaseN; //还有 部分 Array.Copy 在引用
static GCHandle[] bitmapbaseN_handles;
public static int*[] bitmapbaseN_Ptrs;
/** end **/
/** bitmapcolor的指针管理 **/
@ -52,10 +58,10 @@ namespace MAME.Core
//static GCHandle bitmapcolor_handle;
//public static IntPtr bitmapcolor_Ptr;
public static int[] bitmapcolorRect;
static GCHandle bitmapcolorRect_handle;
public static IntPtr bitmapcolorRect_Ptr;
public static int* bitmapcolorRect_Ptrunsafe;
/** end **/
public static int fullwidth, fullheight;
@ -634,15 +640,37 @@ namespace MAME.Core
if (bitmapbase != null)
{
bitmapbase_handles = new GCHandle[bitmapbase.Length];
bitmapbase_Ptrs = new IntPtr[bitmapbase.Length];
bitmapbase_Ptrs = new ushort*[bitmapbase.Length];
for (int i = 0; i < bitmapbase.Length; i++)
{
bitmapbase_handles[i] = GCHandle.Alloc(bitmapbase[i], GCHandleType.Pinned);
bitmapbase_Ptrs[i] = bitmapbase_handles[i].AddrOfPinnedObject();
bitmapbase_Ptrs[i] = (ushort*)bitmapbase_handles[i].AddrOfPinnedObject();
}
}
if (bitmapbaseN_handles != null)
{
for (int i = 0; i < bitmapbaseN_handles.Length; i++)
{
if (bitmapbaseN_handles[i].IsAllocated)
bitmapbaseN_handles[i].Free();
}
bitmapbaseN_handles = null;
bitmapbaseN_Ptrs = null;
}
if (bitmapbaseN != null)
{
bitmapbaseN_handles = new GCHandle[bitmapbaseN.Length];
bitmapbaseN_Ptrs = new int*[bitmapbaseN.Length];
for (int i = 0; i < bitmapbaseN.Length; i++)
{
bitmapbaseN_handles[i] = GCHandle.Alloc(bitmapbaseN[i], GCHandleType.Pinned);
bitmapbaseN_Ptrs[i] = (int*)bitmapbaseN_handles[i].AddrOfPinnedObject();
}
}
/** end **/
//bitmapcolor = new int[Video.fullwidth * Video.fullheight];
@ -674,6 +702,8 @@ namespace MAME.Core
bitmapcolorRect_handle = GCHandle.Alloc(bitmapcolorRect, GCHandleType.Pinned);
// 获取数组的指针
bitmapcolorRect_Ptr = bitmapcolorRect_handle.AddrOfPinnedObject();
bitmapcolorRect_Ptrunsafe = (int*)bitmapcolorRect_Ptr;
/** end **/

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_gng(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
@ -94,7 +94,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0x0f)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}
@ -191,7 +191,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0x0f)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace MAME.Core
{
public partial class Capcom
public unsafe partial class Capcom
{
public static void tilemap_init()
{
@ -193,7 +193,7 @@ namespace MAME.Core
Tilemap.lsTmap.Add(tx_tilemap);
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceCapcom_gng(RECT cliprect, int xpos, int ypos)
{
@ -274,7 +274,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
}
}
offsety2++;
@ -373,7 +373,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
}
}
offsety2++;

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Capcom
public unsafe partial class Capcom
{
public static Tmap bg_tilemap, fg_tilemap, tx_tilemap;
public static int bg_scrollx, fg_scrollx;

View File

@ -62,7 +62,7 @@
int colorbase = 0x10 * color;
blockmove_4toN_transpen_pri16(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx, primask);
}
private static void blockmove_4toN_transpen_pri16(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx, uint primask)
private unsafe static void blockmove_4toN_transpen_pri16(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx, uint primask)
{
int ydir, xdir, col, i, j;
int srcdata_offset = code * 0x100;
@ -97,7 +97,7 @@
{
if (((1 << (Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x1f)) & primask) == 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] = (byte)((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x7f) | 0x1f);
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class CPS
public unsafe partial class CPS
{
public static Tmap[] ttmap;
public static void tilemap_init()
@ -63,7 +63,7 @@ namespace MAME.Core
ttmap[2].total_elements = CPS.gfxrom.Length / 0x200;
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tile_updateC0(int col, int row)
{
@ -376,7 +376,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Tilemap.priority_bitmap[offsety2 + ypos, i] = (byte)(Tilemap.priority_bitmap[offsety2 + ypos, i] | priority);
}
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace MAME.Core
{
public partial class CPS
public unsafe partial class CPS
{
private static int iXAll, iYAll, nBitmap;
//private static Bitmap bmAll=new Bitmap(512,512);
@ -646,7 +646,7 @@ namespace MAME.Core
sy = ((sy - stars2y) & 0xff) + 0x100;
col = (int)(((col & 0xe0) >> 1) + (Video.screenstate.frame_number / 16 & 0x0f));
if (sx >= Video.screenstate.visarea.min_x && sx <= Video.screenstate.visarea.max_x && sy >= Video.screenstate.visarea.min_y && sy <= Video.screenstate.visarea.max_y)
Video.bitmapbase[Video.curbitmap][sy * 0x200 + sx] = (ushort)(0xa00 + col);
Video.bitmapbase_Ptrs[Video.curbitmap][sy * 0x200 + sx] = (ushort)(0xa00 + col);
}
}
}
@ -663,7 +663,7 @@ namespace MAME.Core
sy = ((sy - stars1y) & 0xff) + 0x100;
col = (int)(((col & 0xe0) >> 1) + (Video.screenstate.frame_number / 16 & 0x0f));
if (sx >= Video.screenstate.visarea.min_x && sx <= Video.screenstate.visarea.max_x && sy >= Video.screenstate.visarea.min_y && sy <= Video.screenstate.visarea.max_y)
Video.bitmapbase[Video.curbitmap][sy * 0x200 + sx] = (ushort)(0x800 + col);
Video.bitmapbase_Ptrs[Video.curbitmap][sy * 0x200 + sx] = (ushort)(0x800 + col);
}
}
}
@ -703,7 +703,7 @@ namespace MAME.Core
break;
}
}
public static void video_update_cps1()
public unsafe static void video_update_cps1()
{
int i;
int l0, l1, l2, l3;

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_pcktgal(byte[] bb1, int gfxwidth, int gfxheight, int gfxsrcmodulo, int gfxtotal_elements, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
@ -96,7 +96,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}

View File

@ -35,7 +35,7 @@ namespace MAME.Core
bg_tilemap.tile_update3 = bg_tilemap.tile_updatePcktgalbg;
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tile_updatePcktgalbg(int col, int row)
{
@ -172,7 +172,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
}
}
offsety2++;

View File

@ -34,7 +34,7 @@
}
lhb2_pen_hi = 0;
}
public static void video_update_igs011()
public unsafe static void video_update_igs011()
{
int x, y, l, scr_addr, pri_addr;
int pri_ram_offset;
@ -53,7 +53,7 @@
}
}
l = priority_ram[pri_ram_offset + pri_addr] & 7;
Video.bitmapbase[Video.curbitmap][y * 0x200 + x] = (ushort)(layer[l][scr_addr] | (l << 8));
Video.bitmapbase_Ptrs[Video.curbitmap][y * 0x200 + x] = (ushort)(layer[l][scr_addr] | (l << 8));
}
}
}

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class Konami68000
public unsafe partial class Konami68000
{
public static void common_drawgfxzoom_konami68000(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, int transparent_color, int scalex, int scaley)
{
@ -93,7 +93,7 @@
c = bb1[source_baseoffset + srcoffset];
if (c != transparent_color)
{
Video.bitmapbase[Video.curbitmap][(sy + i) * 0x200 + sx + j] = (ushort)(colorbase + c);
Video.bitmapbase_Ptrs[Video.curbitmap][(sy + i) * 0x200 + sx + j] = (ushort)(colorbase + c);
}
}
}
@ -193,7 +193,7 @@
{
if (((1 << Tilemap.priority_bitmap[sy + i, sx + j]) & pri_mask) == 0)
{
Video.bitmapbase[Video.curbitmap][(sy + i) * 0x200 + sx + j] = (ushort)(colorbase + c);
Video.bitmapbase_Ptrs[Video.curbitmap][(sy + i) * 0x200 + sx + j] = (ushort)(colorbase + c);
}
Tilemap.priority_bitmap[sy + i, sx + j] = 0x1f;
}
@ -306,11 +306,11 @@
{
if ((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x80) != 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);//palette_shadow_table[paldata[col]];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);//palette_shadow_table[paldata[col]];
}
else
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] = (byte)((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x7f) | 0x1f);

View File

@ -10,7 +10,7 @@ namespace MAME.Core
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceKonami68000(RECT cliprect, int xpos, int ypos)
{
@ -98,7 +98,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Tilemap.priority_bitmap[offsety2 + ypos, i] = (byte)(Tilemap.priority_bitmap[offsety2 + ypos, i] | priority);
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Konami68000
public unsafe partial class Konami68000
{
private static int[] layer_colorbase;
private static int sprite_colorbase, bg_colorbase;
@ -589,7 +589,7 @@ namespace MAME.Core
Array.Clear(Tilemap.priority_bitmap, 0, 0x40000);
for (i = 0; i < 0x20000; i++)
{
Video.bitmapbase[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
Video.bitmapbase_Ptrs[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
}
K052109_tilemap[sorted_layer[0]].tilemap_draw_primask(Video.screenstate.visarea, 0x10, 1);
K052109_tilemap[sorted_layer[1]].tilemap_draw_primask(Video.screenstate.visarea, 0x10, 2);
@ -627,7 +627,7 @@ namespace MAME.Core
Array.Clear(Tilemap.priority_bitmap, 0, 0x40000);
for (i = 0; i < 0x20000; i++)
{
Video.bitmapbase[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
Video.bitmapbase_Ptrs[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
}
K052109_tilemap[sorted_layer[0]].tilemap_draw_primask(Video.screenstate.visarea, 0x10, 1);
if (layerpri[0] >= 0x30 && layerpri[1] < 0x30)
@ -709,7 +709,7 @@ namespace MAME.Core
Array.Clear(Tilemap.priority_bitmap, 0, 0x40000);
for (i = 0; i < 0x20000; i++)
{
Video.bitmapbase[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
Video.bitmapbase_Ptrs[Video.curbitmap][i] = (ushort)(16 * bg_colorbase);
}
K052109_tilemap[sorted_layer[0]].tilemap_draw_primask(Video.screenstate.visarea, 0x10, 1);
K052109_tilemap[sorted_layer[1]].tilemap_draw_primask(Video.screenstate.visarea, 0x10, 2);

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_m72(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
@ -94,7 +94,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}

View File

@ -220,7 +220,7 @@ namespace MAME.Core
bg_tilemap_large.tile_update3 = bg_tilemap.tile_updateM72_bg_m72;
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceM72(RECT cliprect, int xpos, int ypos)
{
@ -289,7 +289,7 @@ namespace MAME.Core
{
for (i = xpos + x_start; i < xpos + x_end; i++)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
}
offsety2++;
}
@ -302,7 +302,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
}
}
offsety2++;

View File

@ -61,7 +61,7 @@
int colorbase = 0x10 * color;
blockmove_8toN_transpen_pri16_m92(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx, primask);
}
public static void blockmove_8toN_transpen_pri16_m92(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int sy, int sx, uint primask)
public unsafe static void blockmove_8toN_transpen_pri16_m92(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int sy, int sx, uint primask)
{
int ydir, xdir, col, i, j;
int offsetx = sx, offsety = sy;
@ -99,11 +99,11 @@
{
if ((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x80) != 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = 0x800;
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = 0x800;
}
else
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] = (byte)((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x7f) | 0x1f);

View File

@ -107,7 +107,7 @@ namespace MAME.Core
}
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceM92(RECT cliprect, int xpos, int ypos)
{
@ -193,7 +193,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Tilemap.priority_bitmap[offsety2 + ypos, i] = (byte)(Tilemap.priority_bitmap[offsety2 + ypos, i] | priority);
}
}

View File

@ -61,11 +61,11 @@
int colorbase = 0x10 * color;
blockmove_8toN_transpen_pri16(tx, ty, code, sw, sh, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
private static void setpixelcolorNa(int offsety, int offsetx, int n)
private unsafe static void setpixelcolorNa(int offsety, int offsetx, int n)
{
if (Tilemap.priority_bitmap[offsety, offsetx] != 0x1f && Tilemap.priority_bitmap[offsety, offsetx] <= Namcos1.namcos1_pri)
{
Video.bitmapbase[Video.curbitmap][offsety * 0x200 + offsetx] = (ushort)n;
Video.bitmapbase_Ptrs[Video.curbitmap][offsety * 0x200 + offsetx] = (ushort)n;
}
Tilemap.priority_bitmap[offsety, offsetx] = 0x1f;
}

View File

@ -167,7 +167,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public void tilemap_draw_instanceNa(RECT cliprect, int xpos, int ypos)
public unsafe void tilemap_draw_instanceNa(RECT cliprect, int xpos, int ypos)
{
int mincol, maxcol;
int x1, y1, x2, y2;
@ -232,7 +232,7 @@ namespace MAME.Core
{
for (i = xpos + x_start; i < xpos + x_end; i++)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * 0x200 + i - xpos] + palette_offset);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * 0x200 + i - xpos] + palette_offset);
Tilemap.priority_bitmap[offsety2 + ypos, i] = priority;
}
offsety2++;
@ -246,7 +246,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * 0x200 + i - xpos] + palette_offset);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * 0x200 + i - xpos] + palette_offset);
Tilemap.priority_bitmap[offsety2 + ypos, i] = priority;
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Neogeo
public unsafe partial class Neogeo
{
public static byte[] sprite_gfx;
public static uint sprite_gfx_address_mask;
@ -170,7 +170,7 @@ namespace MAME.Core
// sprite_list_offset = 0x8600;
// }
// Span<ushort> span_neogeo_videoram = neogeo_videoram.AsSpan();
// Span<int> span_bitmapbaseN_iBitmap = Video.bitmapbaseN[iBitmap].AsSpan();
// Span<int> span_bitmapbaseN_iBitmap = Video.bitmapbaseN_Ptrs[iBitmap].AsSpan();
// Span<byte> span_sprite_gfx = sprite_gfx.AsSpan();
// Span<int> span_pens = pens.AsSpan();
// for (max_sprite_index = 95; max_sprite_index >= 0; max_sprite_index--)
@ -277,7 +277,7 @@ namespace MAME.Core
// //if (sprite_gfx[gfx_offset] != 0)
// if (span_sprite_gfx[gfx_offset] != 0)
// {
// //Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// //Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// span_bitmapbaseN_iBitmap[pixel_addr_offsety * 384 + pixel_addr_offsetx] = span_pens[line_pens_offset + span_sprite_gfx[gfx_offset]];
// }
// pixel_addr_offsetx++;
@ -301,7 +301,7 @@ namespace MAME.Core
// //if (sprite_gfx[gfx_offset] != 0)
// if (span_sprite_gfx[gfx_offset] != 0)
// {
// //Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// //Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// span_bitmapbaseN_iBitmap[pixel_addr_offsety * 384 + pixel_addr_offsetx] = span_pens[line_pens_offset + span_sprite_gfx[gfx_offset]];
// }
// pixel_addr_offsetx++;
@ -326,13 +326,14 @@ namespace MAME.Core
{
fixed (ushort* videoramPtr = &neogeo_videoram[0])
fixed (int* bitmapbasePtr = &Video.bitmapbaseN[iBitmap][0])
//fixed (int* bitmapbasePtr = &Video.bitmapbaseN_Ptrs[iBitmap][0])
fixed (byte* spriteGfxPtr = &sprite_gfx[0])
fixed (int* pensPtr = &pens[0])
fixed (byte* zoomyromPtr = &zoomyrom[0])
{
ushort* neogeo_videoram = videoramPtr;
int* bitmapbase = bitmapbasePtr;
//int* bitmapbase = bitmapbasePtr;
int* bitmapbase = &Video.bitmapbaseN_Ptrs[iBitmap][0];
byte* spriteGfx = spriteGfxPtr;
int* pens = pensPtr;
byte* zoomyrom = zoomyromPtr;
@ -473,7 +474,7 @@ namespace MAME.Core
//if (sprite_gfx[gfx_offset] != 0)
if (spriteGfx[gfx_offset] != 0)
{
//Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
//Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
bitmapbase[pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + spriteGfx[gfx_offset]];
}
pixel_addr_offsetx++;
@ -498,7 +499,7 @@ namespace MAME.Core
//if (sprite_gfx[gfx_offset] != 0)
if (spriteGfx[gfx_offset] != 0)
{
//Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
//Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
bitmapbase[pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + spriteGfx[gfx_offset]];
}
pixel_addr_offsetx++;
@ -639,7 +640,7 @@ namespace MAME.Core
// {
// if (sprite_gfx[gfx_offset] != 0)
// {
// Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// }
// pixel_addr_offsetx++;
// }
@ -661,7 +662,7 @@ namespace MAME.Core
// {
// if (sprite_gfx[gfx_offset] != 0)
// {
// Video.bitmapbaseN[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// Video.bitmapbaseN_Ptrs[iBitmap][pixel_addr_offsety * 384 + pixel_addr_offsetx] = pens[line_pens_offset + sprite_gfx[gfx_offset]];
// }
// pixel_addr_offsetx++;
// }
@ -814,7 +815,7 @@ namespace MAME.Core
}
if ((data & 0x0f) != 0)
{
Video.bitmapbaseN[iBitmap][384 * scanline + 30 + x * 8 + i] = pens[char_pens_offset + (data & 0x0f)];
Video.bitmapbaseN_Ptrs[iBitmap][384 * scanline + 30 + x * 8 + i] = pens[char_pens_offset + (data & 0x0f)];
}
}
video_data_offset += 0x20;

View File

@ -128,7 +128,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public void tilemap_draw_instancePgm(RECT cliprect, int xpos, int ypos)
public unsafe void tilemap_draw_instancePgm(RECT cliprect, int xpos, int ypos)
{
int mincol, maxcol;
int x1, y1, x2, y2;
@ -207,7 +207,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = (ushort)(pixmap[offsety2 * width + i - xpos] + palette_offset);
Tilemap.priority_bitmap[offsety2 + ypos, i] = priority;
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class PGM
public unsafe partial class PGM
{
public static ushort[] pgm_spritebufferram; // buffered spriteram
public static ushort[] sprite_temp_render;
@ -48,13 +48,13 @@ namespace MAME.Core
{
if (pri == 0)
{
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
else
{
if ((Tilemap.priority_bitmap[ydrawpos, xdrawpos] & 2) == 0)
{
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
}
}
@ -67,7 +67,7 @@ namespace MAME.Core
{
if ((Tilemap.priority_bitmap[ydrawpos, xdrawpos] & 1) == 0)
{
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
Tilemap.priority_bitmap[ydrawpos, xdrawpos] |= 1;
}
@ -80,7 +80,7 @@ namespace MAME.Core
{
if ((Tilemap.priority_bitmap[ydrawpos, xdrawpos] & 2) == 0)
{
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
}
Tilemap.priority_bitmap[ydrawpos, xdrawpos] |= 1;
@ -109,14 +109,14 @@ namespace MAME.Core
if ((srcdat & 0x8000) == 0)
{
if ((xdrawpos >= 0) && (xdrawpos < 448))
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
xcntdraw++;
xdrawpos = xpos + xcntdraw;
if ((srcdat & 0x8000) == 0)
{
if ((xdrawpos >= 0) && (xdrawpos < 448))
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
xcntdraw++;
}
@ -130,7 +130,7 @@ namespace MAME.Core
if ((srcdat & 0x8000) == 0)
{
if ((xdrawpos >= 0) && (xdrawpos < 448))
Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
Video.bitmapbase_Ptrs[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat;
}
xcntdraw++;
}

View File

@ -61,7 +61,7 @@
int colorbase = 0x10 * color;
blockmove_8toN_transpen16_starfigh(bb1, code, sw, sh, 8, ls, ts, flipx, flipy, dw, dh, colorbase, sx, sy);
}
public static void blockmove_8toN_transpen16_starfigh(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsetx, int offsety)
public unsafe static void blockmove_8toN_transpen16_starfigh(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsetx, int offsety)
{
int ydir, xdir, col, i, j;
int srcdata_offset = code * 0x40;
@ -94,7 +94,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0x0f)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}

View File

@ -61,7 +61,7 @@
int colorbase = 0x10 * color;
blockmove_8toN_transpen16_bublbobl(bb1, code, sw, sh, 8, ls, ts, flipx, flipy, dw, dh, colorbase, sx, sy);
}
public static void blockmove_8toN_transpen16_bublbobl(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsetx, int offsety)
public unsafe static void blockmove_8toN_transpen16_bublbobl(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsetx, int offsety)
{
int ydir, xdir, col, i, j;
int srcdata_offset = code * 0x40;
@ -94,7 +94,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0x0f)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}
@ -162,7 +162,7 @@
int colorbase = color * 0x10;
blockmove_8toN_transpen_pri16_opwolf(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, pri_mask, sx, sy);
}
public static void blockmove_8toN_transpen_pri16_opwolf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,
public unsafe static void blockmove_8toN_transpen_pri16_opwolf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,
int leftskip, int topskip, int flipx, int flipy,
int dstwidth, int dstheight, int colorbase, uint pmask, int sx, int sy)
{
@ -201,7 +201,7 @@
{
if (((1 << (Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x1f)) & pmask) == 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x140 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x140 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] = (byte)((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x7f) | 0x1f);
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceTaito_opwolf(RECT cliprect, int xpos, int ypos)
{
@ -88,7 +88,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x140 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x140 + i] = pixmap[offsety2 * width + i - xpos];
Tilemap.priority_bitmap[offsety2 + ypos, i] = (byte)(Tilemap.priority_bitmap[offsety2 + ypos, i] | priority);
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Taito
public unsafe partial class Taito
{
public static byte[] gfx1rom, gfx2rom, gfx12rom, gfx22rom, prom;
public static int bublbobl_objectram_size = 0x300;

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Taitob
public unsafe partial class Taitob
{
public static Tmap bg_tilemap, fg_tilemap, tx_tilemap;
public static void tilemap_init()
@ -95,7 +95,7 @@ namespace MAME.Core
tx_tilemap.tile_update3 = tx_tilemap.tile_updateTaitobtx;
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tilemap_draw_instanceTaitob(RECT cliprect, int xpos, int ypos)
{
@ -181,7 +181,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x200 + i] = pixmap[offsety2 * width + i - xpos];
Tilemap.priority_bitmap[offsety2 + ypos, i] = (byte)(Tilemap.priority_bitmap[offsety2 + ypos, i] | priority);
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Taitob
public unsafe partial class Taitob
{
public static ushort[][] framebuffer;
public static ushort[] taitob_scroll, TC0180VCU_ram, taitob_spriteram, taitob_pixelram;
@ -507,7 +507,7 @@ namespace MAME.Core
ushort c = framebuffer[framebuffer_page][y * 512 + x];
if (c != 0)
{
Video.bitmapbase[Video.curbitmap][(255 - y) * 512 + 319 - x] = (ushort)(b_sp_color_base + c);
Video.bitmapbase_Ptrs[Video.curbitmap][(255 - y) * 512 + 319 - x] = (ushort)(b_sp_color_base + c);
}
}
}
@ -521,7 +521,7 @@ namespace MAME.Core
ushort c = framebuffer[framebuffer_page][y * 512 + x];
if (c != 0)
{
Video.bitmapbase[Video.curbitmap][y * 512 + x] = (ushort)(b_sp_color_base + c);
Video.bitmapbase_Ptrs[Video.curbitmap][y * 512 + x] = (ushort)(b_sp_color_base + c);
}
}
}
@ -538,7 +538,7 @@ namespace MAME.Core
ushort c = framebuffer[framebuffer_page][y * 512 + x];
if ((c != 0) && ((c & 0x10) == priority))
{
Video.bitmapbase[Video.curbitmap][(255 - y) * 512 + 319 - x] = (ushort)(b_sp_color_base + c);
Video.bitmapbase_Ptrs[Video.curbitmap][(255 - y) * 512 + 319 - x] = (ushort)(b_sp_color_base + c);
}
}
}
@ -552,7 +552,7 @@ namespace MAME.Core
ushort c = framebuffer[framebuffer_page][y * 512 + x];
if ((c != 0) && ((c & 0x10) == priority))
{
Video.bitmapbase[Video.curbitmap][y * 512 + x] = (ushort)(b_sp_color_base + c);
Video.bitmapbase_Ptrs[Video.curbitmap][y * 512 + x] = (ushort)(b_sp_color_base + c);
}
}
}

View File

@ -63,7 +63,7 @@
int colorbase = 8 * color;
blockmove_8toN_transpen16_pbaction(bb1, code, sw, sh, sm, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_pbaction(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx)
public unsafe static void blockmove_8toN_transpen16_pbaction(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx)
{
int ydir, xdir, col, i, j;
int srcdata_offset = code * srcwidth * srcheight;
@ -96,7 +96,7 @@
col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0)
{
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety + ydir * i) * 0x100 + offsetx + xdir * j] = (ushort)(colorbase + col);
}
}
}

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Tehkan
public unsafe partial class Tehkan
{
public static Tmap bg_tilemap, fg_tilemap;
public static void tilemap_init()
@ -62,7 +62,7 @@ namespace MAME.Core
fg_tilemap.tile_update3 = fg_tilemap.tile_updatePbactionfg;
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tile_updatePbactionbg(int col, int row)
{
@ -261,7 +261,7 @@ namespace MAME.Core
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{
Video.bitmapbase[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
Video.bitmapbase_Ptrs[Video.curbitmap][(offsety2 + ypos) * 0x100 + i] = pixmap[offsety2 * width + i - xpos];
}
}
offsety2++;