Merge branch 'feature/anonymous-mode' into 'master'

Emulator config generator: Anonymous mode, argparser

See merge request Mr_Goldberg/goldberg_emulator!51
merge-requests/51/merge
Timic 2023-05-23 16:51:49 +00:00
commit 4422471b84
1 changed files with 43 additions and 35 deletions

View File

@ -13,6 +13,7 @@ from steam.enums import common
from steam.enums.common import EResult from steam.enums.common import EResult
from steam.enums.emsg import EMsg from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto from steam.core.msg import MsgProto
import argparse
import os import os
import sys import sys
import json import json
@ -23,19 +24,26 @@ import queue
prompt_for_unavailable = True prompt_for_unavailable = True
if len(sys.argv) < 2: parser = argparse.ArgumentParser(
print("\nUsage: {} appid appid appid etc..\n\nExample: {} 480\n".format(sys.argv[0], sys.argv[0])) prog="GenerateEmuConfig",
exit(1) description="Emulator Config Generator"
)
appids = [] parser.add_argument("app_id", nargs="+", help="Steam application IDs")
for id in sys.argv[1:]: parser.add_argument("-a", "--anonymous", action="store_true", help="Enable anonymous login mode")
appids += [int(id)]
args = parser.parse_args()
appids = [int(id) for id in args.app_id]
client = SteamClient() client = SteamClient()
if not os.path.exists("login_temp"): if not os.path.exists("login_temp"):
os.makedirs("login_temp") os.makedirs("login_temp")
client.set_credential_location("login_temp") client.set_credential_location("login_temp")
if args.anonymous:
client.anonymous_login()
else:
if (len(USERNAME) == 0 or len(PASSWORD) == 0): if (len(USERNAME) == 0 or len(PASSWORD) == 0):
client.cli_login() client.cli_login()
else: else: