dolphin icon indicating copy to clipboard operation
dolphin copied to clipboard

Add Support for Gecko Codes to Achievements Whitelist

Open LillyJadeKatrin opened this issue 1 year ago • 13 comments

This PR sets up the Achievements whitelist for patches to also support Gecko codes.

LillyJadeKatrin avatar Jul 25 '24 12:07 LillyJadeKatrin

I recommend also supporting Action Replay codes.

JosJuice avatar Jul 25 '24 16:07 JosJuice

I can add that as well, but thought one step at a time, and the requests have overwhelmingly been for Gecko next.

LillyJadeKatrin avatar Jul 25 '24 20:07 LillyJadeKatrin

Okay, I suppose we can do one at a time.

JosJuice avatar Jul 26 '24 14:07 JosJuice

The message "Failed to verify patch {} from file {}." currently mentions patches specifically. It should either mention the specific type of code (i.e. Gecko code or patch), or it could say just "code" instead of "patch".

JosJuice avatar Jul 27 '24 18:07 JosJuice

Smoke-tested?

Tilka avatar Aug 11 '24 13:08 Tilka

In particular, please test if there is any way to cause this to discard 'unapproved' codes from the user's local game INI. It's unclear to me whether that is possible from the code.

AdmiralCurtiss avatar Aug 13 '24 18:08 AdmiralCurtiss

I missed something in my review: The unit test (PatchAllowlistTest.cpp) is still only checking patches, not Gecko codes.

JosJuice avatar Aug 14 '24 19:08 JosJuice

Decided to add a couple things anyways so I'm drafting this until it's ready.

LillyJadeKatrin avatar Aug 16 '24 00:08 LillyJadeKatrin

In particular, please test if there is any way to cause this to discard 'unapproved' codes from the user's local game INI. It's unclear to me whether that is possible from the code.

I'm not entirely certain I follow what you mean here @AdmiralCurtiss , I'm not aware of anything that causes codes to be removed from the INI files but I don't know what I don't know. I'm definitely not calling it on purpose; the functionality should simply be filtering out active codes. I think.

LillyJadeKatrin avatar Oct 04 '24 02:10 LillyJadeKatrin

What I mean is, this seems like a perfectly plausible code path that I'm not sure how you're preventing:

GeckoCodeWidget constructor
  calls GeckoCodeWidget::LoadCodes()
   calls Gecko::LoadCodes(game_ini_default, game_ini_local)
     filters codes, removes any unapproved
   filtered codes are stored in m_gecko_codes

later:

GeckoCodeWidget::SaveCodes() is called for any reason
  calls Gecko::SaveCodes(game_ini_local, m_gecko_codes) with the filtered codes
    calls inifile.SetLines("Gecko", lines) with filtered codes
      overwrites any pre-existing codes in the ini
  saves modified ini without the unapproved codes to disk

AdmiralCurtiss avatar Oct 06 '24 12:10 AdmiralCurtiss

While I'm looking into other questions brought up by this investigation, I can tell you that it appears that no code path within Dolphin is modifying ini files from the Sys folder, aka codes from the repo. What to do with user codes is a different question I'm evaluating in the Discord server currently.

LillyJadeKatrin avatar Oct 06 '24 16:10 LillyJadeKatrin

The description of the last commit mentions "a strange compatibility bug with creator name on Gecko codes". Could you explain why this means you should allowlist the SSL patch for the Nintendo Channel?

JosJuice avatar Oct 15 '24 09:10 JosJuice

Also, have you checked what happens if you use netplay code syncing when the person hosting isn't using hardcore mode but the person joining is?

JosJuice avatar Oct 15 '24 09:10 JosJuice

To be explicit about the current review status: What remains is a concept for how netplay code syncing should be handled.

JosJuice avatar Oct 26 '24 13:10 JosJuice

At least the first step of a Netplay solution is here: https://github.com/dolphin-emu/dolphin/pull/13153

LillyJadeKatrin avatar Oct 27 '24 03:10 LillyJadeKatrin