libretro / mame2010-libretro

Late 2010 version of MAME (0.139) for libretro. Compatible with MAME 0.139 sets.
32 stars 50 forks source link

framerates / timings not being updated correctly? #114

Open dankcushions opened 6 years ago

dankcushions commented 6 years ago

following discussion in https://github.com/libretro/mame2003-plus-libretro/issues/34#issuecomment-380417902 - it appears that mame2010 is somehow bypassing the default audio_max_timing_skew of 0.05, which should mean that games that are 57Hz (eg robocop) are sped up to 60Hz, with the audio respampled to match, UNLESS you lower that setting.

I haven't observed this issue myself but I ended up looking at the code and may have spotted the issue, if there is one.

maybe mame2010 is failing to update info->timing.fps when it loads a games with a fps that is not 60? in the code it appears this value defaults to 60: https://github.com/libretro/mame2010-libretro/blob/545acf2ef0031ef6f76acbaab4e37737b6fa8084/src/osd/retro/retromain.c#L764 and https://github.com/libretro/mame2010-libretro/blob/545acf2ef0031ef6f76acbaab4e37737b6fa8084/src/osd/retro/retromain.c#L68

it looks like it's attempting to update it here: https://github.com/libretro/mame2010-libretro/blob/545acf2ef0031ef6f76acbaab4e37737b6fa8084/src/osd/retro/retromain.c#L394 - but i'd have to debug it to find out if it's getting the expected values.

hmm, also it is using the RETRO_ENVIRONMENT_SET_GEOMETRY callback which may not be sufficient to update timings. i think it might need to call RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO instead?

r-type commented 6 years ago

look at how i deal it for 2009 . https://github.com/r-type/mame2009-libretro/search?utf8=%E2%9C%93&q=retro_fps&type= in void osd_init(running_machine* machine) should detect the refteshrate:

retro_fps    = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds);
NEWGAME_FROM_OSD=1;

and set in retro_run treat this

if (NEWGAME_FROM_OSD == 1)
   {
      struct retro_system_av_info ninfo;

      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);

      NEWGAME_FROM_OSD=0;
}
ghost commented 6 years ago

But there isn't an issue with MAME2010, it's playing the games at the correct refresh rate. MAME2003 is wrong.

r-type commented 6 years ago

if game info said 57Hz and game run at 60Hz then mame2010 not work as expected. also if you change game with mame osd it will not change the refresh speed of the second game....

dankcushions commented 6 years ago

@ZappaUtopia, as I've told you several times now, the default in retroarch is for audio_max_timing_skew to be set to 0.05. under this setting, a game of 57.4 fps will be sped up to 60fps (using a 60hz display). THAT is the expected behaviour.

ghost commented 6 years ago

But that is the wrong refresh rate for some games. Thats probably why Mame2010 bypasses it so it plays at the correct speed. Like @r-type said above.

if game info said 57Hz and game run at 60Hz then mame2010 not work as expected

dankcushions commented 6 years ago

again, this is just how libretro/retroarch works (assuming default settings and a 60hz screen). if you want to stop what retroarch does by default, you simply change the settings and it will stop skewing such games. there's no need to bypass anything.

if any cores bypass it somehow, then they are simply not calling the libretro callbacks at the right times, hence this logged issue.

ghost commented 6 years ago

I just noticed that lr-mame2010 doesn't even have a audio_max_timing_skew option. A few audio options are not there that are present in lr-mame2003.

dankcushions commented 6 years ago

audio_max_timing_skew is a generic retroarch option and will display regardless of the loaded core. i think you need advanced options enabled to see it, though.

ghost commented 6 years ago

its fixed check the pull