config update
This commit is contained in:
parent
8f2c1e081b
commit
c1b7056838
37
dmmBypass.py
37
dmmBypass.py
|
@ -15,17 +15,21 @@ parser.add_argument('-t', '--type', help="DMM game type (ACL/GCL)", default="GCL
|
|||
parser.add_argument('-u', '--update', help="Check for game update before launching", action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
def load_config(config_name):
|
||||
with open(config_name, "rt", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
def load_config(game_id):
|
||||
config_name = game_id + ".cfg"
|
||||
if not os.path.exists(config_name):
|
||||
return None
|
||||
else:
|
||||
with open(config_name, "rt", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
def save_config(config_name, config):
|
||||
with open(config_name, 'wt', encoding="utf-8") as f:
|
||||
def save_config(game_id, config):
|
||||
with open(game_id + '.cfg', 'wt', encoding="utf-8") as f:
|
||||
json.dump(config, f, indent=1, ensure_ascii=False)
|
||||
|
||||
config_name = args.game + '.cfg'
|
||||
config = load_config(args.game)
|
||||
|
||||
if not os.path.exists(config_name):
|
||||
if config is None:
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "requests", "beautifulsoup4", "PyPasser"])
|
||||
config = {
|
||||
"game_id" : args.game,
|
||||
|
@ -35,10 +39,9 @@ if not os.path.exists(config_name):
|
|||
"use_proxy" : input('Your login data will be sent through my VPN.\nIs that okay? (yes/no): ').lower() == "yes"
|
||||
}
|
||||
|
||||
save_config(config_name, config)
|
||||
save_config(args.game, config)
|
||||
else:
|
||||
config = load_config(config_name)
|
||||
print(f'Loaded settings from {config_name}')
|
||||
print(f'Loaded settings from {args.game}.cfg')
|
||||
|
||||
config["update_game"] = args.update
|
||||
config["game_type"] = args.type
|
||||
|
@ -148,7 +151,13 @@ def retrieve_launch_params(game_id, game_type, mac_addr, hdd_serial, motherboard
|
|||
data = result_json["data"]
|
||||
return data
|
||||
except Exception as e:
|
||||
print("Failed to retrieve launch arguments:", e)
|
||||
if str(e).startswith("203:"):
|
||||
config = load_config(game_id)
|
||||
config["saved_login"] = None
|
||||
save_config(game_id, config)
|
||||
print("DMM session has expired. Saved login data cleared. Please run the program again.")
|
||||
else:
|
||||
print("Failed to retrieve launch arguments:", e)
|
||||
|
||||
def main(config):
|
||||
#required arguments
|
||||
|
@ -192,14 +201,18 @@ def main(config):
|
|||
login_expiration = int((current_time + timedelta(days=364)).timestamp()) #expire in less than a year
|
||||
config["saved_login"] = saved_login = {"login_secure" : login_secure, "login_session" : login_session, "expiration": login_expiration}
|
||||
del(config["update_game"])
|
||||
save_config(config_name, config)
|
||||
save_config(game_id, config)
|
||||
|
||||
if not use_proxy: input("Enable VPN now and press Enter")
|
||||
|
||||
#execute_args, file_list_url, file_access_params
|
||||
launch_data : dict = retrieve_launch_params(game_id, game_type, mac_addr, hdd_serial, motherboard, login_secure, login_session, use_proxy, update_game)
|
||||
|
||||
if launch_data == None:
|
||||
return
|
||||
|
||||
execute_args : str = launch_data.get("execute_args", None)
|
||||
|
||||
if execute_args == None:
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue