mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
gstream : Add precalculated RGB Palette for X2222 drawing gfxs, Cleanup duplicates (#3370)
* gstream : Convert bitmap into bitmap_ind16, Cleanup duplicates * gstream.cpp : Fix compile * gstream.cpp : Revert "convert bitmap into ind16", Add precalculated rgb data for X2222 draw gfxs * gstream.cpp : Build fixes * gstream.cpp : More build fixes * gstream.cpp : Remove unneeded arguments of drawgfx_transpen_x2222
This commit is contained in:
parent
a1aeadbe3d
commit
6924f3cdc1
@ -399,7 +399,7 @@ void palette_device::palette_init_BBBBBGGGGGRRRRR(palette_device &palette)
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
RRRRR_GGGGGG_BBBBB -
|
||||
RRRRR_GGGGGG_BBBBB/BBBBB_GGGGGG_RRRRR -
|
||||
standard 5-6-5 palette for games using a
|
||||
16-bit color space
|
||||
-------------------------------------------------*/
|
||||
@ -412,6 +412,14 @@ void palette_device::palette_init_RRRRRGGGGGGBBBBB(palette_device &palette)
|
||||
palette.set_pen_color(i, rgbexpand<5,6,5>(i, 11, 5, 0));
|
||||
}
|
||||
|
||||
void palette_device::palette_init_BBBBBGGGGGGRRRRR(palette_device &palette)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x10000; i++)
|
||||
palette.set_pen_color(i, rgbexpand<5,6,5>(i, 0, 5, 11));
|
||||
}
|
||||
|
||||
rgb_t raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder(u32 raw)
|
||||
{
|
||||
u8 const i = (raw >> 15) & 1;
|
||||
|
@ -265,6 +265,10 @@
|
||||
MCFG_PALETTE_ADD(_tag, 65536) \
|
||||
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGGBBBBB), downcast<palette_device *>(device)));
|
||||
|
||||
#define MCFG_PALETTE_ADD_BBBBBGGGGGGRRRRR(_tag) \
|
||||
MCFG_PALETTE_ADD(_tag, 65536) \
|
||||
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_BBBBBGGGGGGRRRRR), downcast<palette_device *>(device)));
|
||||
|
||||
|
||||
// other standard palettes
|
||||
#define MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS(_tag, _region, _entries) \
|
||||
@ -413,6 +417,7 @@ public:
|
||||
void palette_init_RRRRRGGGGGBBBBB(palette_device &palette);
|
||||
void palette_init_BBBBBGGGGGRRRRR(palette_device &palette);
|
||||
void palette_init_RRRRRGGGGGGBBBBB(palette_device &palette);
|
||||
void palette_init_BBBBBGGGGGGRRRRR(palette_device &palette);
|
||||
|
||||
// helper to update palette when data changed
|
||||
void update() { if (!m_init.isnull()) m_init(*this); }
|
||||
|
@ -143,22 +143,20 @@ class gstream_state : public driver_device
|
||||
{
|
||||
public:
|
||||
gstream_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_oki_1(*this, "oki1"),
|
||||
m_oki_2(*this, "oki2") ,
|
||||
m_workram(*this, "workram"),
|
||||
m_vram(*this, "vram"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_oki(*this, "oki%u", 1)
|
||||
, m_workram(*this, "workram")
|
||||
, m_vram(*this, "vram")
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_palette(*this, "palette")
|
||||
{
|
||||
m_toggle = 0;
|
||||
}
|
||||
|
||||
/* devices */
|
||||
required_device<e132xt_device> m_maincpu;
|
||||
required_device<okim6295_device> m_oki_1;
|
||||
optional_device<okim6295_device> m_oki_2;
|
||||
optional_device_array<okim6295_device, 2> m_oki;
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint32_t> m_workram;
|
||||
@ -166,26 +164,17 @@ public:
|
||||
// uint32_t * m_nvram; // currently this uses generic nvram handling
|
||||
|
||||
/* video-related */
|
||||
uint32_t m_tmap1_scrollx;
|
||||
uint32_t m_tmap2_scrollx;
|
||||
uint32_t m_tmap3_scrollx;
|
||||
uint32_t m_tmap1_scrolly;
|
||||
uint32_t m_tmap2_scrolly;
|
||||
uint32_t m_tmap3_scrolly;
|
||||
uint32_t m_scrollx[3];
|
||||
uint32_t m_scrolly[3];
|
||||
|
||||
/* misc */
|
||||
int m_oki_bank_1;
|
||||
int m_oki_bank_2;
|
||||
int m_oki_bank[2];
|
||||
int m_toggle;
|
||||
int m_xoffset;
|
||||
|
||||
DECLARE_WRITE32_MEMBER(gstream_vram_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap1_scrollx_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap1_scrolly_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap2_scrollx_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap2_scrolly_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap3_scrollx_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_tilemap3_scrolly_w);
|
||||
DECLARE_WRITE32_MEMBER(vram_w);
|
||||
template<int Layer> DECLARE_WRITE16_MEMBER(scrollx_w);
|
||||
template<int Layer> DECLARE_WRITE16_MEMBER(scrolly_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_oki_banking_w);
|
||||
DECLARE_WRITE32_MEMBER(gstream_oki_4040_w);
|
||||
DECLARE_WRITE32_MEMBER(x2222_sound_w);
|
||||
@ -200,8 +189,10 @@ public:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_gstream(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void draw_bg_gstream(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xscrl, int yscrl, int map, uint32_t* ram, int palbase);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void draw_bg(bitmap_rgb32 &bitmap, const rectangle &cliprect, int map, uint32_t* ram);
|
||||
void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,gfx_element *gfx2,
|
||||
uint32_t code, int flipx, int flipy, int32_t destx, int32_t desty);
|
||||
|
||||
void rearrange_sprite_data(uint8_t* ROM, uint32_t* NEW, uint32_t* NEW2);
|
||||
void rearrange_tile_data(uint8_t* ROM, uint32_t* NEW, uint32_t* NEW2);
|
||||
@ -253,56 +244,38 @@ CUSTOM_INPUT_MEMBER(gstream_state::gstream_mirror_r)
|
||||
|
||||
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_vram_w)
|
||||
WRITE32_MEMBER(gstream_state::vram_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram[offset]);
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap1_scrollx_w)
|
||||
template<int Layer>
|
||||
WRITE16_MEMBER(gstream_state::scrollx_w)
|
||||
{
|
||||
m_tmap1_scrollx = data;
|
||||
m_scrollx[Layer] = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap1_scrolly_w)
|
||||
template<int Layer>
|
||||
WRITE16_MEMBER(gstream_state::scrolly_w)
|
||||
{
|
||||
m_tmap1_scrolly = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap2_scrollx_w)
|
||||
{
|
||||
m_tmap2_scrollx = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap2_scrolly_w)
|
||||
{
|
||||
m_tmap2_scrolly = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap3_scrollx_w)
|
||||
{
|
||||
m_tmap3_scrollx = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_tilemap3_scrolly_w)
|
||||
{
|
||||
m_tmap3_scrolly = data;
|
||||
m_scrolly[Layer] = data;
|
||||
}
|
||||
|
||||
void gstream_state::gstream_32bit_map(address_map &map)
|
||||
{
|
||||
map(0x00000000, 0x003FFFFF).ram().share("workram"); // work ram
|
||||
// AM_RANGE(0x40000000, 0x40FFFFFF) AM_RAM // ?? lots of data gets copied here if present, but game runs without it??
|
||||
map(0x80000000, 0x80003FFF).ram().w(this, FUNC(gstream_state::gstream_vram_w)).share("vram"); // video ram
|
||||
map(0x4E000000, 0x4E1FFFFF).rom().region("user2", 0); // main game rom
|
||||
map(0x4F000000, 0x4F000003).w(this, FUNC(gstream_state::gstream_tilemap3_scrollx_w));
|
||||
map(0x4F200000, 0x4F200003).w(this, FUNC(gstream_state::gstream_tilemap3_scrolly_w));
|
||||
map(0x4F400000, 0x4F406FFF).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
|
||||
map(0x4F800000, 0x4F800003).w(this, FUNC(gstream_state::gstream_tilemap1_scrollx_w));
|
||||
map(0x4FA00000, 0x4FA00003).w(this, FUNC(gstream_state::gstream_tilemap1_scrolly_w));
|
||||
map(0x4FC00000, 0x4FC00003).w(this, FUNC(gstream_state::gstream_tilemap2_scrollx_w));
|
||||
map(0x4FE00000, 0x4FE00003).w(this, FUNC(gstream_state::gstream_tilemap2_scrolly_w));
|
||||
map(0xFFC00000, 0xFFC01FFF).ram().share("nvram"); // Backup RAM
|
||||
map(0xFFF80000, 0xFFFFFFFF).rom().region("user1", 0); // boot rom
|
||||
map(0x00000000, 0x003fffff).ram().share("workram"); // work ram
|
||||
// map(0x40000000, 0x40ffffff).ram(); // ?? lots of data gets copied here if present, but game runs without it??
|
||||
map(0x80000000, 0x80003fff).ram().w(this, FUNC(gstream_state::vram_w)).share("vram"); // video ram
|
||||
map(0x4E000000, 0x4e1fffff).rom().region("maindata", 0); // main game rom
|
||||
map(0x4f000000, 0x4f000003).w(this, FUNC(gstream_state::scrollx_w<2>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4f200000, 0x4f200003).w(this, FUNC(gstream_state::scrolly_w<2>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4f400000, 0x4f406fff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
|
||||
map(0x4f800000, 0x4f800003).w(this, FUNC(gstream_state::scrollx_w<0>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4fa00000, 0x4fa00003).w(this, FUNC(gstream_state::scrolly_w<0>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4fc00000, 0x4fc00003).w(this, FUNC(gstream_state::scrollx_w<1>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4fe00000, 0x4fe00003).w(this, FUNC(gstream_state::scrolly_w<1>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0xffc00000, 0xffc01fff).ram().share("nvram"); // Backup RAM
|
||||
map(0xfff80000, 0xffffffff).rom().region("maincpu", 0); // boot rom
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::gstream_oki_banking_w)
|
||||
@ -355,13 +328,13 @@ WRITE32_MEMBER(gstream_state::gstream_oki_banking_w)
|
||||
|
||||
*/
|
||||
|
||||
m_oki_bank_1 = ((BIT(data, 6) & ~BIT(data, 7)) << 1) | (BIT(data, 2) & BIT(data, 3));
|
||||
m_oki_bank_2 = ((BIT(data, 4) & ~BIT(data, 5)) << 1) | (BIT(data, 0) & BIT(data, 1));
|
||||
m_oki_bank[0] = ((BIT(data, 6) & ~BIT(data, 7)) << 1) | (BIT(data, 2) & BIT(data, 3));
|
||||
m_oki_bank[1] = ((BIT(data, 4) & ~BIT(data, 5)) << 1) | (BIT(data, 0) & BIT(data, 1));
|
||||
|
||||
//popmessage("oki bank = %X\noki_1 = %X\noki_2 = %X\n",data, m_oki_bank_1, m_oki_bank_2);
|
||||
//popmessage("oki bank = %X\noki_1 = %X\noki_2 = %X\n",data, m_oki_bank[0], m_oki_bank[1]);
|
||||
|
||||
m_oki_1->set_rom_bank(m_oki_bank_1);
|
||||
m_oki_2->set_rom_bank(m_oki_bank_2);
|
||||
m_oki[0]->set_rom_bank(m_oki_bank[0]);
|
||||
m_oki[1]->set_rom_bank(m_oki_bank[1]);
|
||||
}
|
||||
|
||||
// Some clocking?
|
||||
@ -377,28 +350,28 @@ void gstream_state::gstream_io(address_map &map)
|
||||
map(0x4020, 0x4023).portr("IN2"); // extra coin switches etc
|
||||
map(0x4030, 0x4033).w(this, FUNC(gstream_state::gstream_oki_banking_w)); // oki banking
|
||||
map(0x4040, 0x4043).w(this, FUNC(gstream_state::gstream_oki_4040_w)); // some clocking?
|
||||
map(0x4053, 0x4053).rw(m_oki_1, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // music and samples
|
||||
map(0x4063, 0x4063).rw(m_oki_2, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // music and samples
|
||||
map(0x4053, 0x4053).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // music and samples
|
||||
map(0x4063, 0x4063).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // music and samples
|
||||
}
|
||||
|
||||
|
||||
void gstream_state::x2222_32bit_map(address_map &map)
|
||||
{
|
||||
map(0x00000000, 0x003FFFFF).ram().share("workram"); // work ram
|
||||
map(0x00000000, 0x003fffff).ram().share("workram"); // work ram
|
||||
map(0x40000000, 0x403fffff).ram(); // ?? data gets copied here if present, but game runs without it??
|
||||
map(0x80000000, 0x80003FFF).ram().w(this, FUNC(gstream_state::gstream_vram_w)).share("vram"); // video ram
|
||||
map(0x80000000, 0x80003fff).ram().w(this, FUNC(gstream_state::vram_w)).share("vram"); // video ram
|
||||
|
||||
map(0x4Fc00000, 0x4Fc00003).w(this, FUNC(gstream_state::gstream_tilemap2_scrolly_w));
|
||||
map(0x4Fd00000, 0x4Fd00003).w(this, FUNC(gstream_state::gstream_tilemap2_scrollx_w));
|
||||
map(0x4fc00000, 0x4fc00003).w(this, FUNC(gstream_state::scrolly_w<1>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4fd00000, 0x4fd00003).w(this, FUNC(gstream_state::scrollx_w<1>)).umask32(0xffff0000).cswidth(32);
|
||||
|
||||
map(0x4Fa00000, 0x4Fa00003).w(this, FUNC(gstream_state::gstream_tilemap3_scrolly_w));
|
||||
map(0x4Fb00000, 0x4Fb00003).w(this, FUNC(gstream_state::gstream_tilemap3_scrollx_w));
|
||||
map(0x4fa00000, 0x4fa00003).w(this, FUNC(gstream_state::scrolly_w<2>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4fb00000, 0x4fb00003).w(this, FUNC(gstream_state::scrollx_w<2>)).umask32(0xffff0000).cswidth(32);
|
||||
|
||||
map(0x4Fe00000, 0x4Fe00003).w(this, FUNC(gstream_state::gstream_tilemap1_scrolly_w));
|
||||
map(0x4Ff00000, 0x4Ff00003).w(this, FUNC(gstream_state::gstream_tilemap1_scrollx_w));
|
||||
map(0x4fe00000, 0x4fe00003).w(this, FUNC(gstream_state::scrolly_w<0>)).umask32(0xffff0000).cswidth(32);
|
||||
map(0x4ff00000, 0x4ff00003).w(this, FUNC(gstream_state::scrollx_w<0>)).umask32(0xffff0000).cswidth(32);
|
||||
|
||||
map(0xFFC00000, 0xFFC01FFF).ram().share("nvram"); // Backup RAM (maybe)
|
||||
map(0xFFF00000, 0xFFFFFFFF).rom().region("user1", 0); // boot rom
|
||||
map(0xffc00000, 0xffc01fff).ram().share("nvram"); // Backup RAM (maybe)
|
||||
map(0xfff00000, 0xffffffff).rom().region("maincpu", 0); // boot rom
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(gstream_state::x2222_sound_w)
|
||||
@ -553,10 +526,10 @@ static const gfx_layout layout16x16 =
|
||||
16,16,
|
||||
RGN_FRAC(1,1),
|
||||
8,
|
||||
{ 0,1,2,3,4,5,6,7 },
|
||||
{ 0,8,16,24, 32,40,48,56, 64,72,80,88 ,96,104,112,120 },
|
||||
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128,9*128,10*128,11*128,12*128,13*128,14*128,15*128 },
|
||||
16*128,
|
||||
{ STEP8(0,1) },
|
||||
{ STEP16(0,8) },
|
||||
{ STEP16(0,8*16) },
|
||||
16*16*8,
|
||||
};
|
||||
|
||||
|
||||
@ -565,24 +538,17 @@ static const gfx_layout layout32x32 =
|
||||
32,32,
|
||||
RGN_FRAC(1,1),
|
||||
8,
|
||||
{ 0,1,2,3,4,5,6,7 },
|
||||
{ 0, 8, 16, 24, 32, 40, 48, 56,
|
||||
64, 72, 80, 88, 96, 104, 112, 120,
|
||||
128, 136, 144, 152, 160, 168, 176, 184,
|
||||
192, 200, 208, 216, 224, 232, 240, 248 },
|
||||
{ 0*256, 1*256, 2*256, 3*256, 4*256, 5*256, 6*256, 7*256,
|
||||
8*256, 9*256, 10*256, 11*256, 12*256, 13*256, 14*256, 15*256,
|
||||
16*256, 17*256, 18*256, 19*256, 20*256, 21*256, 22*256, 23*256,
|
||||
24*256, 25*256, 26*256, 27*256, 28*256, 29*256, 30*256, 31*256,
|
||||
},
|
||||
32*256,
|
||||
{ STEP8(0,1) },
|
||||
{ STEP32(0,8) },
|
||||
{ STEP32(0,8*32) },
|
||||
32*32*8,
|
||||
};
|
||||
|
||||
static GFXDECODE_START( gstream )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, layout32x32, 0, 0x80 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, layout32x32, 0, 0x80 )
|
||||
GFXDECODE_ENTRY( "gfx4", 0, layout32x32, 0, 0x80 )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, layout16x16, 0, 0x80 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, layout32x32, 0x1000, 4 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, layout32x32, 0x1400, 4 )
|
||||
GFXDECODE_ENTRY( "gfx4", 0, layout32x32, 0x1800, 4 )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, layout16x16, 0, 32 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
@ -603,14 +569,13 @@ void gstream_state::video_start()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// custom drawgfx function for x2222 to draw RGB data instead of indexed data, needed because our regular drawgfx and tilemap code don't support that
|
||||
void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,gfx_element *gfx2,
|
||||
uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty,
|
||||
uint32_t transpen)
|
||||
void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,gfx_element *gfx2,
|
||||
uint32_t code, int flipx, int flipy, int32_t destx, int32_t desty)
|
||||
{
|
||||
// use pen usage to optimize
|
||||
code %= gfx->elements();
|
||||
const pen_t *rgb = m_palette->pens(); // 16 bit BGR
|
||||
|
||||
// render
|
||||
|
||||
@ -689,33 +654,27 @@ void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_e
|
||||
srcdata += srcy * gfx->rowbytes() + srcx;
|
||||
srcdata2 += srcy * gfx->rowbytes() + srcx;
|
||||
|
||||
/* non-flipped 8bpp case */
|
||||
/* non-flipped 16bpp case */
|
||||
if (!flipx)
|
||||
{
|
||||
/* iterate over pixels in Y */
|
||||
for (cury = desty; cury <= destendy; cury++)
|
||||
{
|
||||
uint32_t *destptr = &dest.pixt<uint32_t>(cury, destx);
|
||||
uint32_t *destptr = &dest.pix32(cury, destx);
|
||||
const uint8_t *srcptr = srcdata;
|
||||
const uint8_t *srcptr2 = srcdata2;
|
||||
srcdata += dy;
|
||||
srcdata2 += dy;
|
||||
|
||||
|
||||
|
||||
/* iterate over leftover pixels */
|
||||
for (curx = 0; curx < leftovers; curx++)
|
||||
{
|
||||
uint32_t srcdata = (srcptr[0]);
|
||||
uint32_t srcdata2 = (srcptr2[0]);
|
||||
|
||||
uint32_t fullval = (srcdata | (srcdata2 << 8));
|
||||
uint32_t r = ((fullval >> 0) & 0x1f) << 3;
|
||||
uint32_t g = ((fullval >> 5) & 0x3f) << 2;
|
||||
uint32_t b = ((fullval >> 11) & 0x1f) << 3;
|
||||
uint32_t full = (r << 16) | (g << 8) | (b << 0);
|
||||
uint16_t full = (srcdata | (srcdata2 << 8));
|
||||
if (full != 0)
|
||||
destptr[0] = full;
|
||||
destptr[0] = rgb[full];
|
||||
|
||||
srcptr++;
|
||||
srcptr2++;
|
||||
@ -724,13 +683,13 @@ void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_e
|
||||
}
|
||||
}
|
||||
|
||||
/* flipped 8bpp case */
|
||||
/* flipped 16bpp case */
|
||||
else
|
||||
{
|
||||
/* iterate over pixels in Y */
|
||||
for (cury = desty; cury <= destendy; cury++)
|
||||
{
|
||||
uint32_t *destptr = &dest.pixt<uint32_t>(cury, destx);
|
||||
uint32_t *destptr = &dest.pix32(cury, destx);
|
||||
const uint8_t *srcptr = srcdata;
|
||||
const uint8_t *srcptr2 = srcdata2;
|
||||
|
||||
@ -743,13 +702,9 @@ void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_e
|
||||
uint32_t srcdata = (srcptr[0]);
|
||||
uint32_t srcdata2 = (srcptr2[0]);
|
||||
|
||||
uint32_t fullval = (srcdata | (srcdata2 << 8));
|
||||
uint32_t r = ((fullval >> 0) & 0x1f) << 3;
|
||||
uint32_t g = ((fullval >> 5) & 0x3f) << 2;
|
||||
uint32_t b = ((fullval >> 11) & 0x1f) << 3;
|
||||
uint32_t full = (r << 16) | (g << 8) | (b << 0);
|
||||
uint16_t full = (srcdata | (srcdata2 << 8));
|
||||
if (full != 0)
|
||||
destptr[0] = full;
|
||||
destptr[0] = rgb[full];
|
||||
|
||||
srcptr--;
|
||||
srcptr2--;
|
||||
@ -762,13 +717,13 @@ void drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_e
|
||||
} while (0);
|
||||
}
|
||||
|
||||
void gstream_state::draw_bg_gstream(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xscrl, int yscrl, int map, uint32_t* ram, int palbase )
|
||||
void gstream_state::draw_bg(bitmap_rgb32 &bitmap, const rectangle &cliprect, int map, uint32_t* ram )
|
||||
{
|
||||
int scrollx;
|
||||
int scrolly;
|
||||
|
||||
scrollx = xscrl&0x1ff;
|
||||
scrolly = yscrl&0x1ff;
|
||||
scrollx = m_scrollx[map]&0x1ff;
|
||||
scrolly = m_scrolly[map]&0x1ff;
|
||||
|
||||
uint16_t basey = scrolly>>5;
|
||||
for (int y=0;y<13;y++)
|
||||
@ -776,14 +731,12 @@ void gstream_state::draw_bg_gstream(bitmap_rgb32 &bitmap, const rectangle &clipr
|
||||
uint16_t basex = scrollx>>5;
|
||||
for (int x=0;x<16;x++)
|
||||
{
|
||||
int vram_data = (ram[(basex&0x0f)+((basey&0x0f)*0x10)]);
|
||||
int pal = (vram_data & 0xc0000000) >> 30;
|
||||
int code = (vram_data & 0x0fff0000) >> 16;
|
||||
|
||||
pal += palbase;
|
||||
int vram_data = (ram[(basex&0x0f)+((basey&0x0f)*0x10)]) >> 16;
|
||||
int pal = (vram_data & 0xc000) >> 14;
|
||||
int code = (vram_data & 0x0fff);
|
||||
|
||||
if (m_gfxdecode->gfx(map+5))
|
||||
drawgfx_transpen_x2222(bitmap,cliprect,m_gfxdecode->gfx(map),m_gfxdecode->gfx(map+5),code,0,0,0,(x*32)-(scrollx&0x1f)-m_xoffset,(y*32)-(scrolly&0x1f),0);
|
||||
drawgfx_transpen_x2222(bitmap,cliprect,m_gfxdecode->gfx(map),m_gfxdecode->gfx(map+5),code,0,0,(x*32)-(scrollx&0x1f)-m_xoffset,(y*32)-(scrolly&0x1f));
|
||||
else
|
||||
m_gfxdecode->gfx(map)->transpen(bitmap,cliprect,code,pal,0,0,(x*32)-(scrollx&0x1f)-m_xoffset,(y*32)-(scrolly&0x1f),0);
|
||||
|
||||
@ -793,7 +746,7 @@ void gstream_state::draw_bg_gstream(bitmap_rgb32 &bitmap, const rectangle &clipr
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t gstream_state::screen_update_gstream(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
uint32_t gstream_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/* The tilemaps and sprite are interleaved together.
|
||||
Even Words are tilemap tiles
|
||||
@ -814,13 +767,13 @@ uint32_t gstream_state::screen_update_gstream(screen_device &screen, bitmap_rgb3
|
||||
|
||||
int i;
|
||||
|
||||
//popmessage("(1) %08x %08x (2) %08x %08x (3) %08x %08x", m_tmap1_scrollx, m_tmap1_scrolly, m_tmap2_scrollx, m_tmap2_scrolly, m_tmap3_scrollx, m_tmap3_scrolly );
|
||||
//popmessage("(1) %08x %08x (2) %08x %08x (3) %08x %08x", m_scrollx[0], m_scrolly[0], m_scrollx[1], m_scrolly[1], m_scrollx[2], m_scrolly[2] );
|
||||
bitmap.fill(0,cliprect);
|
||||
|
||||
|
||||
draw_bg_gstream(bitmap, cliprect, m_tmap3_scrollx >> 16, m_tmap3_scrolly >> 16, 2, m_vram + 0x800/4, 0x18);
|
||||
draw_bg_gstream(bitmap, cliprect, m_tmap2_scrollx >> 16, m_tmap2_scrolly >> 16, 1, m_vram + 0x400/4, 0x14);
|
||||
draw_bg_gstream(bitmap, cliprect, m_tmap1_scrollx >> 16, m_tmap1_scrolly >> 16, 0, m_vram + 0x000/4, 0x10); // move on top for x2222 , check
|
||||
draw_bg(bitmap, cliprect, 2, m_vram + 0x800/4);
|
||||
draw_bg(bitmap, cliprect, 1, m_vram + 0x400/4);
|
||||
draw_bg(bitmap, cliprect, 0, m_vram + 0x000/4); // move on top for x2222 , check
|
||||
|
||||
|
||||
for (i = 0x0000 / 4; i < 0x4000 / 4; i += 4)
|
||||
@ -833,10 +786,10 @@ uint32_t gstream_state::screen_update_gstream(screen_device &screen, bitmap_rgb3
|
||||
|
||||
if (m_gfxdecode->gfx(4))
|
||||
{
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, col, 0, 0, x - m_xoffset, y, 0);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, col, 0, 0, x - m_xoffset, y-0x100, 0);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, col, 0, 0, x - m_xoffset - 0x200, y, 0);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, col, 0, 0, x - m_xoffset - 0x200 , y-0x100, 0);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, 0, 0, x - m_xoffset, y);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, 0, 0, x - m_xoffset, y-0x100);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, 0, 0, x - m_xoffset - 0x200, y);
|
||||
drawgfx_transpen_x2222(bitmap, cliprect, m_gfxdecode->gfx(3), m_gfxdecode->gfx(4), code, 0, 0, x - m_xoffset - 0x200 , y-0x100);
|
||||
|
||||
}
|
||||
else
|
||||
@ -854,26 +807,20 @@ uint32_t gstream_state::screen_update_gstream(screen_device &screen, bitmap_rgb3
|
||||
|
||||
void gstream_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_tmap1_scrollx));
|
||||
save_item(NAME(m_tmap2_scrollx));
|
||||
save_item(NAME(m_tmap3_scrollx));
|
||||
save_item(NAME(m_tmap1_scrolly));
|
||||
save_item(NAME(m_tmap2_scrolly));
|
||||
save_item(NAME(m_tmap3_scrolly));
|
||||
save_item(NAME(m_oki_bank_1));
|
||||
save_item(NAME(m_oki_bank_2));
|
||||
save_item(NAME(m_scrollx));
|
||||
save_item(NAME(m_scrolly));
|
||||
save_item(NAME(m_oki_bank));
|
||||
}
|
||||
|
||||
void gstream_state::machine_reset()
|
||||
{
|
||||
m_tmap1_scrollx = 0;
|
||||
m_tmap2_scrollx = 0;
|
||||
m_tmap3_scrollx = 0;
|
||||
m_tmap1_scrolly = 0;
|
||||
m_tmap2_scrolly = 0;
|
||||
m_tmap3_scrolly = 0;
|
||||
m_oki_bank_1 = 0;
|
||||
m_oki_bank_2 = 0;
|
||||
m_scrollx[0] = 0;
|
||||
m_scrollx[1] = 0;
|
||||
m_scrollx[2] = 0;
|
||||
m_scrolly[0] = 0;
|
||||
m_scrolly[1] = 0;
|
||||
m_scrolly[2] = 0;
|
||||
m_oki_bank[0] = m_oki_bank[1] = 0;
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_START(gstream_state::gstream)
|
||||
@ -893,15 +840,13 @@ MACHINE_CONFIG_START(gstream_state::gstream)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(320, 240)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update_gstream)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update)
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 0x1000 + 0x400 + 0x400 + 0x400) // sprites + 3 bg layers
|
||||
MCFG_PALETTE_FORMAT(BBBBBGGGGGGRRRRR)
|
||||
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", gstream)
|
||||
|
||||
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_OKIM6295_ADD("oki1", 1000000, PIN7_HIGH) /* 1 Mhz? */
|
||||
@ -919,7 +864,6 @@ MACHINE_CONFIG_START(gstream_state::x2222)
|
||||
MCFG_CPU_IO_MAP(x2222_io)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", gstream_state, irq0_line_hold)
|
||||
|
||||
|
||||
// MCFG_NVRAM_ADD_1FILL("nvram")
|
||||
|
||||
/* video hardware */
|
||||
@ -928,9 +872,10 @@ MACHINE_CONFIG_START(gstream_state::x2222)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(320, 240)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update_gstream)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update)
|
||||
|
||||
MCFG_PALETTE_ADD_BBBBBGGGGGGRRRRR("palette")
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 0x1000 + 0x400 + 0x400 + 0x400) // doesn't use a palette, but keep fake gfxdecode happy
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", x2222)
|
||||
|
||||
// unknown sound hw (no sound roms dumped)
|
||||
@ -943,10 +888,10 @@ MACHINE_CONFIG_END
|
||||
|
||||
|
||||
ROM_START( gstream )
|
||||
ROM_REGION32_BE( 0x80000, "user1", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_REGION32_BE( 0x80000, "maincpu", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_LOAD( "gs_prg_01.u56", 0x000000, 0x080000, CRC(0d0c6a38) SHA1(a810bfc1c9158cccc37710d0ea7268e26e520cc2) )
|
||||
|
||||
ROM_REGION32_BE( 0x200000, "user2", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_REGION32_BE( 0x200000, "maindata", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_LOAD16_WORD_SWAP( "gs_prg_02.u197", 0x000000, 0x200000, CRC(2f8a6bea) SHA1(c0a32838f4bd8599f09002139f87562db625c1c5) )
|
||||
|
||||
ROM_REGION( 0x1000000, "gfx1", 0 ) /* sprite tiles (16x16x8) */
|
||||
@ -987,7 +932,7 @@ ROM_END
|
||||
|
||||
|
||||
ROM_START( x2222 )
|
||||
ROM_REGION32_BE( 0x100000, "user1", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_REGION32_BE( 0x100000, "maincpu", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_LOAD( "test.bin", 0x000000, 0x100000, CRC(6260421e) SHA1(095e955d029e98e024d4ec5c7f93a6d4845a92a0) ) // final version - but debug enabled, values on screen, maybe there's a flag in the ROM we can turn off?
|
||||
|
||||
ROM_REGION32_BE( 0x0200000, "misc", 0 ) /* other code */
|
||||
@ -1049,7 +994,7 @@ ROM_END
|
||||
|
||||
|
||||
ROM_START( x2222o )
|
||||
ROM_REGION32_BE( 0x100000, "user1", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_REGION32_BE( 0x100000, "maincpu", 0 ) /* Hyperstone CPU Code */
|
||||
ROM_LOAD( "older.bin", 0x080000, 0x080000, CRC(d12817bc) SHA1(2458f9d9020598a1646dfc848fddd323eebc5120) )
|
||||
|
||||
ROM_REGION32_BE( 0x0200000, "misc", 0 ) /* other code */
|
||||
|
Loading…
Reference in New Issue
Block a user