mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Declaring indirect colors in MCFG is now mandatory. Removed dynamic creation and resizing of indirection tables [Alex Jackson]
This commit is contained in:
parent
4394436886
commit
7d51048dc6
@ -96,12 +96,8 @@ void palette_device::static_enable_hilights(device_t &device)
|
||||
|
||||
void palette_device::set_indirect_color(int index, rgb_t rgb)
|
||||
{
|
||||
// if we have a static size, make sure we're in range
|
||||
assert(m_indirect_entries == 0 || index < m_indirect_entries);
|
||||
|
||||
// otherwise, ensure the array is expanded enough to handle the index
|
||||
while (m_indirect_colors.count() <= index)
|
||||
m_indirect_colors.append(rgb_t(0));
|
||||
// make sure we are in range
|
||||
assert(index < m_indirect_entries);
|
||||
|
||||
// alpha doesn't matter
|
||||
rgb.set_a(255);
|
||||
@ -125,15 +121,12 @@ void palette_device::set_indirect_color(int index, rgb_t rgb)
|
||||
|
||||
void palette_device::set_pen_indirect(pen_t pen, UINT16 index)
|
||||
{
|
||||
assert(pen < m_entries);
|
||||
// make sure we are in range
|
||||
assert(pen < m_entries && index < m_indirect_entries);
|
||||
|
||||
// allocate the array if needed
|
||||
m_indirect_pens.resize(m_entries);
|
||||
m_indirect_pens[pen] = index;
|
||||
|
||||
// permit drivers to configure the pens prior to the colors if they desire
|
||||
if (index < m_indirect_colors.count())
|
||||
m_palette->entry_set_color(pen, m_indirect_colors[index]);
|
||||
m_palette->entry_set_color(pen, m_indirect_colors[index]);
|
||||
}
|
||||
|
||||
|
||||
@ -312,7 +305,7 @@ inline void palette_device::update_for_write(offs_t byte_offset, int bytes_modif
|
||||
UINT32 data = m_paletteram.read(base + index);
|
||||
if (m_paletteram_ext.base() != NULL)
|
||||
data |= m_paletteram_ext.read(base + index) << (8 * bpe);
|
||||
set_pen_color(base + index, m_raw_to_rgb(data));
|
||||
m_palette->entry_set_color(base + index, m_raw_to_rgb(data));
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +412,10 @@ void palette_device::device_start()
|
||||
{
|
||||
m_indirect_colors.resize(m_indirect_entries);
|
||||
for (int color = 0; color < m_indirect_entries; color++)
|
||||
m_indirect_colors[color] = rgb_t(0);
|
||||
{
|
||||
// alpha = 0 ensures change is detected the first time set_indirect_color() is called
|
||||
m_indirect_colors[color] = rgb_t(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
m_indirect_pens.resize(m_entries);
|
||||
for (int pen = 0; pen < m_entries; pen++)
|
||||
@ -427,7 +423,7 @@ void palette_device::device_start()
|
||||
}
|
||||
}
|
||||
|
||||
// call the initialization helper if present (this will expand the indirection tables to full size)
|
||||
// call the initialization helper if present
|
||||
if (!m_init.isnull())
|
||||
m_init(*this);
|
||||
|
||||
@ -437,7 +433,7 @@ void palette_device::device_start()
|
||||
save_item(NAME(m_save_pen));
|
||||
save_item(NAME(m_save_contrast));
|
||||
|
||||
// save indirection tables if explicitly requested
|
||||
// save indirection tables if we have them
|
||||
if (m_indirect_entries > 0)
|
||||
{
|
||||
save_item(NAME(m_indirect_colors));
|
||||
|
@ -503,6 +503,7 @@ static MACHINE_CONFIG_START( mightguy, cop01_state )
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", cop01)
|
||||
MCFG_PALETTE_ADD("palette", 16+8*16+16*16)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(256)
|
||||
MCFG_PALETTE_INIT_OWNER(cop01_state, cop01)
|
||||
|
||||
/* sound hardware */
|
||||
|
@ -456,7 +456,7 @@ static MACHINE_CONFIG_START( gberetb, gberet_state )
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", gberetb)
|
||||
MCFG_PALETTE_ADD("palette", 2*16*16)
|
||||
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32)
|
||||
MCFG_PALETTE_INIT_OWNER(gberet_state,gberet)
|
||||
MCFG_VIDEO_START_OVERRIDE(gberet_state,gberet)
|
||||
|
||||
|
@ -396,7 +396,7 @@ UINT32 taitob_state::screen_update_taitob(screen_device &screen, bitmap_ind16 &b
|
||||
UINT32 taitob_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
address_space &space = machine().driver_data()->generic_space();
|
||||
const rgb_t *palette = m_palette->palette()->entry_list_adjusted();
|
||||
const pen_t *palette = m_palette->pens();
|
||||
UINT8 video_control = m_tc0180vcu->get_videoctrl(space, 0);
|
||||
int x, y;
|
||||
|
||||
|
@ -223,7 +223,7 @@ UINT32 toobin_state::screen_update_toobin(screen_device &screen, bitmap_rgb32 &b
|
||||
|
||||
/* draw and merge the MO */
|
||||
bitmap_ind16 &mobitmap = m_mob->bitmap();
|
||||
const rgb_t *palette = m_palette->palette()->entry_list_adjusted();
|
||||
const pen_t *palette = m_palette->pens();
|
||||
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
{
|
||||
UINT32 *dest = &bitmap.pix32(y);
|
||||
|
Loading…
Reference in New Issue
Block a user