From 0cd1711bcf776b084412439d43455da5755f9958 Mon Sep 17 00:00:00 2001 From: otavepto Date: Sat, 20 Apr 2024 20:15:47 +0200 Subject: [PATCH] * new switches for the `generate_emu_config` tool - `-skip_ach`: skip downloading & generating achievements and their images - `-skip_con`: skip downloading & generating controller configuration files - `-skip_inv`: skip downloading & generating inventory data (`items.json` & `default_items.json`) * copy the readme of the migration tool after build * let the migration tool exit with code 1 if nothing was found --- CHANGELOG.md | 9 +++- .../generate_emu_config.py | 47 ++++++++++++------- tools/migrate_gse/main.py | 3 ++ tools/migrate_gse/rebuild_linux.sh | 2 + tools/migrate_gse/rebuild_win.bat | 2 + 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78c52139..bcc4bd69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,18 @@ * allow changing the name of the base folder used to store save data, suggested by **[Clompress]** by default it would be the new folder `GSE Saves` (instead of `Goldberg SteamEmu Saves`) this could be changed only by setting the option `saves_folder_name` inside the local file `steam_settings/configs.user.ini`, the global one will not work +* new switches for the `generate_emu_config` tool + - `-skip_ach`: skip downloading & generating achievements and their images + - `-skip_con`: skip downloading & generating controller configuration files + - `-skip_inv`: skip downloading & generating inventory data (`items.json` & `default_items.json`) + + suggested by **[M4RCK5]** * new tool `migrate_gse` to convert either your global `settings` folder, or your local `steam_settings` folder from the old format to the new one - run the tool without arguments to let it convert the global settings folder - run the tool and pass the target `steam_settings` or `settings` folder as an argument to convert the structure of that folder - in both cases, the tool will create a new folder `steam_settings` in the current directory with all the results of the conversion + in both cases, the tool will create a new folder `steam_settings` in the current directory with all the results of the conversion + check its own dedicated readme * **[breaking]** changed the environment variable `SteamAppPath` to `GseAppPath`, which is used to override the program path detected by the emu * **[breaking]** removed the setting `disable_account_avatar` in favor of the new one `enable_account_avatar`, this feature is now disabled by default * new option `add_steam_preowned_ids` in `configs.main.ini` which allows adding a lot of Steam builtin and preowned IDs to the DLC list, and the emu's list of installed apps diff --git a/tools/generate_emu_config/generate_emu_config.py b/tools/generate_emu_config/generate_emu_config.py index d5498889..4ac087fd 100644 --- a/tools/generate_emu_config/generate_emu_config.py +++ b/tools/generate_emu_config/generate_emu_config.py @@ -528,18 +528,21 @@ def help(): print(f" Example: {exe_name} -shots -thumbs -vid -imgs -name -cdx -aw -clean -de -cve 421050") print(f" Example: {exe_name} -shots -thumbs -vid -imgs -name -cdx -aw -clean -cve 421050") print("\nSwitches:") - print(" -shots: download screenshots for each app if they're available") - print(" -thumbs: download screenshots thumbnails for each app if they're available") - print(" -vid: download the first video available for each app: trailer, gameplay, announcement, etc...") - print(" -imgs: download common images for each app: Steam generated background, icon, logo, etc...") - print(" -name: save the output of each app in a folder with the same name as the app, unsafe characters are discarded") - print(" -cdx: generate .ini file for CODEX Steam emu for each app") - print(" -aw: generate schemas of all possible languages for Achievement Watcher") - print(" -clean: delete any folder/file with the same name as the output before generating any data") - print(" -anon: login as an anonymous account, these have very limited access and cannot get all app details") - print(" -de: disable some extra features by generating the corresponding config files in steam_settings folder") - print(" -cve: enable some convenient extra features by generating the corresponding config files in steam_settings folder") - print(" -reldir: generate temp files/folders, and expect input files, relative to the current working directory") + print(" -shots: download screenshots for each app if they're available") + print(" -thumbs: download screenshots thumbnails for each app if they're available") + print(" -vid: download the first video available for each app: trailer, gameplay, announcement, etc...") + print(" -imgs: download common images for each app: Steam generated background, icon, logo, etc...") + print(" -name: save the output of each app in a folder with the same name as the app, unsafe characters are discarded") + print(" -cdx: generate .ini file for CODEX Steam emu for each app") + print(" -aw: generate schemas of all possible languages for Achievement Watcher") + print(" -clean: delete any folder/file with the same name as the output before generating any data") + print(" -anon: login as an anonymous account, these have very limited access and cannot get all app details") + print(" -de: disable some extra features by generating the corresponding config files in steam_settings folder") + print(" -cve: enable some convenient extra features by generating the corresponding config files in steam_settings folder") + print(" -reldir: generate temp files/folders, and expect input files, relative to the current working directory") + print(" -skip_ach: skip downloading & generating achievements and their images") + print(" -skip_con: skip downloading & generating controller configuration files") + print(" -skip_inv: skip downloading & generating inventory data (items.json & default_items.json)") print("\nAll switches are optional except app id, at least 1 app id must be provided") print("\nAutomate the login prompt:") print(" * You can create a file called 'my_login.txt' beside the script, then add your username on the first line") @@ -586,6 +589,9 @@ def main(): CLEANUP_BEFORE_GENERATING = False ANON_LOGIN = False RELATIVE_DIR = False + SKIP_ACH = False + SKIP_CONTROLLER = False + SKIP_INVENTORY = False prompt_for_unavailable = True @@ -621,6 +627,12 @@ def main(): CONVENIENT_EXTRA = True elif f'{appid}'.lower() == '-reldir': RELATIVE_DIR = True + elif f'{appid}'.lower() == '-skip_ach': + SKIP_ACH = True + elif f'{appid}'.lower() == '-skip_con': + SKIP_CONTROLLER = True + elif f'{appid}'.lower() == '-skip_inv': + SKIP_INVENTORY = True else: print(f'[X] invalid switch: {appid}') help() @@ -802,7 +814,8 @@ def main(): #print(f"generating achievement stats") #if "community_visible_stats" in game_info_common: #NOTE: checking this seems to skip stats on a few games so it's commented out - achievements = generate_achievement_stats(client, appid, emu_settings_dir, backup_dir) + if not SKIP_ACH: + achievements = generate_achievement_stats(client, appid, emu_settings_dir, backup_dir) if "supported_languages" in game_info_common: langs: dict[str, dict] = game_info_common["supported_languages"] @@ -878,7 +891,7 @@ def main(): config_generated = False if "config" in game_info: - if "steamcontrollerconfigdetails" in game_info["config"]: + if not SKIP_CONTROLLER and "steamcontrollerconfigdetails" in game_info["config"]: controller_details = game_info["config"]["steamcontrollerconfigdetails"] print('downloading controller vdf files') for id in controller_details: @@ -897,7 +910,7 @@ def main(): print(f'controller type is supported') parse_controller_vdf.generate_controller_config(out_vdf.decode('utf-8'), os.path.join(emu_settings_dir, "controller")) config_generated = True - if "steamcontrollertouchconfigdetails" in game_info["config"]: + if not SKIP_CONTROLLER and "steamcontrollertouchconfigdetails" in game_info["config"]: controller_details = game_info["config"]["steamcontrollertouchconfigdetails"] for id in controller_details: details = controller_details[id] @@ -968,7 +981,9 @@ def main(): if out_config_app_ini: write_ini_file(emu_settings_dir, out_config_app_ini) - inventory_data = generate_inventory(client, appid) + inventory_data = None + if not SKIP_INVENTORY: + inventory_data = generate_inventory(client, appid) if inventory_data is not None: out_inventory = {} default_items = {} diff --git a/tools/migrate_gse/main.py b/tools/migrate_gse/main.py index 80fe8097..aac14892 100644 --- a/tools/migrate_gse/main.py +++ b/tools/migrate_gse/main.py @@ -457,6 +457,9 @@ def main(): write_ini_file('steam_settings', out_dict_ini) print(f'new settings written inside: "{os.path.join(os.path.curdir, "steam_settings")}"') + else: + print('nothing found!', file=sys.stderr) + sys.exit(1) if __name__ == "__main__": diff --git a/tools/migrate_gse/rebuild_linux.sh b/tools/migrate_gse/rebuild_linux.sh index 47f0feba..cdf65a70 100644 --- a/tools/migrate_gse/rebuild_linux.sh +++ b/tools/migrate_gse/rebuild_linux.sh @@ -18,6 +18,8 @@ source "./$venv/bin/activate" echo building migrate_gse... pyinstaller "main.py" --distpath "$out_dir" -y --clean --onedir --name "migrate_gse" --noupx --console -i "NONE" --workpath "$build_temp_dir" || exit 1 +cp -f "README.md" "$out_dir/migrate_gse" + echo; echo ============= echo Built inside: "$out_dir/" diff --git a/tools/migrate_gse/rebuild_win.bat b/tools/migrate_gse/rebuild_win.bat index a3c19cbe..75932fbc 100644 --- a/tools/migrate_gse/rebuild_win.bat +++ b/tools/migrate_gse/rebuild_win.bat @@ -36,6 +36,8 @@ pyinstaller "main.py" --distpath "%out_dir%" -y --clean --onedir --name "migrate ) call "%signer_tool%" "%out_dir%\migrate_gse\migrate_gse.exe" +copy /y README.md "%out_dir%\migrate_gse\" + echo: echo ============= echo Built inside: "%out_dir%\"