move more globals to PicoInterface

similar reasons as before
This commit is contained in:
notaz 2017-10-22 02:04:26 +03:00
parent 075672bf9f
commit 6311a3baf5
27 changed files with 244 additions and 247 deletions

View file

@ -259,9 +259,9 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
case MA_OPT_SOUND_QUALITY:
if (strcasecmp(var, "Sound Quality") != 0) return 0;
PsndRate = strtoul(val, &tmp, 10);
if (PsndRate < 8000 || PsndRate > 44100)
PsndRate = 22050;
PicoIn.sndRate = strtoul(val, &tmp, 10);
if (PicoIn.sndRate < 8000 || PicoIn.sndRate > 44100)
PicoIn.sndRate = 22050;
if (*tmp == 'H' || *tmp == 'h') tmp++;
if (*tmp == 'Z' || *tmp == 'z') tmp++;
while (*tmp == ' ') tmp++;

View file

@ -604,7 +604,7 @@ void emu_set_defconfig(void)
{
memcpy(&currentConfig, &defaultConfig, sizeof(currentConfig));
PicoIn.opt = currentConfig.s_PicoOpt;
PsndRate = currentConfig.s_PsndRate;
PicoIn.sndRate = currentConfig.s_PsndRate;
PicoIn.regionOverride = currentConfig.s_PicoRegion;
PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
}
@ -958,10 +958,10 @@ void emu_set_fastforward(int set_on)
static int set_Frameskip, set_EmuOpt, is_on = 0;
if (set_on && !is_on) {
set_PsndOut = PsndOut;
set_PsndOut = PicoIn.sndOut;
set_Frameskip = currentConfig.Frameskip;
set_EmuOpt = currentConfig.EmuOpt;
PsndOut = NULL;
PicoIn.sndOut = NULL;
currentConfig.Frameskip = 8;
currentConfig.EmuOpt &= ~4;
currentConfig.EmuOpt |= 0x40000;
@ -969,7 +969,7 @@ void emu_set_fastforward(int set_on)
emu_status_msg("FAST FORWARD");
}
else if (!set_on && is_on) {
PsndOut = set_PsndOut;
PicoIn.sndOut = set_PsndOut;
currentConfig.Frameskip = set_Frameskip;
currentConfig.EmuOpt = set_EmuOpt;
PsndRerate(1);
@ -1253,9 +1253,9 @@ void emu_init(void)
config_readlrom(path);
PicoInit();
PicoMessage = plat_status_msg_busy_next;
PicoMCDopenTray = emu_tray_open;
PicoMCDcloseTray = emu_tray_close;
PicoIn.osdMessage = plat_status_msg_busy_next;
PicoIn.mcdTrayOpen = emu_tray_open;
PicoIn.mcdTrayClose = emu_tray_close;
sndout_init();
}
@ -1285,12 +1285,12 @@ void emu_finish(void)
static void snd_write_nonblocking(int len)
{
sndout_write_nb(PsndOut, len);
sndout_write_nb(PicoIn.sndOut, len);
}
void emu_sound_start(void)
{
PsndOut = NULL;
PicoIn.sndOut = NULL;
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
{
@ -1299,12 +1299,12 @@ void emu_sound_start(void)
PsndRerate(Pico.m.frame_count ? 1 : 0);
printf("starting audio: %i len: %i stereo: %i, pal: %i\n",
PsndRate, PsndLen, is_stereo, Pico.m.pal);
sndout_start(PsndRate, is_stereo);
PicoWriteSound = snd_write_nonblocking;
PicoIn.sndRate, Pico.snd.len, is_stereo, Pico.m.pal);
sndout_start(PicoIn.sndRate, is_stereo);
PicoIn.writeSound = snd_write_nonblocking;
plat_update_volume(0, 0);
memset(sndBuffer, 0, sizeof(sndBuffer));
PsndOut = sndBuffer;
PicoIn.sndOut = sndBuffer;
}
}

View file

@ -610,7 +610,7 @@ static int mh_opt_misc(int id, int keys)
{
switch (id) {
case MA_OPT_SOUND_QUALITY:
PsndRate = sndrate_prevnext(PsndRate, keys & PBTN_RIGHT);
PicoIn.sndRate = sndrate_prevnext(PicoIn.sndRate, keys & PBTN_RIGHT);
break;
case MA_OPT_REGION:
region_prevnext(keys & PBTN_RIGHT);
@ -674,7 +674,7 @@ static const char *mgn_opt_sound(int id, int *offs)
const char *str2;
*offs = -8;
str2 = (PicoIn.opt & POPT_EN_STEREO) ? "stereo" : "mono";
sprintf(static_buff, "%5iHz %s", PsndRate, str2);
sprintf(static_buff, "%5iHz %s", PicoIn.sndRate, str2);
return static_buff;
}
@ -892,7 +892,7 @@ static void debug_menu_loop(void)
if (inp & PBTN_UP) pv->debug_p ^= PVD_KILL_S_HI;
if (inp & PBTN_MA2) pv->debug_p ^= PVD_KILL_32X;
if (inp & PBTN_MOK) {
PsndOut = NULL; // just in case
PicoIn.sndOut = NULL; // just in case
PicoIn.skipFrame = 1;
PicoFrame();
PicoIn.skipFrame = 0;

View file

@ -167,11 +167,11 @@ void mp3_update(int *buffer, int length, int stereo)
return;
length_mp3 = length;
if (PsndRate <= 11025 + 100) {
if (PicoIn.sndRate <= 11025 + 100) {
mix_samples = mix_16h_to_32_s2;
length_mp3 <<= 2; shr = 2;
}
else if (PsndRate <= 22050 + 100) {
else if (PicoIn.sndRate <= 22050 + 100) {
mix_samples = mix_16h_to_32_s1;
length_mp3 <<= 1; shr = 1;
}