Skip to content

Commit

Permalink
fixed generate_emu_config login, thanks to Sak32009
Browse files Browse the repository at this point in the history
replaced 'client_id' error with simple 'wrong username and / or password' message, asking for correct username and / or password
added pcgw_page script to download PCGamingWiki page (source code only), not yet enabled in main script
generate steam_emu.ini for CODEX and RUNE versions
  • Loading branch information
alex47exe committed Oct 13, 2024
1 parent 9c18c68 commit 14e0bdf
Show file tree
Hide file tree
Showing 16 changed files with 543 additions and 156 deletions.
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
pip install -U steam[client]
pip install -U git+https://github.com/Sak32009/steam_py_fork.git@fix-cm-servers
pip install pyinstaller
pip install requests
pip install certifi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
set /p arg="Generate Emu Config for Steam AppId: "
python -W ignore::DeprecationWarning generate_emu_config.py -img -scr -vids_low -vids_max -scx -cdx -acw -clr -anon %arg%
python -W ignore::DeprecationWarning generate_emu_config.py -img -scr -vids_low -vids_max -scx -cdx -rne -acw -clr -anon %arg%
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
set /p arg="Generate Emu Config for Steam AppId: "
python -W ignore::DeprecationWarning generate_emu_config.py -img -scr -vids_low -vids_max -scx -cdx -acw -clr %arg%
python -W ignore::DeprecationWarning generate_emu_config.py -img -scr -vids_low -vids_max -scx -cdx -rne -acw -clr %arg%
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
set /p arg="Generate Emu Config for Steam AppId: "
python -W ignore::DeprecationWarning generate_emu_config.py -cdx -acw -clr %arg%
python -W ignore::DeprecationWarning generate_emu_config.py -cdx -rne -acw -clr %arg%
11 changes: 6 additions & 5 deletions tools/generate_emu_config/external_components/cdx_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SteamID
)

__codex_ini = '''
__codex_ini = r'''###
### ÜÛÛÛÛÛ Ü
### °ÛÛÛÛ ßÛÛ Û² ßßßÛÛÛÛÛÛÛÜ ßßßßßÛÛ²ÛÛÜ Ü²ÛÛÛß
### ±ÛÛÛß ±ÛÛß ßßÛÛÛÛ° ßÛÛÛ ±ÛÛÛß
Expand Down Expand Up @@ -61,6 +61,7 @@
###
### Steam Client API interface versions
###
SteamAppDisableUpdate=
SteamAppList=
SteamApps=
SteamAppTicket=
Expand Down Expand Up @@ -136,11 +137,11 @@ def generate_cdx_ini(
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"))
if not os.path.exists(os.path.join(base_out_dir, "steam_misc\\extra_crk\\CODEX")):
os.makedirs(os.path.join(base_out_dir, "steam_misc\\extra_crk\\CODEX"))

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'")
codex_ini_path = os.path.join(base_out_dir, "steam_misc\\extra_crk\\CODEX\\steam_emu.ini")
print(f"[ ] Generating CODEX 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]
Expand Down
23 changes: 23 additions & 0 deletions tools/generate_emu_config/external_components/pcgw_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import urllib.request

# download PCGamingWiki page source code only
# to be parsed for additional game info, e.g. config and saved games files locations, extended developer and publisher info, etc
# not yet implemented in main script
def download_pcgw(base_out_dir : str, appid : int):

pcgw_link = f"https://www.pcgamingwiki.com/api/appid.php?appid={appid}"

if not os.path.exists(os.path.join(base_out_dir, 'steam_misc\\app_info')):
os.makedirs(os.path.join(base_out_dir, 'steam_misc\\app_info'))

with urllib.request.urlopen(pcgw_link) as f:
html = f.read().decode('utf-8')

file = os.path.join(base_out_dir, f"steam_misc\\app_info\\pcgw.tmp")
with open(file, 'w', encoding='utf-8') as f:
f.write(html)

if os.path.isfile(os.path.join(base_out_dir, 'steam_misc\\app_info\\pcgw.tmp')):
with open(os.path.join(base_out_dir, 'steam_misc\\app_info\\pcgw.tmp'), 'r', encoding='utf-8') as app_pcgw:
app_pcgw_line = app_pcgw.readlines()
172 changes: 172 additions & 0 deletions tools/generate_emu_config/external_components/rne_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import os
from steam_id_converter.SteamID import (
SteamID
)

__rune_ini = r'''###
### \ /
### _ _ _ _ \\__//
### ____ ._/______:_//\//_/____ _ //___ ./_ __//_____:_\\//
### :\ //_/ _ . /_/ / /_/__:_//_/ /\ /\__/_ _ . /\\\
### \\/// ____/___./ / / / / / / \X_/ //___/ /_\_
### . \/// _______ _/_ /_/ _/_/ \\/ // /_\_\ /.
### z_/ _/\ _/ // / // / \ /// __// :\//
### | / _ / /\// /__// __//_ _ /\ /X/ /__/ |/\/2
### --+-_=\__/ / / / \_____:__/ //\____// /\ /\/__:_______=_-+--\4
### |-\__\- / /________\____.__\/- -\--/_\/_______\--.\________\|___\
### = dS!\/- -\_______\ =-RUNE- -== \/ ==-\______\-= ======== --\__\
###
###
### Game data is stored at %SystemDrive%\Users\Public\Documents\Steam\RUNE\{rne_id}
###
[Settings]
###
### Game identifier (http://store.steampowered.com/app/{rne_id})
###
AppId={rne_id}
###
### Steam Account ID, set it to 0 to get a random Account ID
###
AccountId={rne_accountid}
###
### Name of the current player
###
UserName={rne_username}
###
### Language that will be used in the game
###
Language={rne_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
###
BlockConnection=0
###
[Interfaces]
###
### Steam Client API interface versions
###
SteamAppDisableUpdate=
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
{rne_dlc_list}
###
[Crack]
7f508eddb6d6c0b1=3681a9beddbae875
'''

def generate_rne_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_crk\\RUNE")):
os.makedirs(os.path.join(base_out_dir, "steam_misc\\extra_crk\\RUNE"))

rune_ini_path = os.path.join(base_out_dir, "steam_misc\\extra_crk\\RUNE\\steam_emu.ini")
print(f"[ ] Generating RUNE 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

steam_id = SteamID(accountid)

formatted_ini = __rune_ini.format(
rne_id = appid,
rne_username = username,
rne_accountid = steam_id.get_steam32_id(),
rne_language = language,
rne_dlc_list = "\n".join(dlc_list),
rne_ach_list = "\n".join(achs_list)
)

with open(rune_ini_path, "wt", encoding='utf-8') as f:
f.writelines(formatted_ini)
6 changes: 3 additions & 3 deletions tools/generate_emu_config/external_components/safe_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
'=', '+', '[', '{',
']', '}', ';', '\'',
',', '.', ' ', '\t',
'®', '™',
#'®', '™',
])

def create_safe_name(app_name : str):
safe_name = ''.join(c for c in f'{app_name}' if c.isalnum() or c in ALLOWED_CHARS)\
.rstrip()\
.rstrip('.')\
.replace('\t', ' ')
safe_name = re.sub('\s\s+', ' ', safe_name)
.replace(r'\t', ' ')
safe_name = re.sub(r'\s\s+', ' ', safe_name)
return safe_name
Loading

0 comments on commit 14e0bdf

Please sign in to comment.