jpd002 / Play-

Play! - PlayStation2 Emulator
http://purei.org
Other
2.12k stars 256 forks source link

PAL games run at 60Hz instead of 50Hz #1010

Open bigianb opened 3 years ago

bigianb commented 3 years ago

Just noticed when testing vs PCSX2 that my PAL version of Baldurs Gate runs at 60FPS in Play when it should run at 50FPS. Looking at the code Play fixes the VBlank interval to 60 per second whilst it should be 50 for PAL games by default.

It would also be nice to be able to unlock the FPS limiter like in PCSX2 so we can see performance wise how much headroom there is. For example PCSX2 can run the BGDA initial title screen at 700FPS unlocked. It would be interesting to know what Play can do (right now it just shows 60 as it is limited). Obviously you would not play a game with the cap unlocked as it would be too fast - but it is good for testing. I also wonder whether the 60Hz Vbank in PAL games is what is messing up the sound ... in any case the game will be running too quickly I suspect.

Zer0xFF commented 3 years ago

since you're building from source, you can toggle the vsync off with this call format.setSwapInterval(0) here https://github.com/jpd002/Play-/blob/master/Source/ui_qt/openglwindow.cpp#L18

jpd002 commented 3 years ago

Yeah, we desperately need a frame time limiter in the main emulation loop and we need to stop relying on Vsync. And also remove some of the assumptions about the frame rate in some constants that we have.

FatheredPuma81 commented 3 years ago

Meanwhile for me: "Everything runs at 165Hz instead of 60/50Hz"

jpd002 commented 3 years ago

Working on something here: https://github.com/jpd002/Play-/tree/frame_limiter.

@Zer0xFF: How does RetroArch handle this? I think RetroArch is responsible of fixing the frame rate?

Zer0xFF commented 3 years ago

yes, RA handles this themselves, so as per your current implementation SetFrameRate should be 0 for RA. they also have a callback function that provides their frontend with expected game fps https://github.com/jpd002/Play-/blob/d990b306f336f0f868446459f2aed102e8f75c97/Source/ui_libretro/main_libretro.cpp#L184 this is called after a game is loaded, so if you plan on defaulting PAL/NTSC to 50/60fps, then we we should dynamically set this value there.

bigianb commented 3 years ago

For PAL we also need to set the correct vblank interval, hblank timing etc for 50Hz.

jpd002 commented 3 years ago

Indeed, thanks for reminding me. There's quite a few subtleties that need to be taken in consideration.

jpd002 commented 3 years ago

The branch should now have 50Hz support. Still gotta look at RetroArch though.

I did a quick run with some games, sound seem fine, but lemme know if you notice strange things.

jpd002 commented 3 years ago

Looks like I don't need to change anything for RetroArch. Seems to be working correctly in its current state.

I did try changing the frame rate inside the retro_system_av_info structure at runtime, but it gave some strange results (ex.: fonts completely disappearing).

darkpigeon commented 3 years ago

Is there any way to turn off or customize the limiter? I would love to play some PAL games (which dont have their NTSC variants) at 60fps though