Fixed pmd85 regression, nw. Also replaced a fail-safe in src/lib/util/palette.cpp with an assert. Expect regressions, so better to get it out of the way now. nw

This commit is contained in:
mooglyguy 2018-08-30 23:40:24 +02:00
parent 3bdb63715d
commit bb32d72c7e
2 changed files with 29 additions and 15 deletions

View File

@ -348,10 +348,12 @@ void palette_t::set_gamma(float gamma)
void palette_t::entry_set_color(uint32_t index, rgb_t rgb)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index] == rgb)
// if unchanged, ignore
if (m_entry_color[index] == rgb)
return;
assert(index < m_numcolors);
// set the color
m_entry_color[index] = rgb;
@ -368,10 +370,12 @@ void palette_t::entry_set_color(uint32_t index, rgb_t rgb)
void palette_t::entry_set_red_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].r() == level)
// if unchanged, ignore
if (m_entry_color[index].r() == level)
return;
assert(index < m_numcolors);
// set the level
m_entry_color[index].set_r(level);
@ -388,10 +392,12 @@ void palette_t::entry_set_red_level(uint32_t index, uint8_t level)
void palette_t::entry_set_green_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].g() == level)
// if unchanged, ignore
if (m_entry_color[index].g() == level)
return;
assert(index < m_numcolors);
// set the level
m_entry_color[index].set_g(level);
@ -408,10 +414,12 @@ void palette_t::entry_set_green_level(uint32_t index, uint8_t level)
void palette_t::entry_set_blue_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].b() == level)
// if unchanged, ignore
if (m_entry_color[index].b() == level)
return;
assert(index < m_numcolors);
// set the level
m_entry_color[index].set_b(level);
@ -428,10 +436,12 @@ void palette_t::entry_set_blue_level(uint32_t index, uint8_t level)
void palette_t::entry_set_contrast(uint32_t index, float contrast)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_contrast[index] == contrast)
// if unchanged, ignore
if (m_entry_contrast[index] == contrast)
return;
assert(index < m_numcolors);
// set the contrast
m_entry_contrast[index] = contrast;
@ -451,8 +461,10 @@ void palette_t::group_set_brightness(uint32_t group, float brightness)
// convert incoming value to normalized result
brightness = (brightness - 1.0f) * 256.0f;
// if out of range, or unchanged, ignore
if (group >= m_numgroups || m_group_bright[group] == brightness)
assert(group < m_numgroups);
// if unchanged, ignore
if (m_group_bright[group] == brightness)
return;
// set the contrast
@ -471,10 +483,12 @@ void palette_t::group_set_brightness(uint32_t group, float brightness)
void palette_t::group_set_contrast(uint32_t group, float contrast)
{
// if out of range, or unchanged, ignore
if (group >= m_numgroups || m_group_contrast[group] == contrast)
// if unchanged, ignore
if (m_group_contrast[group] == contrast)
return;
assert(group < m_numgroups);
// set the contrast
m_group_contrast[group] = contrast;

View File

@ -624,7 +624,7 @@ void pmd85_state::pmd85(machine_config &config, bool with_uart)
screen.set_screen_update(FUNC(pmd85_state::screen_update_pmd85));
screen.set_palette("palette");
PALETTE(config, m_palette, 2);
PALETTE(config, m_palette, 3);
m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
/* sound hardware */