Dolphin, the GameCube and Wii emulator - Forums
Switch controller profiles via bash script - Printable Version

+- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org)
+-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support)
+--- Forum: Android (https://forums.dolphin-emu.org/Forum-android)
+--- Thread: Switch controller profiles via bash script (/Thread-switch-controller-profiles-via-bash-script)



Switch controller profiles via bash script - NickHatBoecker - 05-03-2022

Hey guys,

I know that you can't have multiple controller profiles on Android atm.
But I asked myself if it would be possible to switch between configurations via a bash script.

I tried the following script for Zelda Wind Waker:

Code:
#!/bin/bash

echo "Switching to GZLP01_BT_CONTROLLER profile..."
cd /storage/emulated/0/Android/data/org.dolphinemu.dolphinemu/files/GameSettings
rm GZLP01.ini
cp GZLP01_BT_CONTROLLER.ini GZLP01.ini
echo "DONE"

The ini file contains all the input settings. For example:

Code:
[Android]
InputA_0 = Device 'DEVICE_ID'-Button 97

I call the script in Termux via 

Code:
bash ./my_script.sh


Unfortunately this isn't working. Even if I completely delete GZLP01.ini, the old controller configuration is loaded.
Maybe this is the wrong directory? Or we have to trigger dolphin to reload the settings?

I have an AYN Odin console and there are a lot of people, who will need different profiles when using the AYN Super Dock in the future.
So we desperately need this feature or a work around, like this bash script.

Any input/help/ideas on this?
Thanks in advance!

Best regards
Nick


RE: Switch controller profiles via bash script - JosJuice - 05-04-2022

(05-03-2022, 09:37 AM)NickHatBoecker Wrote: Unfortunately this isn't working. Even if I completely delete GZLP01.ini, the old controller configuration is loaded.

In what way are you checking this? When you set the controls in the Android version of Dolphin, they actually get stored in two different locations, one which is loaded for display in the UI and one which is used when actually emulating. (Yes, this is messed up. I'm trying to replace the whole system, but it's taking a while.) IIRC the copy in GameSettings (or Dolphin.ini for the global settings) is the one that gets used when emulating.

(05-03-2022, 09:37 AM)NickHatBoecker Wrote: Maybe this is the wrong directory?

If Config > User Data shows the path /storage/emulated/0/Android/data/org.dolphinemu.dolphinemu/files/, then it's correct.

(05-03-2022, 09:37 AM)NickHatBoecker Wrote: Or we have to trigger dolphin to reload the settings?

Unless you're trying to edit the settings while the game is running, you shouldn't need to do anything like that.


RE: Switch controller profiles via bash script - NickHatBoecker - 05-04-2022

Thanks for your reply.
I didn't know that Dolphin uses two different files for emulator use and GUI. But that explains it, I guess.
I only changed one of them and I guess that wasn't the one for the GUI, because I only checked the values there, without confirming while playing.

I finally found a workaround now using Dolphin MMJR for the moment.
I guess the weird two-config-files-issue was already solved there.
I wrote a little Android helper app which takes an ini file with only Controls, and these are merged with the file Dolphin.ini. So only the controls will be overwritten. If have to manually clear the cache in the Dolphin app afterwards, but I can live with this.

It was however a pain to implement this app, because I'm a web developer. Never had anything to do with java...but at least it's working. Big Grin
Can't wait for your fix in the official release. As soon as this is fixed, I will come back to it, because MMJR is officially abandoned now.
So thank you for your efforts on this!


RE: Switch controller profiles via bash script - JosJuice - 05-04-2022

(05-04-2022, 03:12 AM)NickHatBoecker Wrote: I guess the weird two-config-files-issue was already solved there.

It isn't. To the best of my knowledge, MMJR behaves the same as official Dolphin regarding this.