Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to the netplay netpacket interface #15887

Merged

Conversation

schellingb
Copy link
Contributor

Description

My last PR (#15797) on this feature fixed a bug where a connecting client could lose their local SRAM data due to it getting overwritten by the SRAM data of the host. This originally didn't occur to me because my main focus was on a core that doesn't use SRAM via the retro_get_memory_data libretro interface.

I prepared this PR together with @davidgfnet who is in the process of implementing this interface in the gpSP GBA libretro core. We realized that even with the fix in that last PR, RetroArch 1.16 was released before the fix was made. The issue only affects cases where a core registers the interface via environment call 76 (RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE) which at this point still is not used by any released core. But if such a core were released, it could cause a player using RetroArch 1.16 to lose SRAM data.

Therefore this PR deprecates environment call 76 and moves it to 78 (the same way 20 (RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK) was moved to 22). This means only the next release of RetroArch will support this interface and the cores that make use of it.

We took advantage of this switch to also improve the interface in a few ways to make it easier to use and clarify some points about it while adding some features as well:

  • Switch environment call number from 76 to 78 (retire 76 as it was never used by any core)
  • Simplify broadcasts by removing the option to send to all but one client, use an explicit RETRO_NETPACKET_BROADCAST constant instead
  • Separate explicit flushing and querying of incoming packet into two operations (RETRO_NETPACKET_FLUSH_HINT and retro_netpacket_poll_receive_t) to make lower latency communication easier
  • Enable a core to specify a protocol version string which can get used instead of core version to determine compatibility between two players
  • Log and notify a separate message when there is a content crc mismatch while using this interface to convey it being less severe (as some different games can do network communication with each other)

Related Issues

Related Pull Requests

Reviewers

@davidgfnet

- Switch environment call number from 76 to 78 (retire 76 as it was never used by any core)
- Simplify broadcasts by removing the option to send to all but one client
- Separate explicit flushing and querying of incoming packet into two operations (RETRO_NETPACKET_FLUSH_HINT and retro_netpacket_poll_receive_t)
- Enable a core to specify a protocol version string which can get used instead of core version to determine compatibility between two players
- Log and notify a separate message when there is a content crc mismsatch to convey it being less severe (as different games may be able to do network communication with each other)
@LibretroAdmin LibretroAdmin merged commit 107283e into libretro:master Nov 10, 2023
22 checks passed
Sunderland93 pushed a commit to Sunderland93/RetroArch that referenced this pull request Dec 26, 2024
* Updates to the netplay netpacket interface
- Switch environment call number from 76 to 78 (retire 76 as it was never used by any core)
- Simplify broadcasts by removing the option to send to all but one client
- Separate explicit flushing and querying of incoming packet into two operations (RETRO_NETPACKET_FLUSH_HINT and retro_netpacket_poll_receive_t)
- Enable a core to specify a protocol version string which can get used instead of core version to determine compatibility between two players
- Log and notify a separate message when there is a content crc mismsatch to convey it being less severe (as different games may be able to do network communication with each other)

* C89 compile fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants