summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author r09 <rzero9@gmail.com>2019-07-26 00:29:32 +0200
committer cracyc <cracyc@users.noreply.github.com>2019-07-25 17:29:32 -0500
commit8a2487c47ba1122278c7c9e3fd80efa9c3e001fc (patch)
treee4d42f5c68c89b0a5f07eaf3aec65a39c06c609b
parent0b13d4741efa09eefecf5962d61c720325b81f73 (diff)
fmtowns.cpp: fix crash regression in System Sacom games (#5397) [r09]
This fixes a regression introduced with commit bb32d72c7e68d4b34a94e1250f1440394d473f7d that causes semi-random emulator crashes (at least in non-debug builds) in 38-man Kilo no Kokuu and Yami no Ketsuzoku Special. Apparently they are trying to set colors for palette indexes higher than 15 in 16-color mode, and the m_entry_color array goes out of bounds. I'm not sure if the hardware discards everything but the 4 least significant bits of the palette index, or if it ignores the color change completely, but it doesn't seem to make any difference in practice, so I'm assuming the former.
-rw-r--r--src/mame/video/fmtowns.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp
index f73fa87d23a..dcb776954ac 100644
--- a/src/mame/video/fmtowns.cpp
+++ b/src/mame/video/fmtowns.cpp
@@ -532,7 +532,7 @@ void towns_state::towns_update_palette()
{
case 0x00:
case 0x20:
- m_palette16[(m_video.towns_video_reg[1] & 0x20) >> 5]->set_pen_color(entry, r, g, b);
+ m_palette16[(m_video.towns_video_reg[1] & 0x20) >> 5]->set_pen_color(entry & 0x0f, r, g, b);
break;
case 0x10:
case 0x30: