[Core/Sound] fixed compilation warnings with Nuked core

This commit is contained in:
EkeEke 2017-10-07 00:46:31 +02:00
parent f919bd3849
commit 5c7eb1a55d
2 changed files with 21 additions and 21 deletions

View File

@ -130,7 +130,7 @@ void sound_init( void )
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD) if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
{ {
/* YM2612 */ /* YM2612 */
#ifdef HAVE_YM3438_CORE #ifdef HAVE_YM3438_CORE
if (config.ym3438) if (config.ym3438)
{ {
/* Nuked OPN2 */ /* Nuked OPN2 */
@ -146,7 +146,7 @@ void sound_init( void )
fm_cycles_ratio = 6 * 7; fm_cycles_ratio = 6 * 7;
} }
else else
#endif #endif
{ {
/* MAME */ /* MAME */
YM2612Init(); YM2612Init();
@ -276,7 +276,7 @@ int sound_context_save(uint8 *state)
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD) if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
{ {
#ifdef HAVE_YM3438_CORE #ifdef HAVE_YM3438_CORE
save_param(&config.ym3438, sizeof(config.ym3438)); save_param(&config.ym3438, sizeof(config.ym3438));
if (config.ym3438) if (config.ym3438)
{ {
@ -290,9 +290,9 @@ int sound_context_save(uint8 *state)
bufferptr += YM2612SaveContext(state + sizeof(config.ym3438)); bufferptr += YM2612SaveContext(state + sizeof(config.ym3438));
YM2612Config(config.dac_bits); YM2612Config(config.dac_bits);
} }
#else #else
bufferptr = YM2612SaveContext(state); bufferptr = YM2612SaveContext(state);
#endif #endif
} }
else else
{ {
@ -309,11 +309,11 @@ int sound_context_save(uint8 *state)
int sound_context_load(uint8 *state) int sound_context_load(uint8 *state)
{ {
int bufferptr = 0; int bufferptr = 0;
uint8 config_ym3438;
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD) if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
{ {
#ifdef HAVE_YM3438_CORE #ifdef HAVE_YM3438_CORE
uint8 config_ym3438;
load_param(&config_ym3438, sizeof(config_ym3438)); load_param(&config_ym3438, sizeof(config_ym3438));
if (config_ym3438) if (config_ym3438)
{ {
@ -324,13 +324,13 @@ int sound_context_load(uint8 *state)
} }
else else
{ {
bufferptr += YM2612LoadContext(state + sizeof(config_ym3438)); bufferptr += YM2612LoadContext(state + sizeof(config_ym3438));
YM2612Config(config.dac_bits); YM2612Config(config.dac_bits);
} }
#else #else
bufferptr = YM2612LoadContext(state); bufferptr = YM2612LoadContext(state);
YM2612Config(config.dac_bits); YM2612Config(config.dac_bits);
#endif #endif
} }
else else
{ {

View File

@ -1,3 +1,4 @@
#ifdef HAVE_YM3438_CORE
/* /*
* Copyright (C) 2017 Alexey Khokholov (Nuke.YKT) * Copyright (C) 2017 Alexey Khokholov (Nuke.YKT)
* *
@ -726,7 +727,6 @@ void OPN2_EnvelopeADSR(ym3438_t *chip)
void OPN2_EnvelopePrepare(ym3438_t *chip) void OPN2_EnvelopePrepare(ym3438_t *chip)
{ {
Bit8u reg_rate;
Bit8u rate; Bit8u rate;
Bit8u sum; Bit8u sum;
Bit8u inc = 0; Bit8u inc = 0;
@ -783,21 +783,20 @@ void OPN2_EnvelopePrepare(ym3438_t *chip)
switch (rate_sel) switch (rate_sel)
{ {
case eg_num_attack: case eg_num_attack:
reg_rate = chip->ar[slot]; chip->eg_rate = chip->ar[slot];
break; break;
case eg_num_decay: case eg_num_decay:
reg_rate = chip->dr[slot]; chip->eg_rate = chip->dr[slot];
break; break;
case eg_num_sustain: case eg_num_sustain:
reg_rate = chip->sr[slot]; chip->eg_rate = chip->sr[slot];
break; break;
case eg_num_release: case eg_num_release:
reg_rate = (chip->rr[slot] << 1) | 0x01; chip->eg_rate = (chip->rr[slot] << 1) | 0x01;
break; break;
default: default:
break; break;
} }
chip->eg_rate = reg_rate;
chip->eg_ksv = chip->pg_kcode >> (chip->ks[slot] ^ 0x03); chip->eg_ksv = chip->pg_kcode >> (chip->ks[slot] ^ 0x03);
if (chip->am[slot]) if (chip->am[slot])
{ {
@ -972,7 +971,7 @@ void OPN2_ChOutput(ym3438_t *chip)
/* Ch 4,5,6 */ /* Ch 4,5,6 */
channel++; channel++;
} }
if ((chip->cycles & 3) == 0) if ((cycles & 3) == 0)
{ {
if (!test_dac) if (!test_dac)
{ {
@ -983,7 +982,7 @@ void OPN2_ChOutput(ym3438_t *chip)
chip->ch_lock_r = chip->pan_r[channel]; chip->ch_lock_r = chip->pan_r[channel];
} }
/* Ch 6 */ /* Ch 6 */
if (((chip->cycles >> 2) == 1 && chip->dacen) || test_dac) if (((cycles >> 2) == 1 && chip->dacen) || test_dac)
{ {
out = (Bit16s)chip->dacdata ^ 0x100; out = (Bit16s)chip->dacdata ^ 0x100;
out <<= 7; out <<= 7;
@ -998,7 +997,7 @@ void OPN2_ChOutput(ym3438_t *chip)
if (chip_type == ym3438_type_ym2612) if (chip_type == ym3438_type_ym2612)
{ {
out_en = ((chip->cycles & 3) == 3) || test_dac; out_en = ((cycles & 3) == 3) || test_dac;
/* YM2612 DAC emulation(not verified) */ /* YM2612 DAC emulation(not verified) */
sign = out >> 8; sign = out >> 8;
if (out >= 0) if (out >= 0)
@ -1028,7 +1027,7 @@ void OPN2_ChOutput(ym3438_t *chip)
} }
else else
{ {
out_en = ((chip->cycles & 3) != 0) || test_dac; out_en = ((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_type == ym3438_type_discrete) if (out >= 0 && chip_type == ym3438_type_discrete)
{ {
@ -1427,3 +1426,4 @@ Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
} }
return 0; return 0;
} }
#endif /* HAVE_YM3438_CORE */