EDIT: There was a guide by darklinkpower about two years ago that gives more general and specific instructions about this same process. If this guide doesn't work for you, try his while making appropriate adaptations for your use-case.
Sometimes an Xbox controller won't work with a specific game, or you want to use something closer to the original controller; either way, it may require you to run an application in the background to let this controller be used; but you may not want this application to run in the background the entire time, either for objective reasons or out out preference; This will tell you how to make Playnite launch these programs manually using a really simple method partly outlined in Playnite's own documentation; this will focus on BetterJoyForCemu and emulators but with some substitution this should work for something like DS4Windows and with native PC games as well.
Prerequisites:
- Launch the program that lets you use your specific controller and make sure it's setup the way you want it to be used.
- Launch the program you want to use this controller with to make sure everything is correctly mapped.
Instructions:
The actual process is the same whether it's for an emulator or a native application, but if it's for an emulator I recommend you do this within the "Configure Emulators..." menu for greater convenience (however, it might cause problems if you ever require an more specialized setup for certain games, emulated or otherwise); If you want to do this for a specific game only, edit the game's details and go to the Scripts section. Either way, add the following to the "execute before starting" section:
Start-Process "<INSTALLPATH>\BetterJoyForCemu.exe"
Substitute <INSTALLPATH> for the actual path that contains BetterJoyForCemu.exe and make sure to surround the entire path in quotation marks ("") in case there are certain characters like spaces that would otherwise throw the script off. This makes Windows launch BetterJoyForCemu before starting the game, which will have the controller be picked up by the application (but not always, check the Solutions section of this guide for some workarounds to try).
Then add this to the "execute after exiting" section:
Stop-Process -Name BetterJoyForCemu
This makes Windows forcefully close BetterJoyForCemu (so far there has been no issues doing this aside from the notification icon lingering after the program has been closed, but you can easily hover the your cursor over it and the notification area will undate itself and remove the icon) after you're closed the program. You should see the scripts look something like this:
If everything has been set-up right, you should be able to launch the application, have BetterJoy start up and be able to play the game, and have it close itself out without issues after you exit the application.
Solutions:
If the program you want to use doesn't accept input and it worked before, it may be because the program started up before BetterJoyForCemu. Try the following command:
If the program you want to use doesn't accept input and it worked before, it may be because the program started up before BetterJoyForCemu. Try the following command:
Start-Sleep -Seconds <TIME>
This makes Windows suspend activity on this script for x second(s): substitute <TIME> for any amount in seconds that you wish for it to; this should at least be long enough for BetterJoyForCemu to fully startup (thankfully, you may not need to have it suspended for any longer than a second at most). If the program opening too quickly was the cause of the problem then it should be able to read the controller's inputs now. In case you have some kind of error after trying this, make sure the script looks like this:
If I ever find any issues or that some programs will require special instructions in order to work seamlessly I will update this guide.