Fix TMNT audio decoding so that it doesn't invoke undefined C++ behavior. Also don't bother registering decoded sample data for saving.

This commit is contained in:
Aaron Giles 2021-03-03 01:39:12 -08:00
parent 76f7ddca50
commit 44cec5caaf

View File

@ -230,8 +230,6 @@ SAMPLES_START_CB_MEMBER(tmnt_state::tmnt_decode_sample)
int i;
uint8_t *source = memregion("title")->base();
save_item(NAME(m_sampledata));
/* Sound sample for TMNT.D05 is stored in the following mode (ym3012 format):
*
* Bit 15-13: Exponent (2 ^ x)
@ -248,7 +246,7 @@ SAMPLES_START_CB_MEMBER(tmnt_state::tmnt_decode_sample)
val = (val >> 3) & (0x3ff); /* 10 bit, Max Amplitude 0x400 */
val -= 0x200; /* Centralize value */
val <<= (expo - 3);
val = (val << expo) >> 3;
m_sampledata[i] = val;
}