VOGONS

Common searches


First post, by blam666

User metadata
Rank Newbie
Rank
Newbie

I'm experiencing a problem when I try to set up certain older PC games that need adanced controller mappings in Windows 10 64.

I'm specifically working on getting easier setups for a bunch of games that need vjoy/ucr combination for setting up proper and reasonable controls for modern gamepads (switching axes for old flight simulators etc. that can't be done by regular mapper programs like xpadder). But the problem I have probably touches a lot of other possible usages, too.

So I try to write batch files that completely automatically start up and quit a game including enabling vjoy driver at start to enable a virtual joystick, to start and run a specific UCR profile, then after quitting the game automatically shutting down UCR and disabling the vjoy driver again. I found out the command line arguments for all of this and it's perfectly possible to do this.

But some games need something more. There is no way for some older titles to choose the right game device for controls if it's not set up as the preferred device in Windows game controller options. There is no way to choose between different controller devices in the in-game options themselves, so they will inevitably fall back to Windows "preferred device". So in these cases I want the game to accept the vjoy device as the input device they should observe for the inputs, but have to set this up manually within joy.cpl Windows menu after enabling the vjoy driver every time I start a game and have to revert it back to my physical gamepad when I'm finished playing.

When I don't turn preferred device back to my gamepad after those games, other games would again get into trouble, so I constantly have to switch this setting for this handful of games that need vjoy/ucr.

What I wanted to know is if there is any way to control Windows' "preferred device" gamepad setting within a batch file? Is there some access or command that would enable me to write a command chain that saves me all manual fiddling with that damn setting?

Reply 1 of 4, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Use sysinternals process monitor, only enable registry monitoring and capture events when changing that setting. Then go through the events and match the time you changed it to the events. Once found export the registry, and create setting before and after and import from batch whenever you want or just change the registry value using a cli command and put that command in the batch file.

How To Ask Questions The Smart Way
Make your games work offline

Reply 2 of 4, by blam666

User metadata
Rank Newbie
Rank
Newbie

Thank you very much!

Sounds a bit complicated to me, I have to admit, but I'll have a go at that the next days.

So I should basically monitor and "fish out" the registry change that is enabled by the "preferred device" setting for my system and recreate that registry change (and change back) within a batch file later on (roughly how I understand it...)

That sounds like a thing a clever user-friendly tool could do in a somewhat easier way. But the problem with the "preferred device" setting seems so niche that nobody ever cared to write something for it, I guess

Ok I'm gonna test that method tomorrow and see how far I get with it...

Reply 3 of 4, by blam666

User metadata
Rank Newbie
Rank
Newbie

I think what I specifically want to do here may work in a more comfortable way for noobs like me with a program called "Joystick ID# Swapper".

The "preferred device" is always "joystick Id 1" I learned. If another device gets attached it's put at Joystick ID 2, the next one ID 3 and so on.

I downloaded and tested the program and it can swap the vjoy device with my gamepad when it's enabled from "Joystick Id 2" to the ID 1 slot and it becomes "preferred device" this way automatically (and the physical gamepad becomes "Joystick Id 2"). Vice versa is also possible. In the description to the program they wrote the tool is able to be controlled by command line options, too. But I still have to figure out how this works exactly.

I will check tommorow if I'll be able to successfully write batch files doing exactly what I want it to do with that program and if yes, how I managed to. If I fail, I will tell here, too, and continue looking for other ways.

Reply 4 of 4, by blam666

User metadata
Rank Newbie
Rank
Newbie

Ok, it works really well with Joystick ID# Swapper and I can create all batch processes I need.

All you have to do is start the program once with your usual physical gamepads/controllers and vjoy enabled and then modify and save the ID configurations you want to have for the running game (with vjoy set to ID1) and a configuration you want for AFTER the game is finshed again (with your physical gamecontroller set back to ID#1/preferred device), and you can start the program from within the batch file with the executable (JoyIDs.exe) and the path/file of the saved configuration file (jid-files) in "".

Example:

@echo off
cd "C:\PJP\JoyIDs"
start /w JoyIDs.exe "C:\PJP\JoyIDs\Configs\GameXYZStart.jid"
cd "C:\GAMES\GameXYZ"
start /w game.exe
cd "C:\PJP\JoyIDs"
start JoyIDs.exe "C:\PJP\JoyIDs\Configs\GameXYZStop.jid"

(with the jid-Files being the saved configurations of your desired Joystick #IDs. And the paths of course have to be modified to your actual files and paths.)

For my case, in which I wanted to start a game automatically with enabling vjoy, starting and activating a ucr profile and then shutting everything down again and setting the game controller ID# setting to its default after I quit the game it becomes quite a long batch, it looks like this in my case:

@echo off
cd "C:\vJoy\x64"
start /w vjoyconfig enable on
cd "C:\PJP\JoyIDs"
start /w JoyIDs.exe "C:\PJP\JoyIDs\Configs\GameXYZStart.jid"
cd "C:\UCR_v0.9.0"
start UCR.exe -p "GameXYZ"
timeout /t 10
cd "C:\GAMES/GameXYZ"
start /w "GameXYZ.EXE"
cd "C:\UCR_v0.9.0"
taskkill /IM UCR.exe
cd "C:\PJP\JoyIDs"
start /w JoyIDs.exe "C:\PJP\JoyIDs\Configs\GameXYZStop.jid"
cd "C:\vJoy\x64"
start /w vjoyconfig enable off

The timeout command is in there because UCR takes a bit long to load and interfered a bit with the game starting smoothly at first. I also still have to find out if there is any way to make UCR start minimized to the tray, but that's another problem and the problem I was writing about here is now solved for me.

Thanks again and bye!