From 0c3c721bd0bcbe840ea64ad8701654df65e5f050 Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Wed, 10 Sep 2008 14:31:13 +0000 Subject: [PATCH] fixed default scaling in STRETCH mode, fixed DPAD fast scroll, improved YM2612 enveloppe emulation --- history.txt | 5 +++++ source/ngc/ogc_input.c | 2 +- source/ngc/ogc_video.c | 10 +++++----- source/sound/fm.c | 22 +++++++++++++++------- source/vdp.c | 6 +++--- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/history.txt b/history.txt index 85a4bca..faaf643 100644 --- a/history.txt +++ b/history.txt @@ -3,8 +3,13 @@ Genesis Plus for Gamecube CURRENT: --------- +[Genesis] +- YM2612(MAME): improved Enveloppe Generator accuracy: fix tracks #3 and #9 in Mega Turrican + + [NGC/Wii] - improved menu scrolling using Wiimote D-PAD +- fixed config file incompatibility between GC and Wii versions 26/08/2008: diff --git a/source/ngc/ogc_input.c b/source/ngc/ogc_input.c index 587640c..9b39e3e 100644 --- a/source/ngc/ogc_input.c +++ b/source/ngc/ogc_input.c @@ -71,7 +71,7 @@ static const u16 pad_keys[8] = #define PAD_LEFT 2 #define PAD_RIGHT 3 -#define MAX_HELD_CNT 100 +#define MAX_HELD_CNT 10 static u32 held_cnt = 0; static u32 wpad_dirmap[3][4] = diff --git a/source/ngc/ogc_video.c b/source/ngc/ogc_video.c index ca41c46..f415eff 100644 --- a/source/ngc/ogc_video.c +++ b/source/ngc/ogc_video.c @@ -382,19 +382,19 @@ static void gxScale(void) { int xscale, yscale, xshift, yshift, i; + /* borders are emulated */ if (config.overscan) { if (config.aspect) { - /* borders are emulated */ - xscale = (reg[12] & 1) ? 360 : 358; + xscale = (reg[12] & 1) ? 360 : 358; if (gc_pal) xscale -= 1; yscale = (gc_pal && !config.render) ? (vdp_pal ? 144:143) : (vdp_pal ? 121:120); } else { /* fullscreen stretch */ - xscale = gc_pal ? 354 : 367; + xscale = bitmap.viewport.w + 2*bitmap.viewport.x; yscale = (gc_pal && !config.render) ? (vdp_pal ? (268*144 / bitmap.viewport.h):143) : (vdp_pal ? (224*144 / bitmap.viewport.h):120); } @@ -413,8 +413,8 @@ static void gxScale(void) } else { - /* fullscreen stretch */ - xscale = gc_pal ? 321 : 334; + /* fit screen */ + xscale = 320; yscale = (gc_pal && !config.render) ? 134 : 112; } diff --git a/source/sound/fm.c b/source/sound/fm.c index 8f60a5a..7a2193f 100644 --- a/source/sound/fm.c +++ b/source/sound/fm.c @@ -21,7 +21,9 @@ ** - modified EG rates and frequency, tested by Nemesis on real hardware ** - fixed EG attenuation level on KEY ON (Ecco 2 splash sound) ** - fixed LFO phase update for CH3 special mode (Warlock, Alladin), thanks to AamirM -** - fixed Attack rate refresh (fix Batman&Robin introduction) +** - fixed Attack rate refresh (fix Batman&Robin introduction)$ +** - fixed attenuation level when starting Substain Phase (Gynoug ?) +** - fixed Enveloppe Generator updates in some specific cases (AR maximal and/or Susbstain Level minimal) ** ** 03-08-2003 Jarek Burczynski: ** - fixed YM2608 initial values (after the reset) @@ -660,9 +662,9 @@ INLINE void FM_KEYON(FM_CH *CH , int s ) } else { - /* directly switch to Decay */ + /* directly switch to Decay (or Substain) */ SLOT->volume = MIN_ATT_INDEX; - SLOT->state = EG_DEC; + SLOT->state = (SLOT->sl == MIN_ATT_INDEX) ? EG_SUS : EG_DEC; } } } @@ -933,7 +935,7 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) if (SLOT->volume <= MIN_ATT_INDEX) { SLOT->volume = MIN_ATT_INDEX; - SLOT->state = EG_DEC; + SLOT->state = (SLOT->sl == MIN_ATT_INDEX) ? EG_SUS : EG_DEC; } } break; @@ -947,7 +949,10 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) 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) ) - SLOT->state = EG_SUS; + { + SLOT->volume = (INT32)(SLOT->sl); + SLOT->state = EG_SUS; + } } } else @@ -957,7 +962,10 @@ 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->volume = (INT32)(SLOT->sl); SLOT->state = EG_SUS; + } } } break; @@ -993,14 +1001,14 @@ INLINE void advance_eg_channel(FM_SLOT *SLOT) if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) { - SLOT->state = EG_ATT; /* phase -> Attack */ SLOT->volume = MAX_ATT_INDEX; + SLOT->state = EG_ATT; /* phase -> Attack */ } else { /* Attack Rate is maximal: directly switch to Decay */ - SLOT->state = EG_DEC; SLOT->volume = MIN_ATT_INDEX; + SLOT->state = (SLOT->sl == MIN_ATT_INDEX) ? EG_SUS : EG_DEC; } swap_flag = (SLOT->ssg&0x02); /* bit 1 = alternate */ diff --git a/source/vdp.c b/source/vdp.c index 4ca1673..21ce955 100644 --- a/source/vdp.c +++ b/source/vdp.c @@ -212,7 +212,7 @@ void vdp_reset(void) /* reset border area */ bitmap.viewport.x = config.overscan ? 12 : 0; bitmap.viewport.y = config.overscan ? (vdp_pal ? 32 : 8) : 0; - bitmap.viewport.changed = 1; + bitmap.viewport.changed = 1; /* initialize some registers (normally set by BIOS) */ if (config.bios_enabled != 3) @@ -223,8 +223,8 @@ void vdp_reset(void) vdp_reg_w(15, 0x02); /* auto increment */ } - /* default latency */ - fifo_latency = 27; + /* default latency */ + fifo_latency = 27; } void vdp_shutdown(void)