From 19cede04f6ba170f316be91270c102b763c682e0 Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Thu, 14 Aug 2008 11:54:37 +0000 Subject: [PATCH] reset SSG-EG swap flag (YM2612 MAME), Mouse IR support minor fixes --- source/ngc/ogc_input.c | 2 +- source/sound/fm.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/source/ngc/ogc_input.c b/source/ngc/ogc_input.c index e3e65ce..d313f84 100644 --- a/source/ngc/ogc_input.c +++ b/source/ngc/ogc_input.c @@ -494,7 +494,7 @@ static void wpad_update(s8 num, u8 i, u32 exp) /* wiimote IR */ struct ir_t ir; WPAD_IR(num, &ir); - //if (ir.valid) + if (ir.valid) { input.analog[2][0] = ir.x - old_x; if (input.analog[2][0] > 256) diff --git a/source/sound/fm.c b/source/sound/fm.c index a48531f..33601ae 100644 --- a/source/sound/fm.c +++ b/source/sound/fm.c @@ -925,6 +925,9 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) i = 4; /* four operators per channel */ do { + /* reset swap_flag (EkeEke) */ + swap_flag = 0; + switch(SLOT->state) { case EG_ATT: /* attack phase */ @@ -950,9 +953,9 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) //SLOT->volume += 4 * eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; SLOT->volume += 6 * eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; /* from Nemesis */ - if ( SLOT->volume >= (INT32)(SLOT->sl) ) + if ( SLOT->volume >= (INT32)(SLOT->sl) ) SLOT->state = EG_SUS; - } + } } else { @@ -960,9 +963,9 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) { SLOT->volume += eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; - if ( SLOT->volume >= (INT32)(SLOT->sl) ) - SLOT->state = EG_SUS; - } + if ( SLOT->volume >= (INT32)(SLOT->sl) ) + SLOT->state = EG_SUS; + } } break; @@ -1004,12 +1007,12 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) } } } - } + } else { if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d2r)-1) ) ) { - SLOT->volume += eg_inc[SLOT->eg_sel_d2r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d2r)&7)]; + SLOT->volume += eg_inc[SLOT->eg_sel_d2r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d2r)&7)]; if ( SLOT->volume >= MAX_ATT_INDEX ) { @@ -1040,7 +1043,7 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) } } break; - + } out = SLOT->tl + ((UINT32)SLOT->volume); @@ -1053,7 +1056,8 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) in next instruction */ SLOT->vol_out = out; - SLOT->ssgn ^= swap_flag; + /* reverse SLOT inversion flag if required */ + SLOT->ssgn ^= swap_flag; SLOT++; i--;