-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port: Miyoo Mini Plus #839
Comments
I'm guessing the SDL2 port doesn't expose the buttons as a gamepad. (As "mapping random devices to a standard layout" is kinda what SDL's "gamepad" support is for...) Too bad there's nobody with knowledge of SDL2 internals here... wait. |
We might fare better by using something less custom than the incredibly DraStic specific hack of SDL I used to get stuff up and running quick. It seems to include input plus some integrated menu and a mousekeys mode since the device has no touchscreen - https://github.com/steward-fu/sdl/blob/sdl-2.0.20_ssd202d_miyoo-mini_drastic/src/video/mmiyoo/SDL_video_mmiyoo.c This is a much more succinct version of the Miyoo SDL video driver, without all the input hacks and menus. I’ve no idea how to invoke the OS menu so I just bound the menu button to quit 😬 when using the DraStic SDL libs: https://github.com/steward-fu/sdl/blob/sdl-2.0.20_ssd202d_miyoo-mini/src/video/mmiyoo/SDL_video_mmiyoo.c I guess the next step is to figure out what the vanilla SDL2 port does for input! Okay, roughy the same - reading the scancodes from a hard-coded keyboard device path and packing them into a bitmap for some reason- https://github.com/steward-fu/sdl/blob/sdl-2.0.20_ssd202d_miyoo-mini/src/video/mmiyoo/SDL_event_mmiyoo.c Also some mouse keys support in there, but fewer available “buttons” because there’s no soft menu injecting SDL input events. |
Ouch that repo is nasty. input handling in the video driver... aaaaa Though if the input driver is using |
Yeah it’s doing some hacky stuff to intercept input which we don’t need- I’ll have to bite the bullet, rip out the bits we don’t need and try to compile it from source. Goal is to get a generic Docker image with the buildroot/toolchain preconfigured to build SDL2 apps for Miyoo. Then it’s useful to anyone who wants to make a port! |
Hah, I was just trying to find the actual diff from upstream SDL, but there are a mountain of unrelated (formatting?) changes. May be too far to stop now though. So uh, that might help... |
There: https://github.com/Daft-Freak/SDL/tree/ssd202d_miyoo-mini It looks like there is a joystick driver so it should just need a mapping defined for gamecontroller to work. (Likely in a similar way to the emscripten or psp one) Some other fun stuff:
|
You're a gosh darn wizard! It's your chaotic influence that had me trying to port 32blit to something random in the first place 😆 |
Okay for audio we need something like: #!/bin/sh
echo $0 $*
progdir=`dirname "$0"`
cd $progdir
export HOME=$progdir
export PATH=$progdir:$PATH
export LD_LIBRARY_PATH=$progdir/libs:$LD_LIBRARY_PATH
export SDL_VIDEODRIVER=mmiyoo
export SDL_AUDIODRIVER=mmiyoo
export EGL_VIDEODRIVER=mmiyoo
. /mnt/SDCARD/.tmp_update/script/stop_audioserver.sh
./geometry --fullscreen And possibly this change to config.json from Vitty85 on the RGH Discord- {
"label":"Geometry (32blit)",
"icon":"geometry.png",
"iconsel":"geometry.png",
"launch":"launch.sh",
"useswap":1,
"noaudiofix":1,
"description":"Asteroids with a twist."
} And they also had some interesting changes to the launch script which might come in handy: #!/bin/sh
get_curvol() {
awk '/LineOut/ {if (!printed) {gsub(",", "", $8); print $8; printed=1}}' /proc/mi_modules/mi_ao/mi_ao0
}
set_snd_level() {
local target_vol="$1"
local current_vol
local start_time
local elapsed_time
start_time=$(date +%s)
while [ ! -e /proc/mi_modules/mi_ao/mi_ao0 ]; do
sleep 0.2
elapsed_time=$(( $(date +%s) - start_time ))
if [ "$elapsed_time" -ge 30 ]; then
echo "Timed out waiting for /proc/mi_modules/mi_ao/mi_ao0"
return 1
fi
done
start_time=$(date +%s)
while true; do
echo "set_ao_volume 0 ${target_vol}dB" > /proc/mi_modules/mi_ao/mi_ao0
echo "set_ao_volume 1 ${target_vol}dB" > /proc/mi_modules/mi_ao/mi_ao0
current_vol=$(get_curvol)
if [ "$current_vol" = "$target_vol" ]; then
echo "Volume set to ${current_vol}dB"
return 0
fi
elapsed_time=$(( $(date +%s) - start_time ))
if [ "$elapsed_time" -ge 30 ]; then
echo "Timed out trying to set volume"
return 1
fi
sleep 0.2
done
}
echo $0 $*
progdir=`dirname "$0"`
cd $progdir
export HOME=$progdir
export PATH=$progdir:$PATH
export LD_LIBRARY_PATH=$progdir/libs:$LD_LIBRARY_PATH
export SDL_VIDEODRIVER=mmiyoo
export SDL_AUDIODRIVER=mmiyoo
export EGL_VIDEODRIVER=mmiyoo
curvol=$(get_curvol) # grab current volume
if [ -f /mnt/SDCARD/.tmp_update/script/stop_audioserver.sh ]; then
/mnt/SDCARD/.tmp_update/script/stop_audioserver.sh
else
killall audioserver
killall audioserver.mod
fi
CUST_CPUCLOCK=1
sv=`cat /proc/sys/vm/swappiness`
# 60 by default
echo 10 > /proc/sys/vm/swappiness
if [ "$CUST_CPUCLOCK" == "1" ]; then
echo "set customized cpuspeed"
cpuclock 1500
fi
set_snd_level "${curvol}" &
./geometry --fullscreen
if [ "$CUST_CPUCLOCK" == "1" ]; then
echo "set customized cpuspeed"
cpuclock 1200
fi
echo $sv > /proc/sys/vm/swappiness
sync |
Hmm I'm getting a right mess of conflicting types from somehow including both This was due to an effort to resolve a missing
I deeply suspect I'm doing buildroot hardmode here by having no clue what I'm doing! |
That looks like an SDL1 vs SDL2 conflict (so I guess wrong SDL_ttf version?)... but an SDL video driver really shouldn't have a dependency on a font rendering library... See if anything explodes with that include deleted? 🤷 |
That's a point, it might be specifically for the onscreen menu stuff in the DraStic version! 👀
... ... OH COME ON! 😆
|
Oh now a thing has happened:
ahh...
|
That might be some binaries that got (correctly) .gitignore'd... At least, I see a mmiyoo/libs dir in that SDL repo. SDL_image and a JSON lib as well? In a low-level driver? 🤦 |
Right getting somewhere, I need a couple more libs... EGL and GLESv2, so back to the buildroot config. Okay using the mystery meat libs from here works: https://github.com/steward-fu/sdl/tree/sdl-2.0.20_ssd202d_miyoo-mini Both |
Well this explains what all those includes are doing with the DraStic SDL-
Unfortunately the SDL that I - finally - compiled from sauce is not working. |
More or less the same error, too, so I'm not sure what's awry here. |
🤔 Looking at one of those "trade secret" header files (
So
Which seems plausible to be coming from audio init. |
Okay grabbing the vanilla SDL from Stewart's repo, removing the vestigial libs/includes and building that seems to work - https://github.com/Gadgetoid/steward-fu-sdl/tree/vanilla That gets me... somewhere... I think |
So there's something broken in my "clean" branch then... (Also, stole your patch 😆) |
I'm up and running with a custom SDL, though I've made no effort to unpick the input handling. Audio is extremely delayed (about one second) and I don't really have the first clue why. Removing all the custom input stuff definitely makes input not work... that's an... uh... start... |
Theoretically the linux joystick driver should do... something. (that's the driver for /dev/eventX). Though I can't say whether or not it will detect the device as a "joystick". The custom one looks like a stub. You'd need to get a joystick test running to figure out the gamepad mapping... |
I've figured out what you mean by emscripten/psp joysticks so I'm deep in populating the empty miyoo joystick driver to see if it will... do a thing. Darn Miyoo wont connect to my wifi so I'm stuck pulling the SD card, moving SDL out of my docker container, and then scp'ing it from my remote dev machine onto the SD card aaaah |
Gadgetoid/steward-fu-sdl@dfef26c 😬 I must be missing some secret sauce because the compiler is picking up these changes but driver does nada, never gets probed, or who really knows! |
TIL For posterity: Name -> GUID: |
Okay the mapping works and coaxes SDL into “opening” the joystick, but still no input 🤔 Gadgetoid/steward-fu-sdl@aaafe38 Sort-of debug:
Hmm getting and sending button states, but 32blit seems to be ignoring gamepad input 🤔
|
Seems the bit that should be transforming |
That suggests that the gamecontroller mapping isn't working 🤔. 32blit won't get joystick events as it opens the device a controller and not a joystick (I think). |
Or it could be a keyboard focus issue. Try adding (Remembering some of the issues from getting controllers working in emscripten) |
Sigh after hours of debugging and tinkering and losing sleep yes, it was an |
Due to reasons, I've been avoiding pursuing any work-adjacent hobbies for the time being... this is on the backburner for now, but I think it's still worth solving some of the pieces of this puzzle since it will make future ports easier. |
I think I have a tools patch somewhere for outputting different size icons, if that helps. (Needed to generate 256x256 JPEGs for the switch stuff) |
Some other relevant stuff before I forget again: https://github.com/Daft-Freak/sdl-cross-build |
By the time I get back to this, there will be another handheld to try. Still thinking about the feasibility of a Taito Super Pocket port 😆 |
I picked up a Miyoo Mini Plus recently so I had something to distract me from all the Linux gpio tomfoolery. The few 32blit examples I've managed to port over run pretty well.
https://droix.co.uk/product/miyoo-mini-plus/
TODO
config.json
,launch.sh
,libs/
, icon and binary.Notes
I used https://github.com/shauninman/union-miyoomini-toolchain or, more specifically, https://github.com/shauninman/miyoomini-toolchain-buildroot/ and added the SDL2 libs via the buildroot
make menuconfig
, then used the following toolchain file to configure 32blit-sdk:SDL2
It looks like SDL2 is not natively supported, and the SDL2 libraries nabbed from the buildroot don't seem to work. I had to borrow the ones from https://github.com/steward-fu/sdl/tree/sdl-2.0.20_ssd202d_miyoo-mini though I just grabbed the compiled binaries out of the DraStic port and added SDL2 net.
I dumped these into a
libs
dir inside the app dir (as per DraStic) and then used the followinglaunch.sh
:Input
The SDL scancodes for input are:
The following patch handles key bindings and makes "menu" exit, note that the LCTRL for B conflicts with our use of Ctrl for something, I forget what:
Geometry.zip
The text was updated successfully, but these errors were encountered: