MCPcopy Create free account
hub / github.com/OpenStickCommunity/GP2040-CE / migrateAuthenticationMethods

Function migrateAuthenticationMethods

src/config_utils.cpp:1608–1642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1606}
1607
1608void migrateAuthenticationMethods(Config& config) {
1609 // Auth migrations
1610 GamepadOptions & gamepadOptions = config.gamepadOptions;
1611 PS4Options & ps4Options = config.addonOptions.ps4Options;
1612 PSPassthroughOptions & psPassthroughOptions = config.addonOptions.psPassthroughOptions;
1613 XBOnePassthroughOptions & xbonePassthroughOptions = config.addonOptions.xbonePassthroughOptions;
1614
1615 if ( ps4Options.enabled == true ) { // PS4-Mode "on", assume keys are loaded, do not change modes
1616 gamepadOptions.ps4AuthType = InputModeAuthType::INPUT_MODE_AUTH_TYPE_KEYS;
1617 ps4Options.enabled = false; // disable PS4-Mode add-on permanently
1618 }
1619
1620 if ( psPassthroughOptions.enabled == true ) { // PS5 add-on "on", USB pass through, update ps4->ps5 boot
1621 gamepadOptions.ps5AuthType = InputModeAuthType::INPUT_MODE_AUTH_TYPE_USB;
1622 // If current mode is PS4, update to PS5
1623 if ( gamepadOptions.inputMode == INPUT_MODE_PS4 ) {
1624 gamepadOptions.inputMode = INPUT_MODE_PS5;
1625 }
1626 // Also update our boot mode from PS4 to PS5 if set
1627 int32_t * bootModes[8] = { &config.gamepadOptions.inputModeB1, &config.gamepadOptions.inputModeB2,
1628 &config.gamepadOptions.inputModeB3, &config.gamepadOptions.inputModeB4,
1629 &config.gamepadOptions.inputModeL1, &config.gamepadOptions.inputModeL2,
1630 &config.gamepadOptions.inputModeR1, &config.gamepadOptions.inputModeR2};
1631 for(int32_t i = 0; i < 8; i++ ) {
1632 if ( *bootModes[i] == INPUT_MODE_PS4 ) {
1633 *bootModes[i] = INPUT_MODE_PS5; // modify ps4 -> ps5
1634 }
1635 }
1636 psPassthroughOptions.enabled = false; // disable PS-Passthrough add-on permanently
1637 }
1638
1639 if ( xbonePassthroughOptions.enabled == true ) { // Xbox One add-on "on", USB pass through is assumed
1640 xbonePassthroughOptions.enabled = false; // disable and go on our way
1641 }
1642}
1643
1644// enable profiles that have real data in them (profile 1 is always enabled)
1645// note that profiles 2-4 are no longer populated with profile 1's data on a fresh

Callers 2

loadMethod · 0.85
fromJSONMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected