mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
kaneko_grap2 : Update (#3287)
* kaneko_grap2 : Add device_rom_interface instead runtime tag lookup, Convert address map related defines into device address map, Add internal palette configs galpani3 : Bit of improves on bg-bg priorities, Cleanup duplicates, Change tag "gfx2" to "rlebg" * kaneko_grap2 : Implement Brightness * kaneko_grap2.h : Compile fixes * kaneko_grap2 : Add m_brightreg on save state * kaneko_grap2 : Fix color * kaneko_grap2 : Fix brightness * Fix some galpani3 alpha blending, sprite-bg/bg-bg priorities galpani3 : Minor cleanup * galpani3.cpp : Fix compile * galpani3.cpp : Fix spacing * galpani3.cpp : Update notes, Reduce duplicates * galpani3.cpp : Update notes * galpani3.cpp : Add notes * kaneko_grap2.cpp : Add notes
This commit is contained in:
parent
17f68f309a
commit
8d8c17ae61
@ -118,7 +118,6 @@ public:
|
||||
|
||||
uint32_t screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(galpani3_vblank);
|
||||
int gp3_is_alpha_pen(int pen);
|
||||
void galpani3(machine_config &config);
|
||||
void galpani3_map(address_map &map);
|
||||
};
|
||||
@ -149,11 +148,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(galpani3_state::galpani3_vblank)// 2, 3, 5 ?
|
||||
|
||||
void galpani3_state::video_start()
|
||||
{
|
||||
m_spriteram32 = std::make_unique<uint32_t[]>(0x4000/4);
|
||||
m_spc_regs = std::make_unique<uint32_t[]>(0x40/4);
|
||||
|
||||
/* so we can use video/sknsspr.c */
|
||||
m_spritegen->skns_sprite_kludge(0,0);
|
||||
|
||||
m_spriteram32 = make_unique_clear<uint32_t[]>(0x4000/4);
|
||||
m_spc_regs = make_unique_clear<uint32_t[]>(0x40/4);
|
||||
|
||||
save_item(NAME(m_priority_buffer_scrollx));
|
||||
save_item(NAME(m_priority_buffer_scrolly));
|
||||
@ -161,190 +160,147 @@ void galpani3_state::video_start()
|
||||
save_pointer(NAME(m_spc_regs.get()), 0x40/4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int galpani3_state::gp3_is_alpha_pen(int pen)
|
||||
{
|
||||
uint16_t dat = 0;
|
||||
|
||||
if (pen<0x4000)
|
||||
{
|
||||
dat = m_paletteram[pen];
|
||||
}
|
||||
else if (pen<0x4100)
|
||||
{
|
||||
dat = m_grap2[0]->m_framebuffer_palette[pen&0xff];
|
||||
}
|
||||
else if (pen<0x4200)
|
||||
{
|
||||
dat = m_grap2[1]->m_framebuffer_palette[pen&0xff];
|
||||
}
|
||||
else if (pen<0x4300)
|
||||
{
|
||||
dat = m_grap2[2]->m_framebuffer_palette[pen&0xff];
|
||||
}
|
||||
else if (pen<0x4301)
|
||||
{
|
||||
dat = m_grap2[0]->m_framebuffer_bgcol;
|
||||
}
|
||||
else if (pen<0x4302)
|
||||
{
|
||||
dat = m_grap2[1]->m_framebuffer_bgcol;
|
||||
}
|
||||
else if (pen<0x4303)
|
||||
{
|
||||
dat = m_grap2[2]->m_framebuffer_bgcol;
|
||||
#define SPRITE_DRAW_PIXEL(_pri) \
|
||||
if (((sprdat & 0xc000) == _pri) && ((sprdat & 0xff) != 0)) \
|
||||
{ \
|
||||
dst[drawx] = paldata[sprdat & 0x3fff]; \
|
||||
}
|
||||
|
||||
if (dat&0x8000) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
// Switchable brightness value in highest bit of palette
|
||||
// TODO : m_framebuffer_bright1 is alpha-blended?
|
||||
#define FB_DRAW_PIXEL(_chip, _pixel) \
|
||||
int alpha = 0xff; \
|
||||
uint32_t pal = m_grap2[_chip]->pen_r(_pixel); \
|
||||
if (m_grap2[_chip]->m_framebuffer_palette[_pixel] & 0x8000) \
|
||||
{ \
|
||||
alpha = (m_grap2[_chip]->m_framebuffer_bright2 & 0xff); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
alpha = (m_grap2[_chip]->m_framebuffer_bright1 & 0xff); \
|
||||
} \
|
||||
if (alpha) \
|
||||
{ \
|
||||
if (alpha == 0xff) \
|
||||
dst[drawx] = pal; \
|
||||
else \
|
||||
dst[drawx] = alpha_blend_r32(dst[drawx], pal, alpha); \
|
||||
}
|
||||
|
||||
uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int x,y;
|
||||
uint16_t* src1;
|
||||
uint32_t* dst;
|
||||
uint16_t pixdata1;
|
||||
const pen_t *paldata = m_palette->pens();
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
m_sprite_bitmap.fill(0x0000, cliprect);
|
||||
|
||||
bitmap.fill(0x0000, cliprect);
|
||||
m_spritegen->skns_draw_sprites(m_sprite_bitmap, cliprect, m_spriteram32.get(), 0x4000, m_spc_regs.get() );
|
||||
|
||||
// popmessage("%02x %02x", m_grap2[0]->m_framebuffer_bright2, m_grap2[1]->m_framebuffer_bright2);
|
||||
|
||||
|
||||
|
||||
{
|
||||
int drawy, drawx;
|
||||
for (drawy=0;drawy<512;drawy++)
|
||||
for (drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++)
|
||||
{
|
||||
uint16_t* sprline = &m_sprite_bitmap.pix16(drawy);
|
||||
uint16_t* srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200;
|
||||
uint16_t* srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200;
|
||||
uint16_t* srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200;
|
||||
|
||||
uint16_t* priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200;
|
||||
uint16_t* priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200;
|
||||
|
||||
uint32_t* dst = &bitmap.pix32(drawy & 0x3ff);
|
||||
|
||||
for (drawx=0;drawx<512;drawx++)
|
||||
for (drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++)
|
||||
{
|
||||
int sproffs = drawx & 0x3ff;
|
||||
int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff;
|
||||
int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff;
|
||||
int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff;
|
||||
|
||||
int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff;
|
||||
|
||||
uint8_t dat1 = srcline1[srcoffs1];
|
||||
uint8_t dat2 = srcline2[srcoffs2];
|
||||
uint8_t dat3 = srcline3[srcoffs3];
|
||||
uint16_t sprdat = sprline[sproffs];
|
||||
uint8_t dat1 = srcline1[srcoffs1];
|
||||
uint8_t dat2 = srcline2[srcoffs2];
|
||||
uint8_t dat3 = srcline3[srcoffs3];
|
||||
|
||||
uint8_t pridat = priline[prioffs];
|
||||
uint8_t pridat = priline[prioffs];
|
||||
|
||||
uint32_t* dst = &bitmap.pix32(drawy, drawx);
|
||||
|
||||
|
||||
|
||||
// this is all wrong
|
||||
// TODO : Verify priorities, blendings from real PCB.
|
||||
if (pridat==0x0f) // relates to the area you've drawn over
|
||||
{
|
||||
SPRITE_DRAW_PIXEL(0x0000);
|
||||
if (m_grap2[2]->m_framebuffer_enable)
|
||||
{
|
||||
FB_DRAW_PIXEL(2, dat3);
|
||||
}
|
||||
SPRITE_DRAW_PIXEL(0x4000);
|
||||
if (dat1 && m_grap2[0]->m_framebuffer_enable)
|
||||
{
|
||||
dst[0] = paldata[dat1+0x4000];
|
||||
FB_DRAW_PIXEL(0, dat1);
|
||||
}
|
||||
|
||||
SPRITE_DRAW_PIXEL(0x8000);
|
||||
if (dat2 && m_grap2[1]->m_framebuffer_enable)
|
||||
{
|
||||
dst[0] = paldata[dat2+0x4100];
|
||||
FB_DRAW_PIXEL(1, dat2);
|
||||
}
|
||||
|
||||
SPRITE_DRAW_PIXEL(0xc000);
|
||||
}
|
||||
else if (pridat==0xcf) // the girl
|
||||
{
|
||||
dst[0] = paldata[0x4300];
|
||||
SPRITE_DRAW_PIXEL(0x0000);
|
||||
FB_DRAW_PIXEL(0, 0x100);
|
||||
SPRITE_DRAW_PIXEL(0x4000);
|
||||
if (m_grap2[1]->m_framebuffer_enable)
|
||||
{
|
||||
FB_DRAW_PIXEL(1, 0x100);
|
||||
}
|
||||
SPRITE_DRAW_PIXEL(0x8000);
|
||||
if (dat3 && m_grap2[2]->m_framebuffer_enable)
|
||||
{
|
||||
FB_DRAW_PIXEL(2, dat3);
|
||||
}
|
||||
SPRITE_DRAW_PIXEL(0xc000);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this isn't right, but the registers have something to do with
|
||||
alpha / mixing, and bit 0x8000 of the palette is DEFINITELY alpha
|
||||
enable -- see fading in intro */
|
||||
if (dat1 && m_grap2[0]->m_framebuffer_enable)
|
||||
SPRITE_DRAW_PIXEL(0x0000);
|
||||
if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB?
|
||||
{
|
||||
uint16_t pen = dat1+0x4000;
|
||||
uint32_t pal = paldata[pen];
|
||||
|
||||
if (gp3_is_alpha_pen(pen))
|
||||
{
|
||||
int r,g,b;
|
||||
r = (pal & 0x00ff0000)>>16;
|
||||
g = (pal & 0x0000ff00)>>8;
|
||||
b = (pal & 0x000000ff)>>0;
|
||||
|
||||
r = (r * m_grap2[0]->m_framebuffer_bright2) / 0xff;
|
||||
g = (g * m_grap2[0]->m_framebuffer_bright2) / 0xff;
|
||||
b = (b * m_grap2[0]->m_framebuffer_bright2) / 0xff;
|
||||
|
||||
pal = (r & 0x000000ff)<<16;
|
||||
pal |=(g & 0x000000ff)<<8;
|
||||
pal |=(b & 0x000000ff)<<0;
|
||||
|
||||
dst[0] = pal;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst[0] = pal;
|
||||
}
|
||||
FB_DRAW_PIXEL(0, dat1);
|
||||
}
|
||||
|
||||
SPRITE_DRAW_PIXEL(0x4000);
|
||||
if (dat2 && m_grap2[1]->m_framebuffer_enable)
|
||||
{
|
||||
uint16_t pen = dat2+0x4100;
|
||||
uint32_t pal = paldata[pen];
|
||||
|
||||
if (gp3_is_alpha_pen(pen))
|
||||
{
|
||||
int r,g,b;
|
||||
r = (pal & 0x00ff0000)>>16;
|
||||
g = (pal & 0x0000ff00)>>8;
|
||||
b = (pal & 0x000000ff)>>0;
|
||||
|
||||
r = (r * m_grap2[1]->m_framebuffer_bright2) / 0xff;
|
||||
g = (g * m_grap2[1]->m_framebuffer_bright2) / 0xff;
|
||||
b = (b * m_grap2[1]->m_framebuffer_bright2) / 0xff;
|
||||
|
||||
pal = (r & 0x000000ff)<<16;
|
||||
pal |=(g & 0x000000ff)<<8;
|
||||
pal |=(b & 0x000000ff)<<0;
|
||||
|
||||
dst[0] |= pal;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst[0] = pal;
|
||||
}
|
||||
FB_DRAW_PIXEL(1, dat2);
|
||||
}
|
||||
|
||||
SPRITE_DRAW_PIXEL(0x8000);
|
||||
if (dat3 && m_grap2[2]->m_framebuffer_enable)
|
||||
{
|
||||
dst[0] = paldata[dat3+0x4200];
|
||||
FB_DRAW_PIXEL(2, dat3);
|
||||
}
|
||||
SPRITE_DRAW_PIXEL(0xc000);
|
||||
}
|
||||
|
||||
/*
|
||||
else if (pridat==0x2f) // area outside of the girl
|
||||
{
|
||||
//dst[0] = machine().rand()&0x3fff;
|
||||
//dst[drawx] = machine().rand()&0x3fff;
|
||||
}
|
||||
|
||||
else if (pridat==0x00) // the initial line / box that gets drawn
|
||||
{
|
||||
//dst[0] = machine().rand()&0x3fff;
|
||||
//dst[drawx] = machine().rand()&0x3fff;
|
||||
}
|
||||
else if (pridat==0x30) // during the 'gals boxes' on the intro
|
||||
{
|
||||
//dst[0] = machine().rand()&0x3fff;
|
||||
//dst[drawx] = machine().rand()&0x3fff;
|
||||
}
|
||||
else if (pridat==0x0c) // 'nice' at end of level
|
||||
{
|
||||
//dst[0] = machine().rand()&0x3fff;
|
||||
//dst[drawx] = machine().rand()&0x3fff;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -354,32 +310,6 @@ uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_sprite_bitmap.fill(0x0000, cliprect);
|
||||
|
||||
m_spritegen->skns_draw_sprites(m_sprite_bitmap, cliprect, m_spriteram32.get(), 0x4000, m_spc_regs.get() );
|
||||
|
||||
// ignoring priority bits for now..
|
||||
for (y=0;y<240;y++)
|
||||
{
|
||||
src1 = &m_sprite_bitmap.pix16(y);
|
||||
dst = &bitmap.pix32(y);
|
||||
|
||||
for (x=0;x<320;x++)
|
||||
{
|
||||
pixdata1 = src1[x];
|
||||
|
||||
if (pixdata1 & 0x3fff)
|
||||
{
|
||||
dst[x] = paldata[(pixdata1 & 0x3fff)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -460,11 +390,6 @@ WRITE16_MEMBER(galpani3_state::galpani3_priority_buffer_scrolly_w)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADDRESS_MAP_START(galpani3_state::galpani3_map)
|
||||
AM_RANGE(0x000000, 0x17ffff) AM_ROM
|
||||
|
||||
@ -481,10 +406,10 @@ ADDRESS_MAP_START(galpani3_state::galpani3_map)
|
||||
AM_RANGE(0x680000, 0x680001) AM_DEVWRITE( "toybox", kaneko_toybox_device, mcu_com2_w)
|
||||
AM_RANGE(0x700000, 0x700001) AM_DEVWRITE( "toybox", kaneko_toybox_device, mcu_com3_w)
|
||||
AM_RANGE(0x780000, 0x780001) AM_DEVREAD( "toybox", kaneko_toybox_device, mcu_status_r)
|
||||
|
||||
GRAP2_AREA( 0x800000, "grap2_0" )
|
||||
GRAP2_AREA( 0xa00000, "grap2_1" )
|
||||
GRAP2_AREA( 0xc00000, "grap2_2" )
|
||||
|
||||
AM_RANGE(0x800000, 0x9fffff) AM_DEVICE( "grap2_0", kaneko_grap2_device, grap2_map)
|
||||
AM_RANGE(0xa00000, 0xbfffff) AM_DEVICE( "grap2_1", kaneko_grap2_device, grap2_map)
|
||||
AM_RANGE(0xc00000, 0xdfffff) AM_DEVICE( "grap2_2", kaneko_grap2_device, grap2_map)
|
||||
|
||||
// ?? priority / alpha buffer?
|
||||
AM_RANGE(0xe00000, 0xe7ffff) AM_RAM AM_SHARE("priority_buffer") // area [J] - A area ? odd bytes only, initialized 00..ff,00..ff,..., then cleared
|
||||
@ -522,23 +447,19 @@ MACHINE_CONFIG_START(galpani3_state::galpani3)
|
||||
|
||||
MCFG_DEVICE_ADD("toybox", KANEKO_TOYBOX, 0)
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 0x4303)
|
||||
MCFG_PALETTE_ADD("palette", 0x4000)
|
||||
MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", SKNS_SPRITE, 0)
|
||||
|
||||
MCFG_DEVICE_ADD("grap2_0", KANEKO_GRAP2, 0)
|
||||
MCFG_KANEKO_GRAP2_CHIPNUM(0)
|
||||
MCFG_KANEKO_GRAP2_PALETTE("palette")
|
||||
MCFG_DEVICE_ROM("rlebg")
|
||||
|
||||
MCFG_DEVICE_ADD("grap2_1", KANEKO_GRAP2, 0)
|
||||
MCFG_KANEKO_GRAP2_CHIPNUM(1)
|
||||
MCFG_KANEKO_GRAP2_PALETTE("palette")
|
||||
MCFG_DEVICE_ROM("rlebg")
|
||||
|
||||
MCFG_DEVICE_ADD("grap2_2", KANEKO_GRAP2, 0)
|
||||
MCFG_KANEKO_GRAP2_CHIPNUM(2)
|
||||
MCFG_KANEKO_GRAP2_PALETTE("palette")
|
||||
|
||||
MCFG_DEVICE_ROM("rlebg")
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
@ -557,7 +478,7 @@ ROM_START( galpani3 ) /* All game text in English */
|
||||
ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites - RLE encoded */
|
||||
ROM_LOAD( "gp320000.1", 0x000000, 0x200000, CRC(a0112827) SHA1(0a6c78d71b75a1d78215aab3104176aa1769b14f) )
|
||||
|
||||
ROM_REGION( 0x1000000, "gfx2", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_REGION( 0x1000000, "rlebg", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_LOAD( "gp340000.123", 0x000000, 0x200000, CRC(a58a26b1) SHA1(832d70cce1b4f04fa50fc221962ff6cc4287cb92) ) // 19950414GROMACap
|
||||
ROM_LOAD( "gp340100.122", 0x200000, 0x200000, CRC(746fe4a8) SHA1(a5126ae9e83d556277d31b166296a708c311a902) ) // 19950414GROMBCap
|
||||
ROM_LOAD( "gp340200.121", 0x400000, 0x200000, CRC(e9bc15c8) SHA1(2c6a10e768709d1937d9206970553f4101ce9016) ) // 19950414GROMCCap
|
||||
@ -581,7 +502,7 @@ ROM_START( galpani3hk )
|
||||
ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites - RLE encoded */
|
||||
ROM_LOAD( "gp320000.1", 0x000000, 0x200000, CRC(a0112827) SHA1(0a6c78d71b75a1d78215aab3104176aa1769b14f) )
|
||||
|
||||
ROM_REGION( 0x1000000, "gfx2", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_REGION( 0x1000000, "rlebg", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_LOAD( "gp340000.123", 0x000000, 0x200000, CRC(a58a26b1) SHA1(832d70cce1b4f04fa50fc221962ff6cc4287cb92) ) // 19950414GROMACap
|
||||
ROM_LOAD( "gp340100.122", 0x200000, 0x200000, CRC(746fe4a8) SHA1(a5126ae9e83d556277d31b166296a708c311a902) ) // 19950414GROMBCap
|
||||
ROM_LOAD( "gp340200.121", 0x400000, 0x200000, CRC(e9bc15c8) SHA1(2c6a10e768709d1937d9206970553f4101ce9016) ) // 19950414GROMCCap
|
||||
@ -605,7 +526,7 @@ ROM_START( galpani3j ) /* Some game text in Japanese, but no "For use in Japan"
|
||||
ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites - RLE encoded */
|
||||
ROM_LOAD( "gp320000.1", 0x000000, 0x200000, CRC(a0112827) SHA1(0a6c78d71b75a1d78215aab3104176aa1769b14f) )
|
||||
|
||||
ROM_REGION( 0x1000000, "gfx2", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_REGION( 0x1000000, "rlebg", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_LOAD( "gp340000.123", 0x000000, 0x200000, CRC(a58a26b1) SHA1(832d70cce1b4f04fa50fc221962ff6cc4287cb92) ) // 19950414GROMACap
|
||||
ROM_LOAD( "gp340100.122", 0x200000, 0x200000, CRC(746fe4a8) SHA1(a5126ae9e83d556277d31b166296a708c311a902) ) // 19950414GROMBCap
|
||||
ROM_LOAD( "gp340200.121", 0x400000, 0x200000, CRC(e9bc15c8) SHA1(2c6a10e768709d1937d9206970553f4101ce9016) ) // 19950414GROMCCap
|
||||
@ -629,7 +550,7 @@ ROM_START( galpani3k ) /* Some game text in Korean, but no "For use in Korea" ty
|
||||
ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites - RLE encoded */
|
||||
ROM_LOAD( "gp320000.1", 0x000000, 0x200000, CRC(a0112827) SHA1(0a6c78d71b75a1d78215aab3104176aa1769b14f) )
|
||||
|
||||
ROM_REGION( 0x1000000, "gfx2", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_REGION( 0x1000000, "rlebg", 0 ) /* Backgrounds - RLE encoded */
|
||||
ROM_LOAD( "gp340000.123", 0x000000, 0x200000, CRC(a58a26b1) SHA1(832d70cce1b4f04fa50fc221962ff6cc4287cb92) ) // 19950414GROMACap
|
||||
ROM_LOAD( "gp340100.122", 0x200000, 0x200000, CRC(746fe4a8) SHA1(a5126ae9e83d556277d31b166296a708c311a902) ) // 19950414GROMBCap
|
||||
ROM_LOAD( "gp340200.121", 0x400000, 0x200000, CRC(e9bc15c8) SHA1(2c6a10e768709d1937d9206970553f4101ce9016) ) // 19950414GROMCCap
|
||||
@ -646,8 +567,6 @@ ROM_START( galpani3k ) /* Some game text in Korean, but no "For use in Korea" ty
|
||||
ROM_END
|
||||
|
||||
|
||||
|
||||
|
||||
GAME( 1995, galpani3, 0, galpani3, galpani3, galpani3_state, 0, ROT90, "Kaneko", "Gals Panic 3 (Euro)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1995, galpani3j, galpani3, galpani3, galpani3, galpani3_state, 0, ROT90, "Kaneko", "Gals Panic 3 (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1995, galpani3k, galpani3, galpani3, galpani3, galpani3_state, 0, ROT90, "Kaneko", "Gals Panic 3 (Korea)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -14,43 +14,61 @@
|
||||
#include "emu.h"
|
||||
#include "kaneko_grap2.h"
|
||||
|
||||
ADDRESS_MAP_START(kaneko_grap2_device::grap2_map)
|
||||
AM_RANGE(0x000000, 0x0003ff) AM_READWRITE(unk1_r, unk1_w)
|
||||
AM_RANGE(0x000400, 0x000401) AM_WRITE(framebuffer1_scrollx_w)
|
||||
AM_RANGE(0x000800, 0x000bff) AM_READWRITE(unk2_r, unk2_w)
|
||||
AM_RANGE(0x000c00, 0x000c01) AM_WRITE(framebuffer1_scrolly_w)
|
||||
AM_RANGE(0x000c02, 0x000c03) AM_WRITE(framebuffer1_enable_w)
|
||||
AM_RANGE(0x000c06, 0x000c07) AM_WRITE(framebuffer1_bgcol_w)
|
||||
AM_RANGE(0x000c10, 0x000c11) AM_READWRITE(framebuffer1_fbbright1_r, framebuffer1_fbbright1_w )
|
||||
AM_RANGE(0x000c12, 0x000c13) AM_READWRITE(framebuffer1_fbbright2_r, framebuffer1_fbbright2_w )
|
||||
AM_RANGE(0x000c18, 0x000c1b) AM_WRITE(regs1_address_w)
|
||||
AM_RANGE(0x000c1c, 0x000c1d) AM_WRITE(regs2_w)
|
||||
AM_RANGE(0x000c1e, 0x000c1f) AM_WRITE(regs1_go_w)
|
||||
AM_RANGE(0x000c00, 0x000c1f) AM_READ(regs1_r)
|
||||
AM_RANGE(0x080000, 0x0801ff) AM_READWRITE( pal_r, framebuffer1_palette_w )
|
||||
AM_RANGE(0x100000, 0x17ffff) AM_READWRITE( framebuffer_r, framebuffer_w )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
DEFINE_DEVICE_TYPE(KANEKO_GRAP2, kaneko_grap2_device, "kaneko_grap2", "Kaneko GRAP2")
|
||||
|
||||
kaneko_grap2_device::kaneko_grap2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, KANEKO_GRAP2, tag, owner, clock)
|
||||
, m_palette(*this, finder_base::DUMMY_TAG)
|
||||
, device_rom_interface(mconfig, *this, 32) // TODO : Unknown Address Bits
|
||||
, m_palette(*this, "palette")
|
||||
{
|
||||
m_chipnum = 0;
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_START(kaneko_grap2_device::device_add_mconfig)
|
||||
MCFG_PALETTE_ADD("palette", 0x101)
|
||||
MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
void kaneko_grap2_device::device_start()
|
||||
{
|
||||
m_framebuffer = make_unique_clear<uint16_t[]>(0x80000/2);
|
||||
m_framebuffer_palette = make_unique_clear<uint16_t[]>(0x200/2);
|
||||
m_framebuffer_palette = make_unique_clear<uint16_t[]>(0x101); // 0x00-0xff is internal palette, 0x100 is background colour
|
||||
m_framebuffer_unk1 = make_unique_clear<uint16_t[]>(0x400/2);
|
||||
m_framebuffer_unk2 = make_unique_clear<uint16_t[]>(0x400/2);
|
||||
|
||||
save_pointer(NAME(m_framebuffer.get()), 0x80000/2);
|
||||
save_pointer(NAME(m_framebuffer_palette.get()), 0x200/2);
|
||||
save_pointer(NAME(m_framebuffer_palette.get()), 0x101);
|
||||
save_pointer(NAME(m_framebuffer_unk1.get()), 0x400/2);
|
||||
save_pointer(NAME(m_framebuffer_unk2.get()), 0x400/2);
|
||||
|
||||
save_item(NAME(m_framebuffer_bgcol));
|
||||
save_item(NAME(m_framebuffer_scrolly));
|
||||
save_item(NAME(m_framebuffer_scrollx));
|
||||
save_item(NAME(m_framebuffer_enable));
|
||||
save_item(NAME(m_regs1_i));
|
||||
save_item(NAME(m_regs2));
|
||||
save_item(NAME(m_framebuffer_bright1));
|
||||
save_item(NAME(m_framebuffer_bright2));
|
||||
save_item(NAME(m_regs1_address_regs[0x0]));
|
||||
save_item(NAME(m_regs1_address_regs[0x1]));
|
||||
|
||||
save_item(NAME(m_regs1_address_regs));
|
||||
}
|
||||
|
||||
void kaneko_grap2_device::device_reset()
|
||||
{
|
||||
m_framebuffer_bgcol = 0;
|
||||
m_framebuffer_scrolly = 0;
|
||||
m_framebuffer_scrollx = 0;
|
||||
m_framebuffer_enable = 0;
|
||||
@ -60,8 +78,11 @@ void kaneko_grap2_device::device_reset()
|
||||
m_framebuffer_bright2 = 0;
|
||||
}
|
||||
|
||||
void kaneko_grap2_device::rom_bank_updated()
|
||||
{
|
||||
}
|
||||
|
||||
READ16_MEMBER(kaneko_grap2_device::galpani3_regs1_r)
|
||||
READ16_MEMBER(kaneko_grap2_device::regs1_r)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
@ -76,7 +97,7 @@ READ16_MEMBER(kaneko_grap2_device::galpani3_regs1_r)
|
||||
}
|
||||
|
||||
default:
|
||||
logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space.device().tag(), space.device().safe_pcbase(), offset, mem_mask);
|
||||
logerror("cpu '%s' (PC=%06X): regs1_r %02x %04x\n", space.device().tag(), space.device().safe_pcbase(), offset, mem_mask);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -86,7 +107,7 @@ READ16_MEMBER(kaneko_grap2_device::galpani3_regs1_r)
|
||||
|
||||
|
||||
|
||||
void kaneko_grap2_device::gp3_do_rle(uint32_t address, uint16_t*framebuffer, uint8_t* rledata)
|
||||
void kaneko_grap2_device::do_rle(uint32_t address)
|
||||
{
|
||||
int rle_count = 0;
|
||||
int normal_count = 0;
|
||||
@ -98,7 +119,7 @@ void kaneko_grap2_device::gp3_do_rle(uint32_t address, uint16_t*framebuffer, uin
|
||||
{
|
||||
if (rle_count==0 && normal_count==0) // we need a new code byte
|
||||
{
|
||||
thebyte = rledata[address];
|
||||
thebyte = read_byte(address);
|
||||
|
||||
if ((thebyte & 0x80)) // stream of normal bytes follows
|
||||
{
|
||||
@ -113,8 +134,8 @@ void kaneko_grap2_device::gp3_do_rle(uint32_t address, uint16_t*framebuffer, uin
|
||||
}
|
||||
else if (rle_count)
|
||||
{
|
||||
thebyte = rledata[address];
|
||||
framebuffer[dstaddress] = thebyte;
|
||||
thebyte = read_byte(address);
|
||||
m_framebuffer[dstaddress] = thebyte;
|
||||
dstaddress++;
|
||||
rle_count--;
|
||||
|
||||
@ -125,8 +146,8 @@ void kaneko_grap2_device::gp3_do_rle(uint32_t address, uint16_t*framebuffer, uin
|
||||
}
|
||||
else if (normal_count)
|
||||
{
|
||||
thebyte = rledata[address];
|
||||
framebuffer[dstaddress] = thebyte;
|
||||
thebyte = read_byte(address);
|
||||
m_framebuffer[dstaddress] = thebyte;
|
||||
dstaddress++;
|
||||
normal_count--;
|
||||
address++;
|
||||
@ -137,30 +158,34 @@ void kaneko_grap2_device::gp3_do_rle(uint32_t address, uint16_t*framebuffer, uin
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(kaneko_grap2_device::galpani3_regs1_go_w)
|
||||
WRITE16_MEMBER(kaneko_grap2_device::regs1_go_w)
|
||||
{
|
||||
uint32_t address = m_regs1_address_regs[1]| (m_regs1_address_regs[0]<<16);
|
||||
uint8_t* rledata = memregion(":gfx2")->base();
|
||||
|
||||
// printf("galpani3_regs1_go_w? %08x\n",address );
|
||||
if ((data==0x2000) || (data==0x3000)) gp3_do_rle(address, m_framebuffer.get(), rledata);
|
||||
// printf("regs1_go_w? %08x\n",address );
|
||||
if ((data==0x2000) || (data==0x3000)) do_rle(address);
|
||||
}
|
||||
|
||||
|
||||
void kaneko_grap2_device::set_color_555_gp3(pen_t color, int rshift, int gshift, int bshift, uint16_t data)
|
||||
void kaneko_grap2_device::set_color_555(pen_t color, int rshift, int gshift, int bshift, uint16_t data)
|
||||
{
|
||||
m_palette->set_pen_color(color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(kaneko_grap2_device::galpani3_framebuffer1_palette_w)
|
||||
WRITE16_MEMBER(kaneko_grap2_device::framebuffer1_palette_w)
|
||||
{
|
||||
COMBINE_DATA(&m_framebuffer_palette[offset]);
|
||||
set_color_555_gp3(offset+0x4000 + (m_chipnum * 0x100), 5, 10, 0, m_framebuffer_palette[offset]);
|
||||
set_color_555(offset, 5, 10, 0, m_framebuffer_palette[offset]);
|
||||
}
|
||||
|
||||
/* definitely looks like a cycling bg colour used for the girls */
|
||||
WRITE16_MEMBER(kaneko_grap2_device::galpani3_framebuffer1_bgcol_w)
|
||||
WRITE16_MEMBER(kaneko_grap2_device::framebuffer1_bgcol_w)
|
||||
{
|
||||
COMBINE_DATA(&m_framebuffer_bgcol);
|
||||
set_color_555_gp3(offset+0x4300 + (m_chipnum), 5, 10, 0, m_framebuffer_bgcol);
|
||||
COMBINE_DATA(&m_framebuffer_palette[0x100]);
|
||||
set_color_555(0x100, 5, 10, 0, m_framebuffer_palette[0x100]);
|
||||
}
|
||||
|
||||
uint32_t kaneko_grap2_device::pen_r(int pen)
|
||||
{
|
||||
return m_palette->pens()[pen];
|
||||
}
|
||||
|
@ -6,41 +6,19 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#define GRAP2_AREA( _BASE, name ) \
|
||||
AM_RANGE(_BASE+0x000000, _BASE+0x0003ff) AM_DEVREADWRITE(name,kaneko_grap2_device,unk1_r, unk1_w ) \
|
||||
AM_RANGE(_BASE+0x000400, _BASE+0x000401) AM_DEVWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_scrollx_w) \
|
||||
AM_RANGE(_BASE+0x000800, _BASE+0x000bff) AM_DEVREADWRITE(name,kaneko_grap2_device, unk2_r, unk2_w ) \
|
||||
AM_RANGE(_BASE+0x000c00, _BASE+0x000c01) AM_DEVWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_scrolly_w) \
|
||||
AM_RANGE(_BASE+0x000c02, _BASE+0x000c03) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_framebuffer1_enable_w) \
|
||||
AM_RANGE(_BASE+0x000c06, _BASE+0x000c07) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_framebuffer1_bgcol_w) \
|
||||
AM_RANGE(_BASE+0x000c10, _BASE+0x000c11) AM_DEVREADWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_fbbright1_r, galpani3_framebuffer1_fbbright1_w ) \
|
||||
AM_RANGE(_BASE+0x000c12, _BASE+0x000c13) AM_DEVREADWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_fbbright2_r, galpani3_framebuffer1_fbbright2_w ) \
|
||||
AM_RANGE(_BASE+0x000c18, _BASE+0x000c1b) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_regs1_address_w) \
|
||||
AM_RANGE(_BASE+0x000c1e, _BASE+0x000c1f) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_regs1_go_w) \
|
||||
AM_RANGE(_BASE+0x000c00, _BASE+0x000c1f) AM_DEVREAD(name,kaneko_grap2_device,galpani3_regs1_r) \
|
||||
AM_RANGE(_BASE+0x080000, _BASE+0x0801ff) AM_DEVREADWRITE(name,kaneko_grap2_device, pal_r, galpani3_framebuffer1_palette_w ) \
|
||||
AM_RANGE(_BASE+0x100000, _BASE+0x17ffff) AM_DEVREADWRITE(name,kaneko_grap2_device, framebuffer_r, framebuffer_w )
|
||||
|
||||
|
||||
class kaneko_grap2_device : public device_t
|
||||
class kaneko_grap2_device : public device_t, public device_rom_interface
|
||||
{
|
||||
public:
|
||||
kaneko_grap2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
DECLARE_READ16_MEMBER(regs1_r);
|
||||
DECLARE_WRITE16_MEMBER(regs1_go_w);
|
||||
|
||||
void grap2_map(address_map &map);
|
||||
|
||||
int m_chipnum; // used to decide where we write the palette
|
||||
void do_rle(uint32_t address);
|
||||
void set_color_555(pen_t color, int rshift, int gshift, int bshift, uint16_t data);
|
||||
|
||||
void set_chipnum(int chipnum) { m_chipnum = chipnum; }
|
||||
void set_palette_tag(const char *tag) { m_palette.set_tag(tag); }
|
||||
|
||||
DECLARE_READ16_MEMBER(galpani3_regs1_r);
|
||||
DECLARE_WRITE16_MEMBER(galpani3_regs1_go_w);
|
||||
|
||||
|
||||
void gp3_do_rle(uint32_t address, uint16_t*framebuffer, uint8_t* rledata);
|
||||
void set_color_555_gp3(pen_t color, int rshift, int gshift, int bshift, uint16_t data);
|
||||
|
||||
uint16_t m_framebuffer_bgcol;
|
||||
uint16_t m_framebuffer_scrolly;
|
||||
uint16_t m_framebuffer_scrollx;
|
||||
uint16_t m_framebuffer_enable;
|
||||
@ -50,33 +28,37 @@ public:
|
||||
uint16_t m_framebuffer_bright2;
|
||||
|
||||
uint16_t m_regs1_address_regs[0x2];
|
||||
uint16_t m_regs2;
|
||||
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_enable_w) { m_framebuffer_enable = data; }
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_enable_w) { m_framebuffer_enable = data; }
|
||||
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_scrolly_w) { m_framebuffer_scrolly = data; }
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_scrollx_w) { m_framebuffer_scrollx = data; }
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_scrolly_w) { m_framebuffer_scrolly = data; }
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_scrollx_w) { m_framebuffer_scrollx = data; }
|
||||
|
||||
|
||||
DECLARE_READ16_MEMBER(galpani3_framebuffer1_fbbright1_r) { return m_framebuffer_bright1; }
|
||||
DECLARE_READ16_MEMBER(galpani3_framebuffer1_fbbright2_r) { return m_framebuffer_bright2; }
|
||||
DECLARE_READ16_MEMBER(framebuffer1_fbbright1_r) { return m_framebuffer_bright1; }
|
||||
DECLARE_READ16_MEMBER(framebuffer1_fbbright2_r) { return m_framebuffer_bright2; }
|
||||
|
||||
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_fbbright1_w) { COMBINE_DATA(&m_framebuffer_bright1); }
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_fbbright2_w) { COMBINE_DATA(&m_framebuffer_bright2); }
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_fbbright1_w) { COMBINE_DATA(&m_framebuffer_bright1); }
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_fbbright2_w) { COMBINE_DATA(&m_framebuffer_bright2); }
|
||||
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_bgcol_w);
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_bgcol_w);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(galpani3_regs1_address_w) { COMBINE_DATA(&m_regs1_address_regs[offset]); }
|
||||
DECLARE_WRITE16_MEMBER(regs1_address_w) { COMBINE_DATA(&m_regs1_address_regs[offset]); }
|
||||
DECLARE_WRITE16_MEMBER(regs2_w) { COMBINE_DATA(&m_regs2); }
|
||||
|
||||
DECLARE_READ16_MEMBER( framebuffer_r ) { return m_framebuffer[offset]; }
|
||||
DECLARE_WRITE16_MEMBER( framebuffer_w ) { COMBINE_DATA(&m_framebuffer[offset]); }
|
||||
DECLARE_READ16_MEMBER( pal_r ) { return m_framebuffer_palette[offset]; }
|
||||
DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_palette_w);
|
||||
DECLARE_WRITE16_MEMBER(framebuffer1_palette_w);
|
||||
DECLARE_READ16_MEMBER( unk1_r ) { return m_framebuffer_unk1[offset]; }
|
||||
DECLARE_WRITE16_MEMBER( unk1_w ) { COMBINE_DATA(&m_framebuffer_unk1[offset]); }
|
||||
DECLARE_READ16_MEMBER( unk2_r ) { return m_framebuffer_unk2[offset]; }
|
||||
DECLARE_WRITE16_MEMBER( unk2_w ) { COMBINE_DATA(&m_framebuffer_unk2[offset]); }
|
||||
|
||||
uint32_t pen_r(int pen);
|
||||
|
||||
std::unique_ptr<uint16_t[]> m_framebuffer;
|
||||
std::unique_ptr<uint16_t[]> m_framebuffer_palette;
|
||||
std::unique_ptr<uint16_t[]> m_framebuffer_unk1;
|
||||
@ -86,9 +68,12 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void rom_bank_updated() override;
|
||||
|
||||
private:
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
@ -96,10 +81,5 @@ private:
|
||||
|
||||
DECLARE_DEVICE_TYPE(KANEKO_GRAP2, kaneko_grap2_device)
|
||||
|
||||
#define MCFG_KANEKO_GRAP2_PALETTE(_palette_tag) \
|
||||
downcast<kaneko_grap2_device &>(*device).set_palette_tag("^" _palette_tag);
|
||||
#define MCFG_KANEKO_GRAP2_CHIPNUM(_chipnum) \
|
||||
downcast<kaneko_grap2_device &>(*device).set_chipnum(_chipnum);
|
||||
|
||||
|
||||
#endif // MAME_VIDEO_KANEKO_GRAP2_H
|
||||
|
Loading…
Reference in New Issue
Block a user