Skip to content

Commit 29d612e

Browse files
Merge pull request #239 from pawndev/fix/237/nextui-miyoo-flip-disable-keyboard-joystick-event
fix(nextui/miyoo): disable keyboard and joystick event
2 parents bbd6cf7 + 11a030e commit 29d612e

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

app/setup.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"grout/cfw/koriki"
99
"grout/cfw/minui"
1010
"grout/cfw/muos"
11+
"grout/cfw/nextui"
1112
"grout/cfw/onion"
1213
"grout/cfw/rocknix"
1314
"grout/cfw/spruce"
@@ -118,7 +119,8 @@ func initFramework(currentCFW cfw.CFW) {
118119
gabaOptions.DisplayOrientation = gaba.OrientationRotate90
119120
}
120121

121-
if currentCFW == cfw.MinUI && minui.DetectDevice() == minui.DeviceMiyooFlip {
122+
if (currentCFW == cfw.MinUI && minui.DetectDevice() == minui.DeviceMiyooFlip) ||
123+
(currentCFW == cfw.NextUI && nextui.DetectDevice() == nextui.DeviceMiyooFlip) {
122124
gabaOptions.DisabledInputSources = gaba.DisabledInputSources{
123125
Keyboard: true,
124126
Joystick: true,

cfw/nextui/device.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package nextui
2+
3+
import (
4+
"os"
5+
"runtime"
6+
7+
gaba "github.com/BrandonKowalski/gabagool/v2/pkg/gabagool"
8+
)
9+
10+
const DeviceType = "NEXTUI_DEVICE"
11+
12+
type Device string
13+
14+
const (
15+
DeviceMiyooFlip Device = "miyooflip"
16+
DeviceTrimui Device = "trimui"
17+
DeviceGeneric Device = "generic"
18+
)
19+
20+
func detectDeviceByEnv() Device {
21+
logger := gaba.GetLogger()
22+
logger.Debug("Detecting NextUI device type", "env", DeviceType)
23+
deviceType := os.Getenv(DeviceType)
24+
25+
switch deviceType {
26+
case "tg5040", "tg5050":
27+
return DeviceTrimui
28+
case "my355":
29+
return DeviceMiyooFlip
30+
default:
31+
logger.Warn("Unknown NextUI device type", "value", deviceType)
32+
return DeviceGeneric
33+
}
34+
}
35+
36+
func DetectDevice() Device {
37+
logger := gaba.GetLogger()
38+
logger.Debug("Detecting NextUI device type", "arch", runtime.GOARCH)
39+
40+
deviceType := detectDeviceByEnv()
41+
switch deviceType {
42+
case DeviceMiyooFlip:
43+
return deviceType
44+
}
45+
46+
return DeviceGeneric
47+
}

scripts/NextUI/launch.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ if [ -d ".update" ]; then
99
fi
1010

1111
export CFW=NEXTUI
12+
# This $PLATFORM is automatically set by NextUI, we map it another variable just to remember where it comes from.
13+
export NEXTUI_DEVICE="$PLATFORM"
1214
export LD_LIBRARY_PATH=$CUR_DIR/lib:$LD_LIBRARY_PATH
1315

1416
./grout

0 commit comments

Comments
 (0)