Head Tracking Hook for XWA

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Re: Head Tracking Hook for XWA

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1607
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jun 01, 2019 4:49 pm

JeremyaFr wrote:
Sat Jun 01, 2019 4:31 pm
Both hooks hook the function at address 0x4F9A5F that retrieves the keyboard state.
One of the hook must be rewritten to avoid the conflict.
Instead of hooking the call to the function 0042B900, you can insert the call to the hook at the end of the function 0042B900 itself. There is 10 bytes free so it is enough to call a hook.

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sat Jun 01, 2019 7:02 pm

I attempted to hook at the end of 0042B900 but I was having some trouble. I decided to hook to at 0x4F9A61 instead and all is well with the two hooks. I apologize for the conflict of the hooks. I have sent the changes to blue_max.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1607
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jun 01, 2019 7:54 pm

It's fine.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Jun 02, 2019 1:36 am

I'll remove the dependency with openvr_api.dll, that's not a problem. Also, Justagai just figured out how to avoid the conflict with the Windowed hook (it's basically what Jeremy said above).

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 04, 2019 5:53 am

Alright, here's version 0.9.2:

https://www.dropbox.com/s/h9w96fvl83kvq ... 2.zip?dl=0

I've applied the fix that Justagai sent me to avoid the conflict with Hook_Windowed.dll, this version has native support for TrackIR (thanks to ual002 and Ra'Kaan for their support in testing this) and OpenTrack; but I could not remove the dependency with openvr_api.dll. Sorry, it's too much of a hassle to do run-time linking against that DLL and I'd rather maintain a single version of this hook, so you'll still need the file there for the time being. If enough people are bothered by it, or if it needs to be removed for other reasons (maybe because someone may want to include this in the next XWAUP/DSUP release?) then I'll split the Hook into two versions.

Enjoy!

User avatar
ffaaway
Cadet 2nd Class
Rebel Alliance
Posts: 92
Joined: Mon May 05, 2003 11:01 pm

Post by ffaaway » Tue Jun 04, 2019 6:35 am

I'll update the above posted install guide tomorrow with the new procedure without FreePIE and again when this reaches final release status. :)
X-Wing pilot since 1993 and still kickin'

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 04, 2019 5:48 pm

ffaaway wrote:
Tue Jun 04, 2019 6:35 am
I'll update the above posted install guide tomorrow with the new procedure without FreePIE and again when this reaches final release status. :)
Actually, it's probably better to leave that procedure because that still can be used as a fallback: if TrackIR does not work, people can still use the old method through FreePIE.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat Jun 08, 2019 6:02 am

Version 0.9.2 will crash in MultiPlayer; but Justagai figured out a way to fix the crash. However, the hook doesn't really work in MP due to synchronization issues: the camera just goes nuts and starts spinning around. Stil, I figured it's better than just crashing, so here's a new version that avoids the crash in MP mode:

https://www.dropbox.com/s/pah7iyp47q8f3 ... 3.zip?dl=0

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat Jun 08, 2019 6:08 am

Also, I've been testing a few ideas to enable Roll (so that one day we may have full 6dof in this game). The problem is that the game does not support roll natively (unless I'm mistaken here -- if someone can correct me and point me in the right direction I would certainly appreciate that!). So the only option that I see right now is to add the roll in ddraw. But here, the geometry has already been clipped and culled, so this is what a roll of 45 degrees looks like:
Roll-sample.jpg
That's what I mean when I say that it "doesn't look great". In VR, this may work because we can't see the edges of the screen when wearing the headset anyway; but I don't think people will ike to play like this with TrackIR.

I also tried increasing the scale of the starfield background to cover the edges of the screen... and again, it doesn't really work. It feels like you're swimming inside a sphere dotted with stars.
You do not have the required permissions to view the files attached to this post.

User avatar
Trevor
Cadet 1st Class
Posts: 188
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Jun 08, 2019 4:34 pm

blue_max, why don't you use the same methods of the original VR where you are rendering your own 3d space? wouldn't this avoid the clip issue?

I know that in the original VR hook, the lateral movement still clipped, but it seemed more triangle based rather than view based?

Alternatively, why not just disable frustum clipping?

Also, as I mentioned in PM, Most VR games can be forced Out-Of-Bounds by players as the price for freedom, XWA should be no different. slight sways in your head can (and should) be represented on screen despite the clipping.

As I also stated, head tracking via mouselook has worked brilliantly, but you spoiled us with your key-mapped movements in your first hook and now I want it to return but mapped to head xyz instead :P

Trev

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat Jun 08, 2019 6:52 pm

Hey Trevor! This is the VR mod. It's the same problem.

Disabling the frustum clipping would fix this, yeah; but I don't know how to do that.

I can add the positional x,y,z back through the hook. It won't be perfect, as you know; but it's better than the roll and it feels right most of the time.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jun 19, 2019 4:24 am

Minor update for this hook: the SteamVR mode crashes the game if it fails to initialize. I've fixed the crash and added a second attempt.

https://www.dropbox.com/s/pqn2bwe2vr83c ... 4.zip?dl=0

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10319
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Wed Jun 19, 2019 6:39 am

Sorry but moving this to the XWA Hook Editing Forum
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1712
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Jun 22, 2019 11:47 pm

Just got this working for my install, and I have to say it's fantastic.

It's going to take a while to get used to though, but it's a whole new dynamic to the game and it's literally throwing off my aim, but it's almost like playing ARMA or DCS sooo thank you!

I just wish there wasn't a need to run freePIE every time.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jul 17, 2019 5:14 am

Driftwood wrote:
Sat Jun 22, 2019 11:47 pm
I just wish there wasn't a need to run freePIE every time.
Hey Driftwood, thanks for your comments. Sorry for the late response.

If you're talking about TrackIR, you shouldn't need to run FreePIE anymore. Are you running the latest version?

https://www.dropbox.com/s/pqn2bwe2vr83c ... 4.zip?dl=0

I can't test TrackIR directly; but others should be able to confirm that it works without FreePIE.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jul 17, 2019 5:59 am

I just released a new version of this hook:

https://www.dropbox.com/s/3q0rbzebjjzwh ... 5.zip?dl=0

I added offsets to yaw and pitch and the ability to select the FreePIE slot to read from. The tracker can also be disabled by setting it to "None" to recover normal mouse look function without uninstalling it.

This version should be compatible with TrackIR directly, without FreePIE.

User avatar
ual002
Ensign
Galactic Empire
Posts: 488
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Wed Jul 17, 2019 1:32 pm

1. Out of curiosity, can anything be done to enable head tracking in the hangar?

2. Is there anyway we can keep the hangar view from automatically switching views on the player that wants to keep his head in the pit?
For the glory of his majesty Emperor Palpatine! Image Image Image Image

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jul 17, 2019 9:21 pm

I tried to enable head tracking in the hangar once and it didn't work. I'll check again, though. I don't know if it's possible to prevent the hangar from switching views, sorry. Maybe Justagai might now more in this area.

blue_max
Ensign
XWAU Member
Posts: 331
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Sep 29, 2019 5:23 am

Here's a new release of the cockpit look hook:

https://www.dropbox.com/s/da6aqizhfs02i ... 6.zip?dl=0

In this release:

* THE NAME OF THE HOOK HAS CHANGED to Hook_CockpitLook.dll. Please be aware that you'll have to remove the previous version of the hook or the game might crash on startup.
* I've re-enabled the keypad keys to look around the cockpit.
* The mouse can now be used to look around when the external camera is enabled.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10319
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Sep 29, 2019 9:24 am

Thanks :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Post Reply