kodi-game / game.libretro

Libretro compatibility layer for the Kodi Game API
GNU General Public License v2.0
37 stars 26 forks source link

Add the FrameTime callback #39

Closed RobLoach closed 6 years ago

RobLoach commented 6 years ago

Attempt to add the frame_time callback, to let cores know how much time has passed between frames. This has not been tested yet, as I haven't gotten it to compile yet. Would love your help on getting it to work.

It should use Kodi's frame time delta rather than ctime. Also, is RunFrame the right place to call this?

There's an example of its use over at sdlarch.c.

garbear commented 6 years ago

It should use Kodi's frame time delta rather than ctime.

Can you explain why?

Also, is RunFrame the right place to call this?

The documentation says:

https://github.com/kodi-game/game.libretro/blob/master/src/libretro/libretro.h#L1783

It will be called right before retro_run() every frame.
RobLoach commented 6 years ago

Kodi may have a better API to get accurate tick count? Unsure if clock is the right thing to use here.

Using Kodi's timer may also allow fastforward/slowmotion gameplay via the media controls?

garbear commented 6 years ago

I don't understand. Isn't FF/RW controlled by Kodi? How does exposing the frame time give cores control over this?

RobLoach commented 6 years ago

Not sure, to be honest! Maybe clock() is the way to go.

garbear commented 6 years ago

What cores use this feature?

RobLoach commented 6 years ago

ChaiLove does, to calculate the step time: https://github.com/libretro/libretro-chailove/blob/master/src/libretro.cpp#L286-L290

RobLoach commented 6 years ago

Closing this one for now. Feel free to re-open if it tickles your fancy.