Add early version of script to generate emu config.

Only generates achievements and stats configs at the moment.
merge-requests/50/head
Mr_Goldberg 2022-08-06 05:23:49 -04:00
parent ad66573a20
commit eef92f1fe6
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
3 changed files with 98 additions and 1 deletions

View File

@ -802,7 +802,7 @@ void Steam_Overlay::OverlayProc()
ImGui::Separator(); ImGui::Separator();
ImGui::Text("%s", x.title.c_str()); ImGui::Text("%s", x.title.c_str());
if (x.hidden) { if (hidden) {
ImGui::Text("hidden achievement"); ImGui::Text("hidden achievement");
} else { } else {
ImGui::TextWrapped("%s", x.description.c_str()); ImGui::TextWrapped("%s", x.description.c_str());

View File

@ -0,0 +1,75 @@
USERNAME = ""
PASSWORD = ""
#steam ids with public profiles that own a lot of games
TOP_OWNER_IDS = [76561198028121353, 76561198001237877, 76561198001678750, 76561198237402290]
from stats_schema_achievement_gen import achievements_gen
from steam.client import SteamClient
from steam.client.cdn import CDNClient
from steam.enums import common
from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto
import os
import sys
if len(sys.argv) < 2:
print("\nUsage: {} appid\n\nExample: {} 480\n".format(sys.argv[0], sys.argv[0]))
exit(1)
appid = int(sys.argv[1])
client = SteamClient()
if not os.path.exists("login_temp"):
os.makedirs("login_temp")
client.set_credential_location("login_temp")
if (len(USERNAME) == 0 or len(PASSWORD) == 0):
client.cli_login()
else:
while True:
ret = client.login(USERNAME, password=PASSWORD)
if ret != common.EResult.OK:
if ret == common.EResult.TryAnotherCM:
continue
print("error logging in with set username and password, trying cli login. error was:", ret)
client.cli_login()
break
else:
break
def get_stats_schema(client, game_id, owner_id):
message = MsgProto(EMsg.ClientGetUserStats)
message.body.game_id = game_id
message.body.schema_local_version = -1
message.body.crc_stats = 0
message.body.steam_id_for_user = owner_id
client.send(message)
return client.wait_msg(EMsg.ClientGetUserStatsResponse, timeout=5)
def generate_achievement_stats(client, game_id, output_directory):
steam_id_list = TOP_OWNER_IDS + [client.steam_id]
for x in steam_id_list:
out = get_stats_schema(client, game_id, x)
if out is not None:
if len(out.body.schema) > 0:
with open('UserGameStatsSchema_{}.bin'.format(appid), 'wb') as f:
f.write(out.body.schema)
achievements, stats = achievements_gen.generate_stats_achievements(out.body.schema, output_directory)
return
else:
print("no schema", out)
out_dir = os.path.join("{}".format( "{}_output".format(appid)), "steam_settings")
if not os.path.exists(out_dir):
os.makedirs(out_dir)
print("outputting config to", out_dir)
generate_achievement_stats(client, appid, out_dir)
with open(os.path.join(out_dir, "steam_appid.txt"), 'w') as f:
f.write(str(appid))

View File

@ -0,0 +1,22 @@
Install python then run this in a terminal/powershell to install the dependencies: pip install -U steam[client]
This script depends on python files that are in subfolders so make sure to download the whole folder not just the script.
Using the script: python generate_emu_config.py appid
The appid is the number in the steam url.
The first time you run the script it will ask you for your steam username, password and email code.
The email code will only be asked the first time and the sentry will be saved to the login_temp folder.
This script will not save your username/password anywhere. If you don't want to always type it you must
open up the script in a text editor and change:
USERNAME = ""
PASSWORD = ""
To:
USERNAME = "your_username"
PASSWORD = "your_password"