alex47exe ae979f1edb * [alex47exe] major overhaul of **generate_emu_config** - custom configs, proper ini parsing, better logging and error handling, helper tools:
* add `-def1` ... `-def5` arguments, which can be used to generate your preferred custom config
    if no `-def` argument is provided, `-def1` will be used by default, to automatically copy from the following folders:
    * `.\_DEFAULT\0` ............... essential emu files, like latest GSE dlls (*steam_api.dll* and *steam_api64.dll*)
    * `.\_DEFAULT\1` ............... other GSE files and folders, including default ini files
    * `.\_DEFAULT\<appid>` ... other GSE files and folders, but only for the current `<appid>`, if the folder exists
  * (Windows only) add some useful helper tools, written in *AutoIt3*:
    * **gse_acw_helper.exe** - add the required achievements schema db files for *Achievement Watcher*, if  .\steam_misc\extra_acw\extra_acw.zip file exists (if generated by `generate_emu_config.exe -acw <appid>`)
    * **gse_debug_switch.exe** - automatically switch between release and debug versions of the emulator, if *steam_api.7z* / *steam_api64.7z* file exists (or *steamclient.7z* / *steamclient64.7z*, if you use the steamclient version)
      paths to release and debug files inside 7z, can be customized in .\steam_misc\tools\au3\scripts\gse_debug_switch.ini
    * **gse_generate_interfaces.exe** - simple x64-x86 launcher for *generate_interfaces.exe*
      it also writes all found steam interfaces to CODEX *steam_emu.ini* (if generated by `generate_emu_config -cdx <appid>`)
      make sure to name your original dll to one of these formats, so it can automatically find its interfaces:
      * `valve_api.dll / valve_api64.dll`
      * `steam_api.dll.bak / steam_api64.dll.bak` or `steam_api.dll.org / steam_api64.dll.org`
      * `steam_api.bak / steam_api64.bak` or `steam_api.org / steam_api64.org`
      * `steam_api_orig.dll / steam_api64_orig.dll` or `steam_api_legit.dll / steam_api64_legit.dll`
    * **gse_lobby_connect.exe** - simple x64-x86 launcher for *lobby_connect.exe*
  * new folder structure, compatible with current and future helper tools --- default arguments are `-acw -cdx -clr <appid>`
    NEVER delete `.\steam_misc\app_backup`, `.\steam_misc\app_info`, `.\steam_misc\tools` and `.\steam_settings` folders
    MIGHT need `.\steam_misc\extra_acw` and `.\steam_misc\extra_cdx` for compatibility with Achievement Watcher and CODEX
  * add `-scx` argument to automatically download images / videos for trading cards, backgrounds, badges, emoticons and other tradable items
    unfortunately I couldn't find any direct steam api method to download the files, so I had to write a rudimentary web scrapper to extract the download links from a third-party website, hence the *scx_gen.py* script might need updating in the future if the website design changes
  * download screenshots and videos:
    * download thumbnails for both screenshots and videos, and compress them to `.zip` files
    * screenshots and videos are now numbered from first to last published, as in the Steam store page
    * add `-vids_low` / `-vids_max` arguments to download all videos, in low and / or high quality
  * create / update .\\*top_owners_ids.txt* when .\\*top_owners_ids.html* is present
  * generate controller action sets txt files for all found controller vdf configs, and zip them inside .\steam_misc\app_backup\app_backup.zip
    by default, the emu supports only `xboxone` and `xbox360` controller configs, though if the're are any issues with the default supported controller action sets inside .\steam_settings\controller folder, you could try to unpack and overwrite action sets for other unsupported controller configs
  * (Windows only) add *AdvancedRun* launchers (cmd console + silent) for `.bat` files and `.py` scripts
* **[alex47exe]** major overhaul of **migrate_gse** - uses the same `.\_DEFAULT\0` and `.\_DEFAULT\1` folder structure for default configs
  it can convert old `.txt` format to `.ini` format, minus *branches.json*, which would require using *top_owners_ids.txt* and some login code from **generate_emu_config**, which should actually be used to properly generate the config files, instead of converting from the old `.txt` format
* [alex47exe] *generate_interfaces.exe* - find all Steam Interfaces instead of only old ones
  the emu will ignore the ones it doesn't require, while we'll have the complete list to write it to CODEX *steam_emu.ini*
* [alex47exe] *lobby_connect.exe* - improve cmd console text alignment
* [alex47exe] `mods_img` instead of `mod_images` (better folder consistency), better example for `mods_img`, minor tweaks to `.ini` and `.md` files
2024-07-30 01:21:09 +01:00

176 lines
4.3 KiB
Python

import os
__codex_ini = '''
### ÜÛÛÛÛÛ Ü
### °ÛÛÛÛ ßÛÛ Û² ßßßÛÛÛÛÛÛÛÜ ßßßßßÛÛ²ÛÛÜ Ü²ÛÛÛß
### ±ÛÛÛß ±ÛÛß ßßÛÛÛÛ° ßÛÛÛ ±ÛÛÛß
### ²ÛÛÛ ß ÛÛ² ßÛÛÛ± °ÛÛ²ÛÛÛ
### ²ÛÛÛ ÜÛÛÛÛÛÜ ÛÛÛ ßÛÛÛ ÜÛÛÛÛÛÛÜ ±ÛÛÛÛÛ
### ÛÛÛ° °ÛÛÛÛß ßÛ² ÛÛÛ ÛÛÛ²ÛÛ² °ÛÛ ÛÛÛ²ÛÛÛ
### ±ÛÛÛ ÛÛÛÛ° ÛÛ ÛÛÛ °ÛÛÛÛÛÛÛÛÛÛÛß ÛÛÛ± ±ÛÛÛ
### °ÛÛÛÜ ÜÛÛß²ÛÛÜ ÜÛÛ ²ÛÛ ÛÛÛ±ÛÛÛ° ÜÛÛÛ° °ÛÛÛÜ
### ßÛÛÛÛÛß ßÛÛÛ²ß ÛÛß °ÛÛÛ° ßÛÛÛÛÛÛÛ²Ûß ß²ÛÛÜ
### ÜÛÛÛÛÛÛ±
### ßßßÛÛ²ÜÜÜÜÜÛ²ÛÛÛ²ßß
###
###
### Game data is stored at %SystemDrive%\\Users\\Public\\Documents\\Steam\\CODEX\\{cdx_id}
###
[Settings]
###
### Game identifier (http://store.steampowered.com/app/{cdx_id})
###
AppId={cdx_id}
###
### Steam Account ID, set it to 0 to get a random Account ID
###
AccountId={cdx_accountid}
###
### Name of the current player
###
UserName={cdx_username}
###
### Language that will be used in the game
###
Language={cdx_language}
###
### Enable lobby mode
###
LobbyEnabled=1
###
### Lobby port to listen on
###
#LobbyPort=31183
###
### Enable/Disable Steam overlay
###
Overlays=1
###
### Set Steam connection to offline mode
###
Offline=0
###
SelfProtect=0
###
[Interfaces]
###
### Steam Client API interface versions
###
SteamAppList=
SteamApps=
SteamAppTicket=
SteamClient=
SteamController=
SteamFriends=
SteamGameCoordinator=
SteamGameServerStats=
SteamGameServer=
SteamGameStats=
SteamHTMLSurface=
SteamHTTP=
SteamInput=
SteamInventory=
SteamMasterServerUpdater=
SteamMatchGameSearch=
SteamMatchMakingServers=
SteamMatchMaking=
SteamMusic=
SteamMusicRemote=
SteamNetworkingMessages=
SteamNetworkingSocketsSerialized=
SteamNetworkingSockets=
SteamNetworkingUtils=
SteamNetworking=
SteamParentalSettings=
SteamParties=
SteamRemotePlay=
SteamRemoteStorage=
SteamScreenshots=
SteamTimeline=
SteamTV=
SteamUGC=
SteamUnifiedMessages=
SteamUserStats=
SteamUser=
SteamUtils=
SteamVideo=
###
[DLC]
###
### Automatically unlock all DLCs
###
DLCUnlockall=0
###
### Identifiers for DLCs
###
#ID=Name
{cdx_dlc_list}
###
[AchievementIcons]
###
### Bitmap Icons for Achievements
###
#halloween_8 Achieved=steam_settings\\img\\halloween_8.jpg
#halloween_8 Unachieved=steam_settings\\img\\unachieved\\halloween_8.jpg
{cdx_ach_list}
###
[Crack]
c7a90c3ffa71981e=b7d5bc716512b5d6
'''
def generate_cdx_ini(
base_out_dir : str,
appid: int,
accountid: int,
username: str,
language: str,
dlc: list[tuple[int, str]],
achs: list[dict]) -> None:
if not os.path.exists(os.path.join(base_out_dir, "steam_misc\\extra_cdx")):
os.makedirs(os.path.join(base_out_dir, "steam_misc\\extra_cdx"))
codex_ini_path = os.path.join(base_out_dir, "steam_misc\\extra_cdx\\steam_emu.ini")
print(f"[ ] Generating RUNE / CODEX / PLAZA config --- writing 'steam_emu.ini'")
print(f"[ ] __ if to be used, make sure it has the correct interface versions")
dlc_list = [f"{d[0]}={d[1]}" for d in dlc]
achs_list = []
for ach in achs:
icon = ach.get("icon", None)
if icon:
icon = f"steam_settings\\img\\{icon}"
else:
icon = 'steam_settings\\img\\steam_default_icon_unlocked.jpg'
icon_gray = ach.get("icon_gray", None)
if icon_gray:
icon_gray = f"steam_settings\\img\\{icon_gray}"
else:
icon_gray = 'steam_settings\\img\\steam_default_icon_locked.jpg'
icongray = ach.get("icongray", None)
if icongray:
icon_gray = f"steam_settings\\img\\{icongray}"
achs_list.append(f'{ach["name"]} Achieved={icon}') # unlocked
achs_list.append(f'{ach["name"]} Unachieved={icon_gray}') # locked
formatted_ini = __codex_ini.format(
cdx_id = appid,
cdx_username = username,
cdx_accountid = accountid,
cdx_language = language,
cdx_dlc_list = "\n".join(dlc_list),
cdx_ach_list = "\n".join(achs_list)
)
with open(codex_ini_path, "wt", encoding='utf-8') as f:
f.writelines(formatted_ini)