Reduce CPU usage and increase FPS

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

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Post Reply

Reduce CPU usage and increase FPS

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

Post by JeremyaFr » Sun Mar 15, 2015 7:06 pm

Hello,

Here is a hook to reduce the CPU usage. The side effect is that the framerate is reduced.

xwa_hook_time.zip

User avatar
Darksaber

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

Post by Darksaber » Sun Mar 15, 2015 10:23 pm

So does this remove the need to run XWA on one core, using Runfirst.exe

http://www.xwaupgrade.com/phpBB3008/vie ... 10&t=10594
“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

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

Post by JeremyaFr » Sun Mar 15, 2015 10:35 pm

It does not remove the need to run XWA on one core.
The game uses 100% of one cpu core. It's because at several places the game engine calls timeGetTime in a loop in order to wait a few ms.
The hook adds a call to Sleep before the call to timeGetTime.

craig_mac
Cadet 3rd Class
Posts: 31
Joined: Sun Jun 10, 2001 11:01 pm

Post by craig_mac » Sun Mar 13, 2016 9:45 pm

I assume this is the same reason I get 100% cpu usage with XvT/Bop ?
If so how would I go about applying the same fix for it ?
Thanks for the great work on this btw !
craig mac

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

Post by Reimar » Fri Apr 08, 2016 5:08 pm

You can't easily use this for XvT/BoP, it is specific to the game binary.
I think I don't see the issue when running XvT with this wrapper (the one from JeremyaFr with small changes to make it work with XvT):
https://github.com/rdoeffinger/xwa_ddra ... ses/latest
But even if you do, you can set the PresentSleepTime = 10 option, then it will just stop the game from using your CPU for a fixed amount of time every frame.
It's not as good as this change as it doesn't adjust to how much resources the game really needs, so too low means you waste CPU, too high means the game will run slower than it should, but it's something.

craig_mac
Cadet 3rd Class
Posts: 31
Joined: Sun Jun 10, 2001 11:01 pm

Post by craig_mac » Mon Apr 11, 2016 10:17 am

thanks very much!
this seems to run a lot better.. certain areas were making my framerate fluctuate .. the interdiction of tie advanced fighters especially, but its far more playable now
never thought i'd see the day where i can play the game 1080p with AA but here it is :)
thanks again for the fantastic work
craig mac

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

Post by JeremyaFr » Fri Dec 14, 2018 5:14 pm

UPDATE

Hello,
I've included the 60 fps patch to the time hook.

Please redownload xwa_hook_time.zip

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

Post by JeremyaFr » Mon Feb 04, 2019 7:20 pm

UPDATE

Hello,
I've updated the time hook.
I've reduced CPU usage in game menus and in video playing.

Please redownload xwa_hook_time.zip

User avatar
Darksaber

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

Post by Darksaber » Mon Feb 04, 2019 9:13 pm

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

evilmark
Cadet 4th Class
Posts: 16
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 05, 2019 2:05 am

the 60fps part isn't working for me, game won't go higher than 11 fps for some reason

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

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

UPDATE

Hello,
I've updated the time hook.

I've removed the limit of 59 fps.

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

Post by Phoenix Leader » Wed Jun 26, 2019 11:16 pm

Is there a new fps limit now? Is it that 118 fps you mentioned in this topic: https://xwaupgrade.com/phpBB3/viewtopic ... 6&start=70 ?

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

Post by JeremyaFr » Thu Jun 27, 2019 8:35 pm

The new limit is 236 fps.

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

Post by Phoenix Leader » Fri Jun 28, 2019 2:27 am

Great. X-Wing Alliance on 120 Hz and 144 Hz monitors will be amazing.

Post Reply