From a2a519b3fdc33c941d92286b5a2f34855031886c Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 8 Jul 2016 17:24:53 -0700 Subject: [PATCH] Fix initialization error with YM2151. --- Frameworks/GME/vgmplay/chips/ym2151.c | 6 ++---- Frameworks/HighlyTheoretical/HighlyTheoretical/Core/yam.c | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Frameworks/GME/vgmplay/chips/ym2151.c b/Frameworks/GME/vgmplay/chips/ym2151.c index d75bb0256..13bcc89bc 100644 --- a/Frameworks/GME/vgmplay/chips/ym2151.c +++ b/Frameworks/GME/vgmplay/chips/ym2151.c @@ -1572,9 +1572,6 @@ void * ym2151_init(int clock, int rate) logerror("Could not create file 2151_.cym\n"); }*/ - for (chn = 0; chn < 32; chn ++) - PSG->oper[chn].PSG = PSG; - return PSG; } @@ -1621,7 +1618,8 @@ void ym2151_reset_chip(void *_chip) { memset(&chip->oper[i],'\0',sizeof(YM2151Operator)); chip->oper[i].volume = MAX_ATT_INDEX; - chip->oper[i].kc_i = 768; /* min kc_i value */ + chip->oper[i].kc_i = 768; /* min kc_i value */ + chip->oper[i].PSG = chip; } chip->eg_timer = 0; diff --git a/Frameworks/HighlyTheoretical/HighlyTheoretical/Core/yam.c b/Frameworks/HighlyTheoretical/HighlyTheoretical/Core/yam.c index 2437c6798..e766c47b9 100644 --- a/Frameworks/HighlyTheoretical/HighlyTheoretical/Core/yam.c +++ b/Frameworks/HighlyTheoretical/HighlyTheoretical/Core/yam.c @@ -1739,6 +1739,7 @@ uint32 EMU_CALL yam_aica_load_reg(void *state, uint32 a, uint32 mask) { if(YAMSTATE->out_pending > 0) yam_flush(YAMSTATE); { int c = (YAMSTATE->mslc) & 0x3F; d = (((uint32)(YAMSTATE->chan[c].lp )) & 1) << 15; + if(mask & 0xFF00) { YAMSTATE->chan[c].lp = 0; } if(YAMSTATE->afsel == 0) { d |= (((uint32)(YAMSTATE->chan[c].envstate)) & 3) << 13; d |= (YAMSTATE->chan[c].envlevel) & 0x1FFF;