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

Force NetPlay Clients to Host Hardcore Status #13153

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

Conversation

LillyJadeKatrin
Copy link
Contributor

If the host is in hardcore mode, all joining players will be set to hardcore mode; if not, all joining players will be set to softcore.

@JosJuice
Copy link
Member

Please make sure that this builds correctly when USE_RETRO_ACHIEVEMENTS is disabled. Currently you have a problem where you unconditionally use Config::RA_HARDCORE_ENABLED, whose declaration is behind an ifdef.

(Note that the netplay packet layout must be the same regardless of whether USE_RETRO_ACHIEVEMENTS is enabled.)

@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch from df1e72f to 1671c07 Compare October 27, 2024 14:02
@JMC47
Copy link
Contributor

JMC47 commented Oct 30, 2024

What happens if the joining players aren't logged into RetroAchievements?

@LillyJadeKatrin
Copy link
Contributor Author

LillyJadeKatrin commented Nov 2, 2024

Host logged in with hardcore on, join not logged in - all players see hardcore mode on
Host not logged in, join logged in with hardcore on - all players see hardcore mode off
Designed that way and verified via testing.

Copy link
Member

@JosJuice JosJuice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message should mention why this change is needed (which as I understand it is because otherwise different clients would get different code filtering).

Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp Outdated Show resolved Hide resolved
Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp Outdated Show resolved Hide resolved
@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch 2 times, most recently from bd9792e to 096ba39 Compare November 8, 2024 02:57
@JosJuice
Copy link
Member

JosJuice commented Nov 8, 2024

Now that you're using a config changed callback to call SetHardcoreMode, you should get rid of all calls to SetHardcoreMode from outside AchievementManager.cpp.

Also, please keep in mind that config changed callbacks can run from any thread. SetHardcoreMode uses m_client with no locking. Have you thought through the thread safety implications of this? (Personally I'm not sure what's safe and not, because I haven't been able to find any documentation on the rcheevos library's thread safety requirements.)

@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch from 096ba39 to a003223 Compare November 9, 2024 01:28
@LillyJadeKatrin
Copy link
Contributor Author

I removed it from the only other place I could find it and verified it still worked. As for thread safety, rc_client_set_hardcore_enabled has an internal mutex.

@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch from a003223 to 7e9ac9f Compare November 10, 2024 12:56
@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch from 7e9ac9f to 872bb61 Compare November 10, 2024 13:38
@JosJuice
Copy link
Member

Hold on, I forgot one thing. You haven't updated the commit message to explain why the change is desired.

If the host is in hardcore mode, all joining players will be set to hardcore mode; if not, all joining players will be set to softcore. This ensures all players have the same settings and remain synchroized.
@LillyJadeKatrin LillyJadeKatrin force-pushed the retroachievements-netplay-hardcore branch from 872bb61 to 9b6555c Compare November 10, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants