Last active
March 27, 2025 13:32
-
-
Save MikuAuahDark/dccc43404e6766b3fa6328d084886b40 to your computer and use it in GitHub Desktop.
120 FPS Unlocker for Wuthering Waves (BROKEN IN 2.2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit | |
# of the public at large and to the detriment of our heirs and | |
# successors. We intend this dedication to be an overt act of | |
# relinquishment in perpetuity of all present and future rights to this | |
# software under copyright law. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# For more information, please refer to <https://unlicense.org> | |
import argparse | |
import glob | |
import json | |
import os | |
import os.path | |
import sqlite3 | |
import sys | |
def where_wuthering() -> str | None: | |
appdata = os.environ["APPDATA"] | |
paths = glob.glob(os.path.normpath(f"{appdata}/KRLauncher/*/*/kr_starter_game.json")) | |
candidate = None | |
candidate_ts = 0 | |
for path in paths: | |
stat = os.stat(path) | |
if stat.st_mtime_ns > candidate_ts: | |
print(f"Found candidate '{path}' ts {stat.st_mtime_ns}", file=sys.stderr) | |
candidate = path | |
candidate_ts = stat.st_mtime_ns | |
if candidate is not None: | |
with open(candidate, "r", encoding="utf-8", newline="") as f: | |
jsondata = json.load(f) | |
return jsondata.get("path") | |
return None | |
FRAMERATE_MAP = [30, 45, 60, 120] | |
def main(): | |
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) | |
parser.add_argument( | |
"--framerate", | |
"-f", | |
help="Target framerate (0 = 30 FPS, 1 = 45 FPS, 2 = 60 FPS, 3 = 120 FPS)", | |
type=int, | |
choices=range(len(FRAMERATE_MAP)), | |
default=3, | |
) | |
args = parser.parse_args() | |
wuthering = where_wuthering() | |
if wuthering is None: | |
raise Exception("Wuthering Waves not found. Is the game installed?") | |
print("Found Wuthering Waves:", wuthering, file=sys.stderr) | |
localstorage = os.path.normpath(f"{wuthering}/Client/Saved/LocalStorage/LocalStorage.db") | |
print("LocalStorage.db:", localstorage, file=sys.stderr) | |
if not os.path.isfile(localstorage): | |
raise Exception("LocalStorage.db not found. Let the game run first.") | |
with sqlite3.connect(localstorage) as db: | |
command = f"INSERT INTO LocalStorage VALUES ('CustomFrameRate', {args.framerate}) ON CONFLICT (key) DO UPDATE SET value={args.framerate}" | |
print(command) | |
db.execute(command) | |
print("Framerate set to", FRAMERATE_MAP[args.framerate]) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment