christianhaitian / oga_controls

Adds support for keyboard and mouse emulation using rk3326 device game controls. Originally authored by Kris Henriksen.
GNU General Public License v2.0
5 stars 6 forks source link

Simplifying Scripts #3

Closed mcpalmer1980 closed 2 years ago

mcpalmer1980 commented 3 years ago

I wonder if this program should be altered to simplify scripts. Here are my three cents:

1: make oga_controls detect the device type instead of having it passed to the program from the script

2: make oga_controls fork the program and kill it when its done, instead of doing it in the script

3: make oga_controls restart oga_events

this would let us simplify this:

if [[ -e "/dev/input/by-path/platform-ff300000.usb-usb-0:1.2:1.0-event-joystick" ]]; then
  param_device="anbernic"
elif [[ -e "/dev/input/by-path/platform-odroidgo2-joypad-event-joystick" ]]; then
    if [[ ! -z $(cat /etc/emulationstation/es_input.cfg | grep "190000004b4800000010000001010000") ]]; then
      param_device="oga"
    else
      param_device="rk2020"
    fi
elif [[ -e "/dev/input/by-path/platform-odroidgo3-joypad-event-joystick" ]]; then
  param_device="ogs"
else
  param_device="chi"
fi

cd /roms/ports/openjazz/
sudo ./oga_controls OpenJazz $param_device &
./OpenJazz -f "$(pwd)/gamedata"
sudo kill -9 $(pidof oga_controls)
sudo systemctl restart oga_events &
printf "\033c" >> /dev/tty1

with this:

 sudo ./oga_controls  ./OpenJazz -f "$(pwd)/gamedata"
christianhaitian commented 3 years ago
  1. I thought of incorporating the ability to detect the controller within the program, however, it would be an issue for devices that have the same controller but the button arrangements are different (ex. oga, rk2020, and rgb10) as well as the OGS and RG351MP.

  2. oga_controls doesn't currently fork the program but it can already kill it using the define hotkey for it. For 351 devices, it uses select+start. For some reason, this doesn't work on 351Elec so it's something that will need to be investigated.

  3. Not all operating systems use oga_events. Only ArkOS and TheRA. And that's only needed because force closing some of the ports causes the program (ogage) to stop functioning. For the Ubuntu distros, ogage is what provides the global hotkey services.

If I were to simplify the scripts. johnnyonflame's suggestion of using sourceing seems the most logical, however, I want these ports to be able to be installed without using portmaster.

christianhaitian commented 2 years ago

Closing this as we're transitioning this to using gptokeyb and using a central control script that has simplified this as much as possible. The solution now involves 2 steps for manually unpacking and making use of ports without using the portmaster tool but it makes sense to ease support and future development needs.