r57zone / OpenVR-driver-for-DIY

OpenVR driver for DIY
GNU General Public License v3.0
130 stars 28 forks source link

Still confused #8

Closed jagg3127 closed 1 year ago

jagg3127 commented 1 year ago

I'm trying to make a driver with the ability to map keys kind of like your HalfLifeAlyx driver, but I want to map the keys to control every aspect of the controllers and have the mouse control the HMD (some keyboard buttons too) I just can't figure out where to even start programming my own driver. I'm on windows using visual studio.

NintyS commented 1 year ago

In points: 1) Download this driver 2) Modify the device (HMD) and controller ( make movements in separate threads ) 3) Don't touch cserverdriver_sample

jagg3127 commented 1 year ago

how would i setup visual studio?

NintyS commented 1 year ago

IDK that, I'm working on Linux. With CMake file. If you have CLion I recommend you to use it, if not try QtCreator.

jagg3127 commented 1 year ago

i figured it out there's a project folder in the driver folder i missed it

r57zone commented 1 year ago
  1. Install Visual Studio 2017 or later by selecting the following (C++: VC++ 2017 or newer, C++ Profiler tools, SDK Windows 10, Tools Visual C++, Visual C++ ATL).
  2. Change the Tools and SDK project properties to yours.

Install proporties: 206898213-1554811a-8a03-4da0-861e-5e344e9a89b7

jagg3127 commented 1 year ago

ok now I'm lost again, can you be more specific or link me to an article for step number two?

  1. Modify the device (HMD) and controller ( make movements in separate threads )
NintyS commented 1 year ago

@jagg3127 I know it from checking a OpenVR samples. You have: csamplecontrollerdriver - controller class, csampledevicedriver - head motion device. Only these two classes are important for you right now IMO. You need to create new threads for one in each class in which will be:

if (m_unObjectId != vr::k_unTrackedDeviceIndexInvalid) {
    vr::VRServerDriverHost()->TrackedDevicePoseUpdated(m_unObjectId, GetPose(), sizeof(DriverPose_t));
}

Where GetPose() is already created function in this code. In GetPose() you write a keyboard movement for a controllers and the same with HMD.

I suggest you to create another thread for controller to capture keys for hand buttons.

If you have more questions, ask ;)

jagg3127 commented 1 year ago

a few questions: how do i define each axis, each button/trigger/touchpad to a keypress? how do i set the mouse to control the axis of the hmd, and use keys to alter front back up down how do i set those keypresses in a different file?

r57zone commented 1 year ago

It will be easier for you to change the HalfLifeAlyxNoVR driver, everything is already adapted to the keyboard and mouse https://github.com/r57zone/Half-Life-Alyx-novr hmd and controllers there are immediately attached to the keyboard and mouse, you can also change the buttons under in the configuration file

jagg3127 commented 1 year ago

@r57zone I thought it would be easier but the problem is visual studios has like a billion errors with your cpp code. And the current controls of your half life driver doesnt even control some axis's of things, im trying to use this for vr chat if that helps

NintyS commented 1 year ago

IMO it is easier because you have full control over your driver

r57zone commented 1 year ago

@jagg3127 in order for the errors to disappear, you need to change the tools and sdk, in the project settings, to yours, then all errors will disappear.

r57zone commented 1 year ago

изображение изображение Like this one

jagg3127 commented 1 year ago

its yelling about double to float

r57zone commented 1 year ago

Screenshot 1 These errors are not critical, select "release" and x64 (x86 is usually not used in OpenVR) and press F5, you will have a dll.

jagg3127 commented 1 year ago

image

jagg3127 commented 1 year ago

i tried adding the driver to steam and it has "connect vr headset" did i set it up wrong?

jagg3127 commented 1 year ago

image

NintyS commented 1 year ago

A) You don't installed your driver B) Driver crashed

jagg3127 commented 1 year ago

i put the driver both into windows 32 and 64 i dont know what im doing so maybe i just did it wrong

jagg3127 commented 1 year ago

image

jagg3127 commented 1 year ago

those 2 folders replacing the previous

jagg3127 commented 1 year ago

i checked and the driver isnt disabled either

NintyS commented 1 year ago

Emm, can you add a cout's in code and start steam from CMD? When you turn on a SteamVR then you will se the cout outputs only with other steam out's ( DebugLog won't show, this is visible only in the web console )

jagg3127 commented 1 year ago

idk what any of that is, just so your aware linux is a billion times better than windows

NintyS commented 1 year ago

Do you have basics knowledge of C++ and windows?

jagg3127 commented 1 year ago

never used cpp but i have enough coding knowledge to understand it plus ive also programmed arduinos so i understand that too. Windows is new to me i used to exclusively use linux so getting used to how windows installs things is a challenge at times

jagg3127 commented 1 year ago

actually i should just download linux

NintyS commented 1 year ago

Probably, bulidng on windows is hard. cout are a members of library ( already have it ) to print outputs. You can use printf() too, as you wish. You just need to use something that will print you data in terminal.

jagg3127 commented 1 year ago

Is saving the library files the same? In both linux and windows

NintyS commented 1 year ago

What do you mean?

jagg3127 commented 1 year ago

Like adding the driver to steam

NintyS commented 1 year ago

Yes, this is the same

jagg3127 commented 1 year ago

image

jagg3127 commented 1 year ago

went back to windows with a new pc and now have this error

jagg3127 commented 1 year ago

how would i fix it

jagg3127 commented 1 year ago

wait now no error an no vr screen since i fixed all the float errors

jagg3127 commented 1 year ago

Emm, can you add a cout's in code and start steam from CMD? When you turn on a SteamVR then you will se the cout outputs only with other steam out's ( DebugLog won't show, this is visible only in the web console )

i did that and GetHMDData isnt running at all

jagg3127 commented 1 year ago

"Program Files (x86)"\Steam\steamapps\common\SteamVR\bin\win64\vrcmd.exe --watchdog run DLLMain (line 639) run DLLMain case (line 644) run DLLMain return True (line 727) run DLLMain (line 639) run DLLMain return True (line 727) Unable to init watchdog mode: VRInitError_Init_LowPowerWatchdogNotSupported

jagg3127 commented 1 year ago

i have only written print statements for DLLMain and GetHMDData so far

NintyS commented 1 year ago

You have some rarer in code. I Guess that main part of code works, only part of device has home error in it.

jagg3127 commented 1 year ago

how does one fix that?

jagg3127 commented 1 year ago

its only running DLLMain, i added print statements in all other functions DLLMain only runs

jagg3127 commented 1 year ago

I DID IT!! Thank you