diff --git a/libretro/core-mapper.c b/libretro/core-mapper.c index fbc5b78..471d7ab 100644 --- a/libretro/core-mapper.c +++ b/libretro/core-mapper.c @@ -193,18 +193,19 @@ extern unsigned atari_devices[ 2 ]; #include "pokeysnd.h" extern int UI_is_active; +extern int CURRENT_TV; -unsigned char SBUF[1024*2]; +//unsigned char SBUF[1024*2]; void retro_sound_update() { - int x; + int x,stop=CURRENT_TV==312?885:742;//FIXME: 882/735? if (! UI_is_active) { Sound_Callback(SNDBUF, 1024*2*2); //POKEYSND_Process(SNDBUF,snd_sampler_pal); - for(x=0;xgeometry.base_width = retrow; + info->geometry.base_height = retroh; + + if (log_cb) + log_cb(RETRO_LOG_INFO, "AV_INFO: width=%d height=%d\n",info->geometry.base_width,info->geometry.base_height); + + info->geometry.max_width = 400; + info->geometry.max_height = 300; + + if (log_cb) + log_cb(RETRO_LOG_INFO, "AV_INFO: max_width=%d max_height=%d\n",info->geometry.max_width,info->geometry.max_height); + + info->geometry.aspect_ratio = 4.0 / 3.0; + + if (log_cb) + log_cb(RETRO_LOG_INFO, "AV_INFO: aspect_ratio = %f\n",info->geometry.aspect_ratio); + + info->timing.fps = retro_fps; + info->timing.sample_rate = 44100.0; + + if (log_cb) + log_cb(RETRO_LOG_INFO, "AV_INFO: fps = %f sample_rate = %f\n",info->timing.fps,info->timing.sample_rate); + +} + void retro_init(void) -{ +{ + struct retro_log_callback log; + + if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) + log_cb = log.log; + else + log_cb = NULL; + const char *system_dir = NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &system_dir) && system_dir) @@ -312,17 +353,16 @@ void retro_get_system_info(struct retro_system_info *info) info->block_extract = false; } - +/* void retro_get_system_av_info(struct retro_system_av_info *info) { -//FIXME handle vice PAL/NTSC struct retro_game_geometry geom = { retrow, retroh, 400, 300,4.0 / 3.0 }; - struct retro_system_timing timing = { 50.0, 44100.0 }; + struct retro_system_timing timing = { retro_fps, 44100.0 }; info->geometry = geom; info->timing = timing; } - +*/ void retro_set_audio_sample(retro_audio_sample_t cb) { audio_cb = cb; @@ -354,6 +394,24 @@ void retro_run(void) if(pauseg==0){ + if (ToggleTV == 1) + { + struct retro_system_av_info ninfo; + + retro_fps=CURRENT_TV==312?49.8607597:59.9227434; + + retro_get_system_av_info(&ninfo); + + environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &ninfo); + + if (log_cb) + log_cb(RETRO_LOG_INFO, "ChangeAV: w:%d h:%d ra:%f.\n", + ninfo.geometry.base_width, ninfo.geometry.base_height, ninfo.geometry.aspect_ratio); + + ToggleTV=0; + } + + if(retro_sound_finalized)retro_sound_update(); Retro_PollEvent(); diff --git a/libretro/platform.c b/libretro/platform.c index 122293e..b3f2d91 100644 --- a/libretro/platform.c +++ b/libretro/platform.c @@ -51,6 +51,9 @@ extern unsigned char MXjoy[2]; // joy extern int mbt[16]; extern int retro_sound_finalized; +int CURRENT_TV=Atari800_TV_PAL; +int ToggleTV=0; + static UWORD *palette = NULL; int skel_main(int argc, char **argv) @@ -75,6 +78,10 @@ int skel_main(int argc, char **argv) if (Atari800_display_screen) PLATFORM_DisplayScreen(); + if(CURRENT_TV!=Atari800_tv_mode){ + CURRENT_TV=Atari800_tv_mode; + ToggleTV=1; + } } }