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

(cheevos) include achievement state in netplay states #17416

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Jamiras
Copy link
Contributor

@Jamiras Jamiras commented Jan 16, 2025

Description

Netplay uses special save states to keep clients in sync with the server, but those save states don't include achievement state. As a result, the achievement state can still get desynchronized.

This PR updates the NETPLAY_CMD_LOAD_SAVESTATE netplay command to also pass the achievement state for protocol version 7 (the raw core snapshot will still be passed for protocols 5 and 6). I considered providing a new command, but the command just copies the data into a buffer and the processing occurs elsewhere.

Also fixes an issue where achievement processing was not occurring if the game continued to run behind the menu (netplay Allow Pausing is off or Pause Content when Menu is Active is off).

Related Issues

n/a

Related Pull Requests

n/a

Reviewers

Anyone knowledgeable about the netplay code, or who has opinions on the netplay protocol.

I've tested this code connecting to this code with various states of achievement enablement both with active client and spectating client. I've also tested this code connecting to 1.20 code (both as client and as server) with achievements enabled. All testing has been using LAN hosts (mostly two instances on the same machine). Testing sessions have been limited to a few minutes per configuration and mostly just playing from the host and making sure the client reflected the host state.

@LibretroAdmin
Copy link
Contributor

So if I understand your description right this shouldn't introduce any netplay backwards compatibility issues with clients older than the version we are about to merge? As in a user from 1.20.0 stable can still netplay with someone using a hypothetical 1.21.0 stable later down the line?

@Jamiras
Copy link
Contributor Author

Jamiras commented Jan 16, 2025

Yes. I was able to connect to a 1.20 stable release host with this code as a client, and connect a 1.20 client to this code as a host.

The only thing that changed at the protocol level is the content of the NETPLAY_CMD_LOAD_SAVESTATE message. 6- servers are just sending the core_serialize data. 7+ servers will send the containerized data to 7+ clients and just the core_serialize data to 6- clients. If a 7+ client receives data that doesn't have the container header, it's assumed to just be the core_serialize data and handled appropriately.

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