mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-14 06:45:09 +01:00
Nuked OPN2: requested changes
This commit is contained in:
parent
51f802b2cc
commit
405db5d9f4
@ -67,14 +67,9 @@ static int ym3438_accm[24][2];
|
|||||||
static int ym3438_sample[2];
|
static int ym3438_sample[2];
|
||||||
static unsigned int ym3438_cycles;
|
static unsigned int ym3438_cycles;
|
||||||
|
|
||||||
void sound_ym3438_set_type(uint8 type)
|
|
||||||
{
|
|
||||||
OPN2_SetChipType(&ym3438, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
void YM3438_Reset(void)
|
void YM3438_Reset(void)
|
||||||
{
|
{
|
||||||
OPN2_Reset(&ym3438, config.ym3438_type);
|
OPN2_Reset(&ym3438);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YM3438_Update(int *buffer, int length)
|
void YM3438_Update(int *buffer, int length)
|
||||||
|
@ -41,9 +41,6 @@
|
|||||||
#define _SOUND_H_
|
#define _SOUND_H_
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
#ifdef HAVE_YM3438_CORE
|
|
||||||
extern void sound_ym3438_set_type(uint8 type);
|
|
||||||
#endif
|
|
||||||
extern void sound_init(void);
|
extern void sound_init(void);
|
||||||
extern void sound_reset(void);
|
extern void sound_reset(void);
|
||||||
extern int sound_context_save(uint8 *state);
|
extern int sound_context_save(uint8 *state);
|
||||||
|
@ -232,6 +232,8 @@ static const Bit32u fm_algorithm[4][6][8] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Bit32u chip_type = ym3438_type_discrete;
|
||||||
|
|
||||||
void OPN2_DoIO(ym3438_t *chip)
|
void OPN2_DoIO(ym3438_t *chip)
|
||||||
{
|
{
|
||||||
/* Write signal check */
|
/* Write signal check */
|
||||||
@ -998,7 +1000,7 @@ void OPN2_ChOutput(ym3438_t *chip)
|
|||||||
chip->mol = 0;
|
chip->mol = 0;
|
||||||
chip->mor = 0;
|
chip->mor = 0;
|
||||||
|
|
||||||
if (chip->chip_type == ym3438_type_ym2612)
|
if (chip_type == ym3438_type_ym2612)
|
||||||
{
|
{
|
||||||
out_en = ((chip->cycles & 3) == 3) || test_dac;
|
out_en = ((chip->cycles & 3) == 3) || test_dac;
|
||||||
/* YM2612 DAC emulation(not verified) */
|
/* YM2612 DAC emulation(not verified) */
|
||||||
@ -1032,7 +1034,7 @@ void OPN2_ChOutput(ym3438_t *chip)
|
|||||||
{
|
{
|
||||||
out_en = ((chip->cycles & 3) != 0) || test_dac;
|
out_en = ((chip->cycles & 3) != 0) || test_dac;
|
||||||
/* Discrete YM3438 seems has the ladder effect too */
|
/* Discrete YM3438 seems has the ladder effect too */
|
||||||
if (out >= 0 && chip->chip_type == ym3438_type_discrete)
|
if (out >= 0 && chip_type == ym3438_type_discrete)
|
||||||
{
|
{
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
@ -1219,12 +1221,11 @@ void OPN2_Reset(ym3438_t *chip, Bit32u type)
|
|||||||
chip->pan_l[i] = 1;
|
chip->pan_l[i] = 1;
|
||||||
chip->pan_r[i] = 1;
|
chip->pan_r[i] = 1;
|
||||||
}
|
}
|
||||||
chip->chip_type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPN2_SetChipType(ym3438_t *chip, Bit32u type)
|
void OPN2_SetChipType(Bit32u type)
|
||||||
{
|
{
|
||||||
chip->chip_type = type;
|
chip_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPN2_Clock(ym3438_t *chip, Bit32u *buffer)
|
void OPN2_Clock(ym3438_t *chip, Bit32u *buffer)
|
||||||
@ -1398,7 +1399,7 @@ Bit32u OPN2_ReadIRQPin(ym3438_t *chip)
|
|||||||
|
|
||||||
Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
|
Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
|
||||||
{
|
{
|
||||||
if ((port & 3) == 0 || chip->chip_type == ym3438_type_asic)
|
if ((port & 3) == 0 || chip_type == ym3438_type_asic)
|
||||||
{
|
{
|
||||||
if (chip->mode_test_21[6])
|
if (chip->mode_test_21[6])
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
|
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
|
||||||
* OPL2 ROMs.
|
* OPL2 ROMs.
|
||||||
*
|
*
|
||||||
* version: 1.0.5
|
* version: 1.0.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef YM3438_H
|
#ifndef YM3438_H
|
||||||
@ -66,7 +66,6 @@ typedef int8_t Bit8s;
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Bit32u chip_type;
|
|
||||||
Bit32u cycles;
|
Bit32u cycles;
|
||||||
Bit32u slot;
|
Bit32u slot;
|
||||||
Bit32u channel;
|
Bit32u channel;
|
||||||
@ -208,8 +207,8 @@ typedef struct
|
|||||||
Bit8u pms[6];
|
Bit8u pms[6];
|
||||||
} ym3438_t;
|
} ym3438_t;
|
||||||
|
|
||||||
void OPN2_Reset(ym3438_t *chip, Bit32u type);
|
void OPN2_Reset(ym3438_t *chip);
|
||||||
void OPN2_SetChipType(ym3438_t *chip, Bit32u type);
|
void OPN2_SetChipType(Bit32u type);
|
||||||
void OPN2_Clock(ym3438_t *chip, Bit32u *buffer);
|
void OPN2_Clock(ym3438_t *chip, Bit32u *buffer);
|
||||||
void OPN2_Write(ym3438_t *chip, Bit32u port, Bit8u data);
|
void OPN2_Write(ym3438_t *chip, Bit32u port, Bit8u data);
|
||||||
void OPN2_SetTestPin(ym3438_t *chip, Bit32u value);
|
void OPN2_SetTestPin(ym3438_t *chip, Bit32u value);
|
||||||
|
@ -1106,29 +1106,30 @@ static void check_variables(void)
|
|||||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
||||||
{
|
{
|
||||||
orig_value = config.ym3438;
|
orig_value = config.ym3438;
|
||||||
if (!strcmp(var.value, "nuked opn2"))
|
if (!strcmp(var.value, "nuked (ym2612)"))
|
||||||
|
{
|
||||||
|
OPN2_SetChipType(ym3438_type_ym2612);
|
||||||
config.ym3438 = 1;
|
config.ym3438 = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(var.value, "nuked (asic ym3438)"))
|
||||||
|
{
|
||||||
|
OPN2_SetChipType(ym3438_type_asic);
|
||||||
|
config.ym3438 = 2;
|
||||||
|
}
|
||||||
|
else if (!strcmp(var.value, "nuked (discrete ym3438)"))
|
||||||
|
{
|
||||||
|
OPN2_SetChipType(ym3438_type_discrete);
|
||||||
|
config.ym3438 = 3;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
config.ym3438 = 0;
|
config.ym3438 = 0;
|
||||||
|
|
||||||
if (orig_value != config.ym3438)
|
if (orig_value == 0 && config.ym3438 > 0 || orig_value > 0 && config.ym3438 == 0)
|
||||||
{
|
{
|
||||||
sound_init();
|
sound_init();
|
||||||
sound_reset();
|
sound_reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var.key = "genesis_plus_gx_ym3438_type";
|
|
||||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
|
||||||
{
|
|
||||||
if (!strcmp(var.value, "ym2612"))
|
|
||||||
config.ym3438_type = ym3438_type_ym2612;
|
|
||||||
else if (!strcmp(var.value, "ym3438 asic"))
|
|
||||||
config.ym3438_type = ym3438_type_asic;
|
|
||||||
else
|
|
||||||
config.ym3438_type = ym3438_type_discrete;
|
|
||||||
|
|
||||||
sound_ym3438_set_type(config.ym3438_type);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var.key = "genesis_plus_gx_blargg_ntsc_filter";
|
var.key = "genesis_plus_gx_blargg_ntsc_filter";
|
||||||
@ -1668,8 +1669,7 @@ void retro_set_environment(retro_environment_t cb)
|
|||||||
{ "genesis_plus_gx_ym2413", "Master System FM; auto|disabled|enabled" },
|
{ "genesis_plus_gx_ym2413", "Master System FM; auto|disabled|enabled" },
|
||||||
{ "genesis_plus_gx_dac_bits", "YM2612 DAC quantization; disabled|enabled" },
|
{ "genesis_plus_gx_dac_bits", "YM2612 DAC quantization; disabled|enabled" },
|
||||||
#ifdef HAVE_YM3438_CORE
|
#ifdef HAVE_YM3438_CORE
|
||||||
{ "genesis_plus_gx_ym3438", "YM2612/YM3438 core; mame|nuked opn2" },
|
{ "genesis_plus_gx_ym3438", "YM2612/YM3438 core; mame|nuked (ym2612)|nuked (asic ym3438)|nuked (discrete ym3438)" },
|
||||||
{ "genesis_plus_gx_ym3438_type", "YM2612/YM3438 type(Nuked OPN2); ym2612|ym3438 asic|ym3438 discrete" },
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ "genesis_plus_gx_audio_filter", "Audio filter; disabled|low-pass" },
|
{ "genesis_plus_gx_audio_filter", "Audio filter; disabled|low-pass" },
|
||||||
|
@ -93,7 +93,6 @@ struct
|
|||||||
uint8 ym2413;
|
uint8 ym2413;
|
||||||
#ifdef HAVE_YM3438_CORE
|
#ifdef HAVE_YM3438_CORE
|
||||||
uint8 ym3438;
|
uint8 ym3438;
|
||||||
uint8 ym3438_type;
|
|
||||||
#endif
|
#endif
|
||||||
uint8 mono;
|
uint8 mono;
|
||||||
int16 psg_preamp;
|
int16 psg_preamp;
|
||||||
|
Loading…
Reference in New Issue
Block a user