mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-27 03:31:49 +01:00
Fixed Game Genie option menu
Added more EQ options in audio menu
This commit is contained in:
parent
d112fb72a2
commit
f404e9eaa9
@ -6,7 +6,7 @@ Genesis Plus GX 1.4.0 (??/??/????) (Eke-Eke)
|
||||
------
|
||||
|
||||
* modified SN76489 cut-off frequency
|
||||
* implemented optimized SN76489 core from Blargg that uses Blip Buffer linear synthesis (Noise Channel is now linear interpolated)
|
||||
* implemented optimized SN76489 core which uses Blip Buffer linear synthesis (Noise Channel is now linear interpolated) (credits to Blargg)
|
||||
* added an option to boost SN76489 Noise Channel
|
||||
* removed outdated Gens YM2612 core
|
||||
* improved YM2612 core general accuracy (SSG-EG, CSM mode,...) (based upon Nemesis recent tests on real MD)
|
||||
@ -18,6 +18,7 @@ when High Quality FM is enabled.
|
||||
* improved VDP sprite masking emulation: fixes 3D level in Mickey Mania (thanks to Nemesis for his sprite test program)
|
||||
* fixed lightgun autodetection: fixes cursor position in Lethal Enforcers II
|
||||
* improved DIVU/DVIS (thanks to Jorge Cwik) & MULU/MULS 68k instructions timing accuracy
|
||||
* added Game Genie hardware emulation (this means Game Genie ROM file is now fully supported, see README for more details)
|
||||
* various code cleanup & core optimizations
|
||||
|
||||
[Gamecube/Wii]
|
||||
|
@ -44,7 +44,7 @@ void ggenie_init(void)
|
||||
memset(&ggenie,0,sizeof(ggenie));
|
||||
|
||||
/* load Game Genie ROM program */
|
||||
FILE *f = fopen(GAMEGENIE_ROM,"rb");
|
||||
FILE *f = fopen(GG_ROM,"rb");
|
||||
if (!f) return;
|
||||
fread(ggenie.rom,1,0x8000,f);
|
||||
fclose(f);
|
||||
@ -97,7 +97,7 @@ void ggenie_reset(void)
|
||||
|
||||
|
||||
/* Byte write handler */
|
||||
/* Note: 2nd revision of the Game Genie software use byte writes to set registe values on exit */
|
||||
/* Note: 2nd revision of the Game Genie software use byte writes to set register values on exit */
|
||||
static void ggenie_write_byte(uint32 address, uint32 data)
|
||||
{
|
||||
/* Lock bit */
|
||||
@ -212,6 +212,6 @@ static void ggenie_write_regs(uint8 offset, uint32 data, uint8 type)
|
||||
static uint32 ggenie_read_regs(uint32 address)
|
||||
{
|
||||
if (address < 0x40) return ggenie.regs[address >> 1];
|
||||
else return *(uint16 *)(cart_rom + address);
|
||||
else return *(uint16 *)(cart_rom + address); /* is that correct ? */
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,8 @@ void config_default(void)
|
||||
config.hq_fm = 1;
|
||||
config.psgBoostNoise = 0;
|
||||
config.filter = 1;
|
||||
config.low_freq = 200;
|
||||
config.high_freq = 8000;
|
||||
config.lg = 1.0;
|
||||
config.mg = 1.0;
|
||||
config.hg = 1.0;
|
||||
|
@ -36,6 +36,8 @@ typedef struct
|
||||
int32 psg_preamp;
|
||||
int32 fm_preamp;
|
||||
uint8 filter;
|
||||
uint16 low_freq;
|
||||
uint16 high_freq;
|
||||
float lg;
|
||||
float mg;
|
||||
float hg;
|
||||
|
@ -513,7 +513,7 @@ int FileSelector(unsigned char *buffer, bool useFAT)
|
||||
else
|
||||
{
|
||||
/* user confirmation */
|
||||
if (GUI_ConfirmPrompt("Load this file ?"))
|
||||
if (GUI_ConfirmPrompt("Load selected File ?"))
|
||||
{
|
||||
/* Load ROM file from device */
|
||||
if (useFAT)
|
||||
|
@ -217,16 +217,18 @@ static gui_item items_options[5] =
|
||||
};
|
||||
|
||||
/* Audio options menu */
|
||||
static gui_item items_audio[8] =
|
||||
static gui_item items_audio[10] =
|
||||
{
|
||||
{NULL,NULL,"High-Quality FM: LINEAR", "Setup YM2612 resampling", 52,132,276,48},
|
||||
{NULL,NULL,"PSG Noise Boost: OFF", "Boost PSG Noise Channel", 52,132,276,48},
|
||||
{NULL,NULL,"PSG Volume: 2.50", "Adjust SN76489 output level", 52,132,276,48},
|
||||
{NULL,NULL,"FM Volume: 1.00", "Adjust YM2612 output level", 52,132,276,48},
|
||||
{NULL,NULL,"Filtering: 3-BAND EQ", "Setup Audio filtering", 52,132,276,48},
|
||||
{NULL,NULL,"Low Gain: 1.00", "Adjust EQ Low Gain", 52,132,276,48},
|
||||
{NULL,NULL,"Middle Gain: 1.00", "Adjust EQ Middle Gain", 52,132,276,48},
|
||||
{NULL,NULL,"High Gain: 1.00", "Adjust EQ High Gain", 52,132,276,48},
|
||||
{NULL,NULL,"Low Freq: 200 Hz", "Adjust EQ Low Band Frequency", 52,132,276,48},
|
||||
{NULL,NULL,"High Freq: 20000 Hz","Adjust EQ High Band Frequency",52,132,276,48},
|
||||
{NULL,NULL,"Low Gain: 1.00", "Adjust EQ Low Band Gain", 52,132,276,48},
|
||||
{NULL,NULL,"Middle Gain: 1.00", "Adjust EQ Middle Band Gain", 52,132,276,48},
|
||||
{NULL,NULL,"High Gain: 1.00", "Adjust EQ High BandGain", 52,132,276,48},
|
||||
};
|
||||
|
||||
/* System options menu */
|
||||
@ -439,7 +441,7 @@ static gui_menu menu_audio =
|
||||
{
|
||||
"Audio Settings",
|
||||
0,0,
|
||||
8,4,6,
|
||||
10,4,6,
|
||||
items_audio,
|
||||
buttons_list,
|
||||
bg_list,
|
||||
@ -708,16 +710,18 @@ static void soundmenu ()
|
||||
if (config.filter == 2) sprintf (items[4].text, "Filtering: 3-BAND EQ");
|
||||
else if (config.filter == 1) sprintf (items[4].text, "Filtering: LOW PASS");
|
||||
else sprintf (items[4].text, "Filtering: OFF");
|
||||
sprintf (items[5].text, "Low Gain: %1.2f", config.lg);
|
||||
sprintf (items[6].text, "Middle Gain: %1.2f", config.mg);
|
||||
sprintf (items[7].text, "High Gain: %1.2f", config.hg);
|
||||
sprintf (items[5].text, "Low Freq: %d", config.low_freq);
|
||||
sprintf (items[6].text, "High Freq: %d", config.high_freq);
|
||||
sprintf (items[7].text, "Low Gain: %1.2f", config.lg);
|
||||
sprintf (items[8].text, "Middle Gain: %1.2f", config.mg);
|
||||
sprintf (items[9].text, "High Gain: %1.2f", config.hg);
|
||||
|
||||
GUI_InitMenu(m);
|
||||
|
||||
if (config.filter < 2)
|
||||
m->max_items = 5;
|
||||
else
|
||||
m->max_items = 8;
|
||||
m->max_items = 10;
|
||||
|
||||
GUI_SlideMenuTitle(m,strlen("Audio "));
|
||||
|
||||
@ -781,28 +785,40 @@ static void soundmenu ()
|
||||
else
|
||||
{
|
||||
/* enable items */
|
||||
m->max_items = 8;
|
||||
m->max_items = 10;
|
||||
|
||||
/* intialize EQ */
|
||||
audio_init_equalizer();
|
||||
audio_set_equalizer();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
GUI_OptionBox(m,0,"Low Gain",(void *)&config.lg,0.01,0.0,2.0,0);
|
||||
sprintf (items[5].text, "Low Gain: %1.2f", config.lg);
|
||||
GUI_OptionBox(m,0,"Low Frequency",(void *)&config.low_freq,10,0,config.high_freq,1);
|
||||
sprintf (items[5].text, "Low Freq: %d", config.low_freq);
|
||||
audio_set_equalizer();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
GUI_OptionBox(m,0,"Middle Gain",(void *)&config.mg,0.01,0.0,2.0,0);
|
||||
sprintf (items[6].text, "Middle Gain: %1.2f", config.mg);
|
||||
GUI_OptionBox(m,0,"High Frequency",(void *)&config.high_freq,100,config.low_freq,30000,1);
|
||||
sprintf (items[6].text, "High Freq: %d", config.high_freq);
|
||||
audio_set_equalizer();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
GUI_OptionBox(m,0,"Low Gain",(void *)&config.lg,0.01,0.0,2.0,0);
|
||||
sprintf (items[7].text, "Low Gain: %1.2f", config.lg);
|
||||
audio_set_equalizer();
|
||||
break;
|
||||
|
||||
case 8:
|
||||
GUI_OptionBox(m,0,"Middle Gain",(void *)&config.mg,0.01,0.0,2.0,0);
|
||||
sprintf (items[8].text, "Middle Gain: %1.2f", config.mg);
|
||||
audio_set_equalizer();
|
||||
break;
|
||||
|
||||
case 9:
|
||||
GUI_OptionBox(m,0,"High Gain",(void *)&config.hg,0.01,0.0,2.0,0);
|
||||
sprintf (items[7].text, "High Gain: %1.2f", config.hg);
|
||||
sprintf (items[9].text, "High Gain: %1.2f", config.hg);
|
||||
audio_set_equalizer();
|
||||
break;
|
||||
|
||||
@ -917,10 +933,17 @@ static void systemmenu ()
|
||||
if (config.lock_on > CART_GG) config.lock_on = NO_CART;
|
||||
if (config.lock_on == CART_GG) sprintf (items[4].text, "Lock-On: GAME GENIE");
|
||||
else sprintf (items[4].text, "Lock-On: OFF");
|
||||
if (genromsize || (config.bios_enabled == 3))
|
||||
{
|
||||
system_init ();
|
||||
audio_init(48000);
|
||||
system_reset ();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: /*** SVP emulation ***/
|
||||
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
|
||||
sprintf (items[4].text, "SVP Cycles: %d", SVP_cycles);
|
||||
sprintf (items[5].text, "SVP Cycles: %d", SVP_cycles);
|
||||
break;
|
||||
|
||||
case -1:
|
||||
|
@ -58,7 +58,7 @@ static void load_bios(void)
|
||||
config.bios_enabled &= ~2;
|
||||
|
||||
/* open BIOS file */
|
||||
FILE *fp = fopen(BIOS_ROM, "rb");
|
||||
FILE *fp = fopen(OS_ROM, "rb");
|
||||
if (fp == NULL) return;
|
||||
|
||||
/* read file */
|
||||
|
@ -26,13 +26,13 @@
|
||||
#include "file_mem.h"
|
||||
|
||||
#define DEFAULT_PATH "/genplus"
|
||||
#define GAMEGENIE_ROM "/genplus/ggenie.bin"
|
||||
#define BIOS_ROM "/genplus/bios.bin"
|
||||
#define GG_ROM "/genplus/ggenie.bin"
|
||||
#define OS_ROM "/genplus/bios.bin"
|
||||
|
||||
#ifdef HW_RVL
|
||||
#define VERSION "version 1.3.2cW"
|
||||
#define VERSION "version 1.3.3W"
|
||||
#else
|
||||
#define VERSION "version 1.3.2cG"
|
||||
#define VERSION "version 1.3.3G"
|
||||
#endif
|
||||
|
||||
/* globals */
|
||||
|
@ -109,7 +109,9 @@ double do_3band(EQSTATE * es, int sample)
|
||||
|
||||
// Calculate midrange (signal - (low + high))
|
||||
|
||||
m = es->sdm3 - (h + l);
|
||||
//m = es->sdm3 - (h + l);
|
||||
// fix from http://www.musicdsp.org/showArchiveComment.php?ArchiveID=236 ?
|
||||
m = sample - (h + l);
|
||||
|
||||
// Scale, Combine and store
|
||||
|
||||
|
@ -95,7 +95,7 @@ void SN76489_Reset()
|
||||
p->NoiseShiftRegister=NoiseInitialState;
|
||||
|
||||
/* Clear Blip delta buffer */
|
||||
blip_clear(p->blip_buffer);
|
||||
if (p->blip_buffer) blip_clear(p->blip_buffer);
|
||||
}
|
||||
|
||||
void SN76489_Shutdown(void)
|
||||
|
@ -917,19 +917,20 @@ INLINE void set_ar_ksr(FM_CH *CH,FM_SLOT *SLOT,int v)
|
||||
CH->SLOT[SLOT1].Incr=-1;
|
||||
}
|
||||
|
||||
/* Even if it seems unnecessary, in some odd case, KSR and KC are both modified */
|
||||
/* and could result in SLOT->kc remaining unchanged. */
|
||||
/* In such case, AR values would not be recalculated despite SLOT->ar has changed */
|
||||
/* This fixes the introduction music of Batman & Robin (Eke-Eke) */
|
||||
if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/)
|
||||
/* Even if it seems unnecessary to do it here, it could happen that KSR and KC */
|
||||
/* but the resulted SLOT->ksr value (kc >> SLOT->KSR) remains unchanged. */
|
||||
/* In such case, Attack Rate would not be recalculated by "refresh_fc_eg_slot". */
|
||||
/* This fixes the intro of "The Adventures of Batman & Robin" (Eke-Eke) */
|
||||
if ((SLOT->ar + SLOT->ksr) < (32+62))
|
||||
{
|
||||
SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ];
|
||||
SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* verified by Nemesis on real hardware (Attack phase is blocked) */
|
||||
SLOT->eg_sh_ar = 0;
|
||||
SLOT->eg_sel_ar = 18*RATE_STEPS; /* verified by Nemesis on real hardware (Attack phase is blocked) */
|
||||
SLOT->eg_sel_ar = 18*RATE_STEPS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1392,15 +1393,16 @@ INLINE void refresh_fc_eg_slot(FM_SLOT *SLOT , int fc , int kc )
|
||||
SLOT->ksr = ksr;
|
||||
|
||||
/* recalculate envelope generator rates */
|
||||
if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/)
|
||||
if ((SLOT->ar + SLOT->ksr) < (32+62))
|
||||
{
|
||||
SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ];
|
||||
SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* verified by Nemesis on real hardware (Attack phase is blocked) */
|
||||
SLOT->eg_sh_ar = 0;
|
||||
SLOT->eg_sel_ar = 18*RATE_STEPS; /* verified by Nemesis on real hardware (Attack phase is blocked) */
|
||||
SLOT->eg_sel_ar = 18*RATE_STEPS;
|
||||
}
|
||||
|
||||
SLOT->eg_sh_d1r = eg_rate_shift [SLOT->d1r + SLOT->ksr];
|
||||
@ -1952,6 +1954,14 @@ void YM2612Update(int length)
|
||||
out_fm[4] = 0;
|
||||
out_fm[5] = 0;
|
||||
|
||||
/* update SSG-EG output */
|
||||
update_ssg_eg_channel(&ym2612.CH[0].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[1].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[2].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[3].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[4].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[5].SLOT[SLOT1]);
|
||||
|
||||
/* calculate FM */
|
||||
chan_calc(&ym2612.CH[0]);
|
||||
chan_calc(&ym2612.CH[1]);
|
||||
@ -1961,18 +1971,10 @@ void YM2612Update(int length)
|
||||
if (ym2612.dacen)
|
||||
{
|
||||
/* DAC Mode */
|
||||
*(ym2612.CH[5].connect4) += ym2612.dacout;
|
||||
out_fm[5] = ym2612.dacout;
|
||||
}
|
||||
else chan_calc(&ym2612.CH[5]);
|
||||
|
||||
/* update SSG-EG output */
|
||||
update_ssg_eg_channel(&ym2612.CH[0].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[1].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[2].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[3].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[4].SLOT[SLOT1]);
|
||||
update_ssg_eg_channel(&ym2612.CH[5].SLOT[SLOT1]);
|
||||
|
||||
/* advance LFO */
|
||||
advance_lfo();
|
||||
|
||||
|
@ -43,14 +43,9 @@ uint8 system_hw;
|
||||
****************************************************************/
|
||||
static EQSTATE eq;
|
||||
|
||||
void audio_init_equalizer(void)
|
||||
{
|
||||
init_3band_state(&eq,880,5000,snd.sample_rate);
|
||||
audio_set_equalizer();
|
||||
}
|
||||
|
||||
void audio_set_equalizer(void)
|
||||
{
|
||||
init_3band_state(&eq,config.low_freq,config.high_freq,snd.sample_rate);
|
||||
eq.lg = (double)(config.lg);
|
||||
eq.mg = (double)(config.mg);
|
||||
eq.hg = (double)(config.hg);
|
||||
@ -101,10 +96,10 @@ void audio_update (int size)
|
||||
if (filter & 1)
|
||||
{
|
||||
/* single-pole low-pass filter (6 dB/octave) */
|
||||
l = (ll + l) >> 1;
|
||||
r = (rr + r) >> 1;
|
||||
ll = l;
|
||||
rr = r;
|
||||
ll = (ll + l) >> 1;
|
||||
rr = (rr + r) >> 1;
|
||||
l = ll;
|
||||
r = rr;
|
||||
}
|
||||
else if (filter & 2)
|
||||
{
|
||||
@ -174,7 +169,7 @@ int audio_init (int rate)
|
||||
}
|
||||
|
||||
/* 3 band EQ */
|
||||
audio_init_equalizer();
|
||||
audio_set_equalizer();
|
||||
|
||||
/* Set audio enable flag */
|
||||
snd.enabled = 1;
|
||||
|
@ -87,11 +87,10 @@ extern int32 current_z80;
|
||||
extern uint8 system_hw;
|
||||
|
||||
/* Function prototypes */
|
||||
extern void audio_init_equalizer(void);
|
||||
extern void audio_set_equalizer(void);
|
||||
extern int audio_init (int rate);
|
||||
extern void audio_shutdown (void);
|
||||
extern void audio_update (int len);
|
||||
extern void audio_set_equalizer(void);
|
||||
extern void system_init (void);
|
||||
extern void system_reset (void);
|
||||
extern void system_shutdown (void);
|
||||
|
Loading…
Reference in New Issue
Block a user