Massive Konami Update:

Implemented proper priority handling (fixes Escape Kids / Vendetta)
Adds support for shadows
General code cleanups.
Demote The Main Event. :(
This commit is contained in:
iq_132 2014-09-18 05:23:11 +00:00
parent c43f4c314d
commit 42528b1258
27 changed files with 994 additions and 935 deletions

View File

@ -360,6 +360,7 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x020000;
DrvSndROM1 = Next; Next += 0x020000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -400,6 +401,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -484,19 +487,17 @@ static INT32 DrvInit()
UPD7759SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH);
UPD7759SetRoute(1, 0.30, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(0, 0);
K051960Init(DrvGfxROM1, 0xfffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0xfffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(0, 0);
K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x3ffff, K051316Callback, 4, 0);
K051316SetOffset(0, -104, -16);
GenericTilesInit();
DrvDoReset();
return 0;
@ -529,24 +530,24 @@ static INT32 DrvDraw()
if (k88games_priority)
{
K052109RenderLayer(0, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K052109RenderLayer(1, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 0);
K051316_zoom_draw(0, 4);
if (nBurnLayer & 1) K052109RenderLayer(0, K052109_OPAQUE, 0);
if (nSpriteEnable & 1) K051960SpritesRender(1, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 0);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, 0);
if (nSpriteEnable & 2) K051960SpritesRender(0, 0);
if (nBurnLayer & 8) K051316_zoom_draw(0, 0);
}
else
{
K052109RenderLayer(2, 1, DrvGfxROMExp0);
K051316_zoom_draw(0, 4);
K051960SpritesRender(DrvGfxROMExp1, 0);
K052109RenderLayer(1, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(2, K052109_OPAQUE, 0);
if (nBurnLayer & 2) K051316_zoom_draw(0, 4);
if (nSpriteEnable & 1) K051960SpritesRender(0, 0);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, 0);
if (nSpriteEnable & 2) K051960SpritesRender(1, 1);
if (nBurnLayer & 8) K052109RenderLayer(0, 0, 0);
}
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -27,7 +27,7 @@ static UINT8 *DrvShareRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -372,10 +372,10 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *)
{
*priority = 0;
if ( *color & 0x10) *priority = 1;
if (~*color & 0x40) *priority = 2;
if ( *color & 0x20) *priority = 3;
*priority = 0xff00;
if ( *color & 0x10) *priority |= 0xf0f0;
if (~*color & 0x40) *priority |= 0xcccc;
if ( *color & 0x20) *priority |= 0xaaaa;
*color = 16 + (*color & 0x0f);
*code &= 0x1fff;
}
@ -443,7 +443,8 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x080000;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x801 * sizeof(UINT32);
AllRam = Next;
@ -482,6 +483,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -604,19 +607,17 @@ static INT32 DrvInit()
K007232SetRoute(1, BURN_SND_K007232_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH);
K007232SetRoute(1, BURN_SND_K007232_ROUTE_2, 0.30, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0xfffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0xfffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
K051316Init(0, DrvGfxROM2, DrvGfxROM2, 0x7ffff, K051316Callback, 7, 0);
K051316SetOffset(0, -112, -16);
GenericTilesInit();
DrvDoReset();
return 0;
@ -644,34 +645,34 @@ static INT32 DrvDraw()
{
if (DrvRecalc) {
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
DrvPalette[0x800] = 0; // black
}
K052109UpdateScroll();
BurnTransferClear();
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
konami_temp_screen[i] = DrvPalette[0x800];
konami_priority_bitmap[i] = 0;
}
if (nBurnLayer & 1) K052109RenderLayer(2, 0, DrvGfxROMExp0);
if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 3);
if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 1) K052109RenderLayer(2, 0, 1);
if (ajax_priority)
{
if (nBurnLayer & 2) K051316_zoom_draw(0, 4);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, 2);
}
else
{
if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, 2);
if (nBurnLayer & 2) K051316_zoom_draw(0, 4);
}
if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 1);
if (nSpriteEnable & 8) K051960SpritesRender(DrvGfxROMExp1, 0);
if (nBurnLayer & 8) K052109RenderLayer(0, 0, 8);
if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nSpriteEnable & 8) K051960SpritesRender(-1, -1);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -23,7 +23,7 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -273,18 +273,16 @@ static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *sh
{
switch (*color & 0x70)
{
case 0x10: *priority = 0x00; break;
case 0x00: *priority = 0x01; break;
case 0x40: *priority = 0x02; break;
case 0x10: *priority = 0x00; break;
case 0x00: *priority = 0xf0; break;
case 0x40: *priority = 0xfc; break;
case 0x20:
case 0x60: *priority = 0x03; break;
// when are these used?
case 0x50: *priority = 0x04; break;
case 0x60: *priority = 0xfe; break;
case 0x50: *priority = 0xcc; break;
case 0x30:
case 0x70: *priority = 0x05; break;
case 0x70: *priority = 0xee; break;
}
*code |= (*color & 0x80) << 6;
*code &= 0x3fff;
*color = 16 + (*color & 0x0f);
@ -326,6 +324,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
AllRam = Next;
@ -367,6 +366,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -418,11 +419,11 @@ static INT32 DrvInit()
ZetSetReadHandler(aliens_sound_read);
ZetClose();
K052109Init(DrvGfxROM0, 0x1fffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x1fffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0x1fffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x1fffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
@ -434,8 +435,6 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
DrvDoReset();
return 0;
@ -467,21 +466,17 @@ static INT32 DrvDraw()
K052109UpdateScroll();
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 0x0040;
konami_temp_screen[i] = DrvPalette[0x0040];
konami_priority_bitmap[i] = 0;
}
K051960SpritesRender(DrvGfxROMExp1, 3);
K052109RenderLayer(1, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 0);
if (nBurnLayer & 1) K052109RenderLayer(1, 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 4);
K051960SpritesRender(DrvGfxROMExp1, 4);
K051960SpritesRender(DrvGfxROMExp1, 5);
if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -21,7 +21,7 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -236,7 +236,7 @@ static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32
static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *)
{
*priority = (*color & 0x10) >> 4;
*priority = ((*color & 0x10) >> 3) | 0xfc;
*code &= 0x3ff;
*color = 0x30 + (*color & 0x0f);
@ -275,6 +275,7 @@ static INT32 MemIndex()
DrvGfxROMExp0 = Next; Next += 0x040000;
DrvGfxROMExp1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -315,6 +316,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -365,16 +368,14 @@ static INT32 DrvInit()
BurnYM2151Init(3579545);
BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x1ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x1ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0x1ffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x1ffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
GenericTilesInit();
DrvDoReset();
return 0;
@ -404,13 +405,13 @@ static INT32 DrvDraw()
K052109UpdateScroll();
K052109RenderLayer(2, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 0);
K052109RenderLayer(1, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
K052109RenderLayer(2, K052109_OPAQUE, 0);
K052109RenderLayer(1, 0, 1);
K052109RenderLayer(0, 0, 2);
BurnTransferCopy(DrvPalette);
K051960SpritesRender(0, -1);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -25,7 +25,7 @@ static UINT8 *DrvM6809RAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -459,6 +459,7 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -498,6 +499,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -583,19 +586,17 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(1, DrvK007232VolCallback1);
K007232PCMSetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0xfffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0xfffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x1ffff, K051316Callback, 4, 0);
K051316SetOffset(0, -112, -16);
GenericTilesInit();
DrvDoReset();
return 0;
@ -625,17 +626,17 @@ static INT32 DrvDraw()
K052109UpdateScroll();
BurnTransferClear();
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
K051960SpritesRender(DrvGfxROMExp1, 1);
K051960SpritesRender(1, 1);
K051316_zoom_draw(0, 0);
K051960SpritesRender(DrvGfxROMExp1, 0);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
K051960SpritesRender(DrvGfxROMExp1, 3);
K052109RenderLayer(1, 0, DrvGfxROMExp0);
K051960SpritesRender(0, 0);
K052109RenderLayer(2, 0, 0);
K051960SpritesRender(2, 3);
K052109RenderLayer(1, 0, 0);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -23,7 +23,7 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -439,6 +439,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
AllRam = Next;
@ -480,6 +481,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -536,16 +539,14 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(-2, 0);
K051960Init(DrvGfxROM1, 0xfffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0xfffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(-2, 0);
GenericTilesInit();
DrvDoReset();
return 0;
@ -576,14 +577,14 @@ static INT32 DrvDraw()
K052109UpdateScroll();
K052109RenderLayer(1, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 0);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 0);
if (nSpriteEnable & 1) K051960SpritesRender(2, 2);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 0);
if (nSpriteEnable & 2) K051960SpritesRender(1, 1);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 0);
if (nSpriteEnable & 4) K051960SpritesRender(0, 0);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -23,7 +23,7 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -332,6 +332,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -373,6 +374,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -428,16 +431,14 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0x7ffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x7ffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
GenericTilesInit();
DrvDoReset();
return 0;
@ -471,21 +472,23 @@ static INT32 DrvDraw()
if (nDrvRamBank[0] & 0x08)
{
if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(2, K052109_OPAQUE, 0);
if (nSpriteEnable & 1) K051960SpritesRender(2, 2);
if (nBurnLayer & 2) K052109RenderLayer(1, 0, 0);
if (nSpriteEnable & 2) K051960SpritesRender(0, 0);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 0);
}
else
{
if (nBurnLayer & 4) K052109RenderLayer(1, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 8) K052109RenderLayer(2, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 0);
if (nSpriteEnable & 1) K051960SpritesRender(2, 2);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 0);
if (nSpriteEnable & 2) K051960SpritesRender(0, 0);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 0);
}
K051960SpritesRender(DrvGfxROMExp1, 1);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -158,6 +158,21 @@ static struct BurnDIPInfo Gradius3DIPList[]=
STDDIPINFO(Gradius3)
static void expand_graphics_single(INT32 offset)
{
offset &= 0x1fffe;
INT32 t = DrvShareRAM2[offset+0];
DrvGfxROMExp0[offset * 2 + 2] = t >> 4;
DrvGfxROMExp0[offset * 2 + 3] = t & 0x0f;
t = DrvShareRAM2[offset+1];
DrvGfxROMExp0[offset * 2 + 0] = t >> 4;
DrvGfxROMExp0[offset * 2 + 1] = t & 0x0f;
}
void __fastcall gradius3_main_write_word(UINT32 address, UINT16 data)
{
if (address >= 0x14c000 && address <= 0x153fff) {
@ -165,10 +180,22 @@ void __fastcall gradius3_main_write_word(UINT32 address, UINT16 data)
K052109Write(address / 2, data);
return;
}
if ((address & 0xfe0000) == 0x180000) {
*((UINT16*)(DrvShareRAM2 + (address & 0x1fffe))) = data;
expand_graphics_single(address);
return;
}
}
void __fastcall gradius3_main_write_byte(UINT32 address, UINT8 data)
{
if ((address & 0xfe0000) == 0x180000) {
DrvShareRAM2[(address & 0x1ffff)^1] = data;
expand_graphics_single(address);
return;
}
switch (address)
{
case 0x0c0000:
@ -184,7 +211,7 @@ void __fastcall gradius3_main_write_byte(UINT32 address, UINT8 data)
SekOpen(0);
}
gradius3_priority = data & 0x04;
gradius3_priority =(data & 0x04)>>2;
gradius3_cpub_enable = data & 0x08;
irqA_enable = data & 0x20;
}
@ -278,6 +305,12 @@ void __fastcall gradius3_sub_write_word(UINT32 address, UINT16 data)
return;
}
if ((address & 0xfe0000) == 0x280000) {
*((UINT16*)(DrvShareRAM2 + (address & 0x1fffe))) = data;
expand_graphics_single(address);
return;
}
if ((address & 0xffffff0) == 0x2c0000) {
address -= 0x2c0000;
K051937Write(address / 2, data);
@ -304,6 +337,12 @@ void __fastcall gradius3_sub_write_byte(UINT32 address, UINT8 data)
return;
}
if ((address & 0xfe0000) == 0x280000) {
DrvShareRAM2[(address & 0x1ffff)^1] = data;
expand_graphics_single(address);
return;
}
if ((address & 0xffffff0) == 0x2c0000) {
address -= 0x2c0000;
K051937Write(address / 2, data);
@ -424,7 +463,9 @@ static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32
static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *)
{
*priority = (*color & 0x60) >> 5;
static INT32 primask[2][4] = { { 0xfa, 0xaa, 0xfa, 0xfe }, { 0xfc, 0xf0, 0x00, 0xfe } };
*priority = primask[gradius3_priority][((*color & 0x60) >> 5)];
*code |= (*color & 0x01) << 13;
*code &= 0x3fff;
@ -475,6 +516,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -512,6 +554,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -558,7 +602,7 @@ static INT32 DrvInit()
SekMapMemory(Drv68KRAM0, 0x040000, 0x043fff, SM_RAM);
SekMapMemory(DrvPalRAM, 0x080000, 0x080fff, SM_RAM);
SekMapMemory(DrvShareRAM, 0x100000, 0x103fff, SM_RAM);
SekMapMemory(DrvShareRAM2, 0x180000, 0x19ffff, SM_RAM);
SekMapMemory(DrvShareRAM2, 0x180000, 0x19ffff, SM_ROM);
SekSetWriteWordHandler(0, gradius3_main_write_word);
SekSetWriteByteHandler(0, gradius3_main_write_byte);
SekSetReadWordHandler(0, gradius3_main_read_word);
@ -570,7 +614,7 @@ static INT32 DrvInit()
SekMapMemory(Drv68KROM1, 0x000000, 0x0fffff, SM_ROM);
SekMapMemory(Drv68KRAM1, 0x100000, 0x103fff, SM_RAM);
SekMapMemory(DrvShareRAM, 0x200000, 0x203fff, SM_RAM);
SekMapMemory(DrvShareRAM2, 0x280000, 0x29ffff, SM_RAM);
SekMapMemory(DrvShareRAM2, 0x280000, 0x29ffff, SM_ROM);
SekMapMemory(DrvGfxROM1, 0x400000, 0x5fffff, SM_ROM);
SekSetWriteWordHandler(0, gradius3_sub_write_word);
SekSetWriteByteHandler(0, gradius3_sub_write_byte);
@ -597,16 +641,14 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
K052109Init(DrvShareRAM2, 0x1ffff);
K052109Init(DrvShareRAM2, DrvGfxROMExp0, 0x1ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(-8, 0);
K051960Init(DrvGfxROM1, 0x1fffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x1fffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(-8, 0);
GenericTilesInit();
DrvDoReset();
return 0;
@ -668,40 +710,22 @@ static INT32 DrvDraw()
K052109UpdateScroll();
character_ram_decode();
if (gradius3_priority == 0)
{
if (nSpriteEnable & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0);
if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3);
if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1);
if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0);
if (nSpriteEnable & 2) K052109RenderLayer(2, 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2);
if (nSpriteEnable & 1) K052109RenderLayer(1, K052109_OPAQUE, 2);
if (nSpriteEnable & 2) K052109RenderLayer(2, 0, 4);
if (nSpriteEnable & 4) K052109RenderLayer(0, 0, 1);
}
else
{
if (nSpriteEnable & 1) K052109RenderLayer(0, 1, DrvGfxROMExp0);
if (nSpriteEnable & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K052109RenderLayer(2, 0, DrvGfxROMExp0);
#if 1
if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1);
if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3);
if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0);
#endif
if (nSpriteEnable & 1) K052109RenderLayer(0, K052109_OPAQUE, 1);
if (nSpriteEnable & 2) K052109RenderLayer(1, 0, 2);
if (nSpriteEnable & 4) K052109RenderLayer(2, 0, 4);
}
if (nBurnLayer & 8) K051960SpritesRender(-1, -1);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -1,6 +1,8 @@
// FB Alpha The Main Event / Devastators driver module
// Based on MAME driver by Bryan McPhail
// Why is The Main Event messed up? Very strange...
#include "tiles_generic.h"
#include "z80_intf.h"
#include "hd6309_intf.h"
@ -29,8 +31,8 @@ static UINT8 *nmi_enable;
static UINT8 *nDrvBank;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 DrvJoy1[8];
static UINT8 DrvJoy2[8];
@ -581,12 +583,13 @@ UINT8 __fastcall mainevt_sound_read(UINT16 address)
static void K052109Callback(INT32 layer, INT32 , INT32 *code, INT32 *color, INT32 *flipx, INT32 *priority)
{
INT32 colorbase[3] = { 0, 8, 4 };
*flipx = *color & 0x02;
if (layer == 2) *priority = (*color >> 5) & 1;
*priority = (layer == 2) ? ((*color & 0x20) >> 5) : 0;
*code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7);
*color = ((layer & 2) << 1) + ((layer & 1) << 2) + ((*color & 0xc0) >> 6);
*color = colorbase[layer] + ((*color & 0xc0) >> 6);
}
static void DvK052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *)
@ -597,9 +600,9 @@ static void DvK052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT
static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *)
{
if (*color & 0x20) *priority = 0;
else if (*color & 0x40) *priority = 1;
else *priority = 2;
if (*color & 0x20) *priority = 0xff00;
else if (*color & 0x40) *priority = 0xfff0;
else *priority = 0xfffc;
*color = 0x0c + (*color & 0x03);
}
@ -617,8 +620,6 @@ static void DrvK007232VolCallback(INT32 v)
static INT32 DrvDoReset()
{
DrvReset = 0;
memset (AllRam, 0, RamEnd - AllRam);
HD6309Open(0);
@ -646,13 +647,14 @@ static INT32 MemIndex()
DrvZ80ROM = Next; Next += 0x010000;
DrvGfxROM0 = Next; Next += 0x040000;
DrvGfxROM1 = Next; Next += 0x100000;
DrvGfxROMExp0 = Next; Next += 0x080000;
DrvGfxROM1 = Next; Next += 0x100000;
DrvGfxROMExp1 = Next; Next += 0x200000;
DrvSndROM0 = Next; Next += 0x080000;
DrvSndROM1 = Next; Next += 0x0a0000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32);
AllRam = Next;
@ -693,6 +695,8 @@ static INT32 DrvGfxDecode(INT32 gfxlen0)
static INT32 DrvInit(INT32 type)
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -746,11 +750,11 @@ static INT32 DrvInit(INT32 type)
ZetSetReadHandler(mainevt_sound_read);
ZetClose();
K052109Init(DrvGfxROM0, (gfx0_offset * 2) - 1);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, (gfx0_offset * 2) - 1);
K052109SetCallback(nGame ? DvK052109Callback : K052109Callback);
K052109AdjustScroll(nGame ? 0 : 8, 0);
K051960Init(DrvGfxROM1, 0xfffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0xfffff);
K051960SetCallback(nGame ? DvK051960Callback : K051960Callback);
K051960SetSpriteOffset(nGame ? 0 : 8, 0);
@ -764,8 +768,6 @@ static INT32 DrvInit(INT32 type)
UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM1);
UPD7759SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
DrvDoReset();
return 0;
@ -799,31 +801,26 @@ static INT32 DrvDraw()
if (nGame)
{
K052109RenderLayer(1, 1, DrvGfxROMExp0);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 0);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 0);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 0);
if (nSpriteEnable & 1) K051960SpritesRender(0, 0);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 0);
}
else
{
if (nBurnLayer & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0);
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
if (nBurnLayer & 2) K052109RenderLayer(2 | 0x10, 0, DrvGfxROMExp0);
if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 1);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, K052109_CATEGORY(1), 2);
if (nBurnLayer & 4) K052109RenderLayer(2, 0, 4);
if (nBurnLayer & 8) K052109RenderLayer(0, 0, 8);
if (nBurnLayer & 4) K052109RenderLayer(2 | 0x00, 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 0); // makes sense...
if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
}
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}
@ -989,11 +986,11 @@ static INT32 mainevtInit()
}
struct BurnDriver BurnDrvMainevt = {
struct BurnDriverD BurnDrvMainevt = {
"mainevt", NULL, NULL, NULL, "1988",
"The Main Event (4 Players ver. Y)\0", NULL, "Konami", "GX799",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
0, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
NULL, mainevtRomInfo, mainevtRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo,
mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100,
288, 224, 4, 3
@ -1025,11 +1022,11 @@ static struct BurnRomInfo mainevtoRomDesc[] = {
STD_ROM_PICK(mainevto)
STD_ROM_FN(mainevto)
struct BurnDriver BurnDrvMainevto = {
struct BurnDriverD BurnDrvMainevto = {
"mainevto", "mainevt", NULL, NULL, "1988",
"The Main Event (4 Players ver. F)\0", NULL, "Konami", "GX799",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
NULL, mainevtoRomInfo, mainevtoRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo,
mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100,
288, 224, 4, 3
@ -1061,11 +1058,11 @@ static struct BurnRomInfo mainevt2pRomDesc[] = {
STD_ROM_PICK(mainevt2p)
STD_ROM_FN(mainevt2p)
struct BurnDriver BurnDrvMainevt2p = {
struct BurnDriverD BurnDrvMainevt2p = {
"mainevt2p", "mainevt", NULL, NULL, "1988",
"The Main Event (2 Players ver. X)\0", NULL, "Konami", "GX799",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
NULL, mainevt2pRomInfo, mainevt2pRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo,
mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100,
288, 224, 4, 3
@ -1097,11 +1094,11 @@ static struct BurnRomInfo ringohjaRomDesc[] = {
STD_ROM_PICK(ringohja)
STD_ROM_FN(ringohja)
struct BurnDriver BurnDrvRingohja = {
struct BurnDriverD BurnDrvRingohja = {
"ringohja", "mainevt", NULL, NULL, "1988",
"Ring no Ohja (Japan 2 Players ver. N)\0", NULL, "Konami", "GX799",
L"\u30EA\u30F3\u30B0\u306E \u738B\u8005 (Japan 2 Players ver. N)\0Ring no Ohja\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0,
NULL, ringohjaRomInfo, ringohjaRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo,
mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100,
288, 224, 4, 3

View File

@ -24,8 +24,7 @@ static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *nDrvRomBank;
@ -314,10 +313,10 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
static void K053245Callback(INT32 *code, INT32 *color, INT32 *priority)
{
INT32 pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= layerpri[2]) *priority = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2;
else *priority = 3;
if (pri <= layerpri[2]) *priority = 0x00;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 0xfc;
else *priority = 0xfe;
*code &= 0x1fff;
*color = sprite_colorbase + (*color & 0x1f);
@ -367,7 +366,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -404,6 +403,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -450,11 +451,11 @@ static INT32 DrvInit()
ZetSetReadHandler(parodius_sound_read);
ZetClose();
K052109Init(DrvGfxROM0, 0xfffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0xfffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvGfxROM1, 0xfffff, K053245Callback);
K053245Init(0, DrvGfxROM1, DrvGfxROMExp1, 0xfffff, K053245Callback);
K053245SetSpriteOffset(0, -112, -16);
BurnYM2151Init(3579545);
@ -465,8 +466,6 @@ static INT32 DrvInit()
K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT);
K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT);
GenericTilesInit();
DrvDoReset();
return 0;
@ -504,30 +503,10 @@ static void sortlayers(INT32 *layer,INT32 *pri)
SWAP(1,2)
}
static void DrvRecalcPal()
{
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x1000 / 2; i++) {
UINT16 d = (BURN_ENDIAN_SWAP_INT16(p[i]) << 8) | (BURN_ENDIAN_SWAP_INT16(p[i]) >> 8);
b = (d >> 10) & 0x1f;
g = (d >> 5) & 0x1f;
r = (d >> 0) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
Palette[i] = (r << 16) | (g << 8) | b;
}
}
static INT32 DrvDraw()
{
if (DrvRecalc) {
DrvRecalcPal();
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
K052109UpdateScroll();
@ -550,19 +529,17 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * bg_colorbase;
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
konami_priority_bitmap[i] = 0;
}
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K053245SpritesRender(0, DrvGfxROMExp1, 2); // right?
if (nSpriteEnable & 8) K053245SpritesRender(0, DrvGfxROMExp1, 3);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0);
if (nSpriteEnable & 2) K053245SpritesRender(0, DrvGfxROMExp1, 1);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, 4);
if (nSpriteEnable & 1) K053245SpritesRender(0, DrvGfxROMExp1, 0); // used (back)?
if (nSpriteEnable & 1) K053245SpritesRender(0);
KonamiBlendCopy(Palette, DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -23,8 +23,7 @@ static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static INT32 readzoomroms;
@ -285,7 +284,7 @@ static void rollerg_set_lines(INT32 lines)
static void K053245Callback(INT32 *, INT32 *color, INT32 *priority)
{
*priority = *color & 0x10;
*priority = (*color & 0x10) ? 0 : 0x02;
*color = 16 + (*color & 0x0f);
}
@ -339,7 +338,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
Palette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -359,6 +358,8 @@ static INT32 MemIndex()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -407,10 +408,10 @@ static INT32 DrvInit()
ZetSetReadHandler(rollerg_sound_read);
ZetClose();
K053245Init(0, DrvGfxROM0, 0x1fffff, K053245Callback);
K053245Init(0, DrvGfxROM0, DrvGfxROMExp0, 0x1fffff, K053245Callback);
K053245SetSpriteOffset(0, -112, 17);
K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K051316Callback, 4, 0);
K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x07ffff, K051316Callback, 4, 0);
K051316SetOffset(0, -90, -15);
BurnYM3812Init(3579545, NULL, DrvSynchroniseStream, 0);
@ -420,8 +421,6 @@ static INT32 DrvInit()
K053260Init(0, 3579545, DrvSndROM, 0x80000);
K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
DrvDoReset();
return 0;
@ -444,41 +443,21 @@ static INT32 DrvExit()
return 0;
}
static void DrvRecalcPal()
{
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x800 / 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;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
Palette[i] = (r << 16) | (g << 8) | b;
}
}
static INT32 DrvDraw()
{
if (DrvRecalc) {
DrvRecalcPal();
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800);
}
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 0x100;
konami_temp_screen[i] = DrvPalette[0x100];
konami_priority_bitmap[i] = 0;
}
K053245SpritesRender(0, DrvGfxROMExp0, 0x00);
K051316_zoom_draw(0, 1);
K053245SpritesRender(0, DrvGfxROMExp0, 0x10);
K053245SpritesRender(0);
KonamiBlendCopy(Palette, DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -25,7 +25,6 @@ static UINT8 *DrvPalRAM;
static UINT8 *DrvSprRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
@ -330,10 +329,10 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority)
{
INT32 pri = (*color & 0x0f80) >> 6;
if (pri <= layerpri[2]) *priority = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2;
else *priority = 3;
if (pri <= layerpri[2]) *priority = 0x00;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 0xfc;
else *priority = 0xfe;
*color = sprite_colorbase + (*color & 0x001f);
@ -390,7 +389,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x200000;
Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -440,6 +439,8 @@ static const eeprom_interface simpsons_eeprom_intf =
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -495,11 +496,11 @@ static INT32 DrvInit()
EEPROMInit(&simpsons_eeprom_intf);
K052109Init(DrvGfxROM0, 0x0fffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x0fffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 0x03 /* shadows & highlights */);
K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x3fffff, K053247Callback, 0x03 /* shadows & highlights */);
K053247SetSpriteOffset(-59, 39);
BurnYM2151Init(3579545);
@ -510,8 +511,6 @@ static INT32 DrvInit()
K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_RIGHT);
K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_LEFT);
GenericTilesInit();
DrvDoReset();
return 0;
@ -561,26 +560,6 @@ static void simpsons_objdma()
if (num_inactive) do { *dst = 0; dst += 8; } while (--num_inactive);
}
static void DrvRecalcPal()
{
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x1000 / 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;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
Palette[i] = (r << 16) | (g << 8) | b;
}
}
static void sortlayers(INT32 *layer,INT32 *pri)
{
#define SWAP(a,b) \
@ -599,7 +578,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
DrvRecalcPal();
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
K052109UpdateScroll();
@ -621,19 +600,19 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * 2);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * bg_colorbase;
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
}
if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3); // title (simpsons behind clouds)
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); // title (back-most cloud)
if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2); // smithers' on first stage
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); // main layer (buildings, stage 1)
if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1); // smithers' thugs on stage 1
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); // game over text
if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0); // not used? seems to make sense here...
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, 4);
KonamiBlendCopy(Palette, DrvPalette);
if (nSpriteEnable & 1) K053247SpritesRender();
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -26,7 +26,7 @@ static UINT8 *DrvPMCRAM;
static UINT8 *DrvM6809RAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -411,8 +411,8 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *)
{
*priority = 0x00;
if ( *color & 0x10) *priority = 1;
if (~*color & 0x20) *priority = 2;
if ( *color & 0x10) *priority = 0x0a;
if (~*color & 0x20) *priority = 0x0c;
*color = 0x20 | (*color & 0x0f);
@ -481,6 +481,7 @@ static INT32 MemIndex()
DrvSndROM0 = Next; Next += 0x040000;
DrvSndROM1 = Next; Next += 0x040000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -522,6 +523,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -569,11 +572,11 @@ static INT32 DrvInit()
ZetSetReadHandler(spy_sound_read);
ZetClose();
K052109Init(DrvGfxROM0, 0x07ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x07ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(-2, 0);
K051960Init(DrvGfxROM1, 0x0fffff);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x0fffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(0, 0);
@ -589,8 +592,6 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(1, DrvK007232VolCallback1);
K007232PCMSetAllRoutes(1, 0.20, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
DrvDoReset();
return 0;
@ -623,19 +624,17 @@ static INT32 DrvDraw()
K052109UpdateScroll();
if (spy_video_enable) {
K052109RenderLayer(1, 1, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 2);
K052109RenderLayer(2, 0, DrvGfxROMExp0);
K051960SpritesRender(DrvGfxROMExp1, 1);
K051960SpritesRender(DrvGfxROMExp1, 0);
K052109RenderLayer(0, 0, DrvGfxROMExp0);
K052109RenderLayer(1, K052109_OPAQUE, 1);
K052109RenderLayer(2, 0, 2);
K051960SpritesRender(-1, -1);
K052109RenderLayer(0, 0, 0);
} else {
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 0x0300;
konami_temp_screen[i] = DrvPalette[0x0300];
}
}
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -19,7 +19,6 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
@ -143,8 +142,8 @@ static struct BurnDIPInfo SuratkjDIPList[]=
static struct BurnDIPInfo BonusQuizDIPList[]=
{
{0 , 0xfe, 0 , 2, "Bonus Quiz" },
{0x15, 0x01, 0x80, 0x80, "Include" },
{0x15, 0x01, 0x80, 0x00, "Except" },
{0x15, 0x01, 0x80, 0x80, "Include" },
{0x15, 0x01, 0x80, 0x00, "Except" },
};
STDDIPINFO(Suratkj)
@ -253,10 +252,10 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
static void K053245Callback(INT32 *code, INT32 *color, INT32 *priority)
{
INT32 pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= layerpri[2]) *priority = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2;
else *priority = 3;
if (pri <= layerpri[2]) *priority = 0x00;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 0xfc;
else *priority = 0xfe;
*code &= 0xfff;
*color = sprite_colorbase + (*color & 0x1f);
@ -303,7 +302,7 @@ static INT32 MemIndex()
DrvKonROM = Next; Next += 0x050000;
Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -338,6 +337,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
int nLen = MemEnd - (UINT8 *)0;
@ -369,11 +370,11 @@ static INT32 DrvInit()
konamiSetlinesCallback(supratk_set_lines);
konamiClose();
K052109Init(DrvGfxROM0, 0x7ffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x7ffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvGfxROM1, 0x7ffff, K053245Callback);
K053245Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K053245Callback);
K053245SetSpriteOffset(0, -112, 16);
BurnYM2151Init(3579545);
@ -381,8 +382,6 @@ static INT32 DrvInit()
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
GenericTilesInit();
DrvDoReset();
return 0;
@ -404,26 +403,6 @@ static INT32 DrvExit()
return 0;
}
static void DrvRecalcPal()
{
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x1000 / 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;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
Palette[i] = (r << 16) | (g << 8) | b;
}
}
// stolen directly from mame
static void sortlayers(INT32 *layer,INT32 *pri)
{
@ -443,7 +422,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
DrvRecalcPal();
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
K052109UpdateScroll();
@ -466,19 +445,17 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * bg_colorbase;
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase];
konami_priority_bitmap[i] = 0;
}
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K053245SpritesRender(0, DrvGfxROMExp1, 2); // right?
if (nSpriteEnable & 8) K053245SpritesRender(0, DrvGfxROMExp1, 3);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0);
if (nSpriteEnable & 2) K053245SpritesRender(0, DrvGfxROMExp1, 1);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, 4);
if (nSpriteEnable & 1) K053245SpritesRender(0, DrvGfxROMExp1, 0); // used?
if (nSpriteEnable & 1) K053245SpritesRender(0);
KonamiBlendCopy(Palette, DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}
@ -497,7 +474,7 @@ static INT32 DrvFrame()
DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
}
// Clear Opposites
// Clear Opposites
if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18;
if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06;
if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18;

View File

@ -23,7 +23,7 @@ static UINT8 *DrvBankRAM;
static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *soundlatch;
@ -31,6 +31,7 @@ static UINT8 *nDrvKonamiBank;
static UINT8 *pmcram;
static UINT8 thunderx_1f98_data;
static UINT8 layer_priority;
static UINT8 DrvJoy1[8];
static UINT8 DrvJoy2[8];
@ -322,6 +323,7 @@ static void thunderx_1f98_w(UINT8 data)
static void scontra_bankswitch(INT32 data)
{
nDrvKonamiBank[0] = data;
layer_priority = data & 0x80;
if (~data & 0x10) {
konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM);
@ -337,6 +339,7 @@ static void scontra_bankswitch(INT32 data)
static void thunderx_videobank(INT32 data)
{
nDrvKonamiBank[0] = data;
layer_priority = data & 0x08;
if (data & 0x01) {
konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM);
@ -482,11 +485,17 @@ static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color,
*color = layer_colorbase[layer] + ((*color & 0xe0) >> 5);
}
static void K051960Callback(INT32 *, INT32 *color,INT32 *priority, INT32 *shadow)
static void K051960Callback(INT32 *, INT32 *color,INT32 *priority, INT32 *)
{
*priority = (*color & 0x30) >> 4;
switch (*color & 0x30)
{
case 0x00: *priority = 0xf0; break;
case 0x10: *priority = 0xfe; break;
case 0x20: *priority = 0xfc; break;
case 0x30: *priority = 0xffff; break;
}
*color = 0x20 + (*color & 0x0f);
*shadow = 0;
}
static void thunderx_set_lines(INT32 lines)
@ -517,6 +526,8 @@ static INT32 DrvDoReset()
KonamiICReset();
layer_priority = 0;
return 0;
}
@ -534,6 +545,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x080000;
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
AllRam = Next;
@ -576,6 +588,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -689,16 +703,14 @@ static INT32 DrvInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
K052109Init(DrvGfxROM0, 0x0fffff >> thunderx);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x0fffff >> thunderx);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K051960Init(DrvGfxROM1, 0x0fffff >> thunderx);
K051960Init(DrvGfxROM1, DrvGfxROMExp1, 0x0fffff >> thunderx);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(8, 0);
GenericTilesInit();
DrvDoReset();
return 0;
@ -731,28 +743,22 @@ static INT32 DrvDraw()
K052109UpdateScroll();
// K051960SpritesRender(DrvGfxROMExp1, 3);
if (nDrvKonamiBank[0] & 0x08)
if (layer_priority)
{
if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0);
if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(2, K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(1, 0, 2);
}
else
{
if (nBurnLayer & 8) K052109RenderLayer(2, 1, DrvGfxROMExp0);
if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0);
if (nBurnLayer & 1) K052109RenderLayer(1, K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(2, 0, 2);
}
K051960SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 4) K052109RenderLayer(0, 0, 4);
K051960SpritesRender(DrvGfxROMExp1, 1);
K051960SpritesRender(DrvGfxROMExp1, 0); // mask?
K052109RenderLayer(0, 0, DrvGfxROMExp0);
if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}
@ -856,6 +862,8 @@ static INT32 DrvScan(INT32 nAction,INT32 *pnMin)
if (nAction & ACB_DRIVER_DATA) {
SCAN_VAR(thunderx_1f98_data);
SCAN_VAR(layer_priority);
}
if (nAction & ACB_WRITE) {

View File

@ -36,7 +36,6 @@ static UINT8 *DrvNvRam = NULL;
static UINT8 *DrvTiles = NULL;
static UINT8 *DrvSprites = NULL;
static UINT8 *DrvTempRom = NULL;
static UINT32 *Palette;
static UINT32 *DrvPalette = NULL;
static INT16 *DrvTitleSample = NULL;
@ -2035,7 +2034,7 @@ static INT32 TmntMemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
DrvTitleSample = (INT16*)Next; Next += 0x40000 * sizeof(INT16);
DrvTiles = Next; Next += 0x008000 * 8 * 8;
@ -2064,7 +2063,7 @@ static INT32 MiaMemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
DrvTiles = Next; Next += 0x002000 * 8 * 8;
DrvSprites = Next; Next += 0x002000 * 16 * 16;
@ -2089,7 +2088,7 @@ static INT32 CuebrickMemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
DrvTiles = Next; Next += 0x002000 * 8 * 8;
DrvSprites = Next; Next += 0x001000 * 16 * 16;
@ -2121,7 +2120,7 @@ static INT32 BlswhstlMemIndex()
DrvTiles = Next; Next += 0x008000 * 8 * 8;
DrvSprites = Next; Next += 0x002000 * 16 * 16;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
MemEnd = Next;
@ -2148,7 +2147,7 @@ static INT32 SsridersMemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
DrvTiles = Next; Next += 0x008000 * 8 * 8;
DrvSprites = Next; Next += 0x004000 * 16 * 16;
@ -2177,7 +2176,7 @@ static INT32 Tmnt2MemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
DrvTiles = Next; Next += 0x008000 * 8 * 8;
DrvSprites = Next; Next += 0x008000 * 16 * 16;
@ -2205,7 +2204,7 @@ static INT32 Thndrx2MemIndex()
DrvTileRom = Next; Next += 0x100000;
DrvSpriteRom = Next; Next += 0x100000;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
DrvTiles = Next; Next += 0x008000 * 8 * 8;
DrvSprites = Next; Next += 0x002000 * 16 * 16;
@ -2234,7 +2233,7 @@ static INT32 LgtnfghtMemIndex()
DrvTileRom = Next; Next += 0x100000;
DrvSpriteRom = Next; Next += 0x100000;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
DrvTiles = Next; Next += 0x008000 * 8 * 8;
DrvSprites = Next; Next += 0x002000 * 16 * 16;
@ -2262,7 +2261,7 @@ static INT32 PunkshotMemIndex()
RamEnd = Next;
Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
DrvTiles = Next; Next += 0x004000 * 8 * 8;
DrvSprites = Next; Next += 0x004000 * 16 * 16;
@ -4286,6 +4285,7 @@ static void K052109CuebrickCallback(INT32 Layer, INT32, INT32 *Code, INT32 *Colo
}
}
static void K052109BlswhstlCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *, INT32 *)
{
*Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x10) << 5) | ((*Colour & 0x0c) << 8) | (Bank << 12) | (BlswhstlTileRomBank << 14);
@ -4312,10 +4312,10 @@ static void K051960CuebrickCallback(INT32* Code, INT32 *Colour, INT32*, INT32*)
static void K051960Thndrx2Callback(INT32* code, INT32 *color, INT32* priority, INT32*)
{
INT32 pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= LayerPri[2]) *priority = 0;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2;
else *priority = 3;
if (pri <= LayerPri[2]) *priority = 0x00;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 0xf0;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 0xfc;
else *priority = 0xfe;
*code &= 0x1fff;
*color = SpriteColourBase + (*color & 0x0f);
@ -4324,10 +4324,10 @@ static void K051960Thndrx2Callback(INT32* code, INT32 *color, INT32* priority, I
static void K051960PunkshotCallback(INT32 *code, INT32 *color, INT32 *priority, INT32 *)
{
INT32 pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= LayerPri[2]) *priority = 0;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2;
else *priority = 3;
if (pri <= LayerPri[2]) *priority = 0x00;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 0xf0;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 0xfc;
else *priority = 0xfe;
*code |= (*color & 0x10) << 9;
*code &= 0x3fff;
@ -4337,10 +4337,10 @@ static void K051960PunkshotCallback(INT32 *code, INT32 *color, INT32 *priority,
static void K053245BlswhstlCallback(INT32 *Code, INT32 *Colour, INT32 *Priority)
{
INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2);
if (Pri <= LayerPri[2]) *Priority = 0;
else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1;
else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2;
else *Priority = 3;
if (Pri <= LayerPri[2]) *Priority = 0x00;
else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 0xf0;
else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 0xfc;
else *Priority = 0xfe;
*Code &= 0x1fff;
*Colour = SpriteColourBase + (*Colour & 0x1f);
@ -4349,10 +4349,10 @@ static void K053245BlswhstlCallback(INT32 *Code, INT32 *Colour, INT32 *Priority)
static void K053245SsridersCallback(INT32 *, INT32 *Colour, INT32 *Priority)
{
INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2);
if (Pri <= LayerPri[2]) *Priority = 0;
else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1;
else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2;
else *Priority = 3;
if (Pri <= LayerPri[2]) *Priority = 0x00;
else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 0xf0;
else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 0xfc;
else *Priority = 0xfe;
*Colour = SpriteColourBase + (*Colour & 0x1f);
}
@ -4360,10 +4360,10 @@ static void K053245SsridersCallback(INT32 *, INT32 *Colour, INT32 *Priority)
static void K053245LgtnfghtCallback(INT32 *code, INT32 *color, INT32 *priority)
{
INT32 pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= LayerPri[2]) *priority = 0;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2;
else *priority = 3;
if (pri <= LayerPri[2]) *priority = 0x00;
else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 0xf0;
else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 0xfc;
else *priority = 0xfe;
*color = SpriteColourBase + (*color & 0x1f);
*code &= 0x3fff;
@ -4382,6 +4382,8 @@ static void CuebrickYM2151IrqHandler(INT32 Irq)
static INT32 TmntInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4392,9 +4394,9 @@ static INT32 TmntInit()
memset(Mem, 0, nLen);
TmntMemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K051960Init(DrvSpriteRom, 0x1fffff);
K051960Init(DrvSpriteRom, DrvSprites, 0x1fffff);
K051960SetCallback(K051960TmntCallback);
// Load 68000 Program Roms
@ -4476,8 +4478,6 @@ static INT32 TmntInit()
TmntTitleSampleSetRoute(1.00, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
LayerColourBase[0] = 0;
LayerColourBase[1] = 32;
LayerColourBase[2] = 40;
@ -4491,6 +4491,8 @@ static INT32 TmntInit()
static INT32 MiaInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4501,9 +4503,9 @@ static INT32 MiaInit()
memset(Mem, 0, nLen);
MiaMemIndex();
K052109Init(DrvTileRom, 0x03ffff);
K052109Init(DrvTileRom, DrvTiles, 0x03ffff);
K052109SetCallback(K052109MiaCallback);
K051960Init(DrvSpriteRom, 0x0fffff);
K051960Init(DrvSpriteRom, DrvSprites, 0x0fffff);
K051960SetCallback(K051960MiaCallback);
// Load 68000 Program Roms
@ -4571,8 +4573,6 @@ static INT32 MiaInit()
K007232SetPortWriteHandler(0, DrvK007232VolCallback);
K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
LayerColourBase[0] = 0;
LayerColourBase[1] = 32;
LayerColourBase[2] = 40;
@ -4586,6 +4586,8 @@ static INT32 MiaInit()
static INT32 CuebrickInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4596,10 +4598,10 @@ static INT32 CuebrickInit()
memset(Mem, 0, nLen);
CuebrickMemIndex();
K052109Init(DrvTileRom, 0x03ffff);
K052109Init(DrvTileRom, DrvTiles, 0x03ffff);
K052109SetCallback(K052109CuebrickCallback);
K051960Init(DrvSpriteRom, 0x03ffff);
K051960Init(DrvSpriteRom, DrvSprites, 0x03ffff);
K051960SetCallback(K051960CuebrickCallback);
// Load 68000 Program Roms
@ -4638,9 +4640,7 @@ static INT32 CuebrickInit()
BurnYM2151Init(3579545);
BurnYM2151SetIrqHandler(&CuebrickYM2151IrqHandler);
BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
LayerColourBase[0] = 0;
LayerColourBase[1] = 32;
LayerColourBase[2] = 40;
@ -4654,6 +4654,8 @@ static INT32 CuebrickInit()
static INT32 BlswhstlInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4664,11 +4666,11 @@ static INT32 BlswhstlInit()
memset(Mem, 0, nLen);
BlswhstlMemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109BlswhstlCallback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvSpriteRom, 0xfffff, K053245BlswhstlCallback);
K053245Init(0, DrvSpriteRom, DrvSprites, 0xfffff, K053245BlswhstlCallback);
K053245SetSpriteOffset(0, -112, 16);
// Load 68000 Program Roms
@ -4732,8 +4734,6 @@ static INT32 BlswhstlInit()
EEPROMInit(&BlswhstlEEPROMInterface);
GenericTilesInit();
// Reset the driver
BlswhstlDoReset();
@ -4742,6 +4742,8 @@ static INT32 BlswhstlInit()
static INT32 SsridersInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4752,11 +4754,11 @@ static INT32 SsridersInit()
memset(Mem, 0, nLen);
SsridersMemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvSpriteRom, 0x1fffff, K053245LgtnfghtCallback);
K053245Init(0, DrvSpriteRom, DrvSprites, 0x1fffff, K053245LgtnfghtCallback);
K053245SetSpriteOffset(0, -368, 528);
K05324xSetZRejection(0);
@ -4819,8 +4821,6 @@ static INT32 SsridersInit()
EEPROMInit(&BlswhstlEEPROMInterface);
GenericTilesInit();
// Reset the driver
SsridersDoReset();
@ -4829,6 +4829,8 @@ static INT32 SsridersInit()
static INT32 Thndrx2Init()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4839,11 +4841,11 @@ static INT32 Thndrx2Init()
memset(Mem, 0, nLen);
Thndrx2MemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(8, 0);
K051960Init(DrvSpriteRom, 0x0fffff);
K051960Init(DrvSpriteRom, DrvSprites, 0x0fffff);
K051960SetCallback(K051960Thndrx2Callback);
K051960SetSpriteOffset(8, 0);
@ -4903,8 +4905,6 @@ static INT32 Thndrx2Init()
EEPROMInit(&thndrx2_eeprom_interface);
GenericTilesInit();
// Reset the driver
SsridersDoReset();
@ -4913,6 +4913,8 @@ static INT32 Thndrx2Init()
static INT32 LgtnfghtInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -4923,11 +4925,11 @@ static INT32 LgtnfghtInit()
memset(Mem, 0, nLen);
LgtnfghtMemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvSpriteRom, 0x0fffff, K053245LgtnfghtCallback);
K053245Init(0, DrvSpriteRom, DrvSprites, 0x0fffff, K053245LgtnfghtCallback);
K053245SetSpriteOffset(0, -368, 528);
K05324xSetZRejection(0);
@ -4988,8 +4990,6 @@ static INT32 LgtnfghtInit()
EEPROMInit(&thndrx2_eeprom_interface);
GenericTilesInit();
// Reset the driver
SsridersDoReset();
@ -4998,6 +4998,8 @@ static INT32 LgtnfghtInit()
static INT32 Tmnt2Init()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -5008,11 +5010,11 @@ static INT32 Tmnt2Init()
memset(Mem, 0, nLen);
Tmnt2MemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(8, 0);
K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback);
K053245Init(0, DrvSpriteRom, DrvSprites, 0x3fffff, K053245SsridersCallback);
K053245SetSpriteOffset(0, -368, 272);
K05324xSetZRejection(0);
@ -5081,8 +5083,6 @@ static INT32 Tmnt2Init()
EEPROMInit(&BlswhstlEEPROMInterface);
GenericTilesInit();
// Reset the driver
SsridersDoReset();
@ -5091,6 +5091,8 @@ static INT32 Tmnt2Init()
static INT32 QgakumonInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -5101,11 +5103,11 @@ static INT32 QgakumonInit()
memset(Mem, 0, nLen);
Tmnt2MemIndex();
K052109Init(DrvTileRom, 0x0fffff);
K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(0, 0);
K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback);
K053245Init(0, DrvSpriteRom, DrvSprites, 0x3fffff, K053245SsridersCallback);
K053245SetSpriteOffset(0, -360, 272);
K05324xSetZRejection(0);
@ -5172,8 +5174,6 @@ static INT32 QgakumonInit()
EEPROMInit(&BlswhstlEEPROMInterface);
GenericTilesInit();
// Reset the driver
SsridersDoReset();
@ -5182,6 +5182,8 @@ static INT32 QgakumonInit()
static INT32 PunkshotInit()
{
GenericTilesInit();
INT32 nRet = 0, nLen;
// Allocate and Blank all required memory
@ -5192,11 +5194,11 @@ static INT32 PunkshotInit()
memset(Mem, 0, nLen);
PunkshotMemIndex();
K052109Init(DrvTileRom, 0x07ffff);
K052109Init(DrvTileRom, DrvTiles, 0x07ffff);
K052109SetCallback(K052109TmntCallback);
K052109AdjustScroll(8, 0);
K051960Init(DrvSpriteRom, 0x1fffff);
K051960Init(DrvSpriteRom, DrvSprites, 0x1fffff);
K051960SetCallback(K051960PunkshotCallback);
K051960SetSpriteOffset(8, 0);
@ -5252,8 +5254,6 @@ static INT32 PunkshotInit()
K053260Init(0, 3579545, DrvSoundRom, 0x80000);
K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
srand ( time(NULL) );
// Reset the driver
@ -5344,8 +5344,7 @@ static void DrvCalcPalette()
INT32 Offset = i & ~1;
UINT32 Data = (BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset]) << 8) | BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset + 1]);
Palette[Offset >> 1] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
DrvPalette[Offset >> 1] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0);
DrvPalette[Offset >> 1] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
}
}
@ -5356,25 +5355,10 @@ static void BlswhstlCalcPalette()
for (INT32 i = 0; i < 0x800; i++) {
UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]);
Palette[i] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
DrvPalette[i] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0);
DrvPalette[i] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
}
}
static void TmntDraw()
{
DrvCalcPalette();
K052109UpdateScroll();
K052109RenderLayer(2, 1, DrvTiles);
if ((PriorityFlag & 1) == 1) K051960SpritesRender(DrvSprites, -1);
K052109RenderLayer(1, 0, DrvTiles);
if ((PriorityFlag & 1) == 0) K051960SpritesRender(DrvSprites, -1);
K052109RenderLayer(0, 0, DrvTiles);
BurnTransferCopy(DrvPalette);
}
static void sortlayers(INT32 *layer,INT32 *pri)
{
#define SWAP(a,b) \
@ -5405,7 +5389,7 @@ static inline void BlswhstlCalcPaletteWithContrast(INT32 i, INT32 brt)
g = (g * brt) / 100;
b = (b * brt) / 100;
DrvPalette[i] = BurnHighCol(r, g, b, 0);
DrvPalette[i] = (r<<16) | (g<<8) | b;
}
static void PaletteDim(INT32 dimslayer)
@ -5435,6 +5419,20 @@ static void PaletteDim(INT32 dimslayer)
}
}
static void TmntDraw()
{
DrvCalcPalette();
K052109UpdateScroll();
K052109RenderLayer(2, K052109_OPAQUE, 0);
if ((PriorityFlag & 1) == 1) K051960SpritesRender(0, 0);
K052109RenderLayer(1, 0, 0);
if ((PriorityFlag & 1) == 0) K051960SpritesRender(0, 0);
K052109RenderLayer(0, 0, 0);
KonamiBlendCopy(DrvPalette);
}
static void BlswhstlDraw()
{
INT32 Layer[3];
@ -5455,22 +5453,21 @@ static void BlswhstlDraw()
Layer[2] = 2;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * BGColourBase;
konami_temp_screen[i] = DrvPalette[16 * BGColourBase];
konami_priority_bitmap[i] = 0;
}
sortlayers(Layer, LayerPri);
PaletteDim(Layer[2]);
K053245SpritesRender(0, DrvSprites, 3);
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles);
K053245SpritesRender(0, DrvSprites, 2);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles);
K053245SpritesRender(0, DrvSprites, 1);
K053245SpritesRender(0, DrvSprites, 0);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles);
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
KonamiBlendCopy(Palette, DrvPalette);
if (nSpriteEnable & 1) K053245SpritesRender(0);
KonamiBlendCopy(DrvPalette);
}
static INT32 Thndrx2Draw()
@ -5494,20 +5491,19 @@ static INT32 Thndrx2Draw()
Layer[2] = 2;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * BGColourBase;
konami_temp_screen[i] = DrvPalette[16 * BGColourBase];
konami_priority_bitmap[i] = 0;
}
sortlayers(Layer, LayerPri);
if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3);
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles);
if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles);
if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1);
if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles);
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
BurnTransferCopy(DrvPalette);
if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
KonamiBlendCopy(DrvPalette);
return 0;
}
@ -5534,15 +5530,13 @@ static INT32 PunkshotDraw()
sortlayers(Layer, LayerPri);
// if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3); // not sure...
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 1, DrvTiles);
if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles);
if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles);
if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0);
if (nBurnLayer & 1) K052109RenderLayer(Layer[0], K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
BurnTransferCopy(DrvPalette);
if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -28,7 +28,7 @@ static UINT8 *soundlatch;
static UINT8 *RamEnd;
static UINT8 *MemEnd;
static UINT32 *DrvPalette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static INT32 bank0;
@ -369,6 +369,7 @@ static INT32 MemIndex()
MSM6295ROM = Next;
DrvSndROM = Next; Next += 0x040000;
konami_palette32= (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32);
AllRam = Next;
@ -411,6 +412,8 @@ static INT32 DrvGfxDecode()
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -467,7 +470,7 @@ static INT32 DrvInit()
ZetSetReadHandler(ultraman_sound_read);
ZetClose();
K051960Init(DrvGfxROM0, 0xfffff);
K051960Init(DrvGfxROM0, DrvGfxROMExp0, 0xfffff);
K051960SetCallback(K051960Callback);
K051960SetSpriteOffset(9, 0);
@ -487,8 +490,6 @@ static INT32 DrvInit()
MSM6295Init(0, 1056000 / 132, 1);
MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
DrvDoReset();
return 0;
@ -524,7 +525,7 @@ static inline void DrvRecalcPalette()
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
DrvPalette[i] = (r << 16) + (g << 8) + b;
}
}
@ -534,15 +535,16 @@ static INT32 DrvDraw()
DrvRecalcPalette();
}
BurnTransferClear();
memset (konami_priority_bitmap, 0, nScreenWidth * nScreenHeight * sizeof(INT16));
memset (konami_temp_screen, 0, nScreenWidth * nScreenHeight * sizeof(INT32));
K051316_zoom_draw(2, 0);
K051316_zoom_draw(1, 0);
K051960SpritesRender(DrvGfxROMExp0, 0);
K051960SpritesRender(0, 0);
K051316_zoom_draw(0, 0);
K051960SpritesRender(DrvGfxROMExp0, 1);
K051960SpritesRender(1, 1);
BurnTransferCopy(DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -24,7 +24,6 @@ static UINT8 *DrvKonRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
@ -520,9 +519,9 @@ static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority)
{
INT32 pri = (*color & 0x03e0) >> 4;
if (pri <= layerpri[2]) *priority = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2;
else *priority = 3;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 0xf0 | 0xcc;
else *priority = 0xf0 | 0xcc | 0xaa;
*code &= 0x7fff;
@ -579,7 +578,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x100000;
Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -628,6 +627,8 @@ static const eeprom_interface vendetta_eeprom_intf =
static INT32 DrvInit(INT32 nGame)
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -667,11 +668,11 @@ static INT32 DrvInit(INT32 nGame)
konamiSetlinesCallback(vendetta_set_lines);
konamiClose();
K052109Init(DrvGfxROM0, 0x0fffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x0fffff);
K052109SetCallback(EsckidsK052109Callback);
K052109AdjustScroll(8, -8);
K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1);
K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x3fffff, K053247Callback, 1);
K053247SetSpriteOffset(-11, 14);
bankoffset = 0x6000;
@ -688,11 +689,11 @@ static INT32 DrvInit(INT32 nGame)
konamiSetlinesCallback(vendetta_set_lines);
konamiClose();
K052109Init(DrvGfxROM0, 0x0fffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x0fffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(0, 0);
K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1);
K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x3fffff, K053247Callback, 1);
K053247SetSpriteOffset(-53, 22);
bankoffset = 0;
@ -719,8 +720,6 @@ static INT32 DrvInit(INT32 nGame)
K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
GenericTilesInit();
DrvDoReset();
return 0;
@ -745,26 +744,6 @@ static INT32 DrvExit()
return 0;
}
static void DrvRecalcPal()
{
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x1000 / 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;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
Palette[i] = (r << 16) | (g << 8) | b;
DrvPalette[i] = BurnHighCol(r, g, b, 0);
}
}
static void sortlayers(INT32 *layer,INT32 *pri)
{
#define SWAP(a,b) \
@ -783,7 +762,7 @@ static void sortlayers(INT32 *layer,INT32 *pri)
static INT32 DrvDraw()
{
if (DrvRecalc) {
DrvRecalcPal();
KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000);
}
K052109UpdateScroll();
@ -805,23 +784,13 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
BurnTransferClear();
if (nBurnLayer & 1) K052109RenderLayer(layer[0], K052109_OPAQUE, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, 4);
// this order makes sense...
if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 0);
if (nSpriteEnable & 1) K053247SpritesRender();
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 1, DrvGfxROMExp0);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0);
if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 1);
if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0);
if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 3);
KonamiBlendCopy(Palette, DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}

View File

@ -24,7 +24,6 @@ static UINT8 *Drv68KRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvZ80RAM;
static UINT32 *Palette;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
@ -305,12 +304,12 @@ static void K052109Callback(INT32 layer, INT32 , INT32 *, INT32 *color, INT32 *,
static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority_mask)
{
INT32 pri = (*color & 0x00e0) >> 4;
if (pri <= layerpri[2]) *priority_mask = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority_mask = 1;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority_mask = 2;
else *priority_mask = 3;
if (pri <= layerpri[2]) *priority_mask = 0x00;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority_mask = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority_mask = 0xfc;
else *priority_mask = 0xfe;
*color = sprite_colorbase + (*color & 0x001f);
*color = (sprite_colorbase + (*color & 0x001f)) & 0x7f;
*code &= 0x7fff;
}
@ -360,7 +359,7 @@ static INT32 MemIndex()
DrvSndROM = Next; Next += 0x200000;
Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
konami_palette32 = (UINT32*)Next;
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
AllRam = Next;
@ -413,6 +412,8 @@ static const eeprom_interface xmen_eeprom_intf =
static INT32 DrvInit()
{
GenericTilesInit();
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
@ -468,11 +469,11 @@ static INT32 DrvInit()
EEPROMInit(&xmen_eeprom_intf);
K052109Init(DrvGfxROM0, 0x1fffff);
K052109Init(DrvGfxROM0, DrvGfxROMExp0, 0x1fffff);
K052109SetCallback(K052109Callback);
K052109AdjustScroll(8, 0);
K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1);
K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x3fffff, K053247Callback, 1);
K053247SetSpriteOffset(-510, 158);
BurnYM2151Init(4000000);
@ -483,8 +484,6 @@ static INT32 DrvInit()
K054539SetRoute(0, BURN_SND_K054539_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
K054539SetRoute(0, BURN_SND_K054539_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
GenericTilesInit();
DrvDoReset();
return 0;
@ -509,21 +508,7 @@ static INT32 DrvExit()
return 0;
}
static void sortlayers(INT32 *layer,INT32 *pri)
{
#define SWAP(a,b) \
if (pri[a] < pri[b]) \
{ \
INT32 t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0,1)
SWAP(0,2)
SWAP(1,2)
}
// not standard konami layout
static inline void DrvRecalcPalette()
{
UINT8 r,g,b;
@ -539,11 +524,25 @@ static inline void DrvRecalcPalette()
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
Palette[i] = (r << 16) | (g << 8) | b;
DrvPalette[i] = BurnHighCol(r, g, b, 0);
DrvPalette[i] = (r << 16) | (g << 8) | b;
}
}
static void sortlayers(INT32 *layer,INT32 *pri)
{
#define SWAP(a,b) \
if (pri[a] < pri[b]) \
{ \
INT32 t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0,1)
SWAP(0,2)
SWAP(1,2)
}
static INT32 DrvDraw()
{
if (DrvRecalc) {
@ -570,24 +569,17 @@ static INT32 DrvDraw()
sortlayers(layer,layerpri);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 16 * bg_colorbase+1;
konami_temp_screen[i] = DrvPalette[16 * bg_colorbase+1];
konami_priority_bitmap[i] = 0;
}
if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, 1);
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, 2);
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, 4);
if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0);
if (nSpriteEnable & 1) K053247SpritesRender();
if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0);
if (nBurnLayer & 8) {
if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0);
if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1);
if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2);
}
if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0);
KonamiBlendCopy(Palette, DrvPalette);
KonamiBlendCopy(DrvPalette);
return 0;
}
@ -606,7 +598,7 @@ static INT32 DrvFrame()
DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
}
// Clear Opposites
// Clear Opposites
if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c;
if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03;
if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c;

View File

@ -41,6 +41,8 @@ void K051316Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callb
K051316GfxExpand(gfx, gfxexp, mask+1);
}
konami_allocate_bitmaps();
KonamiIC_K051316InUse = 1;
K051316Offs[chip][0] = K051316Offs[chip][1] = 0;
@ -157,10 +159,12 @@ void K051316WrapEnable(INT32 chip, INT32 status)
K051316Wrap[chip] = status;
}
static inline void copy_roz(INT32 chip, UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, INT32 wrap, INT32 transp)
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)
{
UINT16 *dst = pTransDraw;
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;
@ -172,45 +176,49 @@ static inline void copy_roz(INT32 chip, UINT32 startx, UINT32 starty, INT32 incx
if (wrap) {
if (transp) {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
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 = pxl;
*dst = pal[pxl];
*pri = flags;
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) {
*dst = src[(((cy >> 16) & 0x1ff) << 9) | ((cx >> 16) & 0x1ff)] & 0x7fff;
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++)
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 = pxl;
*dst = pal[pxl];
*pri = flags;
}
}
}
} else {
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
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 = src[pos] & 0x7fff;
*dst = pal[src[pos] & 0x7fff];
*pri = flags;
}
}
}
}
}
void K051316_zoom_draw(INT32 chip, INT32 /*flags*/)
void K051316_zoom_draw(INT32 chip, INT32 flags)
{
UINT32 startx,starty;
INT32 incxx,incxy,incyx,incyy;
@ -228,7 +236,7 @@ void K051316_zoom_draw(INT32 chip, INT32 /*flags*/)
startx -= (89 + K051316Offs[chip][0]) * incxx;
starty -= (89 + K051316Offs[chip][0]) * incxy;
copy_roz(chip, startx << 5,starty << 5,incxx << 5,incxy << 5,incyx << 5,incyy << 5, K051316Wrap[chip], K051316TransColor[chip]+1); // transp..
copy_roz(chip, startx << 5,starty << 5,incxx << 5,incxy << 5,incyx << 5,incyy << 5, K051316Wrap[chip], K051316TransColor[chip]+1, flags); // transp..
}
void K051316RedrawTiles(INT32 chip)

View File

@ -11,8 +11,10 @@ static UINT8 *K051960Ram = NULL;
static UINT8 K051960SpriteRomBank[3];
INT32 K051960ReadRoms;
static INT32 K051960RomOffset;
static UINT32 K051960RomMask;
static UINT8 *K051960Rom;
static UINT32 K051960RomMask;
static UINT8 *K051960RomExp;
static UINT32 K051960RomExpMask;
static UINT8 blank_tile[0x100];
static INT32 nSpriteXOffset;
@ -21,7 +23,7 @@ static INT32 nSpriteYOffset;
typedef void (*K051960_Callback)(INT32 *Code, INT32 *Colour, INT32 *Priority, INT32 *Shadow);
static K051960_Callback K051960Callback;
void K051960SpritesRender(UINT8 *pSrc, INT32 Priority)
void K051960SpritesRender(INT32 min_priority, INT32 max_priority)
{
#define NUM_SPRITES 128
INT32 Offset, PriCode;
@ -31,7 +33,10 @@ void K051960SpritesRender(UINT8 *pSrc, INT32 Priority)
for (Offset = 0; Offset < 0x400; Offset += 8) {
if (K051960Ram[Offset] & 0x80) {
SortedList[K051960Ram[Offset] & 0x7f] = Offset;
if (max_priority == -1) /* draw front to back when using priority buffer */
SortedList[(K051960Ram[Offset] & 0x7f) ^ 0x7f] = Offset;
else
SortedList[K051960Ram[Offset] & 0x7f] = Offset;
}
}
@ -52,9 +57,13 @@ void K051960SpritesRender(UINT8 *pSrc, INT32 Priority)
Shadow = Colour & 0x80;
K051960Callback(&Code, &Colour, &Pri, &Shadow);
if (Priority != -1) {
if (Pri != Priority) continue; // not the best way to go about this...
}
if (max_priority != -1)
if (Pri < min_priority || Pri > max_priority)
continue;
if (Pri == 1 && (nSpriteEnable & 2) == 0) continue;
if (Pri == 2 && (nSpriteEnable & 4) == 0) continue;
if (Pri == 3 && (nSpriteEnable & 8) == 0) continue;
Size = (K051960Ram[Offset + 1] & 0xe0) >> 5;
w = Width[Size];
@ -89,26 +98,24 @@ void K051960SpritesRender(UINT8 *pSrc, INT32 Priority)
INT32 c = Code;
sx = ox + 16 * x;
if (xFlip) c += xOffset[(w - 1 - x)];
if (xFlip) c += xOffset[(w - 1 - x) & 7];
else c += xOffset[x];
if (yFlip) c += yOffset[(h - 1 - y)];
if (yFlip) c += yOffset[(h - 1 - y) & 7];
else c += yOffset[y];
sx &= 0x1ff;
sx -= 104;
sx -= nSpriteXOffset;
if (xFlip) {
if (yFlip) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy, Colour, 4, 0, 0, pSrc);
} else {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy, Colour, 4, 0, 0, pSrc);
}
c &= K051960RomExpMask;
if (Shadow) {
konami_render_zoom_shadow_tile(K051960RomExp, c, Colour * 16, sx, sy, xFlip, yFlip, 16, 16, 0x10000, 0x10000, (max_priority ==-1) ? Pri:0xffffffff, 0);
} else {
if (yFlip) {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy, Colour, 4, 0, 0, pSrc);
if (max_priority == -1) {
konami_draw_16x16_prio_tile(K051960RomExp, c, Colour * 16, sx, sy, xFlip, yFlip, Pri);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy, Colour, 4, 0, 0, pSrc);
konami_draw_16x16_tile(K051960RomExp, c, Colour * 16, sx, sy, xFlip, yFlip);
}
}
}
@ -127,16 +134,26 @@ void K051960SpritesRender(UINT8 *pSrc, INT32 Priority)
sx = ox + ((xZoom * x + (1 << 11)) >> 12);
zw = (ox + ((xZoom * (x + 1) + (1 << 11)) >> 12)) - sx;
if (xFlip) c += xOffset[(w - 1 - x)];
if (xFlip) c += xOffset[(w - 1 - x) & 7];
else c += xOffset[x];
if (yFlip) c += yOffset[(h - 1 - y)];
if (yFlip) c += yOffset[(h - 1 - y) & 7];
else c += yOffset[y];
sx &= 0x1ff;
sx -= 104;
sx -= nSpriteXOffset;
RenderZoomedTile(pTransDraw, pSrc, c, Colour << 4 /*assume 4 bpp*/, 0, sx, sy, xFlip, yFlip, 16, 16, zw << 12, zh << 12);
c &= K051960RomExpMask;
if (Shadow) {
konami_render_zoom_shadow_tile(K051960RomExp, c, Colour * 16, sx, sy, xFlip, yFlip, 16, 16, zw << 12, zh << 12, (max_priority ==-1) ? Pri:0xffffffff, 0);
} else {
if (max_priority == -1) {
konami_draw_16x16_priozoom_tile(K051960RomExp, c, Colour * 16, 0, sx, sy, xFlip, yFlip, 16, 16, zw << 12, zh << 12, Pri);
} else {
konami_draw_16x16_zoom_tile(K051960RomExp, c, Colour * 16, 0, sx, sy, xFlip, yFlip, 16, 16, zw << 12, zh << 12);
}
}
}
}
}
@ -198,21 +215,25 @@ void K051960Reset()
K051960_spriteflip = 0;
}
void K051960Init(UINT8* pRomSrc, UINT32 RomMask)
void K051960Init(UINT8* pRomSrc, UINT8* pRomSrcExp, UINT32 RomMask)
{
nSpriteXOffset = nSpriteYOffset = 0;
K051960Ram = (UINT8*)BurnMalloc(0x400);
K051960RomMask = RomMask;
K051960RomExpMask = (RomMask * 2) / (16 * 16);
K051960Rom = pRomSrc;
K051960RomExp = pRomSrcExp;
KonamiIC_K051960InUse = 1;
memset (blank_tile, 0, 0x100);
nSpriteXOffset = nSpriteYOffset = 0;
konami_allocate_bitmaps();
}
void K051960Exit()
@ -222,7 +243,8 @@ void K051960Exit()
K051960Callback = NULL;
K051960RomMask = 0;
K051960Rom = NULL;
K051960RomExpMask = 0;
K051960RomExp = NULL;
memset(K051960SpriteRomBank, 0, 3);
K051960ReadRoms = 0;
K051960RomOffset = 0;

View File

@ -16,6 +16,9 @@ INT32 K052109RMRDLine;
static UINT8 K052109RomSubBank;
static UINT32 K052109RomMask;
static UINT8 *K052109Rom;
static UINT32 K052109RomExpMask;
static UINT8 *K052109RomExp;
static INT32 K052109FlipEnable;
INT32 K052109_irq_enabled;
@ -141,12 +144,13 @@ void K052109AdjustScroll(INT32 x, INT32 y)
}
}
void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Flags, INT32 Priority)
{
UINT16 *dst = pTransDraw;
UINT32 *dst = konami_temp_screen;
UINT16 *pdst = konami_priority_bitmap;
INT32 Priority = nLayer >> 4;
nLayer &= 0x03;
INT32 Category = Flags & 0xff;
INT32 Opaque = (Flags >> 16) & 1;
for (INT32 my = 0; my < 256; my++) {
@ -182,7 +186,7 @@ void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
K052109Callback(nLayer, Bank, &Code, &Colour, &xFlip, &Prio);
if (Prio != Priority) continue;
if (Prio != Category && Category) continue;
if (xFlip && !(K052109FlipEnable & 1)) xFlip = 0;
if (yFlip && !(K052109FlipEnable & 2)) yFlip = 0;
@ -198,12 +202,12 @@ void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
if (x >= nScreenWidth) continue;
UINT8 *src = pSrc + (Code * 0x40);
src += (yFlip ? (~y & 7) : (y & 7)) << 3;
UINT8 *src = K052109RomExp + ((Code & K052109RomExpMask) * 0x40);
src += (yFlip ? (~my & 7) : (my & 7)) * 8;
if (xFlip) xFlip = 0x07;
INT32 col = Colour << 4;
UINT32 *pal = konami_palette32 + (Colour * 16);
for (INT32 xx = 0; xx < 8; xx++, x++) {
if (x < 0 || x >= nScreenWidth) continue;
@ -211,25 +215,29 @@ void K052109RenderLayerLineScroll(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
INT32 pxl = src[xx ^ xFlip];
if (!Opaque && !pxl) continue;
dst[x] = col | pxl;
dst[x] = pal[pxl];
pdst[x] = Priority;
}
}
pdst += nScreenWidth;
dst += nScreenWidth;
}
}
void K052109RenderLayer(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
void K052109RenderLayer(INT32 nLayer, INT32 Flags, INT32 Priority)
{
nLayer &= 0x03;
if (K052109EnableLine[nLayer]) {
K052109RenderLayerLineScroll(nLayer, Opaque, pSrc);
K052109RenderLayerLineScroll(nLayer, Flags, Priority);
return;
}
INT32 mx, my, Bank, Code, Colour, x, y, xFlip = 0, yFlip, Priority, TileIndex = 0;
INT32 Category = Flags & 0xff;
INT32 Opaque = (Flags >> 16) & 1;
Priority = nLayer >> 4;
nLayer &= 0x03;
INT32 mx, my, Bank, Code, Colour, x, y, xFlip = 0, yFlip, TileIndex = 0;
for (my = 0; my < 32; my++) {
for (mx = 0; mx < 64; mx++) {
@ -260,7 +268,7 @@ void K052109RenderLayer(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
K052109Callback(nLayer, Bank, &Code, &Colour, &xFlip, &Prio);
if (Prio != Priority) continue;
if (Prio != Category && Category) continue;
if (xFlip && !(K052109FlipEnable & 1)) xFlip = 0;
if (yFlip && !(K052109FlipEnable & 2)) yFlip = 0;
@ -282,63 +290,24 @@ void K052109RenderLayer(INT32 nLayer, INT32 Opaque, UINT8 *pSrc)
if (x >= nScreenWidth || y >= nScreenHeight) continue;
if (Opaque) {
if (x >= 0 && x <= (nScreenWidth - 8) && y >= 0 && y <= (nScreenHeight - 8)) {
if (xFlip) {
if (yFlip) {
Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
} else {
Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
}
} else {
if (yFlip) {
Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
} else {
Render8x8Tile(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
}
}
} else {
if (xFlip) {
if (yFlip) {
Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
} else {
Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
}
} else {
if (yFlip) {
Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
} else {
Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, pSrc);
}
}
}
} else {
if (x >= 0 && x <= (nScreenWidth - 8) && y >= 0 && y <= (nScreenHeight - 8)) {
if (xFlip) {
if (yFlip) {
Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
} else {
Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
}
} else {
if (yFlip) {
Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
} else {
Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
}
}
} else {
if (xFlip) {
if (yFlip) {
Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
} else {
Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
}
} else {
if (yFlip) {
Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
} else {
Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
{
UINT8 *gfx = K052109RomExp + (Code & K052109RomExpMask) * 0x40;
INT32 flip = 0;
if (xFlip) flip |= 0x07;
if (yFlip) flip |= 0x38;
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;
}
}
}
}
@ -475,13 +444,15 @@ void K052109Reset()
memset (K052109ScrollCols, 0, 64 * 3 * sizeof(INT32));
}
void K052109Init(UINT8 *pRomSrc, UINT32 RomMask)
void K052109Init(UINT8 *pRomSrc, UINT8 *pRomSrcExp, UINT32 RomMask)
{
K052109Ram = (UINT8*)BurnMalloc(0x6000);
K052109RomMask = RomMask;
K052109RomExpMask = (RomMask * 2) / (8 * 8);
K052109Rom = pRomSrc;
K052109RomExp = pRomSrcExp;
KonamiIC_K052109InUse = 1;
@ -490,6 +461,8 @@ void K052109Init(UINT8 *pRomSrc, UINT32 RomMask)
K052109ScrollYOff[i]=0;
}
konami_allocate_bitmaps();
has_extra_video_ram = 0;
}

View File

@ -6,11 +6,13 @@ static void (*K053245Callback[2])(INT32 *code,INT32 *color,INT32 *priority);
static UINT8 *K053245Ram[2];
static UINT8 *K053245Buf[2];
static UINT8 *K053245Gfx[2];
static UINT8 *K053245GfxExp[2];
static INT32 K053245Mask[2];
static INT32 K053245MaskExp[2];
static INT32 K053245_dx[2];
static INT32 K053245_dy[2];
static UINT16 *K053245Temp = NULL;
static UINT32 *K053245Temp = NULL;
static UINT8 K053244Regs[2][0x10];
static INT32 K053244Bank[2];
@ -41,14 +43,16 @@ void K053245GfxDecode(UINT8 *src, UINT8 *dst, INT32 len)
GfxDecode(len >> 7, 4, 16, 16, Plane, XOffs, YOffs, 0x400, src, dst);
}
void K053245Init(INT32 chip, UINT8 *gfx, INT32 mask, void (*callback)(INT32 *code,INT32 *color,INT32 *priority))
void K053245Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callback)(INT32 *code,INT32 *color,INT32 *priority))
{
K053245Ram[chip] = (UINT8*)BurnMalloc(0x800); // enough
K053245Buf[chip] = (UINT8*)BurnMalloc(0x800); // enough
K053245Mask[chip] = mask;
K053245MaskExp[chip] = (mask * 2) / (16 * 16);
K053245Gfx[chip] = gfx;
K053245GfxExp[chip] = gfxexp;
K053245Callback[chip] = callback;
@ -56,11 +60,7 @@ void K053245Init(INT32 chip, UINT8 *gfx, INT32 mask, void (*callback)(INT32 *cod
KonamiIC_K053245InUse = 1;
if (konami_temp_screen == NULL) {
INT32 width, height;
BurnDrvGetVisibleSize(&width, &height);
konami_temp_screen = (UINT16*)BurnMalloc(width * height * 2);
}
konami_allocate_bitmaps();
K053245Temp = konami_temp_screen;
@ -69,7 +69,7 @@ void K053245Init(INT32 chip, UINT8 *gfx, INT32 mask, void (*callback)(INT32 *cod
void K053245Exit()
{
K053245Temp = NULL;
//K053245Temp = NULL;
for (INT32 i = 0; i < K053245Active; i++) {
BurnFree (K053245Ram[i]);
@ -173,55 +173,7 @@ void K053244Write(INT32 chip, INT32 offset, INT32 data)
// Sprite Rendering
static void RenderZoomedShadowTile(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy)
{
INT32 h = ((zoomy << 4) + 0x8000) >> 16;
INT32 w = ((zoomx << 4) + 0x8000) >> 16;
if (!h || !w || sx + w < 0 || sy + h < 0 || sx >= nScreenWidth || sy >= nScreenHeight) return;
if (fy) fy = (height-1)*width;
if (fx) fy |= (width-1);
INT32 hz = (height << 12) / h;
INT32 wz = (width << 12) / w;
INT32 starty = 0, startx = 0, endy = h, endx = w;
if (sy < 0) starty = 0 - sy;
if (sx < 0) startx = 0 - sx;
if (sy + h >= nScreenHeight) endy -= (h + sy) - nScreenHeight;
if (sx + w >= nScreenWidth ) endx -= (w + sx) - nScreenWidth;
UINT8 *src = gfx + (code * width * height);
UINT16 *dst = konami_temp_screen + (sy + starty) * nScreenWidth + sx;
UINT16 *pTemp = pTransDraw + (sy + starty) * nScreenWidth + sx;
INT32 or1 = 0x8000;
for (INT32 y = starty; y < endy; y++)
{
INT32 zy = ((y * hz) >> 12) * width;
for (INT32 x = startx; x < endx; x++)
{
INT32 pxl = src[(zy + ((x * wz) >> 12)) ^ fy];
if (pxl) {
if (pxl == 15) {
dst[x] = color | pxl;
pTemp[x] |= or1;
} else {
pTemp[x] = color | pxl;
}
}
}
dst += nScreenWidth;
pTemp += nScreenWidth;
}
}
void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
void K053245SpritesRender(INT32 chip)
{
#define NUM_SPRITES 128
INT32 offs,pri_code,i;
@ -238,6 +190,8 @@ void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
UINT16 *sprbuf = (UINT16*)K053245Buf[chip];
UINT8 *gfxdata = K053245GfxExp[chip];
/* prebuild a sorted table */
for (i=0x800/2, offs=0; offs<i; offs+=8)
{
@ -252,7 +206,7 @@ void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
}
}
for (pri_code = 0; pri_code < NUM_SPRITES; pri_code++)
for (pri_code = NUM_SPRITES - 1; pri_code >= 0; pri_code--)
{
INT32 ox,oy,color,code,size,w,h,x,y,flipx,flipy,mirrorx,mirrory,shadow,zoomx,zoomy,pri;
@ -267,8 +221,6 @@ void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
(*K053245Callback[chip])(&code,&color,&pri);
if (pri != priority) continue;//------------------------------------------------------- OK??
size = (BURN_ENDIAN_SWAP_INT16(sprbuf[offs]) & 0x0f00) >> 8;
w = 1 << (size & 0x03);
@ -289,7 +241,7 @@ void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
if (zoomx > 0x2000) continue;
if (zoomx) zoomx = (0x400000+zoomx/2) / zoomx;
else zoomx = 2 * 0x400000;
// else zoomx = zoomy; /* workaround for TMNT2 */
// else zoomx = zoomy; /* workaround for TMNT2 */
}
else zoomx = zoomy;
@ -381,32 +333,20 @@ void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority)
fy = flipy;
}
c = (c & 0x3f) | (code & ~0x3f);
c = ((c & 0x3f) | (code & ~0x3f)) & K053245MaskExp[chip];
if (shadow) {
RenderZoomedShadowTile(gfxdata, c, color << 4, sx, sy, fx, fy, 16, 16, zw << 12, zh << 12);
konami_render_zoom_shadow_tile(gfxdata, c, color * 16, sx, sy, fx, fy, 16, 16, zw << 12, zh << 12, pri, 0);
continue;
}
if (zoomx == 0x10000 && zoomy == 0x10000)
{
if (fy) {
if (fx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxdata);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxdata);
}
} else {
if (fx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxdata);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxdata);
}
}
konami_draw_16x16_prio_tile(gfxdata, c, color * 16, sx, sy, fx, fy, pri);
}
else
{
RenderZoomedTile(pTransDraw, gfxdata, c, color << 4, 0, sx, sy, fx, fy, 16, 16, zw << 12, zh << 12);
konami_draw_16x16_priozoom_tile(gfxdata, c, color * 16, 0, sx, sy, fx, fy, 16, 16, zw << 12, zh << 12, pri);
}
}
}

View File

@ -11,8 +11,10 @@ static UINT16 K053247Regs[16];
static UINT8 *K053246Gfx;
static UINT32 K053246Mask;
static UINT8 *K053246GfxExp;
static UINT32 K053246MaskExp;
static UINT16 *K053247Temp = NULL;
static UINT32 *K053247Temp = NULL;
static INT32 K053247_dx;
static INT32 K053247_dy;
@ -57,24 +59,23 @@ void K053247Scan(INT32 nAction)
}
}
void K053247Init(UINT8 *gfxrom, INT32 gfxlen, void (*Callback)(INT32 *code, INT32 *color, INT32 *priority), INT32 flags)
void K053247Init(UINT8 *gfxrom, UINT8 *gfxromexp, INT32 gfxlen, void (*Callback)(INT32 *code, INT32 *color, INT32 *priority), INT32 flags)
{
K053247Ram = (UINT8*)BurnMalloc(0x1000);
K053246Gfx = gfxrom;
K053246Mask = gfxlen;
K053246GfxExp = gfxromexp;
K053246MaskExp = (gfxlen * 2) / (16 * 16);
K053247Callback = Callback;
K053247_dx = 0;
K053247_dy = 0;
K053247_wraparound = 1;
if (konami_temp_screen == NULL) {
INT32 width, height;
BurnDrvGetVisibleSize(&width, &height);
konami_temp_screen = (UINT16*)BurnMalloc(width * height * 2);
}
konami_allocate_bitmaps();
K053247Temp = konami_temp_screen;
@ -85,7 +86,7 @@ void K053247Init(UINT8 *gfxrom, INT32 gfxlen, void (*Callback)(INT32 *code, INT3
void K053247Exit()
{
K053247Temp = NULL;
// K053247Temp = NULL;
BurnFree (K053247Ram);
@ -176,58 +177,11 @@ INT32 K053246_is_IRQ_enabled()
return K053246Regs[5] & 0x10;
}
static void RenderZoomedShadowTile(UINT8 *gfx, INT32 code, INT32 color, UINT8 *t, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy, INT32 highlight)
{
INT32 h = ((zoomy << 4) + 0x8000) >> 16;
INT32 w = ((zoomx << 4) + 0x8000) >> 16;
if (!h || !w || sx + w < 0 || sy + h < 0 || sx >= nScreenWidth || sy >= nScreenHeight) return;
if (fy) fy = (height-1)*width;
if (fx) fy |= (width-1);
INT32 hz = (height << 12) / h;
INT32 wz = (width << 12) / w;
INT32 starty = 0, startx = 0, endy = h, endx = w;
if (sy < 0) starty = 0 - sy;
if (sx < 0) startx = 0 - sx;
if (sy + h >= nScreenHeight) endy -= (h + sy) - nScreenHeight;
if (sx + w >= nScreenWidth ) endx -= (w + sx) - nScreenWidth;
UINT8 *src = gfx + (code * width * height);
UINT16 *dst = K053247Temp + (sy + starty) * nScreenWidth + sx;
UINT16 *pTemp = pTransDraw + (sy + starty) * nScreenWidth + sx;
INT32 or1 = 0x8000 >> highlight;
for (INT32 y = starty; y < endy; y++)
{
INT32 zy = ((y * hz) >> 12) * width;
for (INT32 x = startx; x < endx; x++)
{
INT32 pxl = src[(zy + ((x * wz) >> 12)) ^ fy];
if (pxl) {
if (t[pxl] == 2) {
dst[x] = color | pxl;
pTemp[x] |= or1;
} else {
pTemp[x] = color | pxl;
}
}
}
dst += nScreenWidth;
pTemp += nScreenWidth;
}
}
void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
void K053247SpritesRender()
{
#define NUM_SPRITES 256
UINT8 dtable[256];
UINT8 stable[256];
UINT8 *wtable;
@ -252,6 +206,8 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
UINT16 *SprRam = (UINT16*)K053247Ram;
UINT8 *gfxbase = K053246GfxExp;
INT32 screen_width = nScreenWidth-1;
if (K053247Flags & 1) {
@ -314,7 +270,7 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
}
}
for (INT32 i = 0; i <= count; i++)
for (INT32 i = count; i >= 0; i--)
{
offs = sortedlist[i];
@ -324,8 +280,6 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
(*K053247Callback)(&code,&color,&primask);
if (primask != priority) continue; //--------------------------------------- fix me!
temp = BURN_ENDIAN_SWAP_INT16(SprRam[offs]);
size = (temp & 0x0f00) >> 8;
@ -384,12 +338,14 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
INT32 highlight = 0;
wtable = dtable;
if (color == -1)
{
// drop the entire sprite to shadow unconditionally
if (shdmask < 0) continue;
color = 0;
shadow = -1;
wtable = stable;
}
else
@ -397,6 +353,7 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
if (shdmask >= 0)
{
shadow = (color & 0x20000000) ? (color >> 20) : (shadow >> 10);
if (shadow &= 3) {
if (((shadow-1) & shdmask) == 1) highlight = 1;
}
@ -501,60 +458,30 @@ void K053247SpritesRender(UINT8 *gfxbase, INT32 priority)
fy = flipy;
}
c &= K053246MaskExp;
if (shadow || wtable == stable) {
if (mirrory && h == 1)
RenderZoomedShadowTile(gfxbase, c, color << 4, wtable, sx, sy, flipx, !flipy, 16, 16, zw << 12, zh << 12, highlight);
konami_render_zoom_shadow_tile(gfxbase, c, color * 16, sx, sy, flipx, !flipy, 16, 16, zw << 12, zh << 12, primask, highlight);
RenderZoomedShadowTile(gfxbase, c, color << 4, wtable, sx, sy, flipx, flipy, 16, 16, zw << 12, zh << 12, highlight);
konami_render_zoom_shadow_tile(gfxbase, c, color * 16, sx, sy, flipx, flipy, 16, 16, zw << 12, zh << 12, primask, highlight);
continue;
}
if (mirrory && h == 1)
{
if (nozoom)
{
if (!flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
}
}
}
else
{
RenderZoomedTile(pTransDraw, gfxbase, c, color << 4, 0, sx, sy, fx, !fy, 16, 16, (zw << 16) >> 4, (zh << 16) >> 4);
}
}
if (nozoom)
{
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
}
if (nozoom) {
konami_draw_16x16_prio_tile(gfxbase, c, color * 16, sx, sy, flipx, !flipy, primask);
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy, color, 4, 0, 0, gfxbase);
}
konami_draw_16x16_priozoom_tile(gfxbase, c, color * 16, 0, sx, sy, fx, !fy, 16, 16, zw<<12, zh<<12, primask);
}
}
else
{
RenderZoomedTile(pTransDraw, gfxbase, c, color << 4, 0, sx, sy, fx, fy, 16, 16, (zw << 16) >> 4, (zh << 16) >> 4);
if (nozoom) {
konami_draw_16x16_prio_tile(gfxbase, c, color * 16, sx, sy, flipx, flipy, primask);
} else {
konami_draw_16x16_priozoom_tile(gfxbase, c, color * 16, 0, sx, sy, fx, fy, 16, 16, zw<<12, zh<<12, primask);
}
} // end of X loop
} // end of Y loop

View File

@ -49,6 +49,8 @@ void K053936Init(INT32 chip, UINT8 *ram, INT32 len, INT32 w, INT32 h, void (*pCa
pTileCallback1 = pCallback;
}
konami_allocate_bitmaps();
KonamiIC_K053936InUse = 1;
}
@ -115,7 +117,8 @@ 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)
{
UINT16 *dst = pTransDraw;
UINT32 *dst = konami_temp_screen;
UINT32 *pal = konami_palette32;
UINT16 *src = tscreen[chip];
INT32 hmask = nHeight[chip] - 1;
@ -135,7 +138,7 @@ static inline void copy_roz(INT32 chip, INT32 minx, INT32 maxx, INT32 miny, INT3
INT32 pxl = src[(((cy >> 16) & hmask) << 10) + ((cx >> 16) & wmask)];
if (!(pxl & 0x8000)) {
*dst = pxl;
*dst = pal[pxl];
}
}
} else {
@ -149,14 +152,14 @@ static inline void copy_roz(INT32 chip, INT32 minx, INT32 maxx, INT32 miny, INT3
INT32 pxl = src[(yy << 10) + xx];
if (!(pxl & 0x8000)) {
*dst = pxl;
*dst = pal[pxl];
}
}
}
} else {
if (wrap) {
for (INT32 x = minx; x < maxx; x++, cx+=incxx, cy+=incxy, dst++) {
*dst = src[(((cy >> 16) & hmask) << 10) + ((cx >> 16) & wmask)] & 0x7fff;
*dst = pal[src[(((cy >> 16) & hmask) << 10) + ((cx >> 16) & wmask)] & 0x7fff];
}
} else {
for (INT32 x = minx; x < maxx; x++, cx+=incxx, cy+=incxy, dst++) {
@ -165,7 +168,7 @@ static inline void copy_roz(INT32 chip, INT32 minx, INT32 maxx, INT32 miny, INT3
INT32 xx = cx >> 16;
if (xx > wmask || xx < 0) continue;
*dst = src[(yy << 10) + xx] & 0x7fff;
*dst = pal[src[(yy << 10) + xx] & 0x7fff];
}
}
}

View File

@ -8,9 +8,13 @@ UINT32 KonamiIC_K053245InUse = 0;
UINT32 KonamiIC_K053247InUse = 0;
UINT32 KonamiIC_K053936InUse = 0;
UINT16 *konami_temp_screen = NULL;
UINT32 *konami_temp_screen = NULL;
INT32 K05324xZRejection = -1;
UINT32 *konami_palette32;
UINT16 *konami_priority_bitmap = NULL;
void K05324xSetZRejection(INT32 z)
{
K05324xZRejection = z;
@ -84,7 +88,7 @@ void KonamiRecalcPal(UINT8 *src, UINT32 *dst, INT32 len)
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
dst[i] = BurnHighCol(r, g, b, 0);
dst[i] = (r << 16) | (g << 8) | b; // 32-bit colors
}
}
@ -105,7 +109,15 @@ void KonamiICReset()
void KonamiICExit()
{
BurnFree (konami_temp_screen);
if (konami_temp_screen) {
BurnFree (konami_temp_screen);
konami_temp_screen = NULL;
}
if (konami_priority_bitmap) {
BurnFree(konami_priority_bitmap);
konami_priority_bitmap = NULL;
}
if (KonamiIC_K051960InUse) K051960Exit();
if (KonamiIC_K052109InUse) K052109Exit();
@ -137,40 +149,299 @@ void KonamiICScan(INT32 nAction)
K051733Scan(nAction);
}
/*
Transfer and blend pixels
* highlights are right? where is this used?
* also, has a limitation of 0x4000 colors, some games may need more.
*/
void KonamiBlendCopy(UINT32 *palette /* 32-bit color */, UINT32 *drvpalette /* n-bit color */)
void konami_allocate_bitmaps()
{
UINT8 *dst = pBurnDraw;
INT32 width, height;
BurnDrvGetVisibleSize(&width, &height);
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++)
{
if (pTransDraw[i] >= 0x4000) // shadow & highlight
{
UINT32 source = palette[pTransDraw[i] & 0x3fff];
UINT32 blend = palette[konami_temp_screen[i] & 0x3fff];
if (konami_temp_screen == NULL) {
konami_temp_screen = (UINT32*)BurnMalloc(width * height * sizeof(INT32));
}
INT32 a = 0x99; // shadow (255 * 0.60)
if (pTransDraw[i] & 0x4000) a = 0xa9; // highlight (255 * (1 / 0.60)) & 0xff; (0x1a9 otherwise) right?
INT32 ad = 256 - a;
// ripped from MAME...
UINT32 p = ((((source & 0x0000ff) * a + (blend & 0x0000ff) * ad) >> 8)) |
((((source & 0x00ff00) * a + (blend & 0x00ff00) * ad) >> 8) & 0x00ff00) |
((((source & 0xff0000) * a + (blend & 0xff0000) * ad) >> 8) & 0xff0000);
PutPix(dst, BurnHighCol(p >> 16, p >> 8, p, 0));
}
else // normal
{
PutPix(dst, drvpalette[pTransDraw[i]]);
}
dst += nBurnBpp;
if (konami_priority_bitmap == NULL) {
konami_priority_bitmap = (UINT16*)BurnMalloc(width * height * sizeof(INT16));
}
}
void KonamiBlendCopy(UINT32 *pPalette)
{
pBurnDrvPalette = pPalette;
UINT32 *bmp = konami_temp_screen;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
PutPix(pBurnDraw + (i * nBurnBpp), BurnHighCol(bmp[i]>>16, (bmp[i]>>8)&0xff, bmp[i]&0xff, 0));
}
}
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)
{
// Based on MAME sources for tile zooming
UINT8 *gfx_base = gfx + (code * width * height);
int dh = (zoomy * height + 0x8000) / 0x10000;
int dw = (zoomx * width + 0x8000) / 0x10000;
priority |= 1<<31; // always on!
UINT32 *pal = konami_palette32 + color;
if (dw && dh)
{
int dx = (width * 0x10000) / dw;
int dy = (height * 0x10000) / dh;
int ex = sx + dw;
int ey = sy + dh;
int x_index_base = 0;
int y_index = 0;
if (fx) {
x_index_base = (dw - 1) * dx;
dx = -dx;
}
if (fy) {
y_index = (dh - 1) * dy;
dy = -dy;
}
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)
{
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{
if ((priority & (1 << (prio[x] & 0x1f)))==0) {
if (x >= 0 && x < nScreenWidth) {
INT32 pxl = src[x_index>>16];
if (pxl != t) {
dst[x] = pal[pxl];
prio[x] = 0x1f;
}
}
}
x_index += dx;
}
}
y_index += dy;
}
}
}
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;
UINT32 *pal = konami_palette32 + color;
if (dw && dh)
{
int dx = (width * 0x10000) / dw;
int dy = (height * 0x10000) / dh;
int ex = sx + dw;
int ey = sy + dh;
int x_index_base = 0;
int y_index = 0;
if (fx) {
x_index_base = (dw - 1) * dx;
dx = -dx;
}
if (fy) {
y_index = (dh - 1) * dy;
dy = -dy;
}
for (INT32 y = sy; y < ey; y++)
{
UINT8 *src = gfx_base + (y_index / 0x10000) * width;
UINT32 *dst = konami_temp_screen + y * nScreenWidth;
if (y >= 0 && y < nScreenHeight)
{
for (INT32 x = sx, x_index = x_index_base; x < ex; x++)
{
if (x >= 0 && x < nScreenWidth) {
INT32 pxl = src[x_index>>16];
if (pxl != t) {
dst[x] = pal[pxl];
}
}
x_index += dx;
}
}
y_index += dy;
}
}
}
void konami_draw_16x16_prio_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, UINT32 priority)
{
INT32 flip = 0;
if (flipx) flip |= 0x0f;
if (flipy) flip |= 0xf0;
UINT8 *gfx = gfxbase + code * 0x100;
UINT16 *pri = konami_priority_bitmap + (sy * nScreenWidth) + sx;
UINT32 *dst = konami_temp_screen + (sy * nScreenWidth) + sx;
UINT32 *pal = konami_palette32 + color;
priority |= 1 << 31; // always on!
for (INT32 y = 0; y < 16; y++, sy++) {
for (INT32 x = 0; x < 16; x++) {
if ((sx+x) >=0 && (sx+x) < nScreenWidth && sy >= 0 && sy < nScreenHeight) {
INT32 pxl = gfx[((y*16)+x)^flip];
if (pxl) {
if ((priority & (1 << (pri[x] & 0x1f)))==0) {
dst[x] = pal[pxl];
pri[x] = 0x1f;
}
}
}
}
pri += nScreenWidth;
dst += nScreenWidth;
}
}
void konami_draw_16x16_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy)
{
INT32 flip = 0;
if (flipx) flip |= 0x0f;
if (flipy) flip |= 0xf0;
UINT8 *gfx = gfxbase + code * 0x100;
UINT32 *pal = konami_palette32 + color;
UINT32 *dst = konami_temp_screen + (sy * nScreenWidth) + sx;
for (INT32 y = 0; y < 16; y++) {
for (INT32 x = 0; x < 16; x++) {
if ((sx+x)>=0 && (sx+x)<nScreenWidth && (sy+y)>=0 && (sy+y)<nScreenHeight) {
INT32 pxl = gfx[((y*16)+x)^flip];
if (pxl) {
dst[x] = pal[pxl];
}
}
}
dst += nScreenWidth;
}
}
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)
{
return (((0xA857A857 + ((d & 0xff00ff) * 0x56)) & 0xff00ff00) + ((0x00A85700 + ((d & 0x00ff00) * 0x56)) & 0x00ff0000)) / 0x100;
}
*/
void konami_render_zoom_shadow_tile(UINT8 *gfxbase, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 fx, INT32 fy, INT32 width, INT32 height, INT32 zoomx, INT32 zoomy, UINT32 priority, INT32 /*highlight*/)
{
INT32 h = ((zoomy << 4) + 0x8000) >> 16;
INT32 w = ((zoomx << 4) + 0x8000) >> 16;
if (!h || !w || sx + w < 0 || sy + h < 0 || sx >= nScreenWidth || sy >= nScreenHeight) return;
if (fy) fy = (height-1)*width;
if (fx) fy |= (width-1);
INT32 hz = (height << 12) / h;
INT32 wz = (width << 12) / w;
INT32 starty = 0, startx = 0, endy = h, endx = w;
if (sy < 0) starty = 0 - sy;
if (sx < 0) startx = 0 - sx;
if (sy + h >= nScreenHeight) endy -= (h + sy) - nScreenHeight;
if (sx + w >= nScreenWidth ) endx -= (w + sx) - nScreenWidth;
UINT8 *src = gfxbase + (code * width * height);
UINT32 *dst = konami_temp_screen + (sy + starty) * nScreenWidth + sx;
UINT16 *pri = konami_priority_bitmap + (sy + starty) * nScreenWidth + sx;
UINT32 *pal = konami_palette32 + color;
if (priority == 0xffffffff)
{
for (INT32 y = starty; y < endy; y++)
{
INT32 zy = ((y * hz) >> 12) * width;
for (INT32 x = startx; x < endx; x++)
{
INT32 pxl = src[(zy + ((x * wz) >> 12)) ^ fy];
if (pxl) {
if (pxl == 0x0f) {
dst[x] = shadow_blend(dst[x]);
} else {
dst[x] = pal[pxl];
}
}
}
dst += nScreenWidth;
}
} else {
priority |= 1<<31; // always on!
for (INT32 y = starty; y < endy; y++)
{
INT32 zy = ((y * hz) >> 12) * width;
for (INT32 x = startx; x < endx; x++)
{
INT32 pxl = src[(zy + ((x * wz) >> 12)) ^ fy];
if (pxl) {
if (pxl == 0x0f) {
if ((priority & (1 << (pri[x]&0x1f)))==0 && (pri[x] & 0x80) == 0) {
//if (highlight) {
// dst[x] = highlight_blend(dst[x]);
//} else {
dst[x] = shadow_blend(dst[x]);
//}
pri[x] |= 0x80;
}
} else {
if ((priority & (1 << (pri[x]&0x1f)))==0) {
dst[x] = pal[pxl];
pri[x] = 0x1f;
}
}
}
}
pri += nScreenWidth;
dst += nScreenWidth;
}
}
}

View File

@ -7,8 +7,19 @@ extern UINT32 KonamiIC_K053245InUse;
extern UINT32 KonamiIC_K053247InUse;
extern UINT32 KonamiIC_K053936InUse;
extern UINT16 *konami_temp_screen;
void KonamiBlendCopy(UINT32 *palette /* 32-bit color */, UINT32 *drvpalette /* n-bit color */);
extern UINT16 *konami_priority_bitmap;
extern UINT32 *konami_temp_screen;
extern UINT32 *konami_palette32;
void KonamiBlendCopy(UINT32 *palette);
void konami_allocate_bitmaps();
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);
@ -30,14 +41,14 @@ UINT8 K052109_051960_r(INT32 offset);
//---------------------------------------------------------------------------------------------------------------
extern INT32 K051960ReadRoms;
extern INT32 K052109_irq_enabled;
void K051960SpritesRender(UINT8 *pSrc, INT32 priority);
void K051960SpritesRender(INT32 min_priority, INT32 max_priority);
UINT8 K0519060FetchRomData(UINT32 Offset);
UINT8 K051960Read(UINT32 Offset);
void K051960Write(UINT32 Offset, UINT8 Data);
void K051960SetCallback(void (*Callback)(INT32 *Code, INT32 *Colour, INT32 *Priority, INT32 *Shadow));
void K051960SetSpriteOffset(INT32 x, INT32 y);
void K051960Reset();
void K051960Init(UINT8* pRomSrc, UINT32 RomMask);
void K051960Init(UINT8* pRomSrc, UINT8* pRomSrcExp, UINT32 RomMask);
void K051960Exit();
void K051960Scan(INT32 nAction);
void K051937Write(UINT32 Offset, UINT8 Data);
@ -52,12 +63,16 @@ extern INT32 K051960_spriteflip;
void K052109UpdateScroll();
void K052109AdjustScroll(INT32 x, INT32 y);
void K052109RenderLayer(INT32 nLayer, INT32 Opaque, UINT8 *pSrc);
#define K052109_OPAQUE 0x10000
#define K052109_CATEGORY(x) (x)
void K052109RenderLayer(INT32 nLayer, INT32 Flags, INT32 Priority);
UINT8 K052109Read(UINT32 Offset);
void K052109Write(UINT32 Offset, UINT8 Data);
void K052109SetCallback(void (*Callback)(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *xFlip, INT32 *priority));
void K052109Reset();
void K052109Init(UINT8 *pRomSrc, UINT32 RomMask);
void K052109Init(UINT8 *pRomSrc, UINT8* pRomSrcExp, UINT32 RomMask);
void K052109Exit();
void K052109Scan(INT32 nAction);
@ -152,10 +167,10 @@ void K051316Scan(INT32 nAction);
//---------------------------------------------------------------------------------------------------------------
INT32 K053245Reset();
void K053245GfxDecode(UINT8 *src, UINT8 *dst, INT32 len);
void K053245Init(INT32 chip, UINT8 *gfx, INT32 mask, void (*callback)(INT32 *code,INT32 *color,INT32 *priority));
void K053245Init(INT32 chip, UINT8 *gfx, UINT8 *gfxexp, INT32 mask, void (*callback)(INT32 *code,INT32 *color,INT32 *priority));
void K053245Exit();
void K053245SpritesRender(INT32 chip, UINT8 *gfxdata, INT32 priority);
void K053245SpritesRender(INT32 chip);
void K053245SetSpriteOffset(INT32 chip,INT32 offsx, INT32 offsy);
void K053245ClearBuffer(INT32 chip);
@ -190,7 +205,7 @@ void K053251Scan(INT32 nAction);
// K053247.cpp
//---------------------------------------------------------------------------------------------------------------
void K053247Reset();
void K053247Init(UINT8 *gfxrom, INT32 gfxlen, void (*Callback)(INT32 *code, INT32 *color, INT32 *priority), INT32 flags);
void K053247Init(UINT8 *gfxrom, UINT8 *gfxromexp, INT32 gfxlen, void (*Callback)(INT32 *code, INT32 *color, INT32 *priority), INT32 flags);
void K053247Exit();
void K053247Scan(INT32 nAction);
@ -207,7 +222,7 @@ void K053247Write(INT32 offset, INT32 data);
UINT8 K053246Read(INT32 offset);
void K053246Write(INT32 offset, INT32 data);
void K053247SpritesRender(UINT8 *gfxbase, INT32 priority);
void K053247SpritesRender();
// k054000.cpp
//------------------------------------------------------------------------------------------