From 1c94be1c3301172ad392e9902e55ab44e15b453f Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 28 Nov 2024 14:38:31 +0900 Subject: [PATCH] SRM: feeding it with Steam user data --- .../steam-rom-manager/userConfigurations.json | 42 +++++++++++++------ config/steam-rom-manager/userSettings.json | 40 +++++++++++------- functions/framework.sh | 20 +++++++++ functions/prepare_component.sh | 4 ++ 4 files changed, 78 insertions(+), 28 deletions(-) diff --git a/config/steam-rom-manager/userConfigurations.json b/config/steam-rom-manager/userConfigurations.json index 94243acf..a30a6145 100644 --- a/config/steam-rom-manager/userConfigurations.json +++ b/config/steam-rom-manager/userConfigurations.json @@ -5,31 +5,40 @@ "steamDirectory": "${steamdirglobal}", "steamCategory": "RetroDECK", "romDirectory": "${romsdirglobal}", + "steamCategories": [], "executableArgs": "", "executableModifier": "\"${exePath}\"", "startInDirectory": "", "titleModifier": "${fuzzyTitle}", + "fetchControllerTemplatesButton": null, + "removeControllersButton": null, + "steamInputEnabled": "1", "imageProviders": [ - "SteamGridDB" + "sgdb", + "steamCDN" + ], + "onlineImageQueries": [ + "${fuzzyTitle}" ], - "onlineImageQueries": "${${fuzzyTitle}}", "imagePool": "${fuzzyTitle}", + "drmProtect": false, "userAccounts": { - "specifiedAccounts": "" + "specifiedAccounts": [ + "" + ] + }, + "parserInputs": { + "glob": "${title}.sh" }, "executable": { "path": "", "shortcutPassthrough": false, "appendArgsToExecutable": true }, - "parserInputs": { - "glob": "${title}.sh" - }, "titleFromVariable": { - "limitToGroups": "", + "limitToGroups": [], "caseInsensitiveVariables": false, - "skipFileIfVariableWasNotFound": false, - "tryToMatchTitle": false + "skipFileIfVariableWasNotFound": false }, "fuzzyMatch": { "replaceDiacritics": true, @@ -47,6 +56,7 @@ "mappingId": "RetroDECK_controller_ps5.vdf", "profileType": "template" }, + "ps5_edge": null, "xbox360": { "title": "RetroDECK Controller", "mappingId": "RetroDECK_controller_xbox360_simple.vdf", @@ -57,6 +67,7 @@ "mappingId": "RetroDECK_controller_xboxone_simple.vdf", "profileType": "template" }, + "xboxelite": null, "switch_joycon_left": { "title": "Controller", "mappingId": "controller_switch_joycon_left_gamepad_joystick.vdf", @@ -76,10 +87,11 @@ "title": "RetroDECK Controller", "mappingId": "RetroDECK_controller_steamdeck_neptune_full.vdf", "profileType": "template" - } + }, + "steamcontroller_gordon": null }, "imageProviderAPIs": { - "SteamGridDB": { + "sgdb": { "nsfw": false, "humor": false, "styles": [], @@ -88,7 +100,11 @@ "stylesIcon": [], "imageMotionTypes": [ "static" - ] + ], + "sizes": [], + "sizesHero": [], + "sizesTall": null, + "sizesIcon": [] } }, "defaultImage": { @@ -106,6 +122,6 @@ "icon": null }, "parserId": "1725539138664815", - "version": 15 + "version": 25 } ] diff --git a/config/steam-rom-manager/userSettings.json b/config/steam-rom-manager/userSettings.json index 0eeebea6..c5fd1dba 100644 --- a/config/steam-rom-manager/userSettings.json +++ b/config/steam-rom-manager/userSettings.json @@ -1,24 +1,29 @@ { "fuzzyMatcher": { - "verbose": false, - "filterProviders": true + "verbose": false, + "filterProviders": true }, "environmentVariables": { - "steamDirectory": "", - "userAccounts": "${steamlogin}", - "romsDirectory": "", - "retroarchPath": "", - "raCoresDirectory": "", - "localImagesDirectory": "" + "steamDirectory": "", + "userAccounts": [ + "steamlogin" + ], + "romsDirectory": "", + "retroarchPath": "", + "raCoresDirectory": "", + "localImagesDirectory": "" }, "previewSettings": { - "retrieveCurrentSteamImages": true, - "deleteDisabledShortcuts": false, - "imageZoomPercentage": 30, - "preload": false + "imageLoadStrategy": "loadLazy", + "retrieveCurrentSteamImages": true, + "disableCategories": false, + "deleteDisabledShortcuts": false, + "imageZoomPercentage": 30, + "hideUserAccount": false }, "enabledProviders": [ - "SteamGridDB" + "sgdb", + "steamCDN" ], "batchDownloadSize": 50, "language": "en-US", @@ -26,5 +31,10 @@ "offlineMode": false, "navigationWidth": 0, "clearLogOnTest": false, - "version": 6 -} + "version": 10, + "dnsServers": [], + "autoUpdate": true, + "autoKillSteam": false, + "autoRestartSteam": false + } + \ No newline at end of file diff --git a/functions/framework.sh b/functions/framework.sh index fdda1be8..ccd64188 100644 --- a/functions/framework.sh +++ b/functions/framework.sh @@ -538,8 +538,28 @@ get_steam_user() { log i "SteamID:\t$steam_id" log i "Username:\t$steam_username" log i "Name:\t\t$steam_prettyname" + + if [[ $steam_sync == "true" ]]; then + populate_steamuser_srm + fi + else # Log warning if file not found log w "No Steam user found, proceeding" >&2 fi } + +populate_steamuser_srm(){ + # Populating SRM config with Steam Username + log d "Populating Steam Rom Manager config file with Steam Username" + jq --arg username "$steam_username" ' + map( + if .userAccounts.specifiedAccounts then + .userAccounts.specifiedAccounts = [$username] + else + . + end + ) + ' "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json" > "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json.tmp" && + mv "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json.tmp" "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json" +} \ No newline at end of file diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index a0024745..ceb7d0fb 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -95,6 +95,10 @@ prepare_component() { log i "Updating steamDirectory and romDirectory lines in $srm_userdata/userSettings.json" jq '.environmentVariables.steamDirectory = "'$HOME'/.steam/steam"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" jq '.environmentVariables.romsDirectory = "'$rdhome'/.sync"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" + + get_steam_user + populate_steamuser_srm + fi if [[ "$component" =~ ^(retroarch|all)$ ]]; then