def main(): profile_path = get_profile_path() print("\nBacking up profile.bin to profile.bin.bak") shutil.copyfile(profile_path, f"{profile_path}.bak") offset: int = CONFIG.get_data("offset") if offset is None: offset = calculate_offset(profile_path) current_sens: int = get_current_sens(profile_path, offset) choice_prompts = [ "1 - Set mouse sensitivity", "2 - Recalculate current sensitivity", "Enter - Quit application", ] while True: print( dedent(f""" Current mouse sensitivity: {current_sens} If your current sensitivity doesn't look right, try recalculating! """)) print(*choice_prompts, sep="\n", end="\n" * 2) choice = input("Type # and press enter: ") if choice == "1": current_sens = rewrite_sens(profile_path, offset) elif choice == "2": offset = calculate_offset(profile_path) current_sens = get_current_sens(profile_path, offset) elif choice == "": print("Exiting.", end="\n" * 2) break else: print("Not a valid choice.")
def get_profile_path() -> str: save_path = CONFIG.get_data("path") game_choice = CONFIG.game_choice.value profile_path = "" if not save_path: path = "{0}:\\Users\\{1}\\Documents\\My Games\\{2}\\WillowGame\\SaveData\\" user = os.environ["USERNAME"] for drive in get_drives(): save_path = path.format(drive, user, game_choice) if os.path.exists(save_path): CONFIG.set_data("path", save_path) break try: profile_path = f"{get_latest_directory(save_path)}\\profile.bin" except FileNotFoundError: if not os.path.isfile(profile_path): text = [ f"\nCould not find '{game_choice}\\WillowGame\\SaveData'.", f"Please enter the full path to WillowGame, this can usually be found in 'Documents\\My Games\\{game_choice}'.", f"Ex. C:\\Users\\CL4P-TP\\Documents\\My Games\\{game_choice}\\WillowGame", ] profile_path = try_input( input_to_game_path, text=text, error= f"Couldn't find WillowGame at that path. Please try entering your path again: ", ) print(f"\nFound latest profile.bin at {profile_path}") return profile_path