You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This ticket is just to document evaluated options for statically determining if a core supports rewind.
Rewind in libretro is implemented by the 3 API calls retro_serialize_size, retro_serialize and retro_unserialize. (https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h#L2123). The frontend detects if rewind is supported by calling retro_serialize_size after a game has been loaded. Unfortunately there's no way to detect that without loading a game.
Some options:
Analyze the sources (with plain regex)
Quite naively, but an option would be check if the method implementation is return 0;. While this looks simple and we can get some fast results just with regular expressions, it get's complicated due to comments, #ifdefs, ....
Another naive approach could be to analyze the binary and do estimations on the function size of retro_serialize_size (those that support rewind have to calculate something and the function might be bigger). This turned out to be unreliable because some cores just call another function (4do) or have a static size.
$ find install -name "game.libretro.*.so" -exec sh -c "echo {}; nm --print-size --size-sort --radix=d {} | grep retr
o_serialize_size" \;
install/game.libretro.beetle-gba/game.libretro.beetle-gba.so
0000000000886956 0000000000000197 T retro_serialize_size
install/game.libretro.prosystem/game.libretro.prosystem.so
0000000000005638 0000000000000011 T retro_serialize_size
install/game.libretro.beetle-pce-fast/game.libretro.beetle-pce-fast.so
0000000000277462 0000000000000153 T retro_serialize_size
install/game.libretro.dinothawr/game.libretro.dinothawr.so
0000000000270589 0000000000000011 T retro_serialize_size
install/game.libretro.nestopia/game.libretro.nestopia.so
0000000001135389 0000000000000268 T retro_serialize_size
install/game.libretro.4do/game.libretro.4do.so
0000000000008426 0000000000000013 T retro_serialize_size
install/game.libretro.picodrive/game.libretro.picodrive.so
0000000000081084 0000000000000145 T retro_serialize_size
Analyze the sources using clang
Might be an interesting exercise to write a small clang checker for this this:
What if we had sample games that we could load via ctypes and then query serialize size? This might be useful for some basic unit testing. Reicast, for instance, crashes if you call retro_init() and then retro_deinit() without calling retro_load_game() in between.
This ticket is just to document evaluated options for statically determining if a core supports rewind.
Rewind in libretro is implemented by the 3 API calls
retro_serialize_size
,retro_serialize
andretro_unserialize
. (https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h#L2123). The frontend detects if rewind is supported by callingretro_serialize_size
after a game has been loaded. Unfortunately there's no way to detect that without loading a game.Some options:
Analyze the sources (with plain regex)
Quite naively, but an option would be check if the method implementation is
return 0;
. While this looks simple and we can get some fast results just with regular expressions, it get's complicated due to comments,#ifdefs
, ....Analyze the binary
Another naive approach could be to analyze the binary and do estimations on the function size of
retro_serialize_size
(those that support rewind have to calculate something and the function might be bigger). This turned out to be unreliable because some cores just call another function (4do) or have a static size.Analyze the sources using clang
Might be an interesting exercise to write a small clang checker for this this:
The text was updated successfully, but these errors were encountered: