Fix tail2nose and clean a bit more

This commit is contained in:
iq_132 2014-09-18 21:34:16 +00:00
parent 0392eb89a4
commit 29db61eaad
27 changed files with 248 additions and 260 deletions

View File

@ -360,7 +360,6 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x020000;
DrvSndROM1 = Next; Next += 0x020000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -522,9 +521,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();

View File

@ -443,7 +443,6 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x801 * sizeof(UINT32);
AllRam = Next;
@ -643,17 +642,11 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
DrvPalette[0x800] = 0; // black
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[0x800];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(0);
if (nBurnLayer & 1) K052109RenderLayer(2, 0, 1);

View File

@ -324,7 +324,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
AllRam = Next;
@ -459,16 +458,11 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x400);
K052109UpdateScroll();
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[0x0040];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[0x0040]);
if (nBurnLayer & 1) K052109RenderLayer(1, 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 2);

View File

@ -275,7 +275,6 @@ static INT32 MemIndex()
DrvGfxROMExp0 = Next; Next += 0x040000;
DrvGfxROMExp1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -399,9 +398,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
K052109UpdateScroll();

View File

@ -459,7 +459,6 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -620,14 +619,11 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
K052109UpdateScroll();
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
KonamiClearBitmaps(0);
K051960SpritesRender(1, 1);
K051316_zoom_draw(0, 0);

View File

@ -439,7 +439,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
AllRam = Next;
@ -571,9 +570,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x400);
K052109UpdateScroll();

View File

@ -332,7 +332,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -463,9 +462,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
K052109UpdateScroll();

View File

@ -654,7 +654,6 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x080000;
DrvSndROM1 = Next; Next += 0x0a0000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32);
AllRam = Next;
@ -793,9 +792,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvHD6309RAM + 0x1e00, DrvPalette, 0x200);
}
KonamiRecalcPalette(DrvHD6309RAM + 0x1e00, DrvPalette, 0x200);
K052109UpdateScroll();
@ -808,9 +805,7 @@ static INT32 DrvDraw()
}
else
{
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
// KonamiClearBitmaps(0);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, K052109_CATEGORY(1), 2);

View File

@ -366,7 +366,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -505,9 +504,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();
@ -527,11 +524,8 @@ static INT32 DrvDraw()
layer[2] = 2;
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[16 * bg_colorbase]);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);

View File

@ -338,7 +338,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -445,14 +444,9 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[0x100];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[0x100]);
K051316_zoom_draw(0, 1);
K053245SpritesRender(0);

View File

@ -389,7 +389,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x200000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -577,9 +576,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();
@ -600,11 +597,7 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * 2);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
}
KonamiClearBitmaps(DrvPalette[16 * bg_colorbase]);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);

View File

@ -481,7 +481,6 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -617,9 +616,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
K052109UpdateScroll();
@ -629,9 +626,7 @@ static INT32 DrvDraw()
K051960SpritesRender(-1, -1);
K052109RenderLayer(0, 0, 0);
} else {
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[0x0300];
}
KonamiClearBitmaps(DrvPalette[0x300]);
}
KonamiBlendCopy(DrvPalette);

View File

@ -302,7 +302,6 @@ static INT32 MemIndex()
DrvKonROM = Next; Next += 0x050000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -421,9 +420,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();
@ -444,10 +441,7 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[16 * bg_colorbase]);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);

View File

@ -545,7 +545,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -737,9 +736,7 @@ static INT32 DrvExit()
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x800);
K052109UpdateScroll();

View File

@ -5449,11 +5449,8 @@ static void BlswhstlDraw()
Layer[0] = 0;
Layer[1] = 1;
Layer[2] = 2;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * BGColourBase];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[16 * BGColourBase]);
sortlayers(Layer, LayerPri);
@ -5488,10 +5485,7 @@ static INT32 Thndrx2Draw()
Layer[1] = 1;
Layer[2] = 2;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * BGColourBase];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[16 * BGColourBase]);
sortlayers(Layer, LayerPri);

View File

@ -535,8 +535,7 @@ static INT32 DrvDraw()
DrvRecalcPalette();
}
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
KonamiClearBitmaps(0);
K051316_zoom_draw(2, 0);
K051316_zoom_draw(1, 0);

View File

@ -578,7 +578,6 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x100000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -761,9 +760,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
KonamiRecalcPalette(DrvPalRAM, DrvPalette, 0x1000);
K052109UpdateScroll();

View File

@ -508,7 +508,6 @@ static INT32 DrvExit()
return 0;
}
// not standard konami layout
static inline void DrvRecalcPalette()
{
UINT8 r,g,b;
@ -568,10 +567,7 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase+1];
konami_priority_bitmap[i] = 0;
}
KonamiClearBitmaps(DrvPalette[16 * bg_colorbase+1]);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);

View File

@ -41,7 +41,7 @@ void K051316Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callb
K051316GfxExpand(gfx, gfxexp, mask+1);
}
konami_allocate_bitmaps();
KonamiAllocateBitmaps();
KonamiIC_K051316InUse = 1;
@ -161,57 +161,111 @@ void K051316WrapEnable(INT32 chip, INT32 status)
static inline void copy_roz(INT32 chip, UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, INT32 wrap, INT32 transp, INT32 flags)
{
UINT32 *dst = konami_temp_screen;
UINT16 *pri = konami_priority_bitmap;
UINT16 *src = K051316TileMap[chip];
UINT32 *pal = konami_palette32;
UINT32 hshift = 512 << 16;
UINT32 wshift = 512 << 16;
for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy)
{
UINT32 cx = startx;
UINT32 cy = starty;
INT32 priority = flags & 0xff;
if (wrap) {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
INT32 pxl = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)];
if (!(pxl & 0x8000)) {
*dst = pal[pxl];
*pri = flags;
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++) {
*dst = pal[src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)] & 0x7fff];
*pri = flags;
}
}
} else {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
if (cx < wshift && cy < hshift) {
if (flags & 0x100) // indexed colors
{
UINT16 *dst = pTransDraw;
UINT16 *src = K051316TileMap[chip];
for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy)
{
UINT32 cx = startx;
UINT32 cy = starty;
if (wrap) {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
{
INT32 pxl = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)];
if (!(pxl & 0x8000)) {
*dst = pal[pxl];
*pri = flags;
*dst = pxl;
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) {
*dst = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)] & 0x7fff;
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
UINT32 pos = ((cy >> 16) << 9) | (cx >> 16);
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
{
if (cx < wshift && cy < hshift) {
INT32 pxl = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)];
if (!(pxl & 0x8000)) {
*dst = pxl;
}
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
{
UINT32 pos = ((cy >> 16) << 9) | (cx >> 16);
if (pos >= 0x40000) continue;
*dst = src[pos] & 0x7fff;
}
}
}
}
}
else // 32-bit colors
{
UINT32 *dst = konami_bitmap32;
UINT8 *pri = konami_priority_bitmap;
UINT16 *src = K051316TileMap[chip];
UINT32 *pal = konami_palette32;
if (pos >= 0x40000) continue;
*dst = pal[src[pos] & 0x7fff];
*pri = flags;
for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy)
{
UINT32 cx = startx;
UINT32 cy = starty;
if (wrap) {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
INT32 pxl = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)];
if (!(pxl & 0x8000)) {
*dst = pal[pxl];
*pri = priority;
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++) {
*dst = pal[src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)] & 0x7fff];
*pri = priority;
}
}
} else {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
if (cx < wshift && cy < hshift) {
INT32 pxl = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)];
if (!(pxl & 0x8000)) {
*dst = pal[pxl];
*pri = priority;
}
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++, pri++)
{
UINT32 pos = ((cy >> 16) << 9) | (cx >> 16);
if (pos >= 0x40000) continue;
*dst = pal[src[pos] & 0x7fff];
*pri = priority;
}
}
}
}

View File

@ -193,6 +193,31 @@ void K051960Write(UINT32 Offset, UINT8 Data)
K051960Ram[Offset] = Data;
}
UINT8 K052109_051960_r(INT32 offset)
{
if (K052109RMRDLine == 0)
{
if (offset >= 0x3800 && offset < 0x3808)
return K051937Read(offset - 0x3800);
else if (offset < 0x3c00)
return K052109Read(offset);
else
return K051960Read(offset - 0x3c00);
}
else return K052109Read(offset);
}
void K052109_051960_w(INT32 offset, INT32 data)
{
if (offset >= 0x3800 && offset < 0x3808)
K051937Write(offset - 0x3800,data);
else if (offset < 0x3c00)
K052109Write(offset, data);
else
K051960Write(offset - 0x3c00,data);
}
void K051960SetCallback(void (*Callback)(INT32 *Code, INT32 *Colour, INT32 *Priority, INT32 *Shadow))
{
K051960Callback = Callback;
@ -233,7 +258,7 @@ void K051960Init(UINT8* pRomSrc, UINT8* pRomSrcExp, UINT32 RomMask)
nSpriteXOffset = nSpriteYOffset = 0;
konami_allocate_bitmaps();
KonamiAllocateBitmaps();
}
void K051960Exit()

View File

@ -146,8 +146,8 @@ void K052109AdjustScroll(INT32 x, INT32 y)
void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Flags, INT32 Priority)
{
UINT32 *dst = konami_temp_screen;
UINT16 *pdst = konami_priority_bitmap;
UINT32 *dst = konami_bitmap32;
UINT8 *pdst = konami_priority_bitmap;
INT32 Category = Flags & 0xff;
INT32 Opaque = (Flags >> 16) & 1;
@ -291,6 +291,8 @@ void K052109RenderLayer(INT32 nLayer, INT32 Flags, INT32 Priority)
if (x >= nScreenWidth || y >= nScreenHeight) continue;
{
UINT32 *dst = konami_bitmap32 + y * nScreenWidth + x;
UINT8 *pri = konami_priority_bitmap + y * nScreenWidth + x;
UINT8 *gfx = K052109RomExp + (Code & K052109RomExpMask) * 0x40;
INT32 flip = 0;
@ -300,16 +302,27 @@ void K052109RenderLayer(INT32 nLayer, INT32 Flags, INT32 Priority)
UINT32 *pal = konami_palette32 + (Colour * 16);
INT32 trans = (Opaque) ? 0xffff : 0;
for (INT32 yy = 0; yy < 8; yy++) {
for (INT32 xx = 0; xx < 8; xx++) {
if ((x+xx) >= 0 && (x+xx) < nScreenWidth && (y+yy) >= 0 && (y+yy) < nScreenHeight) {
INT32 pxl = gfx[((yy*8)+xx)^flip];
if (pxl != trans) {
konami_temp_screen[((yy+y)*nScreenWidth) + x + xx] = pal[pxl];
konami_priority_bitmap[((yy+y)*nScreenWidth) + x + xx] = Priority;
for (INT32 yy = 0; yy < 8; yy++, y++)
{
if (y >= 0 && y < nScreenHeight)
{
for (INT32 xx = 0; xx < 8; xx++)
{
if ((x+xx) >= 0 && (x+xx) < nScreenWidth)
{
INT32 pxl = gfx[((yy*8)+xx)^flip];
if (pxl != trans)
{
dst[xx] = pal[pxl];
pri[xx] = Priority;
}
}
}
}
dst += nScreenWidth;
pri += nScreenWidth;
}
}
}
@ -461,7 +474,7 @@ void K052109Init(UINT8 *pRomSrc, UINT8 *pRomSrcExp, UINT32 RomMask)
K052109ScrollYOff[i]=0;
}
konami_allocate_bitmaps();
KonamiAllocateBitmaps();
has_extra_video_ram = 0;
}

View File

@ -12,13 +12,13 @@ static INT32 K053245MaskExp[2];
static INT32 K053245_dx[2];
static INT32 K053245_dy[2];
static UINT32 *K053245Temp = NULL;
static UINT8 K053244Regs[2][0x10];
static INT32 K053244Bank[2];
static INT32 K053245Active = 0;
INT32 K05324xZRejection = -1;
// Init, Reset, Exit
INT32 K053245Reset()
@ -60,17 +60,13 @@ void K053245Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callb
KonamiIC_K053245InUse = 1;
konami_allocate_bitmaps();
K053245Temp = konami_temp_screen;
KonamiAllocateBitmaps();
K053245Reset();
}
void K053245Exit()
{
//K053245Temp = NULL;
for (INT32 i = 0; i < K053245Active; i++) {
BurnFree (K053245Ram[i]);
BurnFree (K053245Buf[i]);
@ -171,6 +167,11 @@ void K053244Write(INT32 chip, INT32 offset, INT32 data)
}
}
void K05324xSetZRejection(INT32 z)
{
K05324xZRejection = z;
}
// Sprite Rendering
void K053245SpritesRender(INT32 chip)

View File

@ -14,8 +14,6 @@ static UINT32 K053246Mask;
static UINT8 *K053246GfxExp;
static UINT32 K053246MaskExp;
static UINT32 *K053247Temp = NULL;
static INT32 K053247_dx;
static INT32 K053247_dy;
static INT32 K053247_wraparound;
@ -75,9 +73,7 @@ void K053247Init(UINT8 *gfxrom, UINT8 *gfxromexp, INT32 gfxlen, void (*Callback)
K053247_dy = 0;
K053247_wraparound = 1;
konami_allocate_bitmaps();
K053247Temp = konami_temp_screen;
KonamiAllocateBitmaps();
K053247Flags = flags; // 0x02 highlight, 0x01 shadow
@ -86,8 +82,6 @@ void K053247Init(UINT8 *gfxrom, UINT8 *gfxromexp, INT32 gfxlen, void (*Callback)
void K053247Exit()
{
// K053247Temp = NULL;
BurnFree (K053247Ram);
K053247Flags = 0;

View File

@ -49,7 +49,7 @@ void K053936Init(INT32 chip, UINT8 *ram, INT32 len, INT32 w, INT32 h, void (*pCa
pTileCallback1 = pCallback;
}
konami_allocate_bitmaps();
KonamiAllocateBitmaps();
KonamiIC_K053936InUse = 1;
}
@ -117,7 +117,7 @@ void K053936PredrawTiles(INT32 chip, UINT8 *gfx, INT32 transparent, INT32 tcol)
static inline void copy_roz(INT32 chip, INT32 minx, INT32 maxx, INT32 miny, INT32 maxy, UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, INT32 transp)
{
UINT32 *dst = konami_temp_screen;
UINT32 *dst = konami_bitmap32;
UINT32 *pal = konami_palette32;
UINT16 *src = tscreen[chip];

View File

@ -8,42 +8,10 @@ UINT32 KonamiIC_K053245InUse = 0;
UINT32 KonamiIC_K053247InUse = 0;
UINT32 KonamiIC_K053936InUse = 0;
UINT32 *konami_temp_screen = NULL;
INT32 K05324xZRejection = -1;
UINT32 *konami_bitmap32 = NULL;
UINT8 *konami_priority_bitmap = NULL;
UINT32 *konami_palette32;
UINT16 *konami_priority_bitmap = NULL;
void K05324xSetZRejection(INT32 z)
{
K05324xZRejection = z;
}
UINT8 K052109_051960_r(INT32 offset)
{
if (K052109RMRDLine == 0)
{
if (offset >= 0x3800 && offset < 0x3808)
return K051937Read(offset - 0x3800);
else if (offset < 0x3c00)
return K052109Read(offset);
else
return K051960Read(offset - 0x3c00);
}
else return K052109Read(offset);
}
void K052109_051960_w(INT32 offset, INT32 data)
{
if (offset >= 0x3800 && offset < 0x3808)
K051937Write(offset - 0x3800,data);
else if (offset < 0x3c00)
K052109Write(offset, data);
else
K051960Write(offset - 0x3c00,data);
}
static void shuffle(UINT16 *buf, INT32 len)
{
if (len == 2 || len & 3) return;
@ -72,17 +40,18 @@ void konami_rom_deinterleave_4(UINT8 *src, INT32 len)
konami_rom_deinterleave_2(src, len);
}
// xbbbbbgggggrrrrr (used mostly by Konami-custom cpu games)
void KonamiRecalcPal(UINT8 *src, UINT32 *dst, INT32 len)
void KonamiRecalcPalette(UINT8 *src, UINT32 *dst, INT32 len)
{
konami_palette32 = dst;
UINT8 r,g,b;
UINT16 *p = (UINT16*)src;
for (INT32 i = 0; i < len / 2; i++) {
UINT16 d = BURN_ENDIAN_SWAP_INT16((p[i] << 8) | (p[i] >> 8));
b = (d >> 10) & 0x1f;
g = (d >> 5) & 0x1f;
r = (d >> 0) & 0x1f;
g = (d >> 5) & 0x1f;
b = (d >> 10) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
@ -101,7 +70,6 @@ void KonamiICReset()
if (KonamiIC_K053247InUse) K053247Reset();
if (KonamiIC_K053936InUse) K053936Reset();
// No init's, so always reset these
K053251Reset();
K054000Reset();
K051733Reset();
@ -109,9 +77,9 @@ void KonamiICReset()
void KonamiICExit()
{
if (konami_temp_screen) {
BurnFree (konami_temp_screen);
konami_temp_screen = NULL;
if (konami_bitmap32) {
BurnFree (konami_bitmap32);
konami_bitmap32 = NULL;
}
if (konami_priority_bitmap) {
@ -149,27 +117,38 @@ void KonamiICScan(INT32 nAction)
K051733Scan(nAction);
}
void konami_allocate_bitmaps()
void KonamiAllocateBitmaps()
{
INT32 width, height;
BurnDrvGetVisibleSize(&width, &height);
if (konami_temp_screen == NULL) {
konami_temp_screen = (UINT32*)BurnMalloc(width * height * sizeof(INT32));
if (konami_bitmap32 == NULL) {
konami_bitmap32 = (UINT32*)BurnMalloc(width * height * sizeof(INT32));
}
if (konami_priority_bitmap == NULL) {
konami_priority_bitmap = (UINT16*)BurnMalloc(width * height * sizeof(INT16));
konami_priority_bitmap = (UINT8*)BurnMalloc(width * height * sizeof(INT8));
}
}
void KonamiClearBitmaps(UINT32 color)
{
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_priority_bitmap[i] = 0;
konami_bitmap32[i] = color;
}
}
void KonamiBlendCopy(UINT32 *pPalette)
{
pBurnDrvPalette = pPalette;
UINT32 *bmp = konami_temp_screen;
UINT32 *bmp = konami_bitmap32;
if (nBurnBpp == 4) {
memcpy (pBurnDraw, konami_bitmap32, nScreenWidth * nScreenHeight * sizeof(INT32));
return;
}
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
PutPix(pBurnDraw + (i * nBurnBpp), BurnHighCol(bmp[i]>>16, (bmp[i]>>8)&0xff, bmp[i]&0xff, 0));
@ -208,12 +187,12 @@ void konami_draw_16x16_priozoom_tile(UINT8 *gfx, INT32 code, INT32 color, INT32
for (INT32 y = sy; y < ey; y++)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_temp_screen + y * nScreenWidth;
UINT16 *prio = konami_priority_bitmap + y * nScreenWidth;
if (y >= 0 && y < nScreenHeight)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_bitmap32 + y * nScreenWidth;
UINT8 *prio = konami_priority_bitmap + y * nScreenWidth;
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{
if ((priority & (1 << (prio[x] & 0x1f)))==0) {
@ -239,7 +218,6 @@ void konami_draw_16x16_priozoom_tile(UINT8 *gfx, INT32 code, INT32 color, INT32
void konami_draw_16x16_zoom_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32 t, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy)
{
// Based on MAME sources for tile zooming
UINT8 *gfx_base = gfxbase + (code * width * height);
int dh = (zoomy * height + 0x8000) / 0x10000;
int dw = (zoomx * width + 0x8000) / 0x10000;
@ -270,7 +248,7 @@ void konami_draw_16x16_zoom_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32
if (y >= 0 && y < nScreenHeight)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_temp_screen + y * nScreenWidth;
UINT32 *dst = konami_bitmap32 + y * nScreenWidth;
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{
@ -299,8 +277,8 @@ void konami_draw_16x16_prio_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32
UINT8 *gfx = gfxbase + code * 0x100;
UINT16 *pri = konami_priority_bitmap + (sy * nScreenWidth) + sx;
UINT32 *dst = konami_temp_screen + (sy * nScreenWidth) + sx;
UINT8 *pri = konami_priority_bitmap + (sy * nScreenWidth) + sx;
UINT32 *dst = konami_bitmap32 + (sy * nScreenWidth) + sx;
UINT32 *pal = konami_palette32 + color;
priority |= 1 << 31; // always on!
@ -339,7 +317,7 @@ void konami_draw_16x16_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32 sx, I
UINT8 *gfx = gfxbase + code * 0x100;
UINT32 *pal = konami_palette32 + color;
UINT32 *dst = konami_temp_screen + (sy * nScreenWidth) + sx;
UINT32 *dst = konami_bitmap32 + (sy * nScreenWidth) + sx;
for (INT32 y = 0; y < 16; y++, sy++)
{
@ -367,7 +345,6 @@ static inline UINT32 shadow_blend(UINT32 d)
return ((((d & 0xff00ff) * 0x9d) & 0xff00ff00) + (((d & 0x00ff00) * 0x9d) & 0x00ff0000)) / 0x100;
}
/*
// Correct?
static inline UINT32 highlight_blend(UINT32 d)
@ -411,7 +388,7 @@ void konami_render_zoom_shadow_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT
if (y >= 0 && y < nScreenHeight)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_temp_screen + y * nScreenWidth;
UINT32 *dst = konami_bitmap32 + y * nScreenWidth;
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{
@ -441,8 +418,8 @@ void konami_render_zoom_shadow_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT
if (y >= 0 && y < nScreenHeight)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_temp_screen + y * nScreenWidth;
UINT16 *pri = konami_priority_bitmap + y * nScreenWidth;
UINT32 *dst = konami_bitmap32 + y * nScreenWidth;
UINT8 *pri = konami_priority_bitmap + y * nScreenWidth;
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{

View File

@ -7,33 +7,32 @@ extern UINT32 KonamiIC_K053245InUse;
extern UINT32 KonamiIC_K053247InUse;
extern UINT32 KonamiIC_K053936InUse;
extern UINT16 *konami_priority_bitmap;
extern UINT32 *konami_temp_screen;
extern UINT8 *konami_priority_bitmap;
extern UINT32 *konami_bitmap32;
extern UINT32 *konami_palette32;
void KonamiClearBitmaps(UINT32 color);
void KonamiBlendCopy(UINT32 *palette);
void konami_allocate_bitmaps();
void KonamiICReset();
void KonamiICExit();
void KonamiICScan(INT32 nAction);
void KonamiRecalcPalette(UINT8 *src, UINT32 *dst, INT32 len);
void konami_rom_deinterleave_2(UINT8 *src, INT32 len);
void konami_rom_deinterleave_4(UINT8 *src, INT32 len);
// internal
void KonamiAllocateBitmaps();
void konami_draw_16x16_tile(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy);
void konami_draw_16x16_prio_tile(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, UINT32 priority);
void konami_draw_16x16_zoom_tile(UINT8 *gfx, INT32 code, INT32 color, INT32 t, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy);
void konami_draw_16x16_priozoom_tile(UINT8 *gfx, INT32 code, INT32 color, INT32 t, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy, UINT32 priority);
void konami_render_zoom_shadow_tile(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy, UINT32 priority, INT32 shadow);
extern INT32 K05324xZRejection;
void K05324xSetZRejection(INT32 z);
void KonamiICReset();
void KonamiICExit();
void KonamiICScan(INT32 nAction);
void konami_rom_deinterleave_2(UINT8 *src, INT32 len);
void konami_rom_deinterleave_4(UINT8 *src, INT32 len);
void KonamiRecalcPal(UINT8 *src, UINT32 *dst, INT32 len);
// k051960 / k052109 shared
//---------------------------------------------------------------------------------------------------------------
void K052109_051960_w(INT32 offset, INT32 data);
UINT8 K052109_051960_r(INT32 offset);
@ -151,6 +150,8 @@ void K051316Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callb
void K051316Reset();
void K051316Exit();
#define K051316_16BIT (1<<8)
void K051316RedrawTiles(INT32 chip);
UINT8 K051316ReadRom(INT32 chip, INT32 offset);
@ -163,6 +164,11 @@ void K051316SetOffset(INT32 chip, INT32 xoffs, INT32 yoffs);
void K051316_zoom_draw(INT32 chip, INT32 flags);
void K051316Scan(INT32 nAction);
// K053245 / k053247 shared
//---------------------------------------------------------------------------------------------------------------
extern INT32 K05324xZRejection;
void K05324xSetZRejection(INT32 z);
// K053245.cpp
//---------------------------------------------------------------------------------------------------------------
INT32 K053245Reset();
@ -250,4 +256,3 @@ void K053936SetOffset(INT32 chip, INT32 xoffs, INT32 yoffs);
void K053936PredrawTiles(INT32 chip, UINT8 *gfx, INT32 transparent, INT32 tcol /*transparent color*/);
void K053936Draw(INT32 chip, UINT16 *ctrl, UINT16 *linectrl, INT32 transp);

View File

@ -577,7 +577,7 @@ static INT32 DrvDraw()
redraw_zoom_tiles = 0;
}
K051316_zoom_draw(0, 0);
K051316_zoom_draw(0, 0 | K051316_16BIT);
draw_sprites();
draw_layer();
} else {