Hooks

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

Moderator: JeremyaFr

Re: Hooks

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Apr 24, 2022 3:20 pm

UPDATE

Hello,
The random crashes are now fixed.

The crashes were related to the engines count limit in the opt limit hook. There were missing offsets/hooks implementations. The result was that there was a memory write to a memory location that was not allocated by the hook. This memory location was used by the other DLLs (hooks or system). Since Windows Vista, when a dll is loaded, the base offset of the dll is random (for security reasons). That's why there were crashes in random DLLs. I've implemented the missing offsets in the opt limit hook. The crashes are now fixed.

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Apr 25, 2022 5:01 am

Confirmed. All is working fine now. Thank you very much Jeremy. 👍
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

COLBudManstrong
Recruit
Posts: 5
Joined: Sat Apr 30, 2022 2:19 am

Post by COLBudManstrong » Sat Apr 30, 2022 2:33 am

Hello. This is primarily directed to JeremyaFr, but if anyone else might have any advice, feel free to chime in.

I have a base GOG version install of XWA (v2.02, but also have run XWAHacker-QT first), and was wondering if I can just use the hooks standalone, or if need anything from XWA Upgrade? From what I've gathered reading this thread, Jeremy's Git repo, and the Wiki page https://www.xwaupgrade.com/wiki/index.php?title=Hooks, I should be able to use them standalone.

I was wanting to use the joystick related hooks to fix an issue with my Xbox One controller's right joystick/rudder control being based on the vertical axis, rather than horizontal. My understanding is using the related hooks, plus a proper XwaJoystickConfig JoystickConfig.txt file should fix that.

I had tried downloading the XWA Hooks Setup installer from the Downloads page, then moving all of the items into the main XWA game folder as instructed. I then ran the XwaJoystickConfig program, saved a JoystickConfig.txt file to my game folder, and moved the other XwaJoystickConfig files to my game folder as well.

Running XWINGALLIANCE.EXE after all of that though didn't seem to make any changes. I would get Windows dialog errors about an FPS hook not being loaded correctly, so I removed the D3D related hooks, which resolved that. That lead me to believe the hooks were being loaded at the very least. But again, I wasn't able to see any changes being applied regarding joystick input, based on my JoystickConfig.txt settings.

Just wondering if anyone might be able to point me in the right direction, or clarify proper setup if I've done something wrong as mentioned above. Thanks!

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 30, 2022 1:56 pm

Hello,
Yes, you can use the hooks on a vanilla version of XWA (v 2.02 without any mod).

The Hooks' Wiki page hasn't been updated for a while. XwaHooksSetup generates a text file named "Hooks_Readme.txt" in the "Setup" directory. This file is generated from the GitHub repository and is always up-to-date.

Can you post the exact error message you get? There is probably an incompatibility between two installed components. What are your settings in XwaHacker?

COLBudManstrong
Recruit
Posts: 5
Joined: Sat Apr 30, 2022 2:19 am

Post by COLBudManstrong » Sat Apr 30, 2022 3:16 pm

Thank you for clarifying that Jeremy. I seem to have things working now, and will include a brief explanation of the steps I followed, plus screenshots of the error I mentioned seeing, and my current configuration settings.

I ended up reinstalling the game this morning to make sure I had a fresh base, then ran XwaHooksSetup and moved those files into the main game folder first. I then ran XwaJoystickConfig from the main game folder, and changed the roll axis to `4` and saved that out. I can't remember exactly if I then tried running XWA first, or then xwahacker-qt, but regardless, the joystick config now works. I think I had enabled FF in the in game options and maybe one other controller related change. I also don't remember seeing XWAJoysticConfig option in game last night, which seems to confirm the hooks were working for me when I had tried it. (Screenshot attached)

I did run into that same FPS Hook error again when trying to run the game, I believe after running xwahacker-qt. (Screenshot attached) I was also having an issue with the game crashing when setting the resolution to 2560x1440, which I wasn't last night. But running xwahacker-qt again, setting it to 1080p, then back to 1440p seemed to resolved that.

It seems things are all working now, and the process was fresh XWA install, XwaHookSetup, XwaJoystickConfig, then xwahacker-qt for resolution, but that's just my experience. It would seem the FPS increase/hook is not working, given that error, and xwahacker's in game FPS hack only returning 60fps. But I can keep messing around with that (And 60fps is better than 24 :P ).
You do not have the required permissions to view the files attached to this post.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 30, 2022 3:38 pm

The error "To call the hook that sets full FPS" comes from the time hook (hook_time.dll). Have you changed the FPS limit in XWAHacker?

COLBudManstrong
Recruit
Posts: 5
Joined: Sat Apr 30, 2022 2:19 am

Post by COLBudManstrong » Sat Apr 30, 2022 4:38 pm

Yes, I had set the 118 fps option that XWAHacker allows as I have a 165hz monitor, but 60fps is fine if there's no workaround.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 30, 2022 4:42 pm

Setting the fps limit in XWAHacker is not needed. The time hook already removes the fps limit. With the hook, the limit is now 240. The fps is limited to 60 in the hangar.

COLBudManstrong
Recruit
Posts: 5
Joined: Sat Apr 30, 2022 2:19 am

Post by COLBudManstrong » Sat Apr 30, 2022 5:38 pm

That makes sense. Should I reset the FPS Limit in xwahacker to a certain value to let the hook take over?
You do not have the required permissions to view the files attached to this post.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 30, 2022 5:41 pm

Just keep the original 30 FPS.

COLBudManstrong
Recruit
Posts: 5
Joined: Sat Apr 30, 2022 2:19 am

Post by COLBudManstrong » Sat Apr 30, 2022 6:14 pm

JeremyaFr wrote:
Sat Apr 30, 2022 5:41 pm
Just keep the original 30 FPS.
That did the trick. Thank you for all of your help!

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon May 02, 2022 4:36 am

I could be wrong but I thought xwahacker -qt is not even needed anymore. You can just use the hook_resolution.cfg file (or the section inside the hooks.ini file) to set your monitor's maximum screen dimension in pixels. The in-game video menu resolution also doesn't really matter since the hook feeds that data into it. The part I'm not sure about is the scaling of FOV /HUD ratio.
Last edited by Bman on Fri May 06, 2022 9:32 pm, edited 1 time in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri May 06, 2022 6:39 pm

UPDATE

Hello,
I've updated XwaHooksSetup.

Now the tool will also download the WIP hooks to a separate directory ("Hooks_WIP").

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun May 22, 2022 8:35 pm

UPDATE

Hello,
I've updated the mission tie hook.

I've added settings to set the red alert in hangar, to auto switch to turret, to skip hyperspaced messages.

To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini".

To define the red alert in hangar, set "IsRedAlertEnabled = 1". The default setting enables IsRedAlertEnabled for mission id 20.
To skip hyperspaced messages, "set SkipHyperspacedMessages = 1". The default setting enables SkipHyperspacedMessages for mission id 49.
To force the player in turret, set "ForcePlayerInTurret = 1". The default setting enables ForcePlayerInTurret for mission id 1.

User avatar
AngeI
Lieutenant JG
Posts: 522
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sun May 22, 2022 9:05 pm

JeremyaFr wrote:
Sun May 22, 2022 8:35 pm
UPDATE

Hello,
I've updated the mission tie hook.

I've added settings to set the red alert in hangar, to auto switch to turret, to skip hyperspaced messages.

To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini".

To define the red alert in hangar, set "IsRedAlertEnabled = 1". The default setting enables IsRedAlertEnabled for mission id 20.
To skip hyperspaced messages, "set SkipHyperspacedMessages = 1". The default setting enables SkipHyperspacedMessages for mission id 49.
To force the player in turret, set "ForcePlayerInTurret = 1". The default setting enables ForcePlayerInTurret for mission id 1.
@JeremyaFr just to reiterate what was said in TFTC discord:

hook_mission_tie.dll is causing crash to desktop in TFTC, even the stable version. Multiple missons start crashing, usually a few sceonds after launching from the hangar.

example:

Code: Select all

Faulting application name: XwingAlliance.exe, version: 2.0.0.2, time stamp: 0x3765a9b7
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x0000008f
Faulting process id: 0x4458
Faulting application start time: 0x01d86e1ed8bb9c87
Faulting application path: D:\Games\XWA Copies\TFTC v1.2\XwingAlliance.exe
Faulting module path: unknown
Report Id: 4148629c-3c8c-4a28-b42f-ddf46c8729fb
Faulting package full name: 
Faulting package-relative application ID:

Code: Select all

Application: XwingAlliance.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 0000008F
Stack:

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon May 23, 2022 7:44 pm

UPDATE

Hello,
I've updated the mission tie hook.

I've fixed a crash with the skip hyperspaced messages feature.

marcop000
Cadet 1st Class
Posts: 213
Joined: Fri Dec 27, 2019 7:08 pm

Post by marcop000 » Mon Jun 27, 2022 6:16 am

Hi @JeremyaFr ,

The inflight messages chars limit was incresed on Yogeme:

https://github.com/MikeG621/YOGEME/issues/69

but actually the limit of XWA is 68 chars that is insufficent to translate TFTC in (German, French, Italian and Spanish).

Can you please increase this limit to 80/90 chars for example ?

Thank you !!

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Jul 28, 2022 7:12 pm

UPDATE

Hello,
I've updated XwaHooksSetup.

Now the readme will be split between setup and readme files.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jul 30, 2022 9:25 am

UPDATE

Hello,
I've updated XwaHooksSetup.

I've fixed a bug with the Examples directory when it doesn't contain files at the root.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Dec 08, 2022 5:28 pm

UPDATE

Hello,
I've updated the main hook.

I've added a GenerateDumpFilesOnCrash setting.
When the game crashes a dump file will be generated if the GenerateDumpFilesOnCrash setting is set to 1. The default value is 1.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Jan 15, 2023 9:32 pm

UPDATE

Hello,
I've updated the weapon color hook.

The hook now supports object replacement.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Apr 10, 2023 12:29 pm

UPDATE

Hello,
I've updated the hooks.

I've added support for object replacement in:
- hook_dock
- hook_engine_sound
- hook_exterior
- hook_interdictor
- hook_jamming
- hook_reticle
- hook_shield
- hook_slam
- hook_weapon_rate

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 15, 2023 5:54 pm

UPDATE

Hello,
I've updated the opt limit hook.

Now in the Tech Library, the game will always show the most detailed model.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Dec 01, 2023 2:06 pm

UPDATE

Hello,
I've updated the hooks to fix issues with skirmish missions.

Timbo8504
Recruit
Posts: 8
Joined: Sun Aug 20, 2023 11:59 pm

Post by Timbo8504 » Thu Dec 14, 2023 3:26 am

Does the craft count hook modify the number of objects (mines/asteroids) that can be present? Or is it still the default 128 for objects?

Post Reply