Note: PB does not "fully see" some stuff, but this (SDL2) does!
Code: Select all
; Test any joystick/gamepad on PB!
; You will need joyosc:
; https://github.com/danomatika/joyosc
; and stdbuf:
; https://formulae.brew.sh/formula/coreutils#default
; To stop, better quit joyosc (or close the window)
Procedure Shell(ShellCommand$)
Protected shell = RunProgram("/bin/zsh","-l","",
#PB_Program_Open|#PB_Program_Write|#PB_Program_Read)
If shell
WriteProgramStringN(shell,ShellCommand$)
WriteProgramData(shell,#PB_Program_Eof,0)
While ProgramRunning(shell)
If AvailableProgramOutput(shell)
Debug ReadProgramString(shell)
EndIf
Wend
CloseProgram(shell)
EndIf
EndProcedure
Shell(~"stdbuf -oL joyosc -ew") ; full
; Normalized output:
; Shell(~"stdbuf -oL joyosc -ew -jn | stdbuf -oL awk -F'[/: ]' '{print $2\":\"$(NF-3)\":\"$(NF-1)\":\"$NF}'")