mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
* allow setting steam id of apps/games owners from an external file top_owners_ids.txt
beside the script
* use the directory of the generate_emu_config script for temp stuff
This commit is contained in:
parent
e64242a248
commit
d8c14ab13e
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,5 +20,6 @@ tools/generate_emu_config/output/
|
|||||||
tools/generate_emu_config/**/__pycache__/
|
tools/generate_emu_config/**/__pycache__/
|
||||||
tools/generate_emu_config/generate_emu_config*.spec
|
tools/generate_emu_config/generate_emu_config*.spec
|
||||||
tools/generate_emu_config/**/my_login.txt
|
tools/generate_emu_config/**/my_login.txt
|
||||||
|
tools/generate_emu_config/top_owners_ids.txt
|
||||||
|
|
||||||
third-party/
|
third-party/
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
* generate_emu_config: allow setting the steam id of apps/games owners from an external file `top_owners_ids.txt` beside the script
|
||||||
|
* generate_emu_config: always use the directory of the script for: the data `backup` folder, the `login_temp` folder, the `my_login.txt` file
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 2024/2/13
|
## 2024/2/13
|
||||||
|
|
||||||
* cold client loader: validate the PE signature before attempting to detect arch
|
* cold client loader: validate the PE signature before attempting to detect arch
|
||||||
|
@ -9,8 +9,10 @@ you need a Steam account to grab most info, but you can use an anonymous account
|
|||||||
generate_emu_config [options] <app id 1> [app id 2] [app id 3] ...
|
generate_emu_config [options] <app id 1> [app id 2] [app id 3] ...
|
||||||
```
|
```
|
||||||
|
|
||||||
You'll be asked each time to enter your username and password.
|
---
|
||||||
|
|
||||||
|
### Login:
|
||||||
|
You'll be asked each time to enter your username and password.
|
||||||
You can also place a file called `my_login.txt` beside this tool with the following data:
|
You can also place a file called `my_login.txt` beside this tool with the following data:
|
||||||
* Your **username** on the **first** line
|
* Your **username** on the **first** line
|
||||||
* Your **password** on the **second** line
|
* Your **password** on the **second** line
|
||||||
@ -18,6 +20,14 @@ You can also place a file called `my_login.txt` beside this tool with the follow
|
|||||||
**But beware though of accidentally distributing your login data when using this file**.
|
**But beware though of accidentally distributing your login data when using this file**.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Account ID:
|
||||||
|
The script uses public Steam IDs (in Steam64 format) of apps/games owners in order to query the required info, such as achievement data.
|
||||||
|
By default, it has a built-in list of public users IDs, and you can extend this list by creating a file called `top_owners_ids.txt` beside the script, then add each new ID in Steam64 format on a separate line.
|
||||||
|
|
||||||
|
When you login with a non-anonymous account, its ID will be added to the top of the list.
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
## Available **\[options\]**
|
## Available **\[options\]**
|
||||||
@ -45,6 +55,6 @@ generate_emu_config -shots -thumbs -vid -imgs -name -cdx -aw -clean 421050 480
|
|||||||
|
|
||||||
## Attributions and credits
|
## Attributions and credits
|
||||||
|
|
||||||
Windows icon by: [FroyoShark](https://www.iconarchive.com/artist/froyoshark.html)
|
* Windows icon by: [FroyoShark](https://www.iconarchive.com/artist/froyoshark.html)
|
||||||
License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/)
|
license: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/)
|
||||||
Source: [icon archive: Steam Icon](https://www.iconarchive.com/show/enkel-icons-by-froyoshark/Steam-icon.html)
|
Source: [icon archive: Steam Icon](https://www.iconarchive.com/show/enkel-icons-by-froyoshark/Steam-icon.html)
|
||||||
|
@ -20,6 +20,12 @@ import threading
|
|||||||
import queue
|
import queue
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
def get_exe_dir():
|
||||||
|
# https://pyinstaller.org/en/stable/runtime-information.html
|
||||||
|
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||||
|
return os.path.dirname(sys.executable)
|
||||||
|
else:
|
||||||
|
return os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
def get_stats_schema(client, game_id, owner_id):
|
def get_stats_schema(client, game_id, owner_id):
|
||||||
message = MsgProto(EMsg.ClientGetUserStats)
|
message = MsgProto(EMsg.ClientGetUserStats)
|
||||||
@ -84,7 +90,7 @@ def download_achievement_images(game_id : int, image_names : set[str], output_fo
|
|||||||
# const usr_id = usr_link[usr_link.length - 1]
|
# const usr_id = usr_link[usr_link.length - 1]
|
||||||
# console.log(usr_id)
|
# console.log(usr_id)
|
||||||
#}
|
#}
|
||||||
TOP_OWNER_IDS = set([
|
TOP_OWNER_IDS = list(dict.fromkeys([
|
||||||
76561198213148949,
|
76561198213148949,
|
||||||
76561198108581917,
|
76561198108581917,
|
||||||
76561198028121353,
|
76561198028121353,
|
||||||
@ -338,7 +344,7 @@ TOP_OWNER_IDS = set([
|
|||||||
# 76561198017054389,
|
# 76561198017054389,
|
||||||
# 76561198031129658,
|
# 76561198031129658,
|
||||||
# 76561198020728639,
|
# 76561198020728639,
|
||||||
])
|
]))
|
||||||
|
|
||||||
def generate_achievement_stats(client, game_id : int, output_directory, backup_directory) -> list[dict]:
|
def generate_achievement_stats(client, game_id : int, output_directory, backup_directory) -> list[dict]:
|
||||||
steam_id_list = TOP_OWNER_IDS.copy()
|
steam_id_list = TOP_OWNER_IDS.copy()
|
||||||
@ -510,7 +516,6 @@ def help():
|
|||||||
print(" -nd: not making predeterminated disable files")
|
print(" -nd: not making predeterminated disable files")
|
||||||
print("\nAll switches are optional except app id, at least 1 app id must be provided\n")
|
print("\nAll switches are optional except app id, at least 1 app id must be provided\n")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
USERNAME = ""
|
USERNAME = ""
|
||||||
PASSWORD = ""
|
PASSWORD = ""
|
||||||
@ -525,7 +530,7 @@ def main():
|
|||||||
GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = False
|
GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = False
|
||||||
CLEANUP_BEFORE_GENERATING = False
|
CLEANUP_BEFORE_GENERATING = False
|
||||||
ANON_LOGIN = False
|
ANON_LOGIN = False
|
||||||
|
|
||||||
prompt_for_unavailable = True
|
prompt_for_unavailable = True
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
@ -567,13 +572,15 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
client = SteamClient()
|
client = SteamClient()
|
||||||
if not os.path.exists("login_temp"):
|
login_tmp_folder = os.path.join(get_exe_dir(), "login_temp")
|
||||||
os.makedirs("login_temp")
|
if not os.path.exists(login_tmp_folder):
|
||||||
client.set_credential_location("login_temp")
|
os.makedirs(login_tmp_folder)
|
||||||
|
client.set_credential_location(login_tmp_folder)
|
||||||
|
|
||||||
if not ANON_LOGIN and os.path.isfile("my_login.txt"):
|
my_login_file = os.path.join(get_exe_dir(), "my_login.txt")
|
||||||
|
if not ANON_LOGIN and os.path.isfile(my_login_file):
|
||||||
filedata = ['']
|
filedata = ['']
|
||||||
with open("my_login.txt", "r") as f:
|
with open(my_login_file, "r", encoding="utf-8") as f:
|
||||||
filedata = f.readlines()
|
filedata = f.readlines()
|
||||||
filedata = list(map(lambda s: s.strip().replace("\r", "").replace("\n", ""), filedata))
|
filedata = list(map(lambda s: s.strip().replace("\r", "").replace("\n", ""), filedata))
|
||||||
filedata = [l for l in filedata if l]
|
filedata = [l for l in filedata if l]
|
||||||
@ -593,11 +600,12 @@ def main():
|
|||||||
else:
|
else:
|
||||||
result = client.login(USERNAME, password=PASSWORD)
|
result = client.login(USERNAME, password=PASSWORD)
|
||||||
auth_code, two_factor_code = None, None
|
auth_code, two_factor_code = None, None
|
||||||
while result in (EResult.AccountLogonDenied, EResult.InvalidLoginAuthCode,
|
while result in (
|
||||||
EResult.AccountLoginDeniedNeedTwoFactor, EResult.TwoFactorCodeMismatch,
|
EResult.AccountLogonDenied, EResult.InvalidLoginAuthCode,
|
||||||
EResult.TryAnotherCM, EResult.ServiceUnavailable,
|
EResult.AccountLoginDeniedNeedTwoFactor, EResult.TwoFactorCodeMismatch,
|
||||||
EResult.InvalidPassword,
|
EResult.TryAnotherCM, EResult.ServiceUnavailable,
|
||||||
):
|
EResult.InvalidPassword,
|
||||||
|
):
|
||||||
|
|
||||||
if result == EResult.InvalidPassword:
|
if result == EResult.InvalidPassword:
|
||||||
print("invalid password, the password you set is wrong.")
|
print("invalid password, the password you set is wrong.")
|
||||||
@ -626,6 +634,21 @@ def main():
|
|||||||
|
|
||||||
result = client.login(USERNAME, PASSWORD, None, auth_code, two_factor_code)
|
result = client.login(USERNAME, PASSWORD, None, auth_code, two_factor_code)
|
||||||
|
|
||||||
|
# read and prepend top_owners_ids.txt
|
||||||
|
top_owners_file = os.path.join(get_exe_dir(), "top_owners_ids.txt")
|
||||||
|
if os.path.isfile(top_owners_file):
|
||||||
|
filedata = ['']
|
||||||
|
with open(top_owners_file, "r", encoding="utf-8") as f:
|
||||||
|
filedata = f.readlines()
|
||||||
|
filedata = list(map(lambda s: s.replace("\r", "").replace("\n", "").strip(), filedata))
|
||||||
|
filedata = [l for l in filedata if len(l) > 1 and l.isdecimal()]
|
||||||
|
all_ids = list(map(lambda s: int(s), filedata))
|
||||||
|
TOP_OWNER_IDS[:0] = all_ids
|
||||||
|
|
||||||
|
# prepend user account ID as a top owner
|
||||||
|
if not ANON_LOGIN:
|
||||||
|
TOP_OWNER_IDS.insert(0, client.steam_id.as_64)
|
||||||
|
|
||||||
for appid in appids:
|
for appid in appids:
|
||||||
print(f"********* generating info for app id {appid} *********")
|
print(f"********* generating info for app id {appid} *********")
|
||||||
raw = client.get_product_info(apps=[appid])
|
raw = client.get_product_info(apps=[appid])
|
||||||
@ -644,7 +667,7 @@ def main():
|
|||||||
app_name = f"Unknown_Steam_app_{appid}" # we need this for later use in the Achievement Watcher
|
app_name = f"Unknown_Steam_app_{appid}" # we need this for later use in the Achievement Watcher
|
||||||
print(f"[X] Couldn't find app name on store")
|
print(f"[X] Couldn't find app name on store")
|
||||||
|
|
||||||
root_backup_dir = "backup"
|
root_backup_dir = os.path.join(get_exe_dir(), "backup")
|
||||||
backup_dir = os.path.join(root_backup_dir, f"{appid}")
|
backup_dir = os.path.join(root_backup_dir, f"{appid}")
|
||||||
if not os.path.exists(backup_dir):
|
if not os.path.exists(backup_dir):
|
||||||
os.makedirs(backup_dir)
|
os.makedirs(backup_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user