diff --git a/.gitarchiveinclude b/.gitarchiveinclude index 3db3e04..3f964c9 100644 --- a/.gitarchiveinclude +++ b/.gitarchiveinclude @@ -1,3 +1,5 @@ +bin/minui-btntest-tg5040 +bin/minui-btntest-rg35xxplus bin/minui-keyboard-tg5040 bin/minui-keyboard-rg35xxplus bin/minui-list-tg5040 diff --git a/Makefile b/Makefile index f4e63fe..36fd972 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,21 @@ PAK_NAME := $(shell jq -r .label config.json) PLATFORMS := tg5040 rg35xxplus MINUI_LIST_VERSION := 0.3.1 MINUI_KEYBOARD_VERSION := 0.2.1 +MINUI_BTNTEST_VERSION := 0.2.0 clean: + rm -f bin/minui-btntest-* || true rm -f bin/minui-keyboard-* || true rm -f bin/minui-list-* || true rm -f bin/screenshot-monitor || true rm -f bin/sdl2imgshow || true rm -f res/fonts/BPreplayBold.otf || true -build: $(foreach platform,$(PLATFORMS),bin/minui-keyboard-$(platform) bin/minui-list-$(platform) bin/screenshot-monitor) bin/sdl2imgshow res/fonts/BPreplayBold.otf +build: $(foreach platform,$(PLATFORMS),bin/minui-keyboard-$(platform) bin/minui-list-$(platform) bin/minui-btntest-$(platform)) bin/screenshot-monitor bin/sdl2imgshow res/fonts/BPreplayBold.otf + +bin/minui-btntest-%: + curl -f -o bin/minui-btntest-$* -sSL https://github.com/josegonzalez/minui-btntest/releases/download/$(MINUI_BTNTEST_VERSION)/minui-btntest-$* + chmod +x bin/minui-btntest-$* bin/minui-keyboard-%: curl -f -o bin/minui-keyboard-$* -sSL https://github.com/josegonzalez/minui-keyboard/releases/download/$(MINUI_KEYBOARD_VERSION)/minui-keyboard-$* diff --git a/README.md b/README.md index 369cd03..e3ae7c4 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,7 @@ Press the hotkey when in game. A png screenshot will appear on the SDCard, in `/ > [!IMPORTANT] > If one of the hotkeys in use is mapped to something else within MinUI, the pak may not trigger. -The default hotkey is Hotkey 1 (or `L3`), the left hotkey button. To utilize a different hotkey, create a file named `hotkey` in the pak folder with the name of the key you want to monitor. Only the following buttons are supported at this time: - -- `HOTKEY_1` (left hotkey) -- `HOTKEY_2` (right hotkey) - -If another value is specified, this pak will revert to using `HOTKEY_1`. +The default hotkey is `L3` - see the Input app to determine what this maps to on your device. To utilize a different hotkey, create a file named `hotkey` in the pak folder with the name of the key you want to monitor. Any of the buttons supported by [`minui-btntest`](https://github.com/josegonzalez/minui-btntest) are supported. ### Debug Logging diff --git a/bin/screenshot-monitor b/bin/screenshot-monitor index aa6f612..cfcd14e 100755 --- a/bin/screenshot-monitor +++ b/bin/screenshot-monitor @@ -1,31 +1,15 @@ #!/bin/sh -wait_for_button() { - button="$1" - - chmod +x "$PROGDIR/bin/evtest" - "$PROGDIR/bin/evtest" "/dev/input/event3" 2>&1 | while read -r line; do - if echo "$line" | grep -q "code 317 (BTN_THUMBL), *value 1"; then - if [ "$button" = "HOTKEY_1" ]; then - echo "Taking screenshot..." - "$PROGDIR/bin/screenshot" & - fi - fi - - if echo "$line" | grep -q "code 318 (BTN_THUMBR), *value 1"; then - if [ "$button" = "HOTKEY_2" ]; then - echo "Taking screenshot..." - "$PROGDIR/bin/screenshot" & - fi - fi - done -} - main() { echo "Starting screenshot monitor on $HOTKEY..." + chmod +x "$PROGDIR/bin/evtest" + chmod +x "$PROGDIR/bin/minui-btntest-$PLATFORM" + while true; do echo "Waiting for $HOTKEY..." - wait_for_button "$HOTKEY" + "$PROGDIR/bin/minui-btntest-$PLATFORM" wait just_released all "$HOTKEY" + echo "Taking screenshot..." + "$PROGDIR/bin/screenshot" & done } diff --git a/bin/service-on b/bin/service-on index 0a24470..bdb3c77 100755 --- a/bin/service-on +++ b/bin/service-on @@ -15,10 +15,7 @@ main() { fi if [ -z "$hotkey" ]; then - hotkey="HOTKEY_1" - fi - if [ "$hotkey" != "HOTKEY_1" ] && [ "$hotkey" != "HOTKEY_2" ]; then - hotkey="HOTKEY_1" + hotkey="btn_l3" fi (PROGDIR="$progdir" HOTKEY="$hotkey" "$bindir/screenshot-monitor" >"$LOGS_PATH/$PAK_NAME.service.txt" 2>&1 &) & diff --git a/launch.sh b/launch.sh index c5baaad..72ec7a9 100644 --- a/launch.sh +++ b/launch.sh @@ -198,6 +198,11 @@ main() { return 1 fi + if [ ! -f "$progdir/bin/minui-btntest-$PLATFORM" ]; then + show_message "$progdir/bin/minui-btntest-$PLATFORM not found" 2 + return 1 + fi + if [ ! -f "$progdir/bin/minui-keyboard-$PLATFORM" ]; then show_message "$progdir/bin/minui-keyboard-$PLATFORM not found" 2 return 1