From e1792f9021f4dcfe8d94b1fab385f6d4f41131d9 Mon Sep 17 00:00:00 2001 From: J-Doiron <139803019+J-Doiron@users.noreply.github.com> Date: Thu, 21 Aug 2025 12:34:17 -0700 Subject: [PATCH] New navigation to load the save file that's more consistent on cities 2 --- cities_skylines_2/citiesskylines2.py | 36 +++++++++++++++++-- cities_skylines_2/citiesskylines2_utils.py | 2 +- cities_skylines_2/config/continue_game.json | 6 ---- .../launcher/notlauncher-options.json | 2 +- 4 files changed, 35 insertions(+), 11 deletions(-) delete mode 100644 cities_skylines_2/config/continue_game.json diff --git a/cities_skylines_2/citiesskylines2.py b/cities_skylines_2/citiesskylines2.py index cb1aef3..0dc664b 100644 --- a/cities_skylines_2/citiesskylines2.py +++ b/cities_skylines_2/citiesskylines2.py @@ -39,7 +39,6 @@ save_files = [ "Benchmark.cok.cid" ] config_files = [ - "continue_game.json", "UserState.coc" ] @@ -89,12 +88,41 @@ def run_benchmark(keras_service): result = keras_service.wait_for_word("paradox", interval=0.5, timeout=100) if not result: - logging.info("Could not find the paused notification. Unable to mark start time!") + logging.info("Could not find the Paradox logo. Did the game launch?") sys.exit(1) user.press("esc") user.press("esc") user.press("esc") - time.sleep(20) + time.sleep(15) + + result = keras_service.wait_for_word("new", interval=0.5, timeout=100) + if not result: + logging.info("Did not find the main menu. Did the game crash?") + sys.exit(1) + + result = keras_service.look_for_word("load", attempts=10, interval=1) + if not result: + logging.info("Did not find the load game option. Did the save game copy?") + sys.exit(1) + + # Navigate to load save menu + gui.moveTo(result["x"], result["y"]) + time.sleep(0.2) + gui.click() + time.sleep(0.2) + + result = keras_service.look_for_word("08", attempts=10, interval=1) + if not result: + logging.info("Did not find the save game original date. Did the keras click correctly?") + sys.exit(1) + + # Loading the game + gui.moveTo(result["x"], result["y"]) + time.sleep(0.2) + gui.click() + time.sleep(0.2) + user.press("enter") + time.sleep(10) result = keras_service.wait_for_word("grand", interval=0.5, timeout=100) if not result: @@ -102,6 +130,8 @@ def run_benchmark(keras_service): sys.exit(1) elapsed_setup_time = round(int(time.time()) - setup_start_time, 2) logging.info("Setup took %f seconds", elapsed_setup_time) + gui.moveTo(result["x"], result["y"]) + time.sleep(0.2) time.sleep(2) logging.info('Starting benchmark') user.press("3") diff --git a/cities_skylines_2/citiesskylines2_utils.py b/cities_skylines_2/citiesskylines2_utils.py index 9a21c40..ac330fe 100644 --- a/cities_skylines_2/citiesskylines2_utils.py +++ b/cities_skylines_2/citiesskylines2_utils.py @@ -84,7 +84,7 @@ def copy_launcherpath(): shutil.copy(src_path, dest_path) #os.chmod(dest_path, stat.S_IREAD) except OSError as err: - logging.error("Could not copy the launcherpath file. %s", e) + logging.error("Could not copy the launcherpath file. %s", err) raise err diff --git a/cities_skylines_2/config/continue_game.json b/cities_skylines_2/config/continue_game.json deleted file mode 100644 index c6ef16b..0000000 --- a/cities_skylines_2/config/continue_game.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "title": "Benchmark", - "desc": "Population: 103333 Money: \u00a280551826", - "date": "2025-08-20T17:37:03", - "rawGameVersion": "1.3.3f1" -} \ No newline at end of file diff --git a/cities_skylines_2/launcher/notlauncher-options.json b/cities_skylines_2/launcher/notlauncher-options.json index 47733d5..fecac5f 100644 --- a/cities_skylines_2/launcher/notlauncher-options.json +++ b/cities_skylines_2/launcher/notlauncher-options.json @@ -1,5 +1,5 @@ { - "continuelastsave": true, + "continuelastsave": false, "noworkshop": false, "disablemods": false, "nolog": false,