Cyberpunk, Grid Legends & SOTTR fixes for low resolution use (#177)

Some harness fixes for helping with lower resolutions
This commit is contained in:
J-Doiron
2025-12-22 15:20:11 -08:00
committed by GitHub
4 changed files with 30 additions and 11 deletions

View File

@@ -26,7 +26,6 @@ SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
PROCESS_NAME = "cyberpunk2077.exe"
user.FAILSAFE = False
def start_game():
@@ -64,6 +63,25 @@ def check_for_rt():
user.press("down")
am.take_screenshot("graphics_pt.png", ArtifactType.CONFIG_IMAGE, "graphics menu path tracing")
def check_anisotropy(max_attempts=10):
"""Continuously looks for a word using kerasService. If not found in the given time, presses a button.
"""
for _ in range(max_attempts):
# Try finding the word within check_duration seconds
found = kerasService.look_for_word(word="anisotropy", attempts=10, interval=0.5)
if found:
return True # Stop checking
# If not found, press the button once
user.press("down")
# Short delay before rechecking
time.sleep(0.5)
logging.info("Max attempts reached for checking the camera. Did the game load the save?")
sys.exit(1) # Word was not found
def navigate_settings() -> None:
"""Simulate inputs to navigate the main menu"""
navigate_to_settings()
@@ -115,10 +133,8 @@ def navigate_settings() -> None:
user.press("down")
time.sleep(0.5)
result = kerasService.wait_for_word("anisotropy", interval=3, timeout=20)
if not result:
logging.info("Did not see anisotropic options. Did the game navigate the graphics menu correctly?")
sys.exit(1)
check_anisotropy()
am.take_screenshot("graphics_2.png", ArtifactType.CONFIG_IMAGE, "graphics menu 2")
for _ in range(11):

View File

@@ -93,7 +93,7 @@ def run_benchmark(keras_service):
sys.exit(1)
logging.info('Game started. Entering main menu')
time.sleep(2)
time.sleep(4)
user.press("enter")
time.sleep(2)
@@ -142,7 +142,7 @@ def run_benchmark(keras_service):
elapsed_setup_time = round(setup_end_time - setup_start_time, 2)
logging.info("Harness setup took %f seconds", elapsed_setup_time)
if keras_service.wait_for_word(word="manzi", timeout=30, interval=0.1) is None:
if keras_service.wait_for_word(word="manzi", timeout=120, interval=0.1) is None:
logging.error("Didn't see Valentino Manzi. Did the benchmark load?")
sys.exit(1)
test_start_time = int(time.time())

View File

@@ -212,8 +212,8 @@ def run_benchmark():
gamepad.single_button_press(button=vg.DS4_BUTTONS.DS4_BUTTON_CROSS)
time.sleep(0.4)
if kerasService.look_for_word(word="video", attempts=10, interval=1) is None:
logging.info("Couldn't find the video tab. Did the settings menu open?")
if kerasService.look_for_word(word="audio", attempts=10, interval=1) is None:
logging.info("Couldn't find the audio tab. Did the settings menu open?")
sys.exit(1)
time.sleep(1)

View File

@@ -53,6 +53,9 @@ def run_benchmark(keras_service, am):
start_game()
time.sleep(10)
if keras_service.wait_for_word(word="unavailable", timeout=30, interval=1):
user.press("enter")
ss_config = ScreenSplitConfig(
divide_method=ScreenShotDivideMethod.HORIZONTAL,
quadrant=ScreenShotQuadrant.TOP
@@ -106,8 +109,8 @@ def run_benchmark(keras_service, am):
elapsed_setup_time = round(int(time.time()) - setup_start_time, 2)
logging.info("Setup took %f seconds", elapsed_setup_time)
if keras_service.wait_for_word(word="fps", timeout=30, interval=0.5) is None:
logging.info("Did not find the benchmark option on the screen. Did the menu get stuck?")
if keras_service.wait_for_word(word="fps", timeout=60, interval=0.5) is None:
logging.info("Did not find the FPS counter. Did the benchmark crash?")
sys.exit(1)
test_start_time = int(time.time())