libretro / fuse-libretro

A port of the Fuse Unix Spectrum Emulator to libretro
GNU General Public License v3.0
39 stars 50 forks source link

Fix Netplay #147

Closed jfroco closed 2 months ago

jfroco commented 2 months ago

Enable and fix Netplay by:

Co-developed and tested with @rtorralba based on:

It seems that the core/savestates are not deterministic, so the best results during testing were achieved by configuring 'Netplay Check Frames' between 50 and 100 frames.

jfroco commented 2 months ago

Interesting fact for this core documentation, if this PR is accepted.

Netplay didn't work for a particular game due to the following error:

Client log: [ERROR] [Netplay] Netplay state load with an unexpected save state size.

I examined both the host and client (using a special core version with additional debugging information) and found the following:

Host log: [libretro DEBUG] -----------RETRO SERIALIZE SIZE snapshot_size=49391

Client log: [libretro DEBUG] -----------RETRO SERIALIZE SIZE snapshot_size=49439

The only difference is that the cliente has a system/fuse directory containing ROMs (optional), specifically if1-2.rom, and the host does not.

Host log: [libretro INFO] Checking if "\if1-2.rom" exists [libretro INFO] Could not find file "\if1-2.rom", trying file system [INFO] [Environ]: SYSTEM_DIRECTORY: "C:\retroarch-windows-x86_64-stable\system". [libretro INFO] Trying to open "C:\retroarch-windows-x86_64-stable\system/fuse\if1-2.rom" from the file system [libretro ERROR] Could not find file "C:\retroarch-windows-x86_64-stable\system/fuse\if1-2.rom" on the file system [libretro ERROR] couldn't find ROM 'if1-2.rom'

Client log: [libretro INFO] Checking if "\if1-2.rom" exists [libretro INFO] Could not find file "\if1-2.rom", trying file system [INFO] [Environ]: SYSTEM_DIRECTORY: "C:\RetroArch-Win64\system". [libretro INFO] Trying to open "C:\RetroArch-Win64\system/fuse\if1-2.rom" from the file system [libretro INFO] Opened "C:\RetroArch-Win64\system/fuse\if1-2.rom" from the file system [libretro INFO] Could not find file "\if1-2.rom", trying file system [INFO] [Environ]: SYSTEM_DIRECTORY: "C:\RetroArch-Win64\system". [libretro INFO] Trying to open "C:\RetroArch-Win64\system/fuse\if1-2.rom" from the file system [libretro INFO] Opened "C:\RetroArch-Win64\system/fuse\if1-2.rom" from the file system

According to the savestate/snaphost code (found here and here) when this ROM is present, the sate of the Interface 1 is stored in the savestate/snapshot, documentation , which explains the difference in sizes.

After removing the system/fuse directory on the client, netplay worked correctly again.

Conclusion: For netplay to work, both systems must have the same content in the system/fuse directory (or none at all).