evilC / OneSwitch-Utilities

A set of utilitie to assist disabled people operate computers. In association with OneSwtich.
http://oneswitch.org.uk/
4 stars 0 forks source link

mouse to joy Functionality toggle doesn't work. #16

Open Osjur opened 8 years ago

Osjur commented 8 years ago

As the title says, If i bind lets say F5 to functionality toggle and then press it, my axises are still moving in vJoy monitor.

Edit: I understood the functionality toggle wrong, closing

evilC commented 8 years ago

Did you find a solution? BTW, am likely to be re-writing the OneSwitch stuff over the next week or so. Please see my UCR repository.

Osjur commented 8 years ago

Well yes and no, I skimmed through the ADHD lib code and noticed that the functionality toggle just toggles hotkeys on and off, it doesn't turn off the whole script so that's why the axis still moved. I need to create a hotkey to turn off the axis movement and vjoy setbtn hotkeys. In the middle of writing that. I really haven't played with AHK before so its a new experience for me. I have only done some basic stuff with c# and c++ languages.

One question though: I am using your mouse to joy script (what a superb mouse Implementation!) as a base for my script, it just moves different axes and doesn't have relative / calibrate data. Imo your way is better than how I was trying to do it with c++ / qt by calculating the mouse distance from the center of the monitor and then outputting that data to axis and moving the mouse back to center at set intervals.

But back to the question: On start of the script, the initial values for other axis are set to zero. I need them to be in the center instead so I tried to put OutputStick.Acquire() after OutputStick := vJoyInterface.Devices[1], but the mouse script moves the other axis to zero when you move the mouse.

OutputStick.SetAxisByName(16384,"x") etc. after OutputStick := vJoyInterface.Devices[1] keeps the other axis at the center after moving the mouse for some reason, but I'm pretty sure that is not the proper way to do it. Heck maybe the script just reads SetAxis data every time I move mouse or press hotkey, because isn't that command in the auto-execute section before the first return is called.

I just need to find a way to set those other axis to center and then the script should not touch them until they are called with hotkey, etc.

Sorry if my post a little bit confusing to read.

evilC commented 8 years ago

Yeah, apologies, the ADHD stuff is a confusing mess, written in an era when AHK was much more primitive (and I was much greener). I am due to be sitting down with Barrie from OneSwitch this very afternoon and fleshing out how we are going to move forward with the OneSwitch stuff, and mouse to joy is one of his primary concerns, so expect it to be one of the first things to get some attention. Out of interest, what is your angle here? Are you disabled (or supporting someone who is) or just a regular gamer? It makes no difference as UCR is targeted at both, I just want to get a handle on your use-case.

Osjur commented 8 years ago

Just a gamer here. Trying to write a KB+Mouse to virtual gamepad script with GUI and bindable buttons and axises. There are some games which just doesn't support mouse at all but supports gamepads and also doesn't behave properly when using xinput or directinput device and keyboard at the same time. Mouse integration to axis would be for camera controls, keyboard to axis / d-pad for movement and buttons could be binded to either kb or mouse.

I've checked UCR and UJR but they don't have enough functionality as of now to do what I want. There are "many" programs which can do joy-to-kb/mouse bindings but kb/mouse-to-joy programs and scripts are sparse and most of them have a mouse implementation which either doesn't work properly or is not adjustable. Also most of them have been written for PPjoy / GlovePIE which is outdated and just pain in the ass to install. While there's some vJoy+Freepie scripts available, their way of reading mouse movement data is not that great.

That pretty much sums it up.

evilC commented 8 years ago

I just added a proof of concept for Mouse to vJoy in UCR tonight.

With UCR, instead of a "virtual gamepad script", what you would have would be a profile containing a collection of plugins which together control a virtual joystick. So take a "mouse to joy" plugin, a bunch of "button to button" plugins and configure them for that particular game.

That way, the end user can build a profile to suit their needs from building blocks, rather than having to custom write each script for each use-case.

evilC commented 8 years ago

I just released a version of UCR with an initial implementation of Mouse To Joy. No functionality toggle in there yet though, but it would be pretty simple to add a hotkey to the plugin and use it to turn on/off output. https://autohotkey.com/boards/viewtopic.php?f=19&t=12249&p=63868#p63868