Commit f8c35958 authored by Not6's avatar Not6
Browse files

change AVsetting at fly to reflect nScreenRefreshRate and nAudioFrequency

parent c837370b
......@@ -57,6 +57,9 @@ unsigned int video_config = 0;
#define HATARI_VIDEO_OV_HI HATARI_VIDEO_HIRES
#define HATARI_VIDEO_CR_HI HATARI_VIDEO_HIRES|HATARI_VIDEO_CROP
int CHANGE_RATE = 0, CHANGEAV_TIMING = 0;
float FRAMERATE = 50.0, SAMPLERATE = 44100.0;
bool hatari_borders = true;
char hatari_frameskips[2];
int firstpass = 1;
......@@ -547,7 +550,7 @@ void retro_get_system_info(struct retro_system_info *info)
void retro_get_system_av_info(struct retro_system_av_info *info)
{
struct retro_game_geometry geom = { retrow, retroh, 1024, 1024, 4.0 / 3.0 };
struct retro_system_timing timing = { 50.0, 44100.0 };
struct retro_system_timing timing = { FRAMERATE, SAMPLERATE };
info->geometry = geom;
info->timing = timing;
......@@ -568,6 +571,16 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
video_cb = cb;
}
void update_timing(void)
{
struct retro_system_av_info system_av_info;
retro_get_system_av_info(&system_av_info);
system_av_info.timing.fps = FRAMERATE;
system_av_info.timing.sample_rate = SAMPLERATE;
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &system_av_info);
snd_sampler = (int)SAMPLERATE / (int)FRAMERATE;
}
void retro_run(void)
{
int x;
......@@ -579,6 +592,23 @@ void retro_run(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
update_variables();
if (CHANGE_RATE || CHANGEAV_TIMING)
{
if (CHANGEAV_TIMING)
{
update_timing();
CHANGEAV_TIMING = 0;
CHANGE_RATE = 0;
}
if (CHANGE_RATE)
{
update_timing();
CHANGEAV_TIMING = 0;
CHANGE_RATE = 0;
}
}
if(pauseg==0)
{
update_input();
......
......@@ -227,6 +227,10 @@ void Audio_Unlock(void)
SDL_UnlockAudio();
}
#ifdef __LIBRETRO__
extern int CHANGE_RATE;
extern float SAMPLERATE;
#endif
/*-----------------------------------------------------------------------*/
/**
......@@ -240,6 +244,15 @@ void Audio_SetOutputAudioFreq(int nNewFrequency)
/* Set new frequency */
nAudioFrequency = nNewFrequency;
#ifdef __LIBRETRO__
float tmp=(float)nAudioFrequency;
if(tmp!=SAMPLERATE)
{
SAMPLERATE=(float)nAudioFrequency;
CHANGE_RATE=1;
}
#endif
if (ConfigureParams.System.nMachineType == MACHINE_FALCON)
{
/* Compute Ratio between host computer sound frequency and Hatari's sound frequency. */
......
......@@ -2579,6 +2579,10 @@ static void Video_SetHBLPaletteMaskPointers(void)
pHBLPalettes = &HBLPalettes[16*Line]; /* Next colour raster list x16 colours */
}
#ifdef __LIBRETRO__
extern int CHANGEAV_TIMING;
extern float FRAMERATE;
#endif
/*-----------------------------------------------------------------------*/
/**
......@@ -2624,6 +2628,15 @@ static void Video_ResetShifterTimings(void)
nLastVisibleHbl = FIRST_VISIBLE_HBL_60HZ + NUM_VISIBLE_LINES;
}
#ifdef __LIBRETRO__
float tmp=(float)nScreenRefreshRate;
if(tmp!=FRAMERATE)
{
FRAMERATE=(float)nScreenRefreshRate;
CHANGEAV_TIMING=1;
}
#endif
if (bUseHighRes)
{
nEndHBL = nStartHBL + VIDEO_HEIGHT_HBL_MONO;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment