全面指针化

This commit is contained in:
sin365 2025-01-22 18:10:16 +08:00
parent 82fefaa86b
commit 35dbd53908
61 changed files with 2501 additions and 432 deletions

View File

@ -816,8 +816,8 @@ namespace MAME.Core
MC68000.m1.WriteLong = CPS.MCWriteLong_sf2m3;
break;
case "sf2m10":
CPS.mainram2 = new byte[0x100000];
CPS.mainram3 = new byte[0x100];
CPS.mainram2_set = new byte[0x100000];
CPS.mainram3_set = new byte[0x100];
MC68000.m1.ReadByte = CPS.MCReadByte_sf2m10;
MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord = CPS.MCReadWord_sf2m10;
MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong = CPS.MCReadLong_sf2m10;

View File

@ -96,6 +96,8 @@ namespace MAME.Core
set
{
videoram_handle.ReleaseGCHandle();
if (value == null)
return;
videoram_src = value;
videoramLength = value.Length;
videoram_src.GetObjectPtr(ref videoram_handle, ref videoram);
@ -182,6 +184,8 @@ namespace MAME.Core
set
{
spriteram16_handle.ReleaseGCHandle();
if (value == null)
return;
spriteram16_src = value;
spriteram16Length = value.Length;
spriteram16_src.GetObjectPtr(ref spriteram16_handle, ref spriteram16);
@ -199,6 +203,8 @@ namespace MAME.Core
set
{
spriteram16_2_handle.ReleaseGCHandle();
if (value == null)
return;
spriteram16_2_src = value;
spriteram16_2Length = value.Length;
spriteram16_2_src.GetObjectPtr(ref spriteram16_2_handle, ref spriteram16_2);

View File

@ -308,7 +308,7 @@ namespace MAME.Core
playState = PlayState.PLAY_RUNNING;
}
}
public static void postload()
public unsafe static void postload()
{
int i;
switch (Machine.sBoard)

View File

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using UnityEngine;
namespace MAME.Core
{
@ -424,6 +426,12 @@ namespace MAME.Core
GetObjectPtr(srcObj, ref handle, out IntPtr intptr);
ptr = (uint*)intptr;
}
public static void GetObjectPtr(this object srcObj, ref GCHandle handle, ref short* ptr)
{
GetObjectPtr(srcObj, ref handle, out IntPtr intptr);
ptr = (short*)intptr;
}
public static void GetObjectPtr(this object srcObj, ref GCHandle handle, ref ushort* ptr)
{
GetObjectPtr(srcObj, ref handle, out IntPtr intptr);
@ -474,20 +482,36 @@ namespace MAME.Core
set
{
TempBuffer_handle.ReleaseGCHandle();
if (value == null)
return;
TempBuffer_src = value;
TempBuffer_src.GetObjectPtr(ref TempBuffer_handle, ref TempBuffer);
}
}
#endregion
public static void Write(this BinaryWriter bw, byte* buffer, int index, int count)
public static void Write(this BinaryWriter bw, byte* bufferPtr, int offset, int count)
{
// 使用指针复制数据到临时数组
Buffer.MemoryCopy(buffer + index, TempBuffer, count, count);
Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
// 使用BinaryWriter写入临时数组
bw.Write(TempBuffer, 0, count);
bw.Write(TempBuffer_src, 0, count);
}
public static void Write(this FileStream fs, byte* bufferPtr, int offset, int count)
{
// 使用指针复制数据到临时数组
Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
// 使用BinaryWriter写入临时数组
fs.Write(TempBuffer_src, 0, count);
}
public static int Read(this FileStream fs, byte* bufferPtr, int offset, int count)
{
// 使用BinaryWriter写入临时数组
count = fs.Read(TempBuffer_src, offset, count);
// 使用指针复制数据到临时数组
Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
return count;
}
}
public unsafe static class AxiArray
@ -495,43 +519,58 @@ namespace MAME.Core
public static void Copy(byte* src, int srcindex, byte* target, int targetindex, int count)
{
Buffer.MemoryCopy(&src[srcindex], target, targetindex, count);
int singlesize = sizeof(byte);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&src[srcindex], &target[targetindex], totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(short* src, int srcindex, short* target, int targetindex, int count)
{
int singlesize = sizeof(short);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&src[srcindex], &target[targetindex], totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(ushort* src, int srcindex, ushort* target, int targetindex, int count)
{
int singlesize = sizeof(ushort);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&src[srcindex], &target[targetindex], totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(byte* src, byte* target, int index, int count)
{
Buffer.MemoryCopy(src, target, index, count);
int singlesize = sizeof(byte);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&src[index], &target[index], totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(ushort* src, ushort* target, int index, int count)
{
long destinationStartIndexInBytes = index * sizeof(ushort);
long totalBytesToCopy = count * sizeof(ushort);
Buffer.MemoryCopy(src, target, destinationStartIndexInBytes, totalBytesToCopy);
int singlesize = sizeof(ushort);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&src[index], &target[index], totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(ushort* src, ushort* target, int count)
{
long totalBytesToCopy = count * sizeof(ushort);
Buffer.MemoryCopy(src, target, 0, totalBytesToCopy);
int singlesize = sizeof(ushort);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(src, target, totalBytesToCopy, totalBytesToCopy);
}
public static void Copy(byte* src, byte* target, int count)
{
Buffer.MemoryCopy(src, target, 0, count);
int singlesize = sizeof(byte);
long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(src, target, totalBytesToCopy, totalBytesToCopy);
}
public static void Clear(byte* data, int index, int lenght)
{
for (int i = index; i < lenght; i++, index++)
{
data[index] = 0;
}
}
public static void Clear(ushort* data, int index, int lenght)
{
for (int i = index; i < lenght; i++, index++)
{
data[index] = 0;
}
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace MAME.Core
{
@ -16,7 +17,7 @@ namespace MAME.Core
public int max_x;
public int max_y;
}
public partial class Tmap
public unsafe partial class Tmap
{
public int laynum;
public int rows;
@ -43,11 +44,30 @@ namespace MAME.Core
public byte[,] flagsmap;
public byte[,] tileflags;
public byte[,] pen_to_flags;
public byte[] pen_data;
//public byte[] pen_data;
public int mask, value;
public int total_elements;
public Action<int, int> tile_update3;
public Action<RECT, int, int> tilemap_draw_instance3;
#region //指针化 pen_data
byte[] pen_data_src;
GCHandle pen_data_handle;
public byte* pen_data;
public int pen_dataLength;
public bool pen_data_IsNull => pen_data == null;
public byte[] pen_data_set
{
set
{
pen_data_handle.ReleaseGCHandle();
pen_data_src = value;
pen_dataLength = value.Length;
pen_data_src.GetObjectPtr(ref pen_data_handle, ref pen_data);
}
}
#endregion
public int effective_rowscroll(int index)
{
int value;
@ -263,12 +283,12 @@ namespace MAME.Core
all_tiles_dirty = true;
}
}
public class Tilemap
public unsafe class Tilemap
{
public static List<Tmap> lsTmap = new List<Tmap>();
public static byte[,] priority_bitmap;
public static byte[,] bb00, bbFF;
public static byte[] bb0F;
//public static byte[] bb0F;
public static int screen_width, screen_height;
private static int INVALID_LOGICAL_INDEX = -1;
public static byte TILEMAP_PIXEL_TRANSPARENT = 0x00;
@ -279,6 +299,25 @@ namespace MAME.Core
public static byte TILE_FLIPY = 0x02; /* draw this tile vertically flipped */
public static byte TILEMAP_FLIPX = TILE_FLIPX; /* draw the tilemap horizontally flipped */
public static byte TILEMAP_FLIPY = TILE_FLIPY; /* draw the tilemap vertically flipped */
#region //指针化 bb0F
static byte[] bb0F_src;
static GCHandle bb0F_handle;
public static byte* bb0F;
public static int bb0FLength;
public static bool bb0F_IsNull => bb0F == null;
public static byte[] bb0F_set
{
set
{
bb0F_handle.ReleaseGCHandle();
bb0F_src = value;
bb0FLength = value.Length;
bb0F_src.GetObjectPtr(ref bb0F_handle, ref bb0F);
}
}
#endregion
public static void tilemap_init()
{
int i, j;
@ -364,7 +403,7 @@ namespace MAME.Core
case "Taito":
case "Taito B":
case "Konami 68000":
bb0F = new byte[0x400];
bb0F_set = new byte[0x400];
bbFF = new byte[0x80, 0x40];
for (i = 0; i < 0x80; i++)
{

View File

@ -1,12 +1,196 @@
using cpu.m68000;
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Capcom
public unsafe partial class Capcom
{
public static byte[] audiorom2;
//public static byte[] audiorom2;
public static int basebankmain, basebanksnd1;
public static byte[] gfx1rom, gfx2rom, gfx3rom, gfx4rom, gfx5rom, gfx12rom, gfx22rom, gfx32rom, gfx42rom;
//public static byte[] /*gfx1rom,*/ /*gfx2rom, */gfx3rom, gfx4rom, gfx5rom, gfx12rom, gfx22rom, gfx32rom, gfx42rom;
#region //指针化 audiorom2
static byte[] audiorom2_src;
static GCHandle audiorom2_handle;
public static byte* audiorom2;
public static int audiorom2Length;
public static bool audiorom2_IsNull => audiorom2 == null;
public static byte[] audiorom2_set
{
set
{
audiorom2_handle.ReleaseGCHandle();
audiorom2_src = value;
audiorom2Length = value.Length;
audiorom2_src.GetObjectPtr(ref audiorom2_handle, ref audiorom2);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx3rom
static byte[] gfx3rom_src;
static GCHandle gfx3rom_handle;
public static byte* gfx3rom;
public static int gfx3romLength;
public static bool gfx3rom_IsNull => gfx3rom == null;
public static byte[] gfx3rom_set
{
set
{
gfx3rom_handle.ReleaseGCHandle();
gfx3rom_src = value;
gfx3romLength = value.Length;
gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom);
}
}
#endregion
#region //指针化 gfx4rom
static byte[] gfx4rom_src;
static GCHandle gfx4rom_handle;
public static byte* gfx4rom;
public static int gfx4romLength;
public static bool gfx4rom_IsNull => gfx4rom == null;
public static byte[] gfx4rom_set
{
set
{
gfx4rom_handle.ReleaseGCHandle();
gfx4rom_src = value;
gfx4romLength = value.Length;
gfx4rom_src.GetObjectPtr(ref gfx4rom_handle, ref gfx4rom);
}
}
#endregion
#region //指针化 gfx5rom
static byte[] gfx5rom_src;
static GCHandle gfx5rom_handle;
public static byte* gfx5rom;
public static int gfx5romLength;
public static bool gfx5rom_IsNull => gfx5rom == null;
public static byte[] gfx5rom_set
{
set
{
gfx5rom_handle.ReleaseGCHandle();
gfx5rom_src = value;
gfx5romLength = value.Length;
gfx5rom_src.GetObjectPtr(ref gfx5rom_handle, ref gfx5rom);
}
}
#endregion
#region //指针化 gfx12rom
static byte[] gfx12rom_src;
static GCHandle gfx12rom_handle;
public static byte* gfx12rom;
public static int gfx12romLength;
public static bool gfx12rom_IsNull => gfx12rom == null;
public static byte[] gfx12rom_set
{
set
{
gfx12rom_handle.ReleaseGCHandle();
gfx12rom_src = value;
gfx12romLength = value.Length;
gfx12rom_src.GetObjectPtr(ref gfx12rom_handle, ref gfx12rom);
}
}
#endregion
#region //指针化 gfx22rom
static byte[] gfx22rom_src;
static GCHandle gfx22rom_handle;
public static byte* gfx22rom;
public static int gfx22romLength;
public static bool gfx22rom_IsNull => gfx22rom == null;
public static byte[] gfx22rom_set
{
set
{
gfx22rom_handle.ReleaseGCHandle();
gfx22rom_src = value;
gfx22romLength = value.Length;
gfx22rom_src.GetObjectPtr(ref gfx22rom_handle, ref gfx22rom);
}
}
#endregion
#region //指针化 gfx32rom
static byte[] gfx32rom_src;
static GCHandle gfx32rom_handle;
public static byte* gfx32rom;
public static int gfx32romLength;
public static bool gfx32rom_IsNull => gfx32rom == null;
public static byte[] gfx32rom_set
{
set
{
gfx32rom_handle.ReleaseGCHandle();
gfx32rom_src = value;
gfx32romLength = value.Length;
gfx32rom_src.GetObjectPtr(ref gfx32rom_handle, ref gfx32rom);
}
}
#endregion
#region //指针化 gfx42rom
static byte[] gfx42rom_src;
static GCHandle gfx42rom_handle;
public static byte* gfx42rom;
public static int gfx42romLength;
public static bool gfx42rom_IsNull => gfx42rom == null;
public static byte[] gfx42rom_set
{
set
{
gfx42rom_handle.ReleaseGCHandle();
gfx42rom_src = value;
gfx42romLength = value.Length;
gfx42rom_src.GetObjectPtr(ref gfx42rom_handle, ref gfx42rom);
}
}
#endregion
public static ushort dsw1, dsw2;
public static byte bytedsw1, bytedsw2;
public static ushort[] sf_objectram, sf_videoram;
@ -33,25 +217,25 @@ namespace MAME.Core
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
gfx22rom = Machine.GetRom("gfx2.rom");
n = gfx22rom.Length;
gfx2rom = new byte[n * 2];
gfx22rom_set = Machine.GetRom("gfx2.rom");
n = gfx22romLength;
gfx2rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx2rom[i * 2] = (byte)(gfx22rom[i] >> 4);
gfx2rom[i * 2 + 1] = (byte)(gfx22rom[i] & 0x0f);
}
gfx32rom = Machine.GetRom("gfx3.rom");
n = gfx32rom.Length;
gfx3rom = new byte[n * 2];
gfx32rom_set = Machine.GetRom("gfx3.rom");
n = gfx32romLength;
gfx3rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx3rom[i * 2] = (byte)(gfx32rom[i] >> 4);
@ -78,40 +262,40 @@ namespace MAME.Core
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
audiorom2 = Machine.GetRom("audio2.rom");
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
audiorom2_set = Machine.GetRom("audio2.rom");
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
gfx22rom = Machine.GetRom("gfx2.rom");
n = gfx22rom.Length;
gfx2rom = new byte[n * 2];
gfx22rom_set = Machine.GetRom("gfx2.rom");
n = gfx22romLength;
gfx2rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx2rom[i * 2] = (byte)(gfx22rom[i] >> 4);
gfx2rom[i * 2 + 1] = (byte)(gfx22rom[i] & 0x0f);
}
gfx32rom = Machine.GetRom("gfx3.rom");
n = gfx32rom.Length;
gfx3rom = new byte[n * 2];
gfx32rom_set = Machine.GetRom("gfx3.rom");
n = gfx32romLength;
gfx3rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx3rom[i * 2] = (byte)(gfx32rom[i] >> 4);
gfx3rom[i * 2 + 1] = (byte)(gfx32rom[i] & 0x0f);
}
gfx42rom = Machine.GetRom("gfx4.rom");
n = gfx42rom.Length;
gfx4rom = new byte[n * 2];
gfx42rom_set = Machine.GetRom("gfx4.rom");
n = gfx42romLength;
gfx4rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx4rom[i * 2] = (byte)(gfx42rom[i] >> 4);
gfx4rom[i * 2 + 1] = (byte)(gfx42rom[i] & 0x0f);
}
gfx5rom = Machine.GetRom("gfx5.rom");
gfx5rom_set = Machine.GetRom("gfx5.rom");
Memory.Set_mainram(new byte[0x6000]);
Memory.Set_audioram(new byte[0x800]);
if (Memory.mainrom_IsNull || Memory.audiorom_IsNull || gfx12rom == null || gfx22rom == null || gfx32rom == null || gfx42rom == null || gfx5rom == null)

View File

@ -2,7 +2,7 @@
{
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)
public static void common_drawgfx_gng(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -61,7 +61,7 @@
int colorbase = 0x40 + 0x10 * color;
blockmove_8toN_transpen16_gng(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_gng(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 static void blockmove_8toN_transpen16_gng(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 * 0x100;
@ -99,7 +99,7 @@
}
}
}
public static void common_drawgfx_sf(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
public static void common_drawgfx_sf(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -158,7 +158,7 @@
int colorbase = 0x200 + 0x10 * color;
blockmove_8toN_transpen16_sf(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_sf(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 static void blockmove_8toN_transpen16_sf(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 * 0x100;

View File

@ -1,9 +1,85 @@
namespace MAME.Core
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public unsafe partial class Capcom
{
public static byte[] gng_fgvideoram, gng_bgvideoram;
public static byte[] scrollx, scrolly;
//public static byte[] gng_fgvideoram, gng_bgvideoram;
//public static byte[] scrollx, scrolly;
#region //指针化 gng_fgvideoram
static byte[] gng_fgvideoram_src;
static GCHandle gng_fgvideoram_handle;
public static byte* gng_fgvideoram;
public static int gng_fgvideoramLength;
public static bool gng_fgvideoram_IsNull => gng_fgvideoram == null;
public static byte[] gng_fgvideoram_set
{
set
{
gng_fgvideoram_handle.ReleaseGCHandle();
gng_fgvideoram_src = value;
gng_fgvideoramLength = value.Length;
gng_fgvideoram_src.GetObjectPtr(ref gng_fgvideoram_handle, ref gng_fgvideoram);
}
}
#endregion
#region //指针化 gng_bgvideoram
static byte[] gng_bgvideoram_src;
static GCHandle gng_bgvideoram_handle;
public static byte* gng_bgvideoram;
public static int gng_bgvideoramLength;
public static bool gng_bgvideoram_IsNull => gng_bgvideoram == null;
public static byte[] gng_bgvideoram_set
{
set
{
gng_bgvideoram_handle.ReleaseGCHandle();
gng_bgvideoram_src = value;
gng_bgvideoramLength = value.Length;
gng_bgvideoram_src.GetObjectPtr(ref gng_bgvideoram_handle, ref gng_bgvideoram);
}
}
#endregion
#region //指针化 scrollx
static byte[] scrollx_src;
static GCHandle scrollx_handle;
public static byte* scrollx;
public static int scrollxLength;
public static bool scrollx_IsNull => scrollx == null;
public static byte[] scrollx_set
{
set
{
scrollx_handle.ReleaseGCHandle();
scrollx_src = value;
scrollxLength = value.Length;
scrollx_src.GetObjectPtr(ref scrollx_handle, ref scrollx);
}
}
#endregion
#region //指针化 scrolly
static byte[] scrolly_src;
static GCHandle scrolly_handle;
public static byte* scrolly;
public static int scrollyLength;
public static bool scrolly_IsNull => scrolly == null;
public static byte[] scrolly_set
{
set
{
scrolly_handle.ReleaseGCHandle();
scrolly_src = value;
scrollyLength = value.Length;
scrolly_src.GetObjectPtr(ref scrolly_handle, ref scrolly);
}
}
#endregion
public static void gng_bankswitch_w(byte data)
{
if (data == 4)
@ -21,10 +97,10 @@
}
public static void video_start_gng()
{
gng_fgvideoram = new byte[0x800];
gng_bgvideoram = new byte[0x800];
scrollx = new byte[2];
scrolly = new byte[2];
gng_fgvideoram_set = new byte[0x800];
gng_bgvideoram_set = new byte[0x800];
scrollx_set = new byte[2];
scrolly_set = new byte[2];
}
public static void gng_fgvideoram_w(int offset, byte data)
{

View File

@ -59,10 +59,10 @@ namespace MAME.Core
bytedsw1 = reader.ReadByte();
bytedsw2 = reader.ReadByte();
basebankmain = reader.ReadInt32();
gng_fgvideoram = reader.ReadBytes(0x800);
gng_bgvideoram = reader.ReadBytes(0x800);
scrollx = reader.ReadBytes(2);
scrolly = reader.ReadBytes(2);
gng_fgvideoram_set = reader.ReadBytes(0x800);
gng_bgvideoram_set = reader.ReadBytes(0x800);
scrollx_set = reader.ReadBytes(2);
scrolly_set = reader.ReadBytes(2);
Generic.paletteram_set = reader.ReadBytes(0x100);
Generic.paletteram_2_set = reader.ReadBytes(0x100);
Generic.spriteram_set = reader.ReadBytes(0x200);

View File

@ -44,11 +44,11 @@ namespace MAME.Core
fg_tilemap.height = 0x100;
fg_tilemap.enable = true;
fg_tilemap.all_tiles_dirty = true;
fg_tilemap.total_elements = gfx1rom.Length / 0x40;
fg_tilemap.total_elements = gfx1romLength / 0x40;
fg_tilemap.pixmap = new ushort[0x100 * 0x100];
fg_tilemap.flagsmap = new byte[0x100, 0x100];
fg_tilemap.tileflags = new byte[0x20, 0x20];
fg_tilemap.pen_data = new byte[0x40];
fg_tilemap.pen_data_set = new byte[0x40];
fg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -71,11 +71,11 @@ namespace MAME.Core
bg_tilemap.height = 0x200;
bg_tilemap.enable = true;
bg_tilemap.all_tiles_dirty = true;
bg_tilemap.total_elements = gfx2rom.Length / 0x100;
bg_tilemap.total_elements = gfx2romLength / 0x100;
bg_tilemap.pixmap = new ushort[0x200 * 0x200];
bg_tilemap.flagsmap = new byte[0x200, 0x200];
bg_tilemap.tileflags = new byte[0x20, 0x20];
bg_tilemap.pen_data = new byte[0x100];
bg_tilemap.pen_data_set = new byte[0x100];
bg_tilemap.pen_to_flags = new byte[2, 16];
for (i = 0; i < 8; i++)
{
@ -116,11 +116,11 @@ namespace MAME.Core
bg_tilemap.height = 0x100;
bg_tilemap.enable = true;
bg_tilemap.all_tiles_dirty = true;
bg_tilemap.total_elements = gfx1rom.Length / 0x100;
bg_tilemap.total_elements = gfx1romLength / 0x100;
bg_tilemap.pixmap = new ushort[0x100 * 0x8000];
bg_tilemap.flagsmap = new byte[0x100, 0x8000];
bg_tilemap.tileflags = new byte[0x10, 0x800];
bg_tilemap.pen_data = new byte[0x100];
bg_tilemap.pen_data_set = new byte[0x100];
bg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -142,11 +142,11 @@ namespace MAME.Core
fg_tilemap.height = 0x100;
fg_tilemap.enable = true;
fg_tilemap.all_tiles_dirty = true;
fg_tilemap.total_elements = gfx2rom.Length / 0x100;
fg_tilemap.total_elements = gfx2romLength / 0x100;
fg_tilemap.pixmap = new ushort[0x100 * 0x8000];
fg_tilemap.flagsmap = new byte[0x100, 0x8000];
fg_tilemap.tileflags = new byte[0x10, 0x800];
fg_tilemap.pen_data = new byte[0x100];
fg_tilemap.pen_data_set = new byte[0x100];
fg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 15; i++)
{
@ -169,11 +169,11 @@ namespace MAME.Core
tx_tilemap.height = 0x100;
tx_tilemap.enable = true;
tx_tilemap.all_tiles_dirty = true;
tx_tilemap.total_elements = gfx4rom.Length / 0x40;
tx_tilemap.total_elements = gfx4romLength / 0x40;
tx_tilemap.pixmap = new ushort[0x100 * 0x200];
tx_tilemap.flagsmap = new byte[0x100, 0x200];
tx_tilemap.tileflags = new byte[0x20, 0x40];
tx_tilemap.pen_data = new byte[0x40];
tx_tilemap.pen_data_set = new byte[0x40];
tx_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -491,7 +491,7 @@ namespace MAME.Core
group = 0;
tileflags[row, col] = tile_drawCapcomfg_gng(Capcom.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawCapcomfg_gng(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawCapcomfg_gng(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -500,7 +500,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;
@ -530,7 +530,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public byte tile_drawCapcom(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawCapcom(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -539,7 +539,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x100);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x100);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;
@ -569,7 +569,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public byte tile_drawCapcomtx(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawCapcomtx(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -578,7 +578,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
@ -7,12 +8,33 @@ namespace MAME.Core
public static Tmap bg_tilemap, fg_tilemap, tx_tilemap;
public static int bg_scrollx, fg_scrollx;
public static int sf_active;
public static ushort[] uuB0000;
//public static ushort[] uuB0000;
#region //指针化 uuB0000
static ushort[] uuB0000_src;
static GCHandle uuB0000_handle;
public static ushort* uuB0000;
public static int uuB0000Length;
public static bool uuB0000_IsNull => uuB0000 == null;
public static ushort[] uuB0000_set
{
set
{
uuB0000_handle.ReleaseGCHandle();
if (value == null)
return;
uuB0000_src = value;
uuB0000Length = value.Length;
uuB0000_src.GetObjectPtr(ref uuB0000_handle, ref uuB0000);
}
}
#endregion
public static void video_start_sf()
{
int i;
sf_active = 0;
uuB0000 = new ushort[0x200 * 0x100];
uuB0000_set = new ushort[0x200 * 0x100];
for (i = 0; i < 0x20000; i++)
{
uuB0000[i] = 0x0;
@ -155,7 +177,7 @@ namespace MAME.Core
}
else
{
Array.Copy(uuB0000, Video.bitmapbase[Video.curbitmap], 0x20000);
AxiArray.Copy(uuB0000, Video.bitmapbase_Ptrs[Video.curbitmap], 0x20000);
}
fg_tilemap.tilemap_draw_primask(Video.screenstate.visarea, 0x10, 0);
if ((sf_active & 0x80) != 0)

View File

@ -1,15 +1,312 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class CPS
public unsafe partial class CPS
{
public static ushort[] cps_a_regs, cps_b_regs, cps2_objram1, cps2_objram2, cps2_output;
public static byte[] mainromop, gfxrom, gfx1rom, audioromop, starsrom, user1rom;
public static byte[] gfxram;
public static byte[] qsound_sharedram1, qsound_sharedram2;
public static byte[] mainram2, mainram3;
//public static ushort[] cps_a_regs, cps_b_regs, cps2_objram1, cps2_objram2, cps2_output;
//public static byte[] mainromop, gfxrom, gfx1rom, audioromop, starsrom, user1rom;
#region //指针化 cps_a_regs
static ushort[] cps_a_regs_src;
static GCHandle cps_a_regs_handle;
public static ushort* cps_a_regs;
public static int cps_a_regsLength;
public static bool cps_a_regs_IsNull => cps_a_regs == null;
public static ushort[] cps_a_regs_set
{
set
{
cps_a_regs_handle.ReleaseGCHandle();
cps_a_regs_src = value;
cps_a_regsLength = value.Length;
cps_a_regs_src.GetObjectPtr(ref cps_a_regs_handle, ref cps_a_regs);
}
}
#endregion
#region //指针化 cps_b_regs
static ushort[] cps_b_regs_src;
static GCHandle cps_b_regs_handle;
public static ushort* cps_b_regs;
public static int cps_b_regsLength;
public static bool cps_b_regs_IsNull => cps_b_regs == null;
public static ushort[] cps_b_regs_set
{
set
{
cps_b_regs_handle.ReleaseGCHandle();
cps_b_regs_src = value;
cps_b_regsLength = value.Length;
cps_b_regs_src.GetObjectPtr(ref cps_b_regs_handle, ref cps_b_regs);
}
}
#endregion
#region //指针化 cps2_objram1
static ushort[] cps2_objram1_src;
static GCHandle cps2_objram1_handle;
public static ushort* cps2_objram1;
public static int cps2_objram1Length;
public static bool cps2_objram1_IsNull => cps2_objram1 == null;
public static ushort[] cps2_objram1_set
{
set
{
cps2_objram1_handle.ReleaseGCHandle();
cps2_objram1_src = value;
cps2_objram1Length = value.Length;
cps2_objram1_src.GetObjectPtr(ref cps2_objram1_handle, ref cps2_objram1);
}
}
#endregion
#region //指针化 cps2_objram2
static ushort[] cps2_objram2_src;
static GCHandle cps2_objram2_handle;
public static ushort* cps2_objram2;
public static int cps2_objram2Length;
public static bool cps2_objram2_IsNull => cps2_objram2 == null;
public static ushort[] cps2_objram2_set
{
set
{
cps2_objram2_handle.ReleaseGCHandle();
cps2_objram2_src = value;
cps2_objram2Length = value.Length;
cps2_objram2_src.GetObjectPtr(ref cps2_objram2_handle, ref cps2_objram2);
}
}
#endregion
#region //指针化 cps2_output
static ushort[] cps2_output_src;
static GCHandle cps2_output_handle;
public static ushort* cps2_output;
public static int cps2_outputLength;
public static bool cps2_output_IsNull => cps2_output == null;
public static ushort[] cps2_output_set
{
set
{
cps2_output_handle.ReleaseGCHandle();
cps2_output_src = value;
cps2_outputLength = value.Length;
cps2_output_src.GetObjectPtr(ref cps2_output_handle, ref cps2_output);
}
}
#endregion
#region //指针化mainromop
static byte[] mainromop_src;
static GCHandle mainromop_handle;
public static byte* mainromop;
public static int mainromopLength;
public static bool mainromop_IsNull => mainromop == null;
public static byte[] mainromop_set
{
set
{
mainromop_handle.ReleaseGCHandle();
mainromop_src = value;
mainromopLength = value.Length;
mainromop_src.GetObjectPtr(ref mainromop_handle, ref mainromop);
}
}
#endregion
#region //指针化gfxrom
static byte[] gfxrom_src;
static GCHandle gfxrom_handle;
public static byte* gfxrom;
public static int gfxromLength;
public static bool gfxrom_IsNull => gfxrom == null;
public static byte[] gfxrom_set
{
set
{
gfxrom_handle.ReleaseGCHandle();
gfxrom_src = value;
gfxromLength = value.Length;
gfxrom_src.GetObjectPtr(ref gfxrom_handle, ref gfxrom);
}
}
#endregion
#region //指针化gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化audioromop
static byte[] audioromop_src;
static GCHandle audioromop_handle;
public static byte* audioromop;
public static int audioromopLength;
public static bool audioromop_IsNull => audioromop == null;
public static byte[] audioromop_set
{
set
{
audioromop_handle.ReleaseGCHandle();
audioromop_src = value;
audioromopLength = value.Length;
audioromop_src.GetObjectPtr(ref audioromop_handle, ref audioromop);
}
}
#endregion
#region //指针化starsrom
static byte[] starsrom_src;
static GCHandle starsrom_handle;
public static byte* starsrom;
public static int starsromLength;
public static bool starsrom_IsNull => starsrom == null;
public static byte[] starsrom_set
{
set
{
starsrom_handle.ReleaseGCHandle();
if (value == null)
return;
starsrom_src = value;
starsromLength = value.Length;
starsrom_src.GetObjectPtr(ref starsrom_handle, ref starsrom);
}
}
#endregion
#region //指针化user1rom
static byte[] user1rom_src;
static GCHandle user1rom_handle;
public static byte* user1rom;
public static int user1romLength;
public static bool user1rom_IsNull => user1rom == null;
public static byte[] user1rom_set
{
set
{
user1rom_handle.ReleaseGCHandle();
if (value == null)
return;
user1rom_src = value;
user1romLength = value.Length;
user1rom_src.GetObjectPtr(ref user1rom_handle, ref user1rom);
}
}
#endregion
//public static byte[] gfxram;
//public static byte[] qsound_sharedram1, qsound_sharedram2;
//public static byte[] mainram2, mainram3;
#region //指针化 gfxram
static byte[] gfxram_src;
static GCHandle gfxram_handle;
public static byte* gfxram;
public static int gfxramLength;
public static bool gfxram_IsNull => gfxram == null;
public static byte[] gfxram_set
{
set
{
gfxram_handle.ReleaseGCHandle();
gfxram_src = value;
gfxramLength = value.Length;
gfxram_src.GetObjectPtr(ref gfxram_handle, ref gfxram);
}
}
#endregion
#region //指针化 qsound_sharedram1
static byte[] qsound_sharedram1_src;
static GCHandle qsound_sharedram1_handle;
public static byte* qsound_sharedram1;
public static int qsound_sharedram1Length;
public static bool qsound_sharedram1_IsNull => qsound_sharedram1 == null;
public static byte[] qsound_sharedram1_set
{
set
{
qsound_sharedram1_handle.ReleaseGCHandle();
qsound_sharedram1_src = value;
qsound_sharedram1Length = value.Length;
qsound_sharedram1_src.GetObjectPtr(ref qsound_sharedram1_handle, ref qsound_sharedram1);
}
}
#endregion
#region //指针化 qsound_sharedram2
static byte[] qsound_sharedram2_src;
static GCHandle qsound_sharedram2_handle;
public static byte* qsound_sharedram2;
public static int qsound_sharedram2Length;
public static bool qsound_sharedram2_IsNull => qsound_sharedram2 == null;
public static byte[] qsound_sharedram2_set
{
set
{
qsound_sharedram2_handle.ReleaseGCHandle();
qsound_sharedram2_src = value;
qsound_sharedram2Length = value.Length;
qsound_sharedram2_src.GetObjectPtr(ref qsound_sharedram2_handle, ref qsound_sharedram2);
}
}
#endregion
#region //指针化 mainram2
static byte[] mainram2_src;
static GCHandle mainram2_handle;
public static byte* mainram2;
public static int mainram2Length;
public static bool mainram2_IsNull => mainram2 == null;
public static byte[] mainram2_set
{
set
{
mainram2_handle.ReleaseGCHandle();
mainram2_src = value;
mainram2Length = value.Length;
mainram2_src.GetObjectPtr(ref mainram2_handle, ref mainram2);
}
}
#endregion
#region //指针化 mainram3
static byte[] mainram3_src;
static GCHandle mainram3_handle;
public static byte* mainram3;
public static int mainram3Length;
public static bool mainram3_IsNull => mainram3 == null;
public static byte[] mainram3_set
{
set
{
mainram3_handle.ReleaseGCHandle();
mainram3_src = value;
mainram3Length = value.Length;
mainram3_src.GetObjectPtr(ref mainram3_handle, ref mainram3);
}
}
#endregion
public static byte dswa, dswb, dswc;
public static int cps_version;
public static int basebanksnd;
@ -46,16 +343,16 @@ namespace MAME.Core
public static void CPSInit()
{
int i, n;
cps_a_regs = new ushort[0x20];
cps_b_regs = new ushort[0x20];
gfxram = new byte[0x30000];
cps_a_regs_set = new ushort[0x20];
cps_b_regs_set = new ushort[0x20];
gfxram_set = new byte[0x30000];
Memory.Set_mainram(new byte[0x10000]);
Memory.Set_audioram(new byte[0x800]);
Machine.bRom = true;
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
gfxrom = Machine.GetRom("gfx.rom");
n = gfxrom.Length;
gfx1rom = new byte[n * 2];
gfxrom_set = Machine.GetRom("gfx.rom");
n = gfxromLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfxrom[i] & 0x0f);
@ -68,7 +365,7 @@ namespace MAME.Core
{
case "CPS-1":
cps_version = 1;
starsrom = Machine.GetRom("stars.rom");
starsrom_set = Machine.GetRom("stars.rom");
OKI6295.okirom = Machine.GetRom("oki.rom");
if (Memory.mainrom_IsNull || gfxrom == null || Memory.audiorom_IsNull || OKI6295.okirom == null)
{
@ -77,10 +374,10 @@ namespace MAME.Core
break;
case "CPS-1(QSound)":
cps_version = 1;
qsound_sharedram1 = new byte[0x1000];
qsound_sharedram2 = new byte[0x1000];
audioromop = Machine.GetRom("audiocpuop.rom");
user1rom = Machine.GetRom("user1.rom");
qsound_sharedram1_set = new byte[0x1000];
qsound_sharedram2_set = new byte[0x1000];
audioromop_set = Machine.GetRom("audiocpuop.rom");
user1rom_set = Machine.GetRom("user1.rom");
QSound.qsoundrom = ByteToSbyte(Machine.GetRom("qsound.rom"));
if (Memory.mainrom_IsNull || audioromop == null || gfxrom == null || Memory.audiorom_IsNull || QSound.qsoundrom == null)
{
@ -89,22 +386,22 @@ namespace MAME.Core
break;
case "CPS2":
cps_version = 2;
cps2_objram1 = new ushort[0x1000];
cps2_objram2 = new ushort[0x1000];
cps2_output = new ushort[0x06];
cps2_objram1_set = new ushort[0x1000];
cps2_objram2_set = new ushort[0x1000];
cps2_output_set = new ushort[0x06];
cps2networkpresent = 0;
cps2_objram_bank = 0;
scancount = 0;
cps1_scanline1 = 262;
cps1_scanline2 = 262;
cps1_scancalls = 0;
qsound_sharedram1 = new byte[0x1000];
qsound_sharedram2 = new byte[0x1000];
qsound_sharedram1_set = new byte[0x1000];
qsound_sharedram2_set = new byte[0x1000];
if (Machine.sManufacturer != "bootleg")
{
mainromop = Machine.GetRom("maincpuop.rom");
mainromop_set = Machine.GetRom("maincpuop.rom");
}
audioromop = Machine.GetRom("audiocpu.rom");
audioromop_set = Machine.GetRom("audiocpu.rom");
QSound.qsoundrom = ByteToSbyte(Machine.GetRom("qsound.rom"));
if (Memory.mainrom_IsNull || (Machine.sManufacturer != "bootleg" && mainromop == null) || audioromop == null || gfxrom == null || Memory.audiorom_IsNull || QSound.qsoundrom == null)
{

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_c(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, uint primask, RECT clip)
public static void common_drawgfx_c(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, uint primask, RECT clip)
{
int ox;
int oy;
@ -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 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)
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;

View File

@ -906,7 +906,7 @@ namespace MAME.Core
sbyte result = 0;
if (address <= 0x3fffff)
{
if (address < mainromop.Length)
if (address < mainromopLength)
{
result = (sbyte)(mainromop[address]);
}
@ -923,7 +923,7 @@ namespace MAME.Core
sbyte result = 0;
if (address <= 0x3fffff)
{
if (address < mainromop.Length)
if (address < mainromopLength)
{
result = (sbyte)mainromop[address];
}
@ -1071,7 +1071,7 @@ namespace MAME.Core
short result = 0;
if (address <= 0x3fffff)
{
if (address + 1 < mainromop.Length)
if (address + 1 < mainromopLength)
{
result = (short)(mainromop[address] * 0x100 + mainromop[address + 1]);
}
@ -1088,7 +1088,7 @@ namespace MAME.Core
short result = 0;
if (address <= 0x3fffff)
{
if (address + 1 < mainromop.Length)
if (address + 1 < mainromopLength)
{
result = (short)(mainromop[address] * 0x100 + mainromop[address + 1]);
}
@ -1214,7 +1214,7 @@ namespace MAME.Core
int result = 0;
if (address <= 0x3fffff)
{
if (address + 3 < mainromop.Length)
if (address + 3 < mainromopLength)
{
result = (int)(mainromop[address] * 0x1000000 + mainromop[address + 1] * 0x10000 + mainromop[address + 2] * 0x100 + mainromop[address + 3]);
}
@ -1231,7 +1231,7 @@ namespace MAME.Core
int result = 0;
if (address <= 0x3fffff)
{
if (address + 3 < mainromop.Length)
if (address + 3 < mainromopLength)
{
result = (int)(mainromop[address] * 0x1000000 + mainromop[address + 1] * 0x10000 + mainromop[address + 2] * 0x100 + mainromop[address + 3]);
}

View File

@ -115,8 +115,10 @@ namespace MAME.Core
writer.Write(Cpuexec.cpu[i].localtime.attoseconds);
}
EmuTimer.SaveStateBinary(writer);
writer.Write(qsound_sharedram1);
writer.Write(qsound_sharedram2);
//writer.Write(qsound_sharedram1);
//writer.Write(qsound_sharedram2);
writer.Write(qsound_sharedram1, 0, qsound_sharedram1Length);
writer.Write(qsound_sharedram2, 0, qsound_sharedram2Length);
QSound.SaveStateBinary(writer);
writer.Write(Sound.qsoundstream.output_sampindex);
writer.Write(Sound.qsoundstream.output_base_sampindex);
@ -178,8 +180,10 @@ namespace MAME.Core
writer.Write(Cpuexec.cpu[i].localtime.attoseconds);
}
EmuTimer.SaveStateBinary(writer);
writer.Write(qsound_sharedram1);
writer.Write(qsound_sharedram2);
//writer.Write(qsound_sharedram1);
//writer.Write(qsound_sharedram2);
writer.Write(qsound_sharedram1, 0, qsound_sharedram1Length);
writer.Write(qsound_sharedram2, 0, qsound_sharedram2Length);
QSound.SaveStateBinary(writer);
writer.Write(Sound.qsoundstream.output_sampindex);
writer.Write(Sound.qsoundstream.output_base_sampindex);
@ -207,7 +211,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x10000));
gfxram = reader.ReadBytes(0x30000);
gfxram_set = reader.ReadBytes(0x30000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);
@ -277,7 +281,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x10000));
gfxram = reader.ReadBytes(0x30000);
gfxram_set = reader.ReadBytes(0x30000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);
@ -296,8 +300,8 @@ namespace MAME.Core
Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
}
EmuTimer.LoadStateBinary(reader);
qsound_sharedram1 = reader.ReadBytes(0x1000);
qsound_sharedram2 = reader.ReadBytes(0x1000);
qsound_sharedram1_set = reader.ReadBytes(0x1000);
qsound_sharedram2_set = reader.ReadBytes(0x1000);
QSound.LoadStateBinary(reader);
Sound.qsoundstream.output_sampindex = reader.ReadInt32();
Sound.qsoundstream.output_base_sampindex = reader.ReadInt32();
@ -340,7 +344,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x10000));
gfxram = reader.ReadBytes(0x30000);
gfxram_set = reader.ReadBytes(0x30000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);
@ -359,8 +363,8 @@ namespace MAME.Core
Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64();
}
EmuTimer.LoadStateBinary(reader);
qsound_sharedram1 = reader.ReadBytes(0x1000);
qsound_sharedram2 = reader.ReadBytes(0x1000);
qsound_sharedram1_set = reader.ReadBytes(0x1000);
qsound_sharedram2_set = reader.ReadBytes(0x1000);
QSound.LoadStateBinary(reader);
Sound.qsoundstream.output_sampindex = reader.ReadInt32();
Sound.qsoundstream.output_base_sampindex = reader.ReadInt32();

View File

@ -19,7 +19,7 @@ namespace MAME.Core
ttmap[0].flagsmap = new byte[0x200, 0x200];
ttmap[0].tileflags = new byte[0x40, 0x40];
ttmap[0].pen_to_flags = new byte[4, 16];
ttmap[0].pen_data = new byte[0x40];
ttmap[0].pen_data_set = new byte[0x40];
ttmap[1] = new Tmap();
ttmap[1].tilewidth = 0x10;
ttmap[1].tileheight = 0x10;
@ -30,7 +30,7 @@ namespace MAME.Core
ttmap[1].flagsmap = new byte[0x400, 0x400];
ttmap[1].tileflags = new byte[0x40, 0x40];
ttmap[1].pen_to_flags = new byte[4, 16];
ttmap[1].pen_data = new byte[0x100];
ttmap[1].pen_data_set = new byte[0x100];
ttmap[2] = new Tmap();
ttmap[2].tilewidth = 0x20;
ttmap[2].tileheight = 0x20;
@ -41,7 +41,7 @@ namespace MAME.Core
ttmap[2].flagsmap = new byte[0x800, 0x800];
ttmap[2].tileflags = new byte[0x40, 0x40];
ttmap[2].pen_to_flags = new byte[4, 16];
ttmap[2].pen_data = new byte[0x400];
ttmap[2].pen_data_set = new byte[0x400];
for (i = 0; i < 3; i++)
{
ttmap[i].rows = 0x40;
@ -58,9 +58,9 @@ namespace MAME.Core
ttmap[0].tile_update3 = ttmap[0].tile_updateC0;
ttmap[1].tile_update3 = ttmap[1].tile_updateC1;
ttmap[2].tile_update3 = ttmap[2].tile_updateC2;
ttmap[0].total_elements = CPS.gfxrom.Length / 0x40;
ttmap[1].total_elements = CPS.gfxrom.Length / 0x80;
ttmap[2].total_elements = CPS.gfxrom.Length / 0x200;
ttmap[0].total_elements = CPS.gfxromLength / 0x40;
ttmap[1].total_elements = CPS.gfxromLength / 0x80;
ttmap[2].total_elements = CPS.gfxromLength / 0x200;
}
}
public unsafe partial class Tmap
@ -95,13 +95,13 @@ namespace MAME.Core
{
if (match == 0)
{
Array.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x40);
AxiArray.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x40);
}
else
{
for (j = 0; j < 0x08; j++)
{
Array.Copy(CPS.gfx1rom, code * 0x80 + gfxset * 8 + j * 0x10, pen_data, j * 8, 8);
AxiArray.Copy(CPS.gfx1rom, code * 0x80 + gfxset * 8 + j * 0x10, pen_data, j * 8, 8);
}
}
palette_base0 = 0x10 * ((attr & 0x1f) + 0x20);
@ -172,11 +172,11 @@ namespace MAME.Core
attr = CPS.gfxram[(CPS.scroll2 + 2 * memindex + 1) * 2] * 0x100 + CPS.gfxram[(CPS.scroll2 + 2 * memindex + 1) * 2 + 1];
if (match == 0)
{
Array.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x100);
AxiArray.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x100);
}
else
{
Array.Copy(CPS.gfx1rom, code * 0x100, pen_data, 0, 0x100);
AxiArray.Copy(CPS.gfx1rom, code * 0x100, pen_data, 0, 0x100);
}
palette_base1 = 0x10 * ((attr & 0x1f) + 0x40);
flags1 = (byte)(((attr & 0x60) >> 5) & 3);
@ -245,11 +245,11 @@ namespace MAME.Core
attr = CPS.gfxram[(CPS.scroll3 + 2 * memindex + 1) * 2] * 0x100 + CPS.gfxram[(CPS.scroll3 + 2 * memindex + 1) * 2 + 1];
if (match == 0)
{
Array.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x400);
AxiArray.Copy(Tilemap.bb0F, 0, pen_data, 0, 0x400);
}
else
{
Array.Copy(CPS.gfx1rom, code * 0x400, pen_data, 0, 0x400);
AxiArray.Copy(CPS.gfx1rom, code * 0x400, pen_data, 0, 0x400);
}
palette_base2 = 0x10 * ((attr & 0x1f) + 0x60);
flags2 = (byte)(((attr & 0x60) >> 5) & 3);

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace MAME.Core
{
@ -34,7 +35,7 @@ namespace MAME.Core
public static int scroll1, scroll2, scroll3;
public static int scroll1xoff = 0, scroll2xoff = 0, scroll3xoff = 0;
public static int obj, other;
private static ushort[] cps1_buffered_obj, cps2_buffered_obj, uuBFF;
private static ushort[] cps1_buffered_obj, /*cps2_buffered_obj,*/ uuBFF;
private static int cps1_last_sprite_offset;
private static int[] cps1_stars_enabled;
private static byte TILEMAP_PIXEL_TRANSPARENT = 0x00; /* transparent if in none of the layers below */
@ -49,6 +50,25 @@ namespace MAME.Core
public static bool bRecord;
#region //指针化 cps2_buffered_obj
static ushort[] cps2_buffered_obj_src;
static GCHandle cps2_buffered_obj_handle;
public static ushort* cps2_buffered_obj;
public static int cps2_buffered_objLength;
public static bool cps2_buffered_obj_IsNull => cps2_buffered_obj == null;
public static ushort[] cps2_buffered_obj_set
{
set
{
cps2_buffered_obj_handle.ReleaseGCHandle();
cps2_buffered_obj_src = value;
cps2_buffered_objLength = value.Length;
cps2_buffered_obj_src.GetObjectPtr(ref cps2_buffered_obj_handle, ref cps2_buffered_obj);
}
}
#endregion
private static int cps1_base(int offset, int boundary)
{
int base1 = cps_a_regs[offset] * 256;
@ -296,9 +316,9 @@ namespace MAME.Core
primasks = new uint[8];
cps1_stars_enabled = new int[2];
cps1_buffered_obj = new ushort[0x400];
cps2_buffered_obj = new ushort[0x1000];
cps2_objram1 = new ushort[0x1000];
cps2_objram2 = new ushort[0x1000];
cps2_buffered_obj_set = new ushort[0x1000];
cps2_objram1_set = new ushort[0x1000];
cps2_objram2_set = new ushort[0x1000];
uuBFF = new ushort[0x200 * 0x200];
for (i = 0; i < 0x40000; i++)
@ -306,13 +326,13 @@ namespace MAME.Core
uuBFF[i] = 0xbff;
}
Array.Clear(cps1_buffered_obj, 0, 0x400);
Array.Clear(cps2_buffered_obj, 0, 0x1000);
AxiArray.Clear(cps2_buffered_obj, 0, 0x1000);
Array.Clear(gfxram, 0, 0x30000);
Array.Clear(cps_a_regs, 0, 0x20);
Array.Clear(cps_b_regs, 0, 0x20);
Array.Clear(cps2_objram1, 0, 0x1000);
Array.Clear(cps2_objram2, 0, 0x1000);
AxiArray.Clear(gfxram, 0, 0x30000);
AxiArray.Clear(cps_a_regs, 0, 0x20);
AxiArray.Clear(cps_b_regs, 0, 0x20);
AxiArray.Clear(cps2_objram1, 0, 0x1000);
AxiArray.Clear(cps2_objram2, 0, 0x1000);
cps_a_regs[CPS1_OBJ_BASE] = 0x9200;
cps_a_regs[CPS1_SCROLL1_BASE] = 0x9000;
@ -853,11 +873,11 @@ namespace MAME.Core
}
if (baseptr == 0x7000)
{
Array.Copy(cps2_objram1, cps2_buffered_obj, 0x1000);
AxiArray.Copy(cps2_objram1, cps2_buffered_obj, 0x1000);
}
else
{
Array.Copy(cps2_objram2, cps2_buffered_obj, 0x1000);
AxiArray.Copy(cps2_objram2, cps2_buffered_obj, 0x1000);
}
}
}

View File

@ -2,7 +2,7 @@
{
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)
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)
{
int ox;
int oy;
@ -63,7 +63,7 @@
int colorbase = 4 * color;
blockmove_8toN_transpen16_pcktgal(bb1, code, sw, sh, sm, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_pcktgal(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 static void blockmove_8toN_transpen16_pcktgal(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;

View File

@ -1,8 +1,123 @@
namespace MAME.Core
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Dataeast
public unsafe partial class Dataeast
{
public static byte[] audioromop, gfx1rom, gfx2rom, gfx12rom, gfx22rom, prom;
//public static byte[] /*audioromop,*/ /*gfx1rom,*/ gfx2rom, gfx12rom, gfx22rom, prom;
#region //指针化 audioromop
static byte[] audioromop_src;
static GCHandle audioromop_handle;
public static byte* audioromop;
public static int audioromopLength;
public static bool audioromop_IsNull => audioromop == null;
public static byte[] audioromop_set
{
set
{
audioromop_handle.ReleaseGCHandle();
audioromop_src = value;
audioromopLength = value.Length;
audioromop_src.GetObjectPtr(ref audioromop_handle, ref audioromop);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx12rom
static byte[] gfx12rom_src;
static GCHandle gfx12rom_handle;
public static byte* gfx12rom;
public static int gfx12romLength;
public static bool gfx12rom_IsNull => gfx12rom == null;
public static byte[] gfx12rom_set
{
set
{
gfx12rom_handle.ReleaseGCHandle();
gfx12rom_src = value;
gfx12romLength = value.Length;
gfx12rom_src.GetObjectPtr(ref gfx12rom_handle, ref gfx12rom);
}
}
#endregion
#region //指针化 gfx22rom
static byte[] gfx22rom_src;
static GCHandle gfx22rom_handle;
public static byte* gfx22rom;
public static int gfx22romLength;
public static bool gfx22rom_IsNull => gfx22rom == null;
public static byte[] gfx22rom_set
{
set
{
gfx22rom_handle.ReleaseGCHandle();
gfx22rom_src = value;
gfx22romLength = value.Length;
gfx22rom_src.GetObjectPtr(ref gfx22rom_handle, ref gfx22rom);
}
}
#endregion
#region //指针化 prom
static byte[] prom_src;
static GCHandle prom_handle;
public static byte* prom;
public static int promLength;
public static bool prom_IsNull => prom == null;
public static byte[] prom_set
{
set
{
prom_handle.ReleaseGCHandle();
prom_src = value;
promLength = value.Length;
prom_src.GetObjectPtr(ref prom_handle, ref prom);
}
}
#endregion
public static byte dsw;
public static int basebankmain1, basebankmain2, basebanksnd, msm5205next, toggle;
public static void DataeastInit()
@ -20,10 +135,10 @@
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
audioromop = Machine.GetRom("audiocpuop.rom");
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
prom = Machine.GetRom("proms.rom");
audioromop_set = Machine.GetRom("audiocpuop.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
prom_set = Machine.GetRom("proms.rom");
if (Memory.mainrom_IsNull || Memory.audiorom_IsNull || audioromop == null || gfx1rom == null || gfx2rom == null || prom == null)
{
Machine.bRom = false;
@ -36,9 +151,9 @@
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
prom = Machine.GetRom("proms.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
prom_set = Machine.GetRom("proms.rom");
if (Memory.mainrom_IsNull || Memory.audiorom_IsNull || gfx1rom == null || gfx2rom == null || prom == null)
{
Machine.bRom = false;

View File

@ -17,11 +17,11 @@ namespace MAME.Core
bg_tilemap.height = 0x100;
bg_tilemap.enable = true;
bg_tilemap.all_tiles_dirty = true;
bg_tilemap.total_elements = gfx1rom.Length / 0x40;
bg_tilemap.total_elements = gfx1romLength / 0x40;
bg_tilemap.pixmap = new ushort[0x100 * 0x100];
bg_tilemap.flagsmap = new byte[0x100, 0x100];
bg_tilemap.tileflags = new byte[32, 32];
bg_tilemap.pen_data = new byte[0x100];
bg_tilemap.pen_data_set = new byte[0x100];
bg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -54,7 +54,7 @@ namespace MAME.Core
group = 0;
tileflags[row, col] = tile_drawPcktgalbg(Dataeast.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawPcktgalbg(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawPcktgalbg(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -63,7 +63,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -2,7 +2,7 @@
{
public unsafe partial class Dataeast
{
public static void palette_init_pcktgal(byte[] color_prom)
public static void palette_init_pcktgal(byte* color_prom)
{
int i;
for (i = 0; i < 0x200; i++)

View File

@ -1,24 +1,139 @@
namespace MAME.Core
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public unsafe partial class IGS011
{
public static ushort[] priority_ram, paletteram16;
//public static ushort[] priority_ram, paletteram16;
public static byte prot1, prot2, prot1_swap;
public static uint prot1_addr;
public static ushort[] igs003_reg, vbowl_trackball;
//public static ushort[] igs003_reg, vbowl_trackball;
public static ushort priority, igs_dips_sel, igs_input_sel, lhb_irq_enable;
public static byte igs012_prot, igs012_prot_swap;
private static bool igs012_prot_mode;
public static byte[] gfx1rom, gfx2rom;
//public static byte[] /*gfx1rom,*/ /*gfx2rom*/;
public static byte dsw1, dsw2, dsw3, dsw4, dsw5;
#region //指针化 priority_ram
static ushort[] priority_ram_src;
static GCHandle priority_ram_handle;
public static ushort* priority_ram;
public static int priority_ramLength;
public static bool priority_ram_IsNull => priority_ram == null;
public static ushort[] priority_ram_set
{
set
{
priority_ram_handle.ReleaseGCHandle();
priority_ram_src = value;
priority_ramLength = value.Length;
priority_ram_src.GetObjectPtr(ref priority_ram_handle, ref priority_ram);
}
}
#endregion
#region //指针化 paletteram16
static ushort[] paletteram16_src;
static GCHandle paletteram16_handle;
public static ushort* paletteram16;
public static int paletteram16Length;
public static bool paletteram16_IsNull => paletteram16 == null;
public static ushort[] paletteram16_set
{
set
{
paletteram16_handle.ReleaseGCHandle();
paletteram16_src = value;
paletteram16Length = value.Length;
paletteram16_src.GetObjectPtr(ref paletteram16_handle, ref paletteram16);
}
}
#endregion
#region //指针化 igs003_reg
static ushort[] igs003_reg_src;
static GCHandle igs003_reg_handle;
public static ushort* igs003_reg;
public static int igs003_regLength;
public static bool igs003_reg_IsNull => igs003_reg == null;
public static ushort[] igs003_reg_set
{
set
{
igs003_reg_handle.ReleaseGCHandle();
igs003_reg_src = value;
igs003_regLength = value.Length;
igs003_reg_src.GetObjectPtr(ref igs003_reg_handle, ref igs003_reg);
}
}
#endregion
#region //指针化 vbowl_trackball
static ushort[] vbowl_trackball_src;
static GCHandle vbowl_trackball_handle;
public static ushort* vbowl_trackball;
public static int vbowl_trackballLength;
public static bool vbowl_trackball_IsNull => vbowl_trackball == null;
public static ushort[] vbowl_trackball_set
{
set
{
vbowl_trackball_handle.ReleaseGCHandle();
if (value == null)
return;
vbowl_trackball_src = value;
vbowl_trackballLength = value.Length;
vbowl_trackball_src.GetObjectPtr(ref vbowl_trackball_handle, ref vbowl_trackball);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
public static void IGS011Init()
{
Machine.bRom = true;
Generic.generic_nvram_set = new byte[0x4000];
priority_ram = new ushort[0x800];
paletteram16 = new ushort[0x1000];
igs003_reg = new ushort[2];
vbowl_trackball = new ushort[2];
priority_ram_set = new ushort[0x800];
paletteram16_set = new ushort[0x1000];
igs003_reg_set = new ushort[2];
vbowl_trackball_set = new ushort[2];
switch (Machine.sName)
{
case "drgnwrld":
@ -30,7 +145,7 @@
case "drgnwrldv11h":
case "drgnwrldv40k":
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
OKI6295.okirom = Machine.GetRom("oki.rom");
dsw1 = 0xff;
dsw2 = 0xff;
@ -45,7 +160,7 @@
case "dbc":
case "ryukobou":
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
OKI6295.okirom = Machine.GetRom("oki.rom");
dsw1 = 0xf7;
dsw2 = 0xff;
@ -59,8 +174,8 @@
break;
case "lhb2":
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
break;
}

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class IGS011
public unsafe partial class IGS011
{
private static byte lhb2_pen_hi;
private static byte[][] layer;
@ -268,11 +268,11 @@
bool depth4;
int clear, opaque, z;
byte trans_pen, clear_pen, pen_hi, pen = 0;
int gfx_size = gfx1rom.Length;
int gfx_size = gfx1romLength;
int gfx2_size = 0;
if (gfx2rom != null)
{
gfx2_size = gfx2rom.Length;
gfx2_size = gfx2romLength;
}
blitter.flags = data;
opaque = (blitter.flags & 0x0008) == 0 ? 1 : 0;

View File

@ -2,7 +2,7 @@
{
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)
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)
{
if ((scalex == 0) || (scaley == 0))
{
@ -100,7 +100,7 @@
}
}
}
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, uint pri_mask)
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, uint pri_mask)
{
if ((scalex == 0) || (scaley == 0))
{
@ -202,7 +202,7 @@
}
}
}
public static void common_drawgfx_konami68000(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint pri_mask)
public static void common_drawgfx_konami68000(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint pri_mask)
{
int ox;
int oy;
@ -265,7 +265,7 @@
int colorbase = color * 0x10;
blockmove_8toN_transpen_pri16_konami68000(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, pri_mask, sx, sy);
}
public static void blockmove_8toN_transpen_pri16_konami68000(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,
public static void blockmove_8toN_transpen_pri16_konami68000(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)
{

View File

@ -1,19 +1,230 @@
using cpu.m68000;
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public unsafe partial class Konami68000
{
public static byte[] gfx1rom, gfx2rom, gfx12rom, gfx22rom, titlerom, user1rom, zoomrom;
//public static byte[] /*gfx1rom,*/ /*gfx2rom, *//*gfx12rom,*/ gfx22rom, titlerom, user1rom, zoomrom;
public static byte dsw1, dsw2, dsw3, bytee;
public static byte[] mainram2;
public static short[] sampledata;
public static ushort[] cuebrick_nvram, tmnt2_1c0800;
//public static byte[] mainram2;
//public static short[] sampledata;
//public static ushort[] cuebrick_nvram, tmnt2_1c0800;
private static int init_eeprom_count;
private static int toggle, sprite_totel_element;
private static int tmnt_soundlatch, cuebrick_snd_irqlatch, cuebrick_nvram_bank;
public static int basebanksnd;
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx12rom
static byte[] gfx12rom_src;
static GCHandle gfx12rom_handle;
public static byte* gfx12rom;
public static int gfx12romLength;
public static bool gfx12rom_IsNull => gfx12rom == null;
public static byte[] gfx12rom_set
{
set
{
gfx12rom_handle.ReleaseGCHandle();
gfx12rom_src = value;
gfx12romLength = value.Length;
gfx12rom_src.GetObjectPtr(ref gfx12rom_handle, ref gfx12rom);
}
}
#endregion
#region //指针化 gfx22rom
static byte[] gfx22rom_src;
static GCHandle gfx22rom_handle;
public static byte* gfx22rom;
public static int gfx22romLength;
public static bool gfx22rom_IsNull => gfx22rom == null;
public static byte[] gfx22rom_set
{
set
{
gfx22rom_handle.ReleaseGCHandle();
gfx22rom_src = value;
gfx22romLength = value.Length;
gfx22rom_src.GetObjectPtr(ref gfx22rom_handle, ref gfx22rom);
}
}
#endregion
#region //指针化 titlerom
static byte[] titlerom_src;
static GCHandle titlerom_handle;
public static byte* titlerom;
public static int titleromLength;
public static bool titlerom_IsNull => titlerom == null;
public static byte[] titlerom_set
{
set
{
titlerom_handle.ReleaseGCHandle();
if (value == null)
return;
titlerom_src = value;
titleromLength = value.Length;
titlerom_src.GetObjectPtr(ref titlerom_handle, ref titlerom);
}
}
#endregion
#region //指针化 user1rom
static byte[] user1rom_src;
static GCHandle user1rom_handle;
public static byte* user1rom;
public static int user1romLength;
public static bool user1rom_IsNull => user1rom == null;
public static byte[] user1rom_set
{
set
{
user1rom_handle.ReleaseGCHandle();
if (value == null)
return;
user1rom_src = value;
user1romLength = value.Length;
user1rom_src.GetObjectPtr(ref user1rom_handle, ref user1rom);
}
}
#endregion
#region //指针化 zoomrom
static byte[] zoomrom_src;
static GCHandle zoomrom_handle;
public static byte* zoomrom;
public static int zoomromLength;
public static bool zoomrom_IsNull => zoomrom == null;
public static byte[] zoomrom_set
{
set
{
zoomrom_handle.ReleaseGCHandle();
if (value == null)
return;
zoomrom_src = value;
zoomromLength = value.Length;
zoomrom_src.GetObjectPtr(ref zoomrom_handle, ref zoomrom);
}
}
#endregion
#region //指针化 mainram2
static byte[] mainram2_src;
static GCHandle mainram2_handle;
public static byte* mainram2;
public static int mainram2Length;
public static bool mainram2_IsNull => mainram2 == null;
public static byte[] mainram2_set
{
set
{
mainram2_handle.ReleaseGCHandle();
mainram2_src = value;
mainram2Length = value.Length;
mainram2_src.GetObjectPtr(ref mainram2_handle, ref mainram2);
}
}
#endregion
#region //指针化 sampledata
static short[] sampledata_src;
static GCHandle sampledata_handle;
public static short* sampledata;
public static int sampledataLength;
public static bool sampledata_IsNull => sampledata == null;
public static short[] sampledata_set
{
set
{
sampledata_handle.ReleaseGCHandle();
sampledata_src = value;
sampledataLength = value.Length;
sampledata_src.GetObjectPtr(ref sampledata_handle, ref sampledata);
}
}
#endregion
#region //指针化 cuebrick_nvram
static ushort[] cuebrick_nvram_src;
static GCHandle cuebrick_nvram_handle;
public static ushort* cuebrick_nvram;
public static int cuebrick_nvramLength;
public static bool cuebrick_nvram_IsNull => cuebrick_nvram == null;
public static ushort[] cuebrick_nvram_set
{
set
{
cuebrick_nvram_handle.ReleaseGCHandle();
cuebrick_nvram_src = value;
cuebrick_nvramLength = value.Length;
cuebrick_nvram_src.GetObjectPtr(ref cuebrick_nvram_handle, ref cuebrick_nvram);
}
}
#endregion
#region //指针化 tmnt2_1c0800
static ushort[] tmnt2_1c0800_src;
static GCHandle tmnt2_1c0800_handle;
public static ushort* tmnt2_1c0800;
public static int tmnt2_1c0800Length;
public static bool tmnt2_1c0800_IsNull => tmnt2_1c0800 == null;
public static ushort[] tmnt2_1c0800_set
{
set
{
tmnt2_1c0800_handle.ReleaseGCHandle();
if (value == null)
return;
tmnt2_1c0800_src = value;
tmnt2_1c0800Length = value.Length;
tmnt2_1c0800_src.GetObjectPtr(ref tmnt2_1c0800_handle, ref tmnt2_1c0800);
}
}
#endregion
public static void Konami68000Init()
{
int i, n1, n2;
@ -23,10 +234,10 @@ namespace MAME.Core
toggle = 0;
Memory.Set_mainram(new byte[0x4000]);
Memory.Set_audioram(new byte[0x2000]);//0x800 prmrsocr_0x2000
mainram2 = new byte[0x4000];//0x4000 tmnt2_ssriders_0x80
mainram2_set = new byte[0x4000];//0x4000 tmnt2_ssriders_0x80
layer_colorbase = new int[3];
cuebrick_nvram = new ushort[0x400 * 0x20];
tmnt2_1c0800 = new ushort[0x10];
cuebrick_nvram_set = new ushort[0x400 * 0x20];
tmnt2_1c0800_set = new ushort[0x10];
K053245_memory_region = new byte[2][];
K053244_rombank = new int[2];
K053245_ramsize = new int[2];
@ -62,23 +273,23 @@ namespace MAME.Core
Machine.bRom = true;
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
n1 = gfx1rom.Length;
gfx12rom = new byte[n1 * 2];
gfx1rom_set = Machine.GetRom("gfx1.rom");
n1 = gfx1romLength;
gfx12rom_set = new byte[n1 * 2];
for (i = 0; i < n1; i++)
{
gfx12rom[i * 2] = (byte)(gfx1rom[i] >> 4);
gfx12rom[i * 2 + 1] = (byte)(gfx1rom[i] & 0x0f);
}
gfx2rom = Machine.GetRom("gfx2.rom");
n2 = gfx2rom.Length;
gfx22rom = new byte[n2 * 2];
gfx2rom_set = Machine.GetRom("gfx2.rom");
n2 = gfx2romLength;
gfx22rom_set = new byte[n2 * 2];
for (i = 0; i < n2; i++)
{
gfx22rom[i * 2] = (byte)(gfx2rom[i] >> 4);
gfx22rom[i * 2 + 1] = (byte)(gfx2rom[i] & 0x0f);
}
sprite_totel_element = gfx22rom.Length / 0x100;
sprite_totel_element = gfx22romLength / 0x100;
switch (Machine.sName)
{
case "cuebrick":
@ -116,7 +327,7 @@ namespace MAME.Core
K051960_memory_region = Machine.GetRom("k051960.rom");
K007232.k007232rom = Machine.GetRom("k007232.rom");
Upd7759.updrom = Machine.GetRom("upd.rom");
titlerom = Machine.GetRom("title.rom");
titlerom_set = Machine.GetRom("title.rom");
if (Memory.mainrom_IsNull || gfx1rom == null || gfx2rom == null || K052109_memory_region == null || K051960_memory_region == null || Memory.audiorom_IsNull || K007232.k007232rom == null || Upd7759.updrom == null || titlerom == null)
{
Machine.bRom = false;
@ -174,8 +385,8 @@ namespace MAME.Core
case "glfgreatj":
K052109_memory_region = Machine.GetRom("k052109.rom");
K053245_memory_region[0] = Machine.GetRom("k053245.rom");
zoomrom = Machine.GetRom("zoom.rom");
user1rom = Machine.GetRom("user1.rom");
zoomrom_set = Machine.GetRom("zoom.rom");
user1rom_set = Machine.GetRom("user1.rom");
K053260.k053260rom = Machine.GetRom("k053260.rom");
if (Memory.mainrom_IsNull || gfx1rom == null || gfx2rom == null || K052109_memory_region == null || K053245_memory_region[0] == null || zoomrom == null || user1rom == null || Memory.audiorom_IsNull || K053260.k053260rom == null)
{
@ -186,8 +397,8 @@ namespace MAME.Core
case "prmrsocrj":
K052109_memory_region = Machine.GetRom("k052109.rom");
K053245_memory_region[0] = Machine.GetRom("k053245.rom");
zoomrom = Machine.GetRom("zoom.rom");
user1rom = Machine.GetRom("user1.rom");
zoomrom_set = Machine.GetRom("zoom.rom");
user1rom_set = Machine.GetRom("user1.rom");
K054539.k054539rom = Machine.GetRom("k054539.rom");
if (Memory.mainrom_IsNull || gfx1rom == null || gfx2rom == null || K052109_memory_region == null || K053245_memory_region[0] == null || zoomrom == null || user1rom == null || Memory.audiorom_IsNull || K054539.k054539rom == null)
{
@ -585,7 +796,7 @@ namespace MAME.Core
public static void tmnt_decode_sample()
{
int i;
sampledata = new short[0x40000];
sampledata_set = new short[0x40000];
for (i = 0; i < 0x40000; i++)
{
int val = titlerom[2 * i] + titlerom[2 * i + 1] * 256;

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Konami68000
public unsafe partial class Konami68000
{
private static byte[] K052109_memory_region;
public static int K052109_videoram_F_offset, K052109_videoram2_F_offset, K052109_colorram_F_offset, K052109_videoram_A_offset, K052109_videoram2_A_offset, K052109_colorram_A_offset, K052109_videoram_B_offset, K052109_videoram2_B_offset, K052109_colorram_B_offset;
@ -87,14 +87,14 @@ namespace MAME.Core
K052109_tilemap[i].pixmap = new ushort[0x100 * 0x200];
K052109_tilemap[i].flagsmap = new byte[0x100, 0x200];
K052109_tilemap[i].tileflags = new byte[0x20, 0x40];
K052109_tilemap[i].pen_data = new byte[0x40];
K052109_tilemap[i].pen_data_set = new byte[0x40];
K052109_tilemap[i].pen_to_flags = new byte[1, 16];
K052109_tilemap[i].pen_to_flags[0, 0] = 0;
for (j = 1; j < 16; j++)
{
K052109_tilemap[i].pen_to_flags[0, j] = 0x10;
}
K052109_tilemap[i].total_elements = gfx12rom.Length / 0x40;
K052109_tilemap[i].total_elements = gfx12romLength / 0x40;
}
K052109_tilemap[0].tile_update3 = K052109_tilemap[0].tile_updateKonami68000_0;
K052109_tilemap[1].tile_update3 = K052109_tilemap[1].tile_updateKonami68000_1;

View File

@ -102,7 +102,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x4000));
mainram2 = reader.ReadBytes(0x4000);
mainram2_set = reader.ReadBytes(0x4000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Cpuint.LoadStateBinary(reader);
@ -214,7 +214,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x4000));
mainram2 = reader.ReadBytes(0x4000);
mainram2_set = reader.ReadBytes(0x4000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);
@ -895,7 +895,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x4000));
mainram2 = reader.ReadBytes(0x80);
mainram2_set = reader.ReadBytes(0x80);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);
@ -999,7 +999,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x4000));
mainram2 = reader.ReadBytes(0x80);
mainram2_set = reader.ReadBytes(0x80);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x800));
Z80A.zz1[0].LoadStateBinary(reader);

View File

@ -240,7 +240,7 @@ namespace MAME.Core
flags = flags ^ (attributes & 0x03);
tileflags[row, col] = tile_drawKonami68000(Konami68000.gfx12rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawKonami68000(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawKonami68000(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -249,7 +249,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class M72
public unsafe partial class M72
{
public static int setvector_param;
public static byte irqvector;
@ -107,7 +107,7 @@
public static void m72_sample_w(byte data)
{
DAC.dac_signed_data_w(0, data);
sample_addr = (sample_addr + 1) & (samplesrom.Length - 1);
sample_addr = (sample_addr + 1) & (samplesromLength - 1);
}
}
}

View File

@ -2,7 +2,7 @@
{
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)
public static void common_drawgfx_m72(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -61,7 +61,7 @@
int colorbase = 0x10 * color;
blockmove_8toN_transpen16_m72(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_m72(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 static void blockmove_8toN_transpen16_m72(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 * 0x100;

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
@ -9,7 +10,145 @@ namespace MAME.Core
public static byte m72_irq_base;
public static int m72_scanline_param;
public static byte[] spritesrom, sprites1rom, samplesrom, gfx2rom, gfx21rom, gfx3rom, gfx31rom;
//public static byte[] spritesrom, sprites1rom, samplesrom /*,gfx2rom,*/ /*gfx21rom,*/ /*gfx3rom/*, gfx31rom*/;
#region //指针化 spritesrom
static byte[] spritesrom_src;
static GCHandle spritesrom_handle;
public static byte* spritesrom;
public static int spritesromLength;
public static bool spritesrom_IsNull => spritesrom == null;
public static byte[] spritesrom_set
{
set
{
spritesrom_handle.ReleaseGCHandle();
if (value == null)
return;
spritesrom_src = value;
spritesromLength = value.Length;
spritesrom_src.GetObjectPtr(ref spritesrom_handle, ref spritesrom);
}
}
#endregion
#region //指针化 sprites1rom
static byte[] sprites1rom_src;
static GCHandle sprites1rom_handle;
public static byte* sprites1rom;
public static int sprites1romLength;
public static bool sprites1rom_IsNull => sprites1rom == null;
public static byte[] sprites1rom_set
{
set
{
sprites1rom_handle.ReleaseGCHandle();
if (value == null)
return;
sprites1rom_src = value;
sprites1romLength = value.Length;
sprites1rom_src.GetObjectPtr(ref sprites1rom_handle, ref sprites1rom);
}
}
#endregion
#region //指针化 samplesrom
static byte[] samplesrom_src;
static GCHandle samplesrom_handle;
public static byte* samplesrom;
public static int samplesromLength;
public static bool samplesrom_IsNull => samplesrom == null;
public static byte[] samplesrom_set
{
set
{
samplesrom_handle.ReleaseGCHandle();
samplesrom_src = value;
samplesromLength = value.Length;
samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx21rom
static byte[] gfx21rom_src;
static GCHandle gfx21rom_handle;
public static byte* gfx21rom;
public static int gfx21romLength;
public static bool gfx21rom_IsNull => gfx21rom == null;
public static byte[] gfx21rom_set
{
set
{
gfx21rom_handle.ReleaseGCHandle();
gfx21rom_src = value;
gfx21romLength = value.Length;
gfx21rom_src.GetObjectPtr(ref gfx21rom_handle, ref gfx21rom);
}
}
#endregion
#region //指针化 gfx3rom
static byte[] gfx3rom_src;
static GCHandle gfx3rom_handle;
public static byte* gfx3rom;
public static int gfx3romLength;
public static bool gfx3rom_IsNull => gfx3rom == null;
public static byte[] gfx3rom_set
{
set
{
gfx3rom_handle.ReleaseGCHandle();
gfx3rom_src = value;
gfx3romLength = value.Length;
gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom);
}
}
#endregion
#region //指针化 gfx31rom
static byte[] gfx31rom_src;
static GCHandle gfx31rom_handle;
public static byte* gfx31rom;
public static int gfx31romLength;
public static bool gfx31rom_IsNull => gfx31rom == null;
public static byte[] gfx31rom_set
{
set
{
gfx31rom_handle.ReleaseGCHandle();
gfx31rom_src = value;
gfx31romLength = value.Length;
gfx31rom_src.GetObjectPtr(ref gfx31rom_handle, ref gfx31rom);
}
}
#endregion
public static byte[] airduelm72_code = new byte[] {
0x68, 0x00, 0xd0, 0x1f, 0xc6, 0x06, 0xc0, 0x1c, 0x57, 0xea, 0x69, 0x0b, 0x00, 0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -48,35 +187,35 @@ namespace MAME.Core
protection_ram = new byte[0x1000];
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
Memory.Set_audiorom(Machine.GetRom("soundcpu.rom"));
//Memory.audiorom = new byte[0x10000];
spritesrom = Machine.GetRom("sprites.rom");
n1 = spritesrom.Length;
sprites1rom = new byte[n1 * 2];
//Memory.audiorom_set = new byte[0x10000];
spritesrom_set = Machine.GetRom("sprites.rom");
n1 = spritesromLength;
sprites1rom_set = new byte[n1 * 2];
for (i1 = 0; i1 < n1; i1++)
{
sprites1rom[i1 * 2] = (byte)(spritesrom[i1] >> 4);
sprites1rom[i1 * 2 + 1] = (byte)(spritesrom[i1] & 0x0f);
}
gfx2rom = Machine.GetRom("gfx2.rom");
n2 = gfx2rom.Length;
gfx21rom = new byte[n2 * 2];
gfx2rom_set = Machine.GetRom("gfx2.rom");
n2 = gfx2romLength;
gfx21rom_set = new byte[n2 * 2];
for (i2 = 0; i2 < n2; i2++)
{
gfx21rom[i2 * 2] = (byte)(gfx2rom[i2] >> 4);
gfx21rom[i2 * 2 + 1] = (byte)(gfx2rom[i2] & 0x0f);
}
gfx3rom = Machine.GetRom("gfx3.rom");
gfx3rom_set = Machine.GetRom("gfx3.rom");
if (gfx3rom != null)
{
n3 = gfx3rom.Length;
gfx31rom = new byte[n3 * 2];
n3 = gfx3romLength;
gfx31rom_set = new byte[n3 * 2];
for (i3 = 0; i3 < n3; i3++)
{
gfx31rom[i3 * 2] = (byte)(gfx3rom[i3] >> 4);
gfx31rom[i3 * 2 + 1] = (byte)(gfx3rom[i3] & 0x0f);
}
}
samplesrom = Machine.GetRom("samples.rom");
samplesrom_set = Machine.GetRom("samples.rom");
Memory.Set_mainram(new byte[0x4000]);
Memory.Set_audioram(new byte[0x10000]);
dsw = 0xffbf;

View File

@ -20,8 +20,8 @@ namespace MAME.Core
bg_tilemap.pixmap = new ushort[0x200 * 0x200];
bg_tilemap.flagsmap = new byte[0x200, 0x200];
bg_tilemap.tileflags = new byte[0x40, 0x40];
bg_tilemap.total_elements = M72.gfx21rom.Length / 0x40;
bg_tilemap.pen_data = new byte[0x40];
bg_tilemap.total_elements = M72.gfx21romLength / 0x40;
bg_tilemap.pen_data_set = new byte[0x40];
bg_tilemap.pen_to_flags = new byte[3, 16];
for (i = 0; i < 16; i++)
{
@ -57,8 +57,8 @@ namespace MAME.Core
fg_tilemap.pixmap = new ushort[0x200 * 0x200];
fg_tilemap.flagsmap = new byte[0x200, 0x200];
fg_tilemap.tileflags = new byte[0x40, 0x40];
fg_tilemap.total_elements = M72.gfx21rom.Length / 0x40;
fg_tilemap.pen_data = new byte[0x400];
fg_tilemap.total_elements = M72.gfx21romLength / 0x40;
fg_tilemap.pen_data_set = new byte[0x400];
fg_tilemap.pen_to_flags = new byte[3, 32];
fg_tilemap.pen_to_flags[0, 0] = 0;
for (i = 1; i < 16; i++)
@ -114,8 +114,8 @@ namespace MAME.Core
bg_tilemap.pixmap = new ushort[0x200 * 0x200];
bg_tilemap.flagsmap = new byte[0x200, 0x200];
bg_tilemap.tileflags = new byte[0x40, 0x40];
bg_tilemap.total_elements = M72.gfx21rom.Length / 0x40;
bg_tilemap.pen_data = new byte[0x40];
bg_tilemap.total_elements = M72.gfx21romLength / 0x40;
bg_tilemap.pen_data_set = new byte[0x40];
bg_tilemap.pen_to_flags = new byte[3, 16];
for (i = 0; i < 16; i++)
{
@ -151,8 +151,8 @@ namespace MAME.Core
fg_tilemap.pixmap = new ushort[0x200 * 0x200];
fg_tilemap.flagsmap = new byte[0x200, 0x200];
fg_tilemap.tileflags = new byte[0x40, 0x40];
fg_tilemap.total_elements = M72.gfx21rom.Length / 0x40;
fg_tilemap.pen_data = new byte[0x400];
fg_tilemap.total_elements = M72.gfx21romLength / 0x40;
fg_tilemap.pen_data_set = new byte[0x400];
fg_tilemap.pen_to_flags = new byte[3, 32];
fg_tilemap.pen_to_flags[0, 0] = 0;
for (i = 1; i < 16; i++)
@ -190,8 +190,8 @@ namespace MAME.Core
bg_tilemap_large.pixmap = new ushort[0x400 * 0x200];
bg_tilemap_large.flagsmap = new byte[0x200, 0x400];
bg_tilemap_large.tileflags = new byte[0x40, 0x80];
bg_tilemap_large.total_elements = M72.gfx21rom.Length / 0x40;
bg_tilemap_large.pen_data = new byte[0x40];
bg_tilemap_large.total_elements = M72.gfx21romLength / 0x40;
bg_tilemap_large.pen_data_set = new byte[0x40];
bg_tilemap_large.pen_to_flags = new byte[3, 16];
for (i = 0; i < 16; i++)
{
@ -372,7 +372,7 @@ namespace MAME.Core
pen_data_offset = code1 * 0x40;
tileflags[row, col] = tile_drawM72(M72.gfx21rom, pen_data_offset, x0, y0, 0x100 + 0x10 * (color & 0x0f), pri, (((color & 0x60) >> 5) & 3) ^ (attributes & 0x03));
}
public byte tile_drawM72(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawM72(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
int height = tileheight;
int width = tilewidth;
@ -383,7 +383,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += height - 1;

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_m92(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint primask)
public static void common_drawgfx_m92(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint primask)
{
int ox;
int oy;
@ -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 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)
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;

View File

@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class M92
public unsafe partial class M92
{
public static byte irqvector;
public static ushort sound_status;
@ -14,7 +15,100 @@ namespace MAME.Core
public static int m92_scanline_param;
public static int setvector_param;
public static byte m92_sprite_buffer_busy;
public static byte[] gfx1rom, gfx11rom, gfx2rom, gfx21rom, eeprom;
//public static byte[] /*gfx1rom,*/ /*gfx11rom,*//* gfx2rom,*/ /*gfx21rom,*/ eeprom;
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx11rom
static byte[] gfx11rom_src;
static GCHandle gfx11rom_handle;
public static byte* gfx11rom;
public static int gfx11romLength;
public static bool gfx11rom_IsNull => gfx11rom == null;
public static byte[] gfx11rom_set
{
set
{
gfx11rom_handle.ReleaseGCHandle();
gfx11rom_src = value;
gfx11romLength = value.Length;
gfx11rom_src.GetObjectPtr(ref gfx11rom_handle, ref gfx11rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx21rom
static byte[] gfx21rom_src;
static GCHandle gfx21rom_handle;
public static byte* gfx21rom;
public static int gfx21romLength;
public static bool gfx21rom_IsNull => gfx21rom == null;
public static byte[] gfx21rom_set
{
set
{
gfx21rom_handle.ReleaseGCHandle();
gfx21rom_src = value;
gfx21romLength = value.Length;
gfx21rom_src.GetObjectPtr(ref gfx21rom_handle, ref gfx21rom);
}
}
#endregion
#region //指针化 eeprom
static byte[] eeprom_src;
static GCHandle eeprom_handle;
public static byte* eeprom;
public static int eepromLength;
public static bool eeprom_IsNull => eeprom == null;
public static byte[] eeprom_set
{
set
{
eeprom_handle.ReleaseGCHandle();
eeprom_src = value;
eepromLength = value.Length;
eeprom_src.GetObjectPtr(ref eeprom_handle, ref eeprom);
}
}
#endregion
public static byte[] gunforce_decryption_table = new byte[256] {
0xff,0x90,0x90,0x2c,0x90,0x90,0x43,0x88, 0x90,0x13,0x0a,0xbd,0xba,0x60,0xea,0x90, /* 00 */
0x90,0x90,0xf2,0x29,0xb3,0x22,0x90,0x0c, 0xa9,0x5f,0x9d,0x07,0x90,0x90,0x0b,0xbb, /* 10 */
@ -241,23 +335,23 @@ namespace MAME.Core
Iremga20.iremrom = Machine.GetRom("irem.rom");
Memory.Set_mainram(new byte[0x10000]);
Memory.Set_audioram(new byte[0x4000]);
gfx1rom = Machine.GetRom("gfx1.rom");
n1 = gfx1rom.Length;
gfx11rom = new byte[n1 * 2];
gfx1rom_set = Machine.GetRom("gfx1.rom");
n1 = gfx1romLength;
gfx11rom_set = new byte[n1 * 2];
for (i1 = 0; i1 < n1; i1++)
{
gfx11rom[i1 * 2] = (byte)(gfx1rom[i1] >> 4);
gfx11rom[i1 * 2 + 1] = (byte)(gfx1rom[i1] & 0x0f);
}
gfx2rom = Machine.GetRom("gfx2.rom");
n2 = gfx2rom.Length;
gfx21rom = new byte[n2 * 2];
gfx2rom_set = Machine.GetRom("gfx2.rom");
n2 = gfx2romLength;
gfx21rom_set = new byte[n2 * 2];
for (i2 = 0; i2 < n2; i2++)
{
gfx21rom[i2 * 2] = (byte)(gfx2rom[i2] >> 4);
gfx21rom[i2 * 2 + 1] = (byte)(gfx2rom[i2] & 0x0f);
}
eeprom = Machine.GetRom("eeprom.rom");
eeprom_set = Machine.GetRom("eeprom.rom");
m92_game_kludge = 0;
m92_irq_vectorbase = 0x80;
m92_sprite_buffer_busy = 1;

View File

@ -22,8 +22,8 @@ namespace MAME.Core
M92.pf_layer[i].tmap.pixmap = new ushort[0x200 * 0x200];
M92.pf_layer[i].tmap.flagsmap = new byte[0x200, 0x200];
M92.pf_layer[i].tmap.tileflags = new byte[0x40, 0x40];
M92.pf_layer[i].tmap.total_elements = M92.gfx11rom.Length / 0x40;
M92.pf_layer[i].tmap.pen_data = new byte[0x40];
M92.pf_layer[i].tmap.total_elements = M92.gfx11romLength / 0x40;
M92.pf_layer[i].tmap.pen_data_set = new byte[0x40];
M92.pf_layer[i].tmap.pen_to_flags = new byte[3, 0x10];
M92.pf_layer[i].tmap.scrollrows = 512;
M92.pf_layer[i].tmap.scrollcols = 1;
@ -45,8 +45,8 @@ namespace MAME.Core
M92.pf_layer[i].wide_tmap.pixmap = new ushort[0x200 * 0x400];
M92.pf_layer[i].wide_tmap.flagsmap = new byte[0x200, 0x400];
M92.pf_layer[i].wide_tmap.tileflags = new byte[0x40, 0x80];
M92.pf_layer[i].wide_tmap.total_elements = M92.gfx11rom.Length / 0x40;
M92.pf_layer[i].wide_tmap.pen_data = new byte[0x40];
M92.pf_layer[i].wide_tmap.total_elements = M92.gfx11romLength / 0x40;
M92.pf_layer[i].wide_tmap.pen_data_set = new byte[0x40];
M92.pf_layer[i].wide_tmap.pen_to_flags = new byte[3, 0x10];
M92.pf_layer[i].wide_tmap.scrollrows = 512;
M92.pf_layer[i].wide_tmap.scrollcols = 1;
@ -241,7 +241,7 @@ namespace MAME.Core
flags = ((attrib >> 9) & 3) ^ (attributes & 0x03);
tileflags[row, col] = tile_drawM92(M92.gfx11rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawM92(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawM92(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -250,7 +250,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,6 +1,6 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_na(int sizex, int sizey, int tx, int ty, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{

View File

@ -1,14 +1,185 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Namcos1
public unsafe partial class Namcos1
{
public static int dac0_value, dac1_value, dac0_gain, dac1_gain;
public static byte[] gfx1rom, gfx2rom, gfx3rom, user1rom, mcurom;
public static byte[] audiorom, voicerom, bank_ram20, bank_ram30;
//public static byte[] /*gfx1rom,*/ /*gfx2rom,*/ gfx3rom, user1rom, mcurom;
//public static byte[] audiorom, voicerom, bank_ram20, bank_ram30;
public static int namcos1_pri;
public static byte dipsw;
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx3rom
static byte[] gfx3rom_src;
static GCHandle gfx3rom_handle;
public static byte* gfx3rom;
public static int gfx3romLength;
public static bool gfx3rom_IsNull => gfx3rom == null;
public static byte[] gfx3rom_set
{
set
{
gfx3rom_handle.ReleaseGCHandle();
gfx3rom_src = value;
gfx3romLength = value.Length;
gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom);
}
}
#endregion
#region //指针化 user1rom
static byte[] user1rom_src;
static GCHandle user1rom_handle;
public static byte* user1rom;
public static int user1romLength;
public static bool user1rom_IsNull => user1rom == null;
public static byte[] user1rom_set
{
set
{
user1rom_handle.ReleaseGCHandle();
if (value == null)
return;
user1rom_src = value;
user1romLength = value.Length;
user1rom_src.GetObjectPtr(ref user1rom_handle, ref user1rom);
}
}
#endregion
#region //指针化 mcurom
static byte[] mcurom_src;
static GCHandle mcurom_handle;
public static byte* mcurom;
public static int mcuromLength;
public static bool mcurom_IsNull => mcurom == null;
public static byte[] mcurom_set
{
set
{
mcurom_handle.ReleaseGCHandle();
mcurom_src = value;
mcuromLength = value.Length;
mcurom_src.GetObjectPtr(ref mcurom_handle, ref mcurom);
}
}
#endregion
#region //指针化 audiorom
static byte[] audiorom_src;
static GCHandle audiorom_handle;
public static byte* audiorom;
public static int audioromLength;
public static bool audiorom_IsNull => audiorom == null;
public static byte[] audiorom_set
{
set
{
audiorom_handle.ReleaseGCHandle();
audiorom_src = value;
audioromLength = value.Length;
audiorom_src.GetObjectPtr(ref audiorom_handle, ref audiorom);
}
}
#endregion
#region //指针化 voicerom
static byte[] voicerom_src;
static GCHandle voicerom_handle;
public static byte* voicerom;
public static int voiceromLength;
public static bool voicerom_IsNull => voicerom == null;
public static byte[] voicerom_set
{
set
{
voicerom_handle.ReleaseGCHandle();
if (value == null)
return;
voicerom_src = value;
voiceromLength = value.Length;
voicerom_src.GetObjectPtr(ref voicerom_handle, ref voicerom);
}
}
#endregion
#region //指针化 bank_ram20
static byte[] bank_ram20_src;
static GCHandle bank_ram20_handle;
public static byte* bank_ram20;
public static int bank_ram20Length;
public static bool bank_ram20_IsNull => bank_ram20 == null;
public static byte[] bank_ram20_set
{
set
{
bank_ram20_handle.ReleaseGCHandle();
bank_ram20_src = value;
bank_ram20Length = value.Length;
bank_ram20_src.GetObjectPtr(ref bank_ram20_handle, ref bank_ram20);
}
}
#endregion
#region //指针化 bank_ram30
static byte[] bank_ram30_src;
static GCHandle bank_ram30_handle;
public static byte* bank_ram30;
public static int bank_ram30Length;
public static bool bank_ram30_IsNull => bank_ram30 == null;
public static byte[] bank_ram30_set
{
set
{
bank_ram30_handle.ReleaseGCHandle();
bank_ram30_src = value;
bank_ram30Length = value.Length;
bank_ram30_src.GetObjectPtr(ref bank_ram30_handle, ref bank_ram30);
}
}
#endregion
public static byte[] ByteTo2byte(byte[] bb1)
{
byte[] bb2 = null;
@ -29,17 +200,18 @@ namespace MAME.Core
{
Machine.bRom = true;
user1rom_offset = new int[2, 8];
audiorom = Machine.GetRom("audiocpu.rom");
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom"));
user1rom = Machine.GetRom("user1.rom");
mcurom = MameMainMotion.resource.mcu;
voicerom = new byte[0xc0000];
byte[] bb1 = Machine.GetRom("voice.rom");
Array.Copy(bb1, voicerom, bb1.Length);
bank_ram20 = new byte[0x2000];
bank_ram30 = new byte[0x80];
audiorom_set = Machine.GetRom("audiocpu.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
gfx3rom_set = ByteTo2byte(Machine.GetRom("gfx3.rom"));
user1rom_set = Machine.GetRom("user1.rom");
mcurom_set = MameMainMotion.resource.mcu;
voicerom_set = new byte[0xc0000];
//byte[] bb1 = Machine.GetRom("voice.rom");
//AxiArray.Copy(bb1, voicerom, bb1.Length);
voicerom_set = Machine.GetRom("voice.rom");
bank_ram20_set = new byte[0x2000];
bank_ram30_set = new byte[0x80];
Namco.namco_wavedata = new byte[0x400];
Generic.generic_nvram_set = new byte[0x800];
cus117_offset = new int[2, 8];

View File

@ -81,8 +81,8 @@ namespace MAME.Core
{
Palette.entry_color[i] = reader.ReadUInt32();
}
bank_ram20 = reader.ReadBytes(0x2000);
bank_ram30 = reader.ReadBytes(0x80);
bank_ram20_set = reader.ReadBytes(0x2000);
bank_ram30_set = reader.ReadBytes(0x80);
namcos1_videoram = reader.ReadBytes(0x8000);
namcos1_cus116 = reader.ReadBytes(0x10);
namcos1_spriteram = reader.ReadBytes(0x1000);

View File

@ -63,7 +63,7 @@ namespace MAME.Core
}
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tile_updateNa(int col, int row)
{

View File

@ -1,9 +1,10 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Neogeo
public unsafe partial class Neogeo
{
private static int NEOGEO_HBEND = 0x01e;//30 /* this should really be 29.5 */
private static int NEOGEO_HBSTART = 0x15e;//350 /* this should really be 349.5 */
@ -25,18 +26,58 @@ namespace MAME.Core
public static byte main_cpu_vector_table_source;
//public static byte audio_result;
public static byte[] audio_cpu_banks;
public static byte[] mainbiosrom, mainram2, audiobiosrom, fixedrom, fixedbiosrom, zoomyrom, spritesrom, pvc_cartridge_ram;
public static byte[] mainbiosrom, /*mainram2,*/ audiobiosrom, fixedrom, fixedbiosrom, zoomyrom, /*spritesrom,*/ pvc_cartridge_ram;
public static byte[] extra_ram = new byte[0x2000];
public static uint fatfury2_prot_data;
public static ushort neogeo_rng;
private static byte save_ram_unlocked;
public static bool audio_cpu_nmi_enabled, audio_cpu_nmi_pending;
#region //指针化 mainram2
static byte[] mainram2_src;
static GCHandle mainram2_handle;
public static byte* mainram2;
public static int mainram2Length;
public static bool mainram2_IsNull => mainram2 == null;
public static byte[] mainram2_set
{
set
{
mainram2_handle.ReleaseGCHandle();
mainram2_src = value;
mainram2Length = value.Length;
mainram2_src.GetObjectPtr(ref mainram2_handle, ref mainram2);
}
}
#endregion
#region //指针化 spritesrom
static byte[] spritesrom_src;
static GCHandle spritesrom_handle;
public static byte* spritesrom;
public static int spritesromLength;
public static bool spritesrom_IsNull => spritesrom == null;
public static byte[] spritesrom_set
{
set
{
spritesrom_handle.ReleaseGCHandle();
if (value == null)
return;
spritesrom_src = value;
spritesromLength = value.Length;
spritesrom_src.GetObjectPtr(ref spritesrom_handle, ref spritesrom);
}
}
#endregion
public static void NeogeoInit()
{
audio_cpu_banks = new byte[4];
pvc_cartridge_ram = new byte[0x2000];
Memory.Set_mainram(new byte[0x10000]);
mainram2 = new byte[0x10000];
mainram2_set = new byte[0x10000];
Memory.Set_audioram(new byte[0x800]);
Machine.bRom = true;
dsw = 0xff;
@ -49,7 +90,7 @@ namespace MAME.Core
fixedrom = Machine.GetRom("fixed.rom");
FM.ymsndrom = Machine.GetRom("ymsnd.rom");
YMDeltat.ymsnddeltatrom = Machine.GetRom("ymsnddeltat.rom");
spritesrom = Machine.GetRom("sprites.rom");
spritesrom_set = Machine.GetRom("sprites.rom");
if (fixedbiosrom == null || zoomyrom == null || audiobiosrom == null || mainbiosrom == null || Memory.mainrom_IsNull || Memory.audiorom_IsNull || fixedrom == null || FM.ymsndrom == null || spritesrom == null)
{
Machine.bRom = false;

View File

@ -93,7 +93,7 @@ namespace MAME.Core
save_ram_unlocked = reader.ReadByte();
audio_cpu_nmi_enabled = reader.ReadBoolean();
audio_cpu_nmi_pending = reader.ReadBoolean();
mainram2 = reader.ReadBytes(0x10000);
mainram2_set = reader.ReadBytes(0x10000);
pvc_cartridge_ram = reader.ReadBytes(0x2000);
for (i = 0; i < 2; i++)
{

View File

@ -823,8 +823,8 @@ namespace MAME.Core
}
private static void optimize_sprite_data()
{
sprite_gfx_address_mask = (uint)(spritesrom.Length * 2 - 1);
for (int i = 0; i < spritesrom.Length; i++)
sprite_gfx_address_mask = (uint)(spritesromLength * 2 - 1);
for (int i = 0; i < spritesromLength; i++)
{
sprite_gfx[i * 2] = (byte)((spritesrom[i] & 0xf0) >> 4);
sprite_gfx[i * 2 + 1] = (byte)(spritesrom[i] & 0x0f);
@ -917,7 +917,7 @@ namespace MAME.Core
}
public static void video_start_neogeo()
{
sprite_gfx = new byte[spritesrom.Length * 2];
sprite_gfx = new byte[spritesromLength * 2];
neogeo_videoram = new ushort[0x10000];
palettes = new ushort[2, 0x1000];
pens = new int[0x1000];

View File

@ -1,16 +1,58 @@
using cpu.m68000;
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class PGM
public unsafe partial class PGM
{
public static byte[] mainbiosrom, videobios, audiobios;
public static byte[] pgm_bg_videoram, pgm_tx_videoram, pgm_rowscrollram, pgm_videoregs, sprmaskrom, sprcolrom, tilesrom, tiles1rom, tiles2rom, pgm_sprite_a_region;
public static byte[] pgm_bg_videoram, pgm_tx_videoram, pgm_rowscrollram, pgm_videoregs, sprmaskrom, sprcolrom, tilesrom, /*tiles1rom,*/ /*tiles2rom, */pgm_sprite_a_region;
public static byte CalVal, CalMask, CalCom = 0, CalCnt = 0;
public static uint[] arm7_shareram;
public static uint arm7_latch;
public static int pgm_sprite_a_region_allocate;
#region //指针化 tiles1rom
static byte[] tiles1rom_src;
static GCHandle tiles1rom_handle;
public static byte* tiles1rom;
public static int tiles1romLength;
public static bool tiles1rom_IsNull => tiles1rom == null;
public static byte[] tiles1rom_set
{
set
{
tiles1rom_handle.ReleaseGCHandle();
if (value == null)
return;
tiles1rom_src = value;
tiles1romLength = value.Length;
tiles1rom_src.GetObjectPtr(ref tiles1rom_handle, ref tiles1rom);
}
}
#endregion
#region //指针化 tiles2rom
static byte[] tiles2rom_src;
static GCHandle tiles2rom_handle;
public static byte* tiles2rom;
public static int tiles2romLength;
public static bool tiles2rom_IsNull => tiles2rom == null;
public static byte[] tiles2rom_set
{
set
{
tiles2rom_handle.ReleaseGCHandle();
if (value == null)
return;
tiles2rom_src = value;
tiles2romLength = value.Length;
tiles2rom_src.GetObjectPtr(ref tiles2rom_handle, ref tiles2rom);
}
}
#endregion
public static void PGMInit()
{
Machine.bRom = true;
@ -35,7 +77,7 @@ namespace MAME.Core
Array.Copy(videobios, tilesrom, 0x200000);
Array.Copy(bb2, 0, tilesrom, 0x400000, n2);
n3 = tilesrom.Length;
tiles1rom = new byte[n3 * 2];
tiles1rom_set = new byte[n3 * 2];
for (i3 = 0; i3 < n3; i3++)
{
tiles1rom[i3 * 2] = (byte)(tilesrom[i3] & 0x0f);
@ -61,7 +103,7 @@ namespace MAME.Core
private static void expand_32x32x5bpp()
{
int n2 = tilesrom.Length / 5 * 8;
tiles2rom = new byte[n2];
tiles2rom_set = new byte[n2];
int cnt;
byte pix;
for (cnt = 0; cnt < tilesrom.Length / 5; cnt++)

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class PGM
public unsafe partial class PGM
{
public static Tmap pgm_tx_tilemap, pgm_bg_tilemap;
public static void tilemap_init()
@ -23,7 +23,7 @@ namespace MAME.Core
pgm_tx_tilemap.tile_update3 = pgm_tx_tilemap.tile_updatePgmtx;
pgm_tx_tilemap.tilemap_draw_instance3 = pgm_tx_tilemap.tilemap_draw_instancePgm;
pgm_tx_tilemap.total_elements = 0x800000 / 0x20;
pgm_tx_tilemap.pen_data = new byte[0x40];
pgm_tx_tilemap.pen_data_set = new byte[0x40];
pgm_tx_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 15; i++)
{
@ -49,7 +49,7 @@ namespace MAME.Core
pgm_bg_tilemap.tile_update3 = pgm_bg_tilemap.tile_updatePgmbg;
pgm_bg_tilemap.tilemap_draw_instance3 = pgm_bg_tilemap.tilemap_draw_instancePgm;
pgm_bg_tilemap.total_elements = 0x3333;
pgm_bg_tilemap.pen_data = new byte[0x400];
pgm_bg_tilemap.pen_data_set = new byte[0x400];
pgm_bg_tilemap.pen_to_flags = new byte[1, 32];
for (i = 0; i < 31; i++)
{
@ -62,7 +62,7 @@ namespace MAME.Core
pgm_bg_tilemap.colscroll = new int[pgm_bg_tilemap.scrollcols];
}
}
public partial class Tmap
public unsafe partial class Tmap
{
public void tile_updatePgmtx(int col, int row)
{
@ -98,7 +98,7 @@ namespace MAME.Core
int xoffs;
byte andmask = 0xff, ormask = 0;
byte pen, map;
Array.Copy(PGM.tiles1rom, pendata_offset, pen_data, 0, 0x40);
AxiArray.Copy(PGM.tiles1rom, pendata_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += height - 1;
@ -257,7 +257,7 @@ namespace MAME.Core
int xoffs;
byte andmask = 0xff, ormask = 0;
byte pen, map;
Array.Copy(PGM.tiles2rom, pendata_offset, pen_data, 0, 0x400);
AxiArray.Copy(PGM.tiles2rom, pendata_offset, pen_data, 0, 0x400);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += height - 1;

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_starfigh(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
public static void common_drawgfx_starfigh(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -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 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)
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;

View File

@ -1,8 +1,9 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class SunA8
public unsafe partial class SunA8
{
public static byte m_rombank, m_spritebank, m_palettebank, spritebank_latch;
public static byte suna8_unknown;
@ -11,11 +12,124 @@ namespace MAME.Core
public static GFXBANK_TYPE m_gfxbank_type;
public static byte dsw1, dsw2, dswcheat;
public static byte m_rombank_latch, m_nmi_enable;
public static byte[] mainromop, gfx1rom, gfx12rom, samplesrom;
//public static byte[] /*mainromop,*/ /*gfx1rom,*/ gfx12rom, samplesrom;
public static int basebankmain;
public static short[] samplebuf, samplebuf2;
//public static short[] samplebuf, samplebuf2;
public static int sample;
public static int sample_offset;
#region //指针化 mainromop
static byte[] mainromop_src;
static GCHandle mainromop_handle;
public static byte* mainromop;
public static int mainromopLength;
public static bool mainromop_IsNull => mainromop == null;
public static byte[] mainromop_set
{
set
{
mainromop_handle.ReleaseGCHandle();
mainromop_src = value;
mainromopLength = value.Length;
mainromop_src.GetObjectPtr(ref mainromop_handle, ref mainromop);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx12rom
static byte[] gfx12rom_src;
static GCHandle gfx12rom_handle;
public static byte* gfx12rom;
public static int gfx12romLength;
public static bool gfx12rom_IsNull => gfx12rom == null;
public static byte[] gfx12rom_set
{
set
{
gfx12rom_handle.ReleaseGCHandle();
gfx12rom_src = value;
gfx12romLength = value.Length;
gfx12rom_src.GetObjectPtr(ref gfx12rom_handle, ref gfx12rom);
}
}
#endregion
#region //指针化 samplesrom
static byte[] samplesrom_src;
static GCHandle samplesrom_handle;
public static byte* samplesrom;
public static int samplesromLength;
public static bool samplesrom_IsNull => samplesrom == null;
public static byte[] samplesrom_set
{
set
{
samplesrom_handle.ReleaseGCHandle();
samplesrom_src = value;
samplesromLength = value.Length;
samplesrom_src.GetObjectPtr(ref samplesrom_handle, ref samplesrom);
}
}
#endregion
#region //指针化 samplebuf
static short[] samplebuf_src;
static GCHandle samplebuf_handle;
public static short* samplebuf;
public static int samplebufLength;
public static bool samplebuf_IsNull => samplebuf == null;
public static short[] samplebuf_set
{
set
{
samplebuf_handle.ReleaseGCHandle();
samplebuf_src = value;
samplebufLength = value.Length;
samplebuf_src.GetObjectPtr(ref samplebuf_handle, ref samplebuf);
}
}
#endregion
#region //指针化 samplebuf2
static short[] samplebuf2_src;
static GCHandle samplebuf2_handle;
public static short* samplebuf2;
public static int samplebuf2Length;
public static bool samplebuf2_IsNull => samplebuf2 == null;
public static short[] samplebuf2_set
{
set
{
samplebuf2_handle.ReleaseGCHandle();
samplebuf2_src = value;
samplebuf2Length = value.Length;
samplebuf2_src.GetObjectPtr(ref samplebuf2_handle, ref samplebuf2);
}
}
#endregion
public static void SunA8Init()
{
int i, n;
@ -24,13 +138,13 @@ namespace MAME.Core
{
case "starfigh":
Generic.spriteram_set = new byte[0x4000];
mainromop = Machine.GetRom("maincpuop.rom");
mainromop_set = Machine.GetRom("maincpuop.rom");
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
samplesrom = Machine.GetRom("samples.rom");
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
samplesrom_set = Machine.GetRom("samples.rom");
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
@ -129,14 +243,14 @@ namespace MAME.Core
{
int i1 = 1;
}
Array.Copy(samplebuf, 0x800 * sample, samplebuf2, 0, 0x800);
AxiArray.Copy(samplebuf, 0x800 * sample, samplebuf2, 0, 0x800);
Sample.sample_start_raw(0, samplebuf2, 0x0800, 4000, 0);
}
else if ((~data & 0x08) != 0)
{
sample &= 3;
sample_offset = 0x800 * (sample + 7);
Array.Copy(samplebuf, 0x800 * (sample + 7), samplebuf2, 0, 0x800);
AxiArray.Copy(samplebuf, 0x800 * (sample + 7), samplebuf2, 0, 0x800);
Sample.sample_start_raw(0, samplebuf2, 0x0800, 4000, 0);
}
}
@ -147,9 +261,9 @@ namespace MAME.Core
}
public static void suna8_sh_start()
{
int i, len = samplesrom.Length;
samplebuf = new short[len];
samplebuf2 = new short[0x800];
int i, len = samplesromLength;
samplebuf_set = new short[len];
samplebuf2_set = new short[0x800];
for (i = 0; i < len; i++)
{
samplebuf[i] = (short)((sbyte)(samplesrom[i] ^ 0x80) * 256);

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_bublbobl(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
public static void common_drawgfx_bublbobl(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -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 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)
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;
@ -99,7 +99,7 @@
}
}
}
public static void common_drawgfx_opwolf(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint pri_mask)
public static void common_drawgfx_opwolf(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, uint pri_mask)
{
int ox;
int oy;
@ -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 unsafe 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)
{

View File

@ -305,7 +305,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x1800));
mainram2 = reader.ReadBytes(0x100);
mainram2_set = reader.ReadBytes(0x100);
mainram3 = reader.ReadBytes(0x100);
Memory.Set_audioram(reader.ReadBytes(0x1000));
for (i = 0; i < 3; i++)
@ -703,7 +703,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x8000));
mainram2 = reader.ReadBytes(0x10000);
mainram2_set = reader.ReadBytes(0x10000);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x1000));
for (i = 0; i < Z80A.nZ80; i++)

View File

@ -1,11 +1,50 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Taito
public unsafe partial class Taito
{
public static int basebankmain, basebanksnd;
public static byte[] bb1, bublbobl_mcu_sharedram, videoram, bublbobl_objectram, slaverom, mcurom, mcuram, mainram2, mainram3, subrom;
public static byte[] bb1, bublbobl_mcu_sharedram, videoram, bublbobl_objectram, slaverom,/* mcurom,*/ mcuram, /*mainram2,*/ mainram3, subrom;
#region //指针化 mcurom
static byte[] mcurom_src;
static GCHandle mcurom_handle;
public static byte* mcurom;
public static int mcuromLength;
public static bool mcurom_IsNull => mcurom == null;
public static byte[] mcurom_set
{
set
{
mcurom_handle.ReleaseGCHandle();
mcurom_src = value;
mcuromLength = value.Length;
mcurom_src.GetObjectPtr(ref mcurom_handle, ref mcurom);
}
}
#endregion
#region //指针化 mainram2
static byte[] mainram2_src;
static GCHandle mainram2_handle;
public static byte* mainram2;
public static int mainram2Length;
public static bool mainram2_IsNull => mainram2 == null;
public static byte[] mainram2_set
{
set
{
mainram2_handle.ReleaseGCHandle();
mainram2_src = value;
mainram2Length = value.Length;
mainram2_src.GetObjectPtr(ref mainram2_handle, ref mainram2);
}
}
#endregion
public static void TaitoInit()
{
int i, n;
@ -26,15 +65,15 @@ namespace MAME.Core
slaverom = Machine.GetRom("slave.rom");
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
prom = Machine.GetRom("proms.rom");
prom_set = Machine.GetRom("proms.rom");
bublbobl_video_enable = 1;
if (Memory.mainrom_IsNull || slaverom == null || Memory.audiorom_IsNull || gfx1rom == null || prom == null)
{
@ -65,16 +104,16 @@ namespace MAME.Core
slaverom = Machine.GetRom("slave.rom");
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
mcurom = Machine.GetRom("mcu.rom");
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
mcurom_set = Machine.GetRom("mcu.rom");
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
prom = Machine.GetRom("proms.rom");
prom_set = Machine.GetRom("proms.rom");
bublbobl_video_enable = 0;
if (Memory.mainrom_IsNull || slaverom == null || Memory.audiorom_IsNull || mcurom == null || gfx1rom == null || prom == null)
{
@ -94,7 +133,7 @@ namespace MAME.Core
case "sboblboblc":
case "dland":
case "bbredux":
mainram2 = new byte[0x100];
mainram2_set = new byte[0x100];
mainram3 = new byte[0x100];
videoram = new byte[0x1d00];
bublbobl_objectram = new byte[0x300];
@ -105,15 +144,15 @@ namespace MAME.Core
slaverom = Machine.GetRom("slave.rom");
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
prom = Machine.GetRom("proms.rom");
prom_set = Machine.GetRom("proms.rom");
bublbobl_video_enable = 0;
if (Memory.mainrom_IsNull || slaverom == null || Memory.audiorom_IsNull || gfx1rom == null || prom == null)
{
@ -127,7 +166,7 @@ namespace MAME.Core
break;
case "bublboblb":
case "boblcave":
mainram2 = new byte[0x100];
mainram2_set = new byte[0x100];
mainram3 = new byte[0x100];
videoram = new byte[0x1d00];
bublbobl_objectram = new byte[0x300];
@ -138,15 +177,15 @@ namespace MAME.Core
slaverom = Machine.GetRom("slave.rom");
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
prom = Machine.GetRom("proms.rom");
prom_set = Machine.GetRom("proms.rom");
bublbobl_video_enable = 0;
if (Memory.mainrom_IsNull || slaverom == null || Memory.audiorom_IsNull || gfx1rom == null || prom == null)
{
@ -163,30 +202,30 @@ namespace MAME.Core
case "opwolfj":
case "opwolfu":
{
mainram2 = new byte[0x10000];
mainram2_set = new byte[0x10000];
cchip_ram = new byte[0x2000];
Generic.paletteram16_set = new ushort[0x800];
Memory.Set_mainram(new byte[0x8000]);
Memory.Set_audioram(new byte[0x1000]);
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
bb1 = Machine.GetRom("audiocpu.rom");
//Memory.audiorom = new byte[0x20000];
//Memory.audiorom_set = new byte[0x20000];
//Array.Copy(bb1, 0, Memory.audiorom, 0, 0x10000);
byte[] temprom = new byte[0x20000];
Array.Copy(bb1, 0, temprom, 0, 0x10000);
Memory.Set_audiorom(temprom);
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
gfx22rom = Machine.GetRom("gfx2.rom");
n = gfx22rom.Length;
gfx2rom = new byte[n * 2];
gfx22rom_set = Machine.GetRom("gfx2.rom");
n = gfx22romLength;
gfx2rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx2rom[i * 2] = (byte)(gfx22rom[i] >> 4);
@ -207,31 +246,31 @@ namespace MAME.Core
break;
case "opwolfb":
{
mainram2 = new byte[0x10000];
mainram2_set = new byte[0x10000];
cchip_ram = new byte[0x2000];
Generic.paletteram16_set = new ushort[0x800];
Memory.Set_mainram(new byte[0x8000]);
Memory.Set_audioram(new byte[0x1000]);
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
bb1 = Machine.GetRom("audiocpu.rom");
//Memory.audiorom = new byte[0x20000];
//Memory.audiorom_set = new byte[0x20000];
//Array.Copy(bb1, 0, Memory.audiorom, 0, 0x10000);
byte[] temprom = new byte[0x20000];
Array.Copy(bb1, 0, temprom, 0, 0x10000);
Memory.Set_audiorom(temprom);
byte[] temprom_set = new byte[0x20000];
Array.Copy(bb1, 0, temprom_set, 0, 0x10000);
Memory.Set_audiorom(temprom_set);
subrom = Machine.GetRom("sub.rom");
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
gfx22rom = Machine.GetRom("gfx2.rom");
n = gfx22rom.Length;
gfx2rom = new byte[n * 2];
gfx22rom_set = Machine.GetRom("gfx2.rom");
n = gfx22romLength;
gfx2rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx2rom[i * 2] = (byte)(gfx22rom[i] >> 4);
@ -252,31 +291,30 @@ namespace MAME.Core
break;
case "opwolfp":
{
mainram2 = new byte[0x10000];
mainram2_set = new byte[0x10000];
cchip_ram = new byte[0x2000];
Generic.paletteram16_set = new ushort[0x800];
Memory.Set_mainram(new byte[0x8000]);
Memory.Set_audioram(new byte[0x1000]);
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
bb1 = Machine.GetRom("audiocpu.rom");
//Memory.audiorom = new byte[0x20000];
//Memory.audiorom_set = new byte[0x20000];
//Array.Copy(bb1, 0, Memory.audiorom, 0, 0x10000);
byte[] temprom = new byte[0x20000];
Array.Copy(bb1, 0, temprom, 0, 0x10000);
Memory.Set_audiorom(temprom);
gfx12rom = Machine.GetRom("gfx1.rom");
n = gfx12rom.Length;
gfx1rom = new byte[n * 2];
gfx12rom_set = Machine.GetRom("gfx1.rom");
n = gfx12romLength;
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfx12rom[i] >> 4);
gfx1rom[i * 2 + 1] = (byte)(gfx12rom[i] & 0x0f);
}
gfx22rom = Machine.GetRom("gfx2.rom");
n = gfx22rom.Length;
gfx2rom = new byte[n * 2];
gfx22rom_set = Machine.GetRom("gfx2.rom");
n = gfx22romLength;
gfx2rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx2rom[i * 2] = (byte)(gfx22rom[i] >> 4);

View File

@ -2,7 +2,7 @@
namespace MAME.Core
{
public partial class Taito
public unsafe partial class Taito
{
public static int PC080SN_chips;
public static ushort[][] PC080SN_ctrl;
@ -74,11 +74,11 @@ namespace MAME.Core
PC080SN_tilemap[i][j].height = 0x200;
PC080SN_tilemap[i][j].enable = true;
PC080SN_tilemap[i][j].all_tiles_dirty = true;
PC080SN_tilemap[i][j].total_elements = gfx1rom.Length / 0x40;
PC080SN_tilemap[i][j].total_elements = gfx1romLength / 0x40;
PC080SN_tilemap[i][j].pixmap = new ushort[0x200 * 0x200];
PC080SN_tilemap[i][j].flagsmap = new byte[0x200, 0x200];
PC080SN_tilemap[i][j].tileflags = new byte[64, 64];
PC080SN_tilemap[i][j].pen_data = new byte[0x40];
PC080SN_tilemap[i][j].pen_data_set = new byte[0x40];
PC080SN_tilemap[i][j].pen_to_flags = new byte[1, 16];
PC080SN_tilemap[i][j].pen_to_flags[0, 0] = 0;
for (k = 1; k < 16; k++)
@ -101,11 +101,11 @@ namespace MAME.Core
PC080SN_tilemap[i][j].height = 0x200;
PC080SN_tilemap[i][j].enable = true;
PC080SN_tilemap[i][j].all_tiles_dirty = true;
PC080SN_tilemap[i][j].total_elements = gfx1rom.Length / 0x40;
PC080SN_tilemap[i][j].total_elements = gfx1romLength / 0x40;
PC080SN_tilemap[i][j].pixmap = new ushort[0x200 * 0x400];
PC080SN_tilemap[i][j].flagsmap = new byte[0x200, 0x400];
PC080SN_tilemap[i][j].tileflags = new byte[128, 64];
PC080SN_tilemap[i][j].pen_data = new byte[0x40];
PC080SN_tilemap[i][j].pen_data_set = new byte[0x40];
PC080SN_tilemap[i][j].pen_to_flags = new byte[1, 16];
PC080SN_tilemap[i][j].pen_to_flags[0, 0] = 0;
for (k = 1; k < 16; k++)

View File

@ -161,7 +161,7 @@ namespace MAME.Core
flags = (((attr & 0xc000) >> 14) & 3) ^ (attributes & 0x03);
tileflags[row, col] = tile_drawTaitobg_opwolf(Taito.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawTaitobg_opwolf(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawTaitobg_opwolf(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -170,7 +170,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,13 +1,105 @@
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public unsafe partial class Taito
{
public static byte[] gfx1rom, gfx2rom, gfx12rom, gfx22rom, prom;
//public static byte[] /*gfx1rom, *//*gfx2rom,*/ /*gfx12rom,*/ /*gfx22rom*//*, prom*/;
public static int bublbobl_objectram_size = 0x300;
public static RECT cliprect;
public static ushort[] uuFF;
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx12rom
static byte[] gfx12rom_src;
static GCHandle gfx12rom_handle;
public static byte* gfx12rom;
public static int gfx12romLength;
public static bool gfx12rom_IsNull => gfx12rom == null;
public static byte[] gfx12rom_set
{
set
{
gfx12rom_handle.ReleaseGCHandle();
gfx12rom_src = value;
gfx12romLength = value.Length;
gfx12rom_src.GetObjectPtr(ref gfx12rom_handle, ref gfx12rom);
}
}
#endregion
#region //指针化 gfx22rom
static byte[] gfx22rom_src;
static GCHandle gfx22rom_handle;
public static byte* gfx22rom;
public static int gfx22romLength;
public static bool gfx22rom_IsNull => gfx22rom == null;
public static byte[] gfx22rom_set
{
set
{
gfx22rom_handle.ReleaseGCHandle();
gfx22rom_src = value;
gfx22romLength = value.Length;
gfx22rom_src.GetObjectPtr(ref gfx22rom_handle, ref gfx22rom);
}
}
#endregion
#region //指针化 prom
static byte[] prom_src;
static GCHandle prom_handle;
public static byte* prom;
public static int promLength;
public static bool prom_IsNull => prom == null;
public static byte[] prom_set
{
set
{
prom_handle.ReleaseGCHandle();
prom_src = value;
promLength = value.Length;
prom_src.GetObjectPtr(ref prom_handle, ref prom);
}
}
#endregion
public static void video_start_bublbobl()
{
int i;

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfxzoom_taitob(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, int transparent_color, int scalex, int scaley)
public static void common_drawgfxzoom_taitob(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, int transparent_color, int scalex, int scaley)
{
if ((scalex == 0) || (scaley == 0))
{
@ -108,7 +108,7 @@
}
}
}
public static void common_drawgfx_taitob(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
public static void common_drawgfx_taitob(byte* bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip)
{
int ox;
int oy;
@ -167,7 +167,7 @@
int colorbase = color;
blockmove_8toN_transpen_raw16_taitob(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sx, sy);
}
public static void blockmove_8toN_transpen_raw16_taitob(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 sx, int sy)
public static void blockmove_8toN_transpen_raw16_taitob(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 sx, int sy)
{
int ydir, xdir, col, i, j, offsetx, offsety;
int srcdata_offset = code * 0x100;

View File

@ -143,7 +143,7 @@ namespace MAME.Core
Palette.entry_color[i] = reader.ReadUInt32();
}
Memory.Set_mainram(reader.ReadBytes(0x10000));
mainram2 = reader.ReadBytes(0x1e80);
mainram2_set = reader.ReadBytes(0x1e80);
MC68000.m1.LoadStateBinary(reader);
Memory.Set_audioram(reader.ReadBytes(0x2000));
Z80A.zz1[0].LoadStateBinary(reader);

View File

@ -1,10 +1,104 @@
using static MAME.Core.EmuTimer;
using System;
using System.Runtime.InteropServices;
using static MAME.Core.EmuTimer;
namespace MAME.Core
{
public partial class Taitob
public unsafe partial class Taitob
{
public static byte[] gfxrom, gfx0rom, gfx1rom, mainram2, mainram3;
//public static byte[] /*gfxrom,*/ /*gfx0rom,*/ /*gfx1rom,*/ mainram2, mainram3;
#region //指针化 gfxrom
static byte[] gfxrom_src;
static GCHandle gfxrom_handle;
public static byte* gfxrom;
public static int gfxromLength;
public static bool gfxrom_IsNull => gfxrom == null;
public static byte[] gfxrom_set
{
set
{
gfxrom_handle.ReleaseGCHandle();
gfxrom_src = value;
gfxromLength = value.Length;
gfxrom_src.GetObjectPtr(ref gfxrom_handle, ref gfxrom);
}
}
#endregion
#region //指针化 gfx0rom
static byte[] gfx0rom_src;
static GCHandle gfx0rom_handle;
public static byte* gfx0rom;
public static int gfx0romLength;
public static bool gfx0rom_IsNull => gfx0rom == null;
public static byte[] gfx0rom_set
{
set
{
gfx0rom_handle.ReleaseGCHandle();
gfx0rom_src = value;
gfx0romLength = value.Length;
gfx0rom_src.GetObjectPtr(ref gfx0rom_handle, ref gfx0rom);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 mainram2
static byte[] mainram2_src;
static GCHandle mainram2_handle;
public static byte* mainram2;
public static int mainram2Length;
public static bool mainram2_IsNull => mainram2 == null;
public static byte[] mainram2_set
{
set
{
mainram2_handle.ReleaseGCHandle();
mainram2_src = value;
mainram2Length = value.Length;
mainram2_src.GetObjectPtr(ref mainram2_handle, ref mainram2);
}
}
#endregion
#region //指针化 mainram3
static byte[] mainram3_src;
static GCHandle mainram3_handle;
public static byte* mainram3;
public static int mainram3Length;
public static bool mainram3_IsNull => mainram3 == null;
public static byte[] mainram3_set
{
set
{
mainram3_handle.ReleaseGCHandle();
mainram3_src = value;
mainram3Length = value.Length;
mainram3_src.GetObjectPtr(ref mainram3_handle, ref mainram3);
}
}
#endregion
public static ushort eep_latch;
public static ushort coin_word;
public static int basebanksnd;
@ -20,8 +114,8 @@ namespace MAME.Core
TC0640FIO_regs = new byte[8];
taitob_scroll = new ushort[0x400];
Memory.Set_mainram(new byte[0x10000]);
mainram2 = new byte[0x1e80];
mainram3 = new byte[0x2000];
mainram2_set = new byte[0x1e80];
mainram3_set = new byte[0x2000];
Memory.Set_audioram(new byte[0x2000]);
bg_rambank = new ushort[2];
fg_rambank = new ushort[2];
@ -42,10 +136,10 @@ namespace MAME.Core
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfxrom = Machine.GetRom("gfx1.rom");
n = gfxrom.Length;
gfx0rom = new byte[n * 2];
gfx1rom = new byte[n * 2];
gfxrom_set = Machine.GetRom("gfx1.rom");
n = gfxromLength;
gfx0rom_set = new byte[n * 2];
gfx1rom_set = new byte[n * 2];
for (i = 0; i < n; i++)
{
gfx1rom[i * 2] = (byte)(gfxrom[i] >> 4);

View File

@ -22,11 +22,11 @@ namespace MAME.Core
bg_tilemap.height = 0x400;
bg_tilemap.enable = true;
bg_tilemap.all_tiles_dirty = true;
bg_tilemap.total_elements = gfx1rom.Length / 0x100;
bg_tilemap.total_elements = gfx1romLength / 0x100;
bg_tilemap.pixmap = new ushort[0x400 * 0x400];
bg_tilemap.flagsmap = new byte[0x400, 0x400];
bg_tilemap.tileflags = new byte[64, 64];
bg_tilemap.pen_data = new byte[0x100];
bg_tilemap.pen_data_set = new byte[0x100];
bg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -48,11 +48,11 @@ namespace MAME.Core
fg_tilemap.height = 0x400;
fg_tilemap.enable = true;
fg_tilemap.all_tiles_dirty = true;
fg_tilemap.total_elements = gfx1rom.Length / 0x100;
fg_tilemap.total_elements = gfx1romLength / 0x100;
fg_tilemap.pixmap = new ushort[0x400 * 0x400];
fg_tilemap.flagsmap = new byte[0x400, 0x400];
fg_tilemap.tileflags = new byte[64, 64];
fg_tilemap.pen_data = new byte[0x100];
fg_tilemap.pen_data_set = new byte[0x100];
fg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 1; i < 16; i++)
{
@ -76,11 +76,11 @@ namespace MAME.Core
tx_tilemap.height = 0x100;
tx_tilemap.enable = true;
tx_tilemap.all_tiles_dirty = true;
tx_tilemap.total_elements = gfx1rom.Length / 0x40;
tx_tilemap.total_elements = gfx1romLength / 0x40;
tx_tilemap.pixmap = new ushort[0x100 * 0x200];
tx_tilemap.flagsmap = new byte[0x100, 0x200];
tx_tilemap.tileflags = new byte[32, 64];
tx_tilemap.pen_data = new byte[0x40];
tx_tilemap.pen_data_set = new byte[0x40];
tx_tilemap.pen_to_flags = new byte[1, 16];
for (i = 1; i < 16; i++)
{
@ -254,7 +254,7 @@ namespace MAME.Core
flags = attributes & 0x03;
tileflags[row, col] = tile_drawTaitobtx(Taitob.gfx0rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawTaitob(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawTaitob(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -263,7 +263,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x100);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x100);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;
@ -293,7 +293,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public byte tile_drawTaitobtx(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawTaitobtx(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -302,7 +302,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,8 +1,8 @@
namespace MAME.Core
{
public partial class Drawgfx
public unsafe partial class Drawgfx
{
public static void common_drawgfx_pbaction(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)
public static void common_drawgfx_pbaction(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)
{
int ox;
int oy;
@ -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 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)
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;

View File

@ -1,11 +1,106 @@
using cpu.z80;
using System;
using System.Runtime.InteropServices;
namespace MAME.Core
{
public partial class Tehkan
public unsafe partial class Tehkan
{
public static byte dsw1, dsw2;
public static byte[] mainromop, gfx1rom, gfx2rom, gfx3rom, gfx32rom;
//public static byte[] /*mainromop,*/ /*gfx1rom,*/ /*gfx2rom,*/ gfx3rom, gfx32rom;
#region //指针化 mainromop
static byte[] mainromop_src;
static GCHandle mainromop_handle;
public static byte* mainromop;
public static int mainromopLength;
public static bool mainromop_IsNull => mainromop == null;
public static byte[] mainromop_set
{
set
{
mainromop_handle.ReleaseGCHandle();
mainromop_src = value;
mainromopLength = value.Length;
mainromop_src.GetObjectPtr(ref mainromop_handle, ref mainromop);
}
}
#endregion
#region //指针化 gfx1rom
static byte[] gfx1rom_src;
static GCHandle gfx1rom_handle;
public static byte* gfx1rom;
public static int gfx1romLength;
public static bool gfx1rom_IsNull => gfx1rom == null;
public static byte[] gfx1rom_set
{
set
{
gfx1rom_handle.ReleaseGCHandle();
gfx1rom_src = value;
gfx1romLength = value.Length;
gfx1rom_src.GetObjectPtr(ref gfx1rom_handle, ref gfx1rom);
}
}
#endregion
#region //指针化 gfx2rom
static byte[] gfx2rom_src;
static GCHandle gfx2rom_handle;
public static byte* gfx2rom;
public static int gfx2romLength;
public static bool gfx2rom_IsNull => gfx2rom == null;
public static byte[] gfx2rom_set
{
set
{
gfx2rom_handle.ReleaseGCHandle();
gfx2rom_src = value;
gfx2romLength = value.Length;
gfx2rom_src.GetObjectPtr(ref gfx2rom_handle, ref gfx2rom);
}
}
#endregion
#region //指针化 gfx3rom
static byte[] gfx3rom_src;
static GCHandle gfx3rom_handle;
public static byte* gfx3rom;
public static int gfx3romLength;
public static bool gfx3rom_IsNull => gfx3rom == null;
public static byte[] gfx3rom_set
{
set
{
gfx3rom_handle.ReleaseGCHandle();
gfx3rom_src = value;
gfx3romLength = value.Length;
gfx3rom_src.GetObjectPtr(ref gfx3rom_handle, ref gfx3rom);
}
}
#endregion
#region //指针化 gfx32rom
static byte[] gfx32rom_src;
static GCHandle gfx32rom_handle;
public static byte* gfx32rom;
public static int gfx32romLength;
public static bool gfx32rom_IsNull => gfx32rom == null;
public static byte[] gfx32rom_set
{
set
{
gfx32rom_handle.ReleaseGCHandle();
gfx32rom_src = value;
gfx32romLength = value.Length;
gfx32rom_src.GetObjectPtr(ref gfx32rom_handle, ref gfx32rom);
}
}
#endregion
public static void PbactionInit()
{
int i, n;
@ -17,10 +112,10 @@ namespace MAME.Core
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
gfx3rom = Machine.GetRom("gfx3.rom");
gfx32rom = Machine.GetRom("gfx32.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
gfx3rom_set = Machine.GetRom("gfx3.rom");
gfx32rom_set = Machine.GetRom("gfx32.rom");
Memory.Set_mainram(new byte[0x1000]);
Memory.Set_audioram(new byte[0x800]);
Generic.videoram_set = new byte[0x400];
@ -38,13 +133,13 @@ namespace MAME.Core
case "pbaction4":
case "pbaction5":
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
mainromop = Machine.GetRom("maincpuop.rom");
mainromop_set = Machine.GetRom("maincpuop.rom");
//Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
gfx3rom = Machine.GetRom("gfx3.rom");
gfx32rom = Machine.GetRom("gfx32.rom");
gfx1rom_set = Machine.GetRom("gfx1.rom");
gfx2rom_set = Machine.GetRom("gfx2.rom");
gfx3rom_set = Machine.GetRom("gfx3.rom");
gfx32rom_set = Machine.GetRom("gfx32.rom");
Memory.Set_mainram(new byte[0x1000]);
Memory.Set_audioram(new byte[0x800]);
Generic.videoram_set = new byte[0x400];

View File

@ -17,11 +17,11 @@ namespace MAME.Core
bg_tilemap.height = 0x100;
bg_tilemap.enable = true;
bg_tilemap.all_tiles_dirty = true;
bg_tilemap.total_elements = gfx2rom.Length / 0x40;
bg_tilemap.total_elements = gfx2romLength / 0x40;
bg_tilemap.pixmap = new ushort[0x100 * 0x100];
bg_tilemap.flagsmap = new byte[0x100, 0x100];
bg_tilemap.tileflags = new byte[32, 32];
bg_tilemap.pen_data = new byte[0x100];
bg_tilemap.pen_data_set = new byte[0x100];
bg_tilemap.pen_to_flags = new byte[1, 16];
for (i = 0; i < 16; i++)
{
@ -43,11 +43,11 @@ namespace MAME.Core
fg_tilemap.height = 0x100;
fg_tilemap.enable = true;
fg_tilemap.all_tiles_dirty = true;
fg_tilemap.total_elements = gfx1rom.Length / 0x40;
fg_tilemap.total_elements = gfx1romLength / 0x40;
fg_tilemap.pixmap = new ushort[0x100 * 0x100];
fg_tilemap.flagsmap = new byte[0x100, 0x100];
fg_tilemap.tileflags = new byte[32, 32];
fg_tilemap.pen_data = new byte[0x100];
fg_tilemap.pen_data_set = new byte[0x100];
fg_tilemap.pen_to_flags = new byte[1, 16];
fg_tilemap.pen_to_flags[0, 0] = 0;
for (i = 1; i < 16; i++)
@ -100,7 +100,7 @@ namespace MAME.Core
group = 0;
tileflags[row, col] = tile_drawTehkanfg(Tehkan.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public byte tile_drawTehkanbg(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawTehkanbg(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -109,7 +109,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;
@ -143,7 +143,7 @@ namespace MAME.Core
}
return (byte)(andmask ^ ormask);
}
public byte tile_drawTehkanfg(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
public byte tile_drawTehkanfg(byte* bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags)
{
byte andmask = 0xff, ormask = 0;
int dx0 = 1, dy0 = 1;
@ -152,7 +152,7 @@ namespace MAME.Core
int offset1 = 0;
int offsety1;
int xoffs;
Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
AxiArray.Copy(bb1, pen_data_offset, pen_data, 0, 0x40);
if ((flags & Tilemap.TILE_FLIPY) != 0)
{
y0 += tileheight - 1;

View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace MAME.Core
{
@ -7,7 +8,26 @@ namespace MAME.Core
{
public struct sample_channel
{
public short[] source;
//public short[] source;
#region //指针化 source
short[] source_src;
GCHandle source_handle;
public short* source;
public int sourceLength;
public bool source_IsNull => source == null;
public short[] source_set
{
set
{
source_handle.ReleaseGCHandle();
source_src = value;
sourceLength = value.Length;
source_src.GetObjectPtr(ref source_handle, ref source);
}
}
#endregion
public int source_length;
public int source_num;
public uint pos;
@ -36,12 +56,12 @@ namespace MAME.Core
}
public static samples_info info = new samples_info();
public delegate void starthandler();
public static void sample_start_raw_n(int num, int channel, short[] sampledata, int samples, int frequency, int loop)
public static void sample_start_raw_n(int num, int channel, short* sampledata, int samples, int frequency, int loop)
{
Sound.samplestream.stream_update();
info.channel[channel].source_length = samples;
info.channel[channel].source = new short[samples];
Array.Copy(sampledata, 0, info.channel[channel].source, 0, samples);
info.channel[channel].source_set = new short[samples];
AxiArray.Copy(sampledata, 0, info.channel[channel].source, 0, samples);
info.channel[channel].source_num = -1;
info.channel[channel].pos = 0;
info.channel[channel].frac = 0;
@ -49,7 +69,7 @@ namespace MAME.Core
info.channel[channel].step = (uint)(((long)info.channel[channel].basefreq << 24) / 48000);
info.channel[channel].loop = (byte)loop;
}
public static void sample_start_raw(int channel, short[] sampledata, int samples, int frequency, int loop)
public static void sample_start_raw(int channel, short* sampledata, int samples, int frequency, int loop)
{
sample_start_raw_n(0, channel, sampledata, samples, frequency, loop);
}

View File

@ -22,7 +22,7 @@
</Declarations>
<Code Language="csharp">
<![CDATA[
#region //指针化$PtrDataname$
#region //指针化 $PtrDataname$
static $PtrDataType$[] $PtrDataname$_src;
static GCHandle $PtrDataname$_handle;
public static $PtrDataType$* $PtrDataname$;