60FPS Inflight hook

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

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Re: 60FPS Inflight hook

User avatar
Darksaber

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

Post by Darksaber » Wed Dec 26, 2018 1:57 pm

If someone was to install this over Jeremy's Original Dinput.dll, it's it going to interfere with any of his Hooks?

Also When installing the DSUCP or XWAUCP, you have a choice to install on to the Disc, Steam, Gog versions of XWA. which ever you select the DSUCP or XWAUCP replaces the xwaingalliance.exe to the original disc version of the exe, removing what ever crap STEAM or GOG edited into there versions of the exe, (ie Steam with the DRM stuff)

My Question's are (first forget the DSUCP and XWAUCP), with you editing the Dinput.dll to make it compatible with STEAM, if someone comes along and installs the GOG version of XWA, then installs your Steam compatible version of the Dinput.dll are there going to be any adverse effects, because they have installed the GOG version, which has no DRM?

Next question is, The 60FPS, might be your find, but Jeremy has added it (including the preflight hangar) to his Time Hook, again if someone was to add your Hook_60FPS.dll won't this conflict with the Hook_Time.dll? If both are installed doesn't that mean you'll get the Dinput.dll error message?

I'm just concerned that your going to add your edited Dinput.dll to your Muliplayer Tour stuff, I initially asked you if I could add the Multiplayer Tour Stuff to the DSUCP, but if your going to start editing the main Dinput.dll, I might have to remove the Multiplayer tour stuff from the DSUCP as I don't want any conflicts between DLLs.

Another question would be, if you released a new version of the Multiplayer Tour stuff, and you've edited the dinput.dll, but because I remove necessity for your edited dinput.dll by replacing the Steam xwingalliance.exe with the original xwingalliance.exe, would your Multiplayer Tour Stuff still work with Jeremy's Dinput.dll, which to be honest I would still prefer to use?

Sorry for so many questions, I just need a little clarification :D
“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

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

Post by Justagai » Wed Dec 26, 2018 9:12 pm

If someone was to install this over Jeremy's Original Dinput.dll, it's it going to interfere with any of his Hooks?
No it shouldn't interfere with any of Jeremy's hooks.
Also When installing the DSUCP or XWAUCP, you have a choice to install on to the Disc, Steam, Gog versions of XWA. which ever you select the DSUCP or XWAUCP replaces the xwaingalliance.exe to the original disc version of the exe, removing what ever crap STEAM or GOG edited into there versions of the exe, (ie Steam with the DRM stuff)
Yes I figured that. The only reason to have XWAUP/DSUCP compatible with steam is to keep the steam overlay and stats and any steam related features. I understand that XWAUP/DSUCP makes a lot of exe edits which would be time consuming to convert to hooks. I don't expect direct steam support anytime soon.
My Question's are (first forget the DSUCP and XWAUCP), with you editing the Dinput.dll to make it compatible with STEAM, if someone comes along and installs the GOG version of XWA, then installs your Steam compatible version of the Dinput.dll are there going to be any adverse effects, because they have installed the GOG version, which has no DRM?
No there would be no averse affects.
Next question is, The 60FPS, might be your find, but Jeremy has added it (including the preflight hangar) to his Time Hook, again if someone was to add your Hook_60FPS.dll won't this conflict with the Hook_Time.dll? If both are installed doesn't that mean you'll get the Dinput.dll error message?
I have added 60FPS to the preflight hangar in my patch as well based on Jeremy's find. I am not sure how he applies 60FPS to his time hook so I can't say for sure, but I will take a look at the source later. I would like to know how this hook works since my community is a little bit reluctant to use the time hook as its caused issues in the past. In my opinion so far, I think they should be separated to avoid issues and I'm not sure how it will work with multiplayer. But again, this is without knowledge of how his hook works.
I'm just concerned that your going to add your edited Dinput.dll to your Muliplayer Tour stuff, I initially asked you if I could add the Multiplayer Tour Stuff to the DSUCP, but if your going to start editing the main Dinput.dll, I might have to remove the Multiplayer tour stuff from the DSUCP as I don't want any conflicts between DLLs.
There wouldn't be any conflicts with DLLs with the new dinput.dll. The only conflicts would be at the hook level.
Another question would be, if you released a new version of the Multiplayer Tour stuff, and you've edited the dinput.dll, but because I remove necessity for your edited dinput.dll by replacing the Steam xwingalliance.exe with the original xwingalliance.exe, would your Multiplayer Tour Stuff still work with Jeremy's Dinput.dll, which to be honest I would still prefer to use?
Yes the multiplayer tour patch would be fine with Jeremy's dinput.dll.
Sorry for so many questions, I just need a little clarification :D
Ask away, I like everything clarified myself :)

As an added note, I'm fine if you folks don't use my 60FPS patch or the dinput with XWAUP/DSUCP (or even the multiplayer tour patch). All I wish is to contribute to the community here and elsewhere with these patches. A lot of the work that I do, while mostly involved with the X-Wing and XvT engine, share a lot of aspects with the XWA engine which is why I was able to apply 60FPS to XWA. I think if we work together we can do great things with the engines themselves.

User avatar
Darksaber

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

Post by Darksaber » Wed Dec 26, 2018 9:55 pm

That's brilliant Justagai, thanks
Justagai wrote:
Wed Dec 26, 2018 9:12 pm
I have added 60FPS to the preflight hangar in my patch as well based on Jeremy's find. I am not sure how he applies 60FPS to his time hook so I can't say for sure, but I will take a look at the source later. I would like to know how this hook works since my community is a little bit reluctant to use the time hook as its caused issues in the past. In my opinion so far, I think they should be separated to avoid issues and I'm not sure how it will work with multiplayer. But again, this is without knowledge of how his hook works.
Just another question

You say your community are bit reluctant to use the time hook as it's caused issues in the past.

Could you explain what issues they have had with the Time Hook please?

Perhaps @Jeremy could answer this
Here is a hook to reduce the CPU usage. The side effect is that the framerate is reduced.
Adding the 60FPS to the Time Hook, wouldn't this conflict with the CPU stuff?

Sorry, but I'm a little confused, could this be explained a little more please :)
“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

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

Post by Justagai » Thu Dec 27, 2018 2:36 am


Just another question

You say your community are bit reluctant to use the time hook as it's caused issues in the past.

Could you explain what issues they have had with the Time Hook please?
There were issues where people (including myself) were getting really low frame rates (like around 10-15fps, sometimes less) after installing XWAUP/DSUCP. Some people started to think that their own hardware was the issue. Eventually we discovered that disabling the time hook fixed the issue. I've quickly tested Jeremy's latest time hook and it seems to be fine however.

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

Post by JeremyaFr » Thu Dec 27, 2018 8:29 pm

Hello,
Here is a perf comparison of the old time hook and without time or 60 fps hook:

Without time or 60 fps hook:
xwa_hook_time_base.PNG

With the old time hook:
xwa_hook_time_cpu.PNG
You do not have the required permissions to view the files attached to this post.

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

Post by JeremyaFr » Thu Dec 27, 2018 8:38 pm

Hello,
Here is a perf comparison of the 60 fps hook and the new time hook:

With the 60 fps hook:
xwa_hook_60fps.PNG

With the new time hook:
xwa_hook_time.PNG
You do not have the required permissions to view the files attached to this post.

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

Post by Justagai » Thu Dec 27, 2018 9:42 pm

Interesting comparisons. I have a few questions.

What application did you use to measure? It looks like something useful to have.

I've looked at the new time hook and I saw these listed:

Code: Select all

{ 0x10FBD2, "83FA08", "83FA02" },
{ 0x10FBF6, "83F808", "83F802" },
//{ 0x10FC8D, "0F8DFCFEFFFF", "90E9FCFEFFFF" },
{ 0x10FC8A, "83FA08", "83FA02" },
{ 0x10FCB2, "83F808", "83F802" },
{ 0x058005, "83FA08", "83FA02" },
{ 0x058027, "83F908", "83F902" },
Based on what I'm reading here, this would be setting the time units per frame to at least 2. What is the reason for setting these to 2?

Since the time hook sets the time units per frame to 2, it will have a quicker duration per frame compared to my 60FPS hook since my sets it to 4 time units per frame. What would the tests look like if the time hook was set with 4 time units per frame?

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

Post by JeremyaFr » Fri Dec 28, 2018 11:40 am

Hello,

To measure, I use the Graphics Diagnostics tool in Visual Studio 2015.

I've set the setting to 2 to allow 120 fps for people that have a 120 Hz monitor. I haven't tested that.

If I set 4 for the time hook, here is the result:
xwa_hook_time4.PNG
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 » Fri Dec 28, 2018 2:23 pm

Most look the same so I overplayed them and you can now see that the old hook and no hook is predominantly <30fps while the new hook allows >30fps (though if you enabled v-sync you would be pretty much a solid 30fps (just like no hook)
Image

the old hook is by far the worst


Trev

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

Post by Justagai » Fri Dec 28, 2018 10:14 pm

Here are some performance tests. I also tested no frame limit as well.

Test standard:
  • Vanilla XWA
    Skirmish
    Two flight groups
    240HZ monitor

new time hook:

Image

60FPS hook:

Image

No frame limit GSYNC on:

Image

No frame limit GSYNC off:

Image

I wasn't able to get more than 60FPS with either of our hooks but removing the frame limit allowed me to reach around 80+ FPS.

GYNC off gave me a little bit more FPS.

Video of 60FPS:

https://1drv.ms/v/s!AoEpIrw6LOkUjbYqwxoDE2bKWBzDtQ

Video of no frame limit:

https://1drv.ms/v/s!AoEpIrw6LOkUjbYpUJSChszpwaiB7w

Another video with no frame limit:

https://1drv.ms/v/s!AoEpIrw6LOkUjbYo4VfJvDejPMnsOw

Based on the above:


- No Frame Limit

Having no frame limit (based on Jeremy's find) would have issues with making gameplay too fast. This could be because some other code has to be modified in order to sync the gameplay and the framerate together.

- New Time Hook

The new time hook should be fine for singleplayer, but having the hook set at 2 time units per frame could be troublesome for multiplayer. Though it didn't go beyond my FPS hook in terms of framerate.

Currently I am trying to figure out why a friend of mine isn't getting 60FPS with either of the hooks. Something else in the code is stabilizing the FPS to 30 for some reason.

Reimar
Cadet 1st Class
Posts: 232
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Tue Jan 01, 2019 6:18 pm

Thanks for finding this!
I used the information to fix XWAHacker to be able to set the FPS limit (and also disable it inflight).
But could you also give me the offsets you patched for the other games in the series?
I'd like to support patching them in XWAHacker as well.
If nothing else just to have all these fixes documented in a single place, this kind of knowledge simply gets lost too easily (and also some people might want more than 60 FPS).

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

Post by Justagai » Tue Jan 01, 2019 8:04 pm

Code: Select all

X-Wing:
new HookPatchItem(0x2E7EC, "BF08", "BF04"),

TIE Fighter:
new HookPatchItem(0x8CDC1, "BE07000000", "BE03000000"),

X-Wing vs TIE Fighter:
new HookPatchItem(0x36F46, "83F808", "83F804"),
new HookPatchItem(0x3706C, "83F808", "83F804"),

Balance of Power:
new HookPatchItem(0x473FC, "83F808", "83F804"),
new HookPatchItem(0x474B5, "83F808", "83F804"),
I've also uploaded the source on my onedrive. I should also get to uploading that on my github as well.

EDIT: The info behind how it works should also be in this document soon: X-Wing Engine Technical Document

User avatar
Phoenix Leader
Ensign
Rebel Alliance
Posts: 309
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Sat Jan 26, 2019 4:34 pm

While I'm able to hold 60 fps in mission, I usually have frame drops even to 30 fps in the Film Room.
When this happens, the film is slown down (1 second in mission = 2 seconds).

My system:
CPU Intel Core i7-5930K
RAM G Skill 32 GB
GPU GeForce GTX 980Ti

I have a high end system, so I hardly think the frame drops are caused by hardware.

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

Post by JeremyaFr » Sat Jan 26, 2019 5:04 pm

Hello,
Which version of the hook do you use? Justagai's (hook_60fps.dll) or mine (hook_time.dll).

Check if you have the latest version.

If you use hook_60fps.dll, you can try to disable the hook_time.dll to see if it helps.

User avatar
Phoenix Leader
Ensign
Rebel Alliance
Posts: 309
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Sun Jan 27, 2019 2:00 am

I have Hook_Time.dll (Date modified: Friday, ‎14 ‎December, ‎2018, ‏‎7:00:52 PM) in my Star Wars - X-Wing Alliance directory, but there is no hook_60fps.dll

gazzawazza
Cadet 4th Class
Posts: 14
Joined: Sat May 05, 2007 11:01 pm

Post by gazzawazza » Sat Feb 02, 2019 3:23 am

hi

I can't get the 60fps to work either

I've tried both hook_60fps.dll and hook_time.dll previously.

Basically, i get approx 56fps in the hangar for about 2 secs, then it drops to approx 28fps. On launch, it flicks very quickly between i think 27.5 and 28.3fps.

This is on the first mission as a rebel cadet.

However, i've literally just done a clean install, so will document what I've done through that, as I'd have thought it should work this way, without any additional intervention.

- win 7 64bit home premium
- i5-4670k @ 4ghz
- 16GB RAM
- 1060 6GB
- steam version of xwa
- ran XWAUCPv1.5.exe
- used all default settings in this (didn't apply any options, etc)
- used xwahacker 3.2
- used xwahacker GUI 0.32

Image

I'd be most grateful for any help.



Regards,

Gary

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

Post by JeremyaFr » Sat Feb 02, 2019 12:37 pm

Hello,
You can try the latest version of the hooks. The easy way to download them is to use XwaHooksSetup (see viewtopic.php?p=154911#p154911).

You can also test the latest version of the custom ddraw.dll (see https://github.com/JeremyAnsel/xwa_ddra ... ses/latest and https://github.com/rdoeffinger/xwa_ddra ... ses/latest).

You can also try to disable the 32 bit rendering in XWA Hacker.

Reimar
Cadet 1st Class
Posts: 232
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Sun Feb 03, 2019 5:06 pm

Also just checking CPU and GPU usage (e.g. from task manager) would be useful.
For CPU usage make sure to not look at the overall percentage, but check the per-core usage, specifically core 2.

gazzawazza
Cadet 4th Class
Posts: 14
Joined: Sat May 05, 2007 11:01 pm

Post by gazzawazza » Mon Feb 04, 2019 12:43 am

@JeremyaFr @Reimar

thank you both for your replies. Much appreciated.

I've a long post now, with results and pretty graphs :D

Just a query before regarding file versions
I’m confused about hook version numbers and modified dates. Which do I trust?

Examples:

- hook_time.dll which was presumably provided by the xwa craft pack 1.5 is “1.0.0.1” with a modified date of 14/09/2017

- hook_time.dll on github (which presumably has the 60fps patch) is also “1.0.0.1” with a modified date of 14/12/2018 & 70KB

- dinput.dll, presumably from craftpack 1.5, is “1.0.0.1” but with a modified date 04/01/2018 and 125Kb

- dinput.dll on github is also “1.0.0.1” with a modified date of 28/11/2018 and 204KB

Surely the version numbers change with code changes/additions?


errors produced during testing (when game was run) - only when latest hooks were used
Changing hook_time.dll only (downloaded using xwahookssetup)
“ “To call the hook that sets full FPS” is not correctly initialized ”

Changing hook_time.dll and dinput.dll (downloaded using xwahookssetup)
“ “To call the hook that sets full FPS” is not correctly initialized “


Replacing all hooks and configs with those downloaded (using xwahookssetup)
“ “’triangling to infinity’ patch” is not correctly initialized “


Testing conditions & results 01
- XWAUCPv1.5.exe applied
- no hooks changed, etc (see previous hook errors)
- Use xwahacker 3.2 to apply 1920x1080
- Running on 16 bit didn’t help (set back to 32bit)
- Mission “the alliance suffered a terrible defeat at hoth”
- 18.5fps inflight initially. Maxed out at 28.3 (I think)
- Core 2 in high use (much higher than other 3 cores) – 80% spike then approx. 25%. Average including spikes prob 40%.Other cores were approx. 5%
- GPU usage relatively low – max point apparently 14% (not sure about average – probably 8%, looking at graph)
- Brown on graph = core 2 %
- Navy blue on graph = GPU %


Image


Testing conditions & results 02
- XWAUCPv1.5.exe applied
- Use xwahacker 3.2 to apply 1920x1080
- No hooks changed
- Running on 16 bit didn’t help (reset back to 32bit)
- Latest dx11 ddraw.dll & ddraw.cfg (1.1.3.6)
- Mission “the alliance suffered a terrible defeat at hoth”
- Much improved fps – fluctuates though. Felt smoother. Fps dropped on big ship models – higher numbers of big ships correlated to lower fps (not surprisingly – presumably more polygons)
  • Approx. 30-56fps. Average probably around 40ish fps
  • After hyperspace jump to convoy, fps seemed virtually @ 56fps
  • Tried forcing 118fps (just to see how high my fps would go). Didn’t rise beyond 56fps
  • Set AnisotropicFiltering off in ddraw.cfg (just to test) – no changes in fps behaviour (though I didn’t jump into hyperspace to goto convoy before turning it off)
  • Most consistent play came from capping at 30fps
- Core 2 in high use (much higher than other 3 cores) – 99% spike then approx. 25%. Average including spikes prob 40%. Other cores were approx. 4%
- GPU usage relatively low – max point 9% (not sure about average – probably 8%)
- 4:3 resolution in concourse & briefing
- Appropriate widescreen in hangar & inflight
- Brown on graph = core 2 %
- Navy blue on graph = GPU %
- Look at 0:00 to 0:03


Image

Summary
Seems that latest ddraw.dll and ddraw.cfg sorted stuff out

I only used the hook_time.dll (date modified 14/09/2017), then set resolution, FPS, etc, via xwahacker 3.2 (and GUI0.32)

Presumably since it appears to process on one core (core 2), the GPU is bottlenecked by my CPU? Hence the low utilisation?





Regards,

Gary

gazzawazza
Cadet 4th Class
Posts: 14
Joined: Sat May 05, 2007 11:01 pm

Post by gazzawazza » Tue Feb 05, 2019 1:27 am

UPDATE!!!

applied all hooks & configs using XwaHooksSetup + kept/used ddraw.dll 1.1.3.6

ignored the triangling to infinity error.

rock solid 56fps reported inflight on mission “the alliance suffered a terrible defeat at hoth”. Other missions not tested as yet.

silky smooth too - no FPS drops that I noticed.

Played same mission a good few times. 5-10 mins typically (or until I died – still find the game difficult. Nice that “hard” actually means hard or maybe I just suck).

GPU usage around 8% as an average

CPU loading is on core 2. Big spikes at beginning and end of gaming (go upto anything from 60-90ish %)

When the GPU is active / loaded, CPU core 2 probably averages around 35-40% usage.

Image

tried setting 79fps limit via xwahacker. Still reported 56fps inflight.

tried setting 118fps limit via xwahacker. Still reported 56fps inflight.

Astonishing work gentlemen. Hugely grateful.

only thing I've not got to work is vsync - tried forcing through nvidia control panel. didn't seem to work

Oh and the rudder control on my joystick (thrustmaster hotas-x) is the roll axis and the x axis is the yaw control - grrrrr.



Regards,

Gary

User avatar
keiranhalcyon7
Ensign
Posts: 276
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Feb 05, 2019 7:15 am

gazzawazza wrote:
Tue Feb 05, 2019 1:27 am
Oh and the rudder control on my joystick (thrustmaster hotas-x) is the roll axis and the x axis is the yaw control - grrrrr.
That, sadly, is just how the X-Wing series was written from the start.

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

Post by JeremyaFr » Tue Feb 05, 2019 7:54 am

gazzawazza wrote:
Mon Feb 04, 2019 12:43 am
Replacing all hooks and configs with those downloaded (using xwahookssetup)
“ “’triangling to infinity’ patch” is not correctly initialized “
You need to disable the 'triangling to infinity' patch with Xwa Exe Patcher.

Reimar
Cadet 1st Class
Posts: 232
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Tue Feb 05, 2019 8:37 pm

gazzawazza wrote:
Tue Feb 05, 2019 1:27 am
only thing I've not got to work is vsync - tried forcing through nvidia control panel. didn't seem to work
Which way did you try to force it? The ddraw.dll (all versions) requests vsync by default.
If it's not working it's either forced of in driver settings or somehow broken.

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

Post by Justagai » Tue Feb 05, 2019 11:27 pm

I just want to throw this out there but the in game FPS display does not display the FPS accurately above 60FPS. Visual Studio's profiling tools or an external FPS display will give a more accurate display.

User avatar
keiranhalcyon7
Ensign
Posts: 276
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Wed Feb 06, 2019 7:46 am

FYI, I've noticed that while hook_time works well for the game engine, it causes the cutscenes to stutter somewhat.

Post Reply