From 5f012719f973f477a0ed6c3ce1c7d391eee954f0 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 5 Jul 2025 17:20:17 -0700 Subject: implement configurable keylayout --- README.md | 11 +++++++++-- chuni-hands-evolved.py | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index da90a2b..baaf08c 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,15 @@ Another mysterious tool that detects things. Inspired by [chuni-hands](https://g # Usage Notes In most cases you will not need to turn on keybinds output option (unless you are doing something custom) -If you are using this with UMIGURI and are using [brokenithm-evolved-ios-umi](https://git.moekyun.me/pinapelz/brokenithm-evolved-ios-umi), keybinds option is not needed. +If you are using this with UMIGURI and are using [brokenithm-evolved-ios-umi](https://gitea.tendokyu.moe/pinapelz/brokenithm-evolved-ios-umi), keybinds option is not needed. The UI will lag when the update rate is set to low, its recommended that you first configure using a high update rate, then set it as low as possible for use to ensure minimal latency. -*It takes some time to start up, so please be patient*. \ No newline at end of file +*It takes some time to start up, so please be patient*. + +- Low-quality webcams will make detection difficult +- Expanding the areas of the air-zones will allow for higher accuracy, as it takes the average lighting within a larger area +- The GUI "scales", please adjust window height accordingly (i love tkinter yep.) + +# Config +On first launch a `config.json` file will be created. Saving your configs from the UI will write to this file, unsaved changes wil be lost. \ No newline at end of file diff --git a/chuni-hands-evolved.py b/chuni-hands-evolved.py index 9859d9c..cda7010 100644 --- a/chuni-hands-evolved.py +++ b/chuni-hands-evolved.py @@ -19,12 +19,12 @@ zones = [ ] _UMIGIRI_32_AIRZONE_LAYOUT = { - 0: "o", - 1: "0", - 2: "p", - 3: "l", - 4: ",", - 5: ".", + 0: ".", + 1: ",", + 2: "P", + 3: "L", + 4: "O", + 5: "0", } base_positions = [{"x": zone["x"], "y": zone["y"]} for zone in zones] @@ -200,6 +200,7 @@ def setup_gui(camera_width: int, camera_height: int, preview_width: int, preview "width": int(width_var.get()), "camera_index": current_camera_index, "chuniio_enabled": chuniio_enabled.get(), + "layout": _UMIGIRI_32_AIRZONE_LAYOUT } with open(CONFIG_FILE, "w") as f: json.dump(config, f) @@ -350,9 +351,13 @@ def load_config() -> dict: return {} def main(): - global root, current_camera_index, cap, video_canvas, x_slider, y_slider, width_var, spacing_slider, sensitivity_var, keystrokes_enabled, chuniio_enabled, update_rate, CAMERA_WIDTH, CAMERA_HEIGHT, latest_frame, running + global root, current_camera_index, cap, video_canvas, x_slider, y_slider, width_var, spacing_slider, sensitivity_var, keystrokes_enabled, chuniio_enabled, update_rate, CAMERA_WIDTH, CAMERA_HEIGHT, latest_frame, running, _UMIGIRI_32_AIRZONE_LAYOUT print("Now starting up... please wait a bit...") config = load_config() + if config.get("layout") is not None: + print("Loading key-layout from config") + _UMIGIRI_32_AIRZONE_LAYOUT = {int(k): v for k, v in config.get("layout").items()} + print(_UMIGIRI_32_AIRZONE_LAYOUT) current_camera_index = config.get("camera_index", 0) cap = cv2.VideoCapture(current_camera_index) cap.set(cv2.CAP_PROP_FRAME_WIDTH, CAMERA_WIDTH) -- cgit v1.2.3