libretro-lutro icon indicating copy to clipboard operation
libretro-lutro copied to clipboard

Save states (serialization)

Open miguelbaldi opened this issue 11 months ago • 3 comments

I'm a bit confused on whether Lutro support for save states/serialization is working or not. Looking at the examples and the Lutro source code, seems that serialization is implemented, but on RetroArch/Libretro it is disabled.

I'm porting a love2d game to Lutro, and save states would be great. Thanks

miguelbaldi avatar Jan 17 '25 13:01 miguelbaldi

You unfortunately have to serialize them yourself. For example: https://github.com/kivutar/lutro-bobble/blob/master/main.lua#L200-L344

RobLoach avatar Jan 19 '25 03:01 RobLoach

You unfortunately have to serialize them yourself. For example: https://github.com/kivutar/lutro-bobble/blob/master/main.lua#L200-L344

Thanks, @RobLoach ! I've already implemented serialization hooks, but when I trigger a save state within RetroArch, I'm receiving an error: "Core does not support save states"

How can I test my serialization functions?

miguelbaldi avatar Jan 20 '25 13:01 miguelbaldi

This commit has probably solved the issue, but before that one had to go to Settings - Core and set "Bypass Core Info Save States Features" to On.

This is still required to enable netplay, because netplay is only allowed with savestate_features = "deterministic" ("serialized" is not enough). If I understood well, the only issue with "serialized" is the non-reproducibility of random numbers, but one can easily implement a very basic random number generator, like the LCG, and serialize the current state of the generator. This should allow for the synchronization of random numbers between the players.

houbilami avatar Sep 11 '25 07:09 houbilami