Hooks

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

Moderator: JeremyaFr

Post Reply

Re: Hooks

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Mon May 21, 2018 4:10 pm

Ah right I get it, I had it arse ways upwards lol

Thanks Jeremy

Oh and Bman
“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
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon May 21, 2018 4:46 pm

Darksaber wrote:
Sun May 20, 2018 7:03 pm
I like the idea, but I don't see how that would work, as far as I know you can't control what mesh is visible depending on FG

If it was possible you would be able to have the Xwing, Awing, Bwing and Ywing if one package and just select which was visible by which Flghtgroup you selected
The game engine supports rendering a different mesh based on the flightgroup color.

As a test, I've modified the X-Wing to regroup the 4 wings in a single switch node. In the image below, each wing is rendered based on the flightgroup color.

meshes_switch.png

The problem is that there is no opt editor that supports that. I've modified the X-Wing by directly modifying the file nodes with my opt library.
You do not have the required permissions to view the files attached to this post.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Mon May 21, 2018 5:49 pm

That's good to know, it's something you might be able to add to XwAOptEditor or the other one in time :)
“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
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue May 22, 2018 6:16 am

That's awesome! And here I thought it was going to be an inefficient kludge like applying transparent textures to the meshes that you don't want to be visible for a given variant.

Question - is there any possibility of applying different fg colors to different ships in the same fg?

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

Post by JeremyaFr » Tue May 22, 2018 12:08 pm

Note that the ships stats will not be different (only the geometry and textures are selectable). You can't set different stats for different ships in the same craft slot.

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

Post by JeremyaFr » Sat May 26, 2018 8:11 pm

SAMPLE

Hello,
Here is an example showing how to setup turret/gunner for a starfighter.
As a test, I choose to edit the Y-Wing.

- Edit the OPTs.
Rename YWing.opt to YWing_.opt
Rename YWingExterior.opt to YWingExterior_.opt
Make a copy of FamilyTransport.opt and name it YWing.opt
Make a copy of CorellianTransportGunner.opt and name it YWingGunner.opt
Open YWingGunner.opt with XwaOptEditor and modify the textures so that you can distinguish the two Gunner OPTs.
Create a text file named YWingWeaponRate.txt with the following content:

Code: Select all

DechargeRate = 4
RechargeRate = 2
- Edit the craft stats with MXvTED.
Backup XWingAlliance.exe
Select the Y-Wing (n° 2).
In the Cockpit tab:
Gunner 1 = 0, 250, 19
Turret 1 Activated = 317
Pod1 X Orientation = -16384
Pod2 X Orientation = 16384
Arc1 = 12040
Arc3 = 17308
Click Write.

- Launch XWingAlliance.exe and test the Y-Wing.

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

Post by JeremyaFr » Mon Jun 11, 2018 6:27 pm

UPDATE

Hello,
I've updated the main hook (dinput.dll) to be compatible with the Windows' Data Execution Prevention (DEP).
See viewtopic.php?f=10&t=11902.

Please redownload xwa_hook_main.zip

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Jul 08, 2018 7:20 pm

Jeremyah, I'm having a bug with the turret hook all of a sudden and I cannot figure out why.

So as you know I've been working on updating the shuttle with a cockpit and rear player turret gunner opt. Last week everything was working fine. The default turret was assigned and functioning correctly for both slots 58, 59, 60, and 34 (Yt1760 and all the stock YT series craft) plus slot 50 (updated shuttle) with the new shuttle gunner opt.

Now all of a sudden things are not working correctly.

The issue I'm having is that the game is suddenly replacing the CorellianTransportGunner opt for slots 58, 59, 60, and 34 with the shuttlegunner opt when it is installed in the flightmodels folder, but with the YT1300 POV and arcs, while the shuttle in slot 50 is loading the stats for the shuttle gunner POV / arcs as well as loading the shuttle gunner turret opt.

I've done a clean install, twice, based on DSUCP and REBCP, and updated all the hooks to current versions manually after installing the Luxury Yacht and Rebel Platform updates to ensure everything is up to date as I believed at first that I messed something up.

I have also manually input the shuttle turret stats into MXvTED rather than loading a .shp, assuming that the .shp file may be corrupted. Just in case.

So here's the thing, prior to this week (haven't loaded the game in a week or so till today), the custom turret for the shuttle worked fine, as did the corellian transport opt. Both worked independently, and correctly with no issue.

I had the shuttle configured as such:
Turret 1 activated: 50 Turret On

This worked fine. It called the shuttlegunner opt.

The Corellian transport series craft (including DTM's YT1760) were configured as
Turret 1 (and/or 2 depending on craft) activated: 317 Turret On.

This also worked fine. It called the corelliantransportgunner opt.

Now, this week something has happened.
I had the shuttle configured as such:
Turret 1 activated: 50 Turret On

Now it calls the Shuttle (Base) opt for the turret mesh

The Corellian transport series craft (including DTM's YT1760) were configured as
Turret 1 (and/or 2 depending on craft) activated: 317 Turret On.

Now it calls the Shuttlegunner opt for the turret mesh

I also discovered upon reinstalling my Shuttle base opt did not have a gunner hardpoint, so I added that (again, don't know why it was missing)
I still had the shuttle configured as such:
Turret 1 activated: 50 Turret On

Still it calls the Shuttle (Base) opt for the turret mesh.

I check the YT1300s
The Corellian transport series craft (including DTM's YT1760) were configured as
Turret 1 (and/or 2 depending on craft) activated: 317 Turret On.

Still calls the Shuttlegunner opt for the turret mesh

So I switch back to the shuttle and reconfigure it to
Turret 1 activated: 317 Turret On

And now it calls the shuttle gunner mesh correctly. Problem solved!

However, I check the Corellian transports again, and they are still calling the shuttle gunner mesh instead of the correct corelliantransportgunner opt.

For some reason the stupid game is now overriding the default gunner opt for all the YT transports with the new custom shuttle one if it is in the flightmodels folder for no discernible reason. It never did that before, and it continues to do it until I delete the shuttlegunner opt.
The other oddity of course is that prior to this I discovered I could set the turret activation for slot 50, to 50 Turret On instead of 317 Turret On and it would call the shuttle gunner opt properly, whereas now it calls the base opt if configured as such.

EDIT # four thousand and fifty....

Okay so there's definitely a bug with the hook. But I'm not sure that it's game breaking provided you only have one player turret craft in a mission, though perhaps there's a fix for this now that I've isolated things further.

I am testing this in skirmish/solo and I had both the YT1300 and the Lambda shuttle in the mission, lambda in slot 1 on team 1, and Yt1300 in slot 2 on team 1.

I put the player in the lambda. Loaded up the turret, displayed fine.

I exited the mission and put the player into the YT1300, the game loaded up the shuttlegunner turret instead, with the YT1300 arc/POVs.

I removed the Lambda shuttle from the team and put the player in the yt1300 again, the corelliantransportgunner opt loaded up just fine.

I removed the YT1300 from the mission, added the lambda and put the player in the lambda and loaded up the mission, the shuttlegunner opt loaded up fine.

SO, I conclude that everything is in fact configured 100% correctly on my end in all areas and everything works, PROVIDED that there are not two ships with player turrets in the same mission. For some reason the game overrides the corelliantransportgunner turret with whatever customgunner turret is installed. It does not however, seem to work the other way around.

Perhaps there can be a way to denote what opt loads what gun turret via text file config to avoid this bug if one wanted to have a skirmish with two turreted craft/in multiplayer?
Last edited by Driftwood on Sun Jul 08, 2018 10:54 pm, edited 7 times in total.

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

Post by Bman » Sun Jul 08, 2018 8:19 pm

The Lambda shuttle with a working rear turret mesh ... nice! Have you made the shuttle "Flyable" in the text file ?
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Jul 08, 2018 8:59 pm

Of course. Everything is configured correctly, but the hook is calling the wrong meshes all of a sudden. It's very strange. At first I thought i corrupted something, but since reverting to a fresh install did nothing to resolve the issue I'm wondering if this is a bug since the last couple hook, main hook perhaps, updates.

The really strange thing is that the shuttle slot is behaving like the custom gunner opt doesn't exist even though it does and is named correctly, and that conversely the default gunner opt is being replaced by the shuttle gunner opt instead as default. It makes no sense since nothing has changed regarding that opt or the corresponding other slots that should be calling the default gunner opt.

Literally only the shuttle slot turret data has been altered, and the file structure for the shuttle opts are set up correctly, so by all rights it should work as intended, and nothing should be interacting with the default gunner opt, or corresponding slots as data and files pertaining to them have not been touched.

:kopfwand:

EDIT: See above re-re-re-re-re-edited post above Bma's for my conclusions regarding the issue I've encountered and "somewhat fixed".

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

Post by JeremyaFr » Mon Jul 09, 2018 3:49 pm

The hook replaces "CorellianTransportGunner.opt" with "[Player]Gunner.opt" if it exists. It doesn't work when there are multiple players with custom gunner. It seems that the first custom gunner is loaded.
As a workaround, you can place the different gunner opts to different slots.

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

Post by JeremyaFr » Sat Aug 11, 2018 4:11 pm

UPDATE

Hello,
Here is a tool to easily download the hooks.
XwaHooksSetup.zip

Usage:
1) Run XwaHooksSetup.exe.
2) It will create a directory named "Hooks" and download the hooks from GitHub into this directory. To redownload the hooks, delete the directory "Hooks".
3) It will extract the hooks into a directory named "Setup".
4) Copy the content of the "Setup" directory in your XWA install directory.

The source code is here: https://github.com/JeremyAnsel/XwaHooksSetup
You do not have the required permissions to view the files attached to this post.
Last edited by JeremyaFr on Sat Oct 27, 2018 1:18 pm, edited 1 time in total.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Aug 11, 2018 6:21 pm

Nice :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

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Tue Sep 04, 2018 6:33 am

I updated via the hook downloader and copied all the files over.

Triangling to infinity patch doesn't seem to work anymore, and the s-foil one is broken too by the look of it.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Sep 04, 2018 7:26 am

You'll have to first remove the Triangling to infinity from the exe using XWA Exe Patcher
“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

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

Post by Bman » Wed Sep 05, 2018 2:32 am

Yep, I saw DTM post that too. At top of the list, click "Restore" as DS just mentioned. Then, in the .xml file, you can edit it with notepad and either delete the first patch section (two lines of code plus the opening Patch array header and Patch trailer, or just put a semi-colon " ; " to comment out these four lines then save. The compiler will ignore anything that follows a semi-colon.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by JeremyaFr » Thu Oct 11, 2018 4:22 pm

UPDATE

Hello,
I've updated the backdrops hook.
Now you can replace dat images for any missions.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To replace dat images, create a file named "[MissionDir]\[Mission]_Resdata.txt" and list your new dat files.
The format of this file is the same as "Resdata.txt".

Please redownload xwa_hook_backdrops.zip
Last edited by JeremyaFr on Sat Oct 20, 2018 1:22 pm, edited 1 time in total.

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Thu Oct 11, 2018 6:22 pm

Wow! I will test the new hook this week end!
Thanks to your update it will be possible:
- To introduce new different starfields in different reagions of custom missions.
- To create new sky and athmosferic custom missions without distance limitations
- To create low and high orbit scenarios

All options above have been already tested, but they have been nevere applied, because it was important to keep the original planet.dat file, that is randomly loaded in the skirmish missions. Changes to the original planet.dat are not well accepted by the comunity. Now it will possible to create custom mission using multiple dat files. Excellent. Thanks Jeremya!

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

Post by Bman » Fri Oct 12, 2018 1:09 am

Awesome, thanks for this. Do you think it will be possible to allow for true 32-bit colored static images, yet ?
Last edited by Bman on Fri Oct 12, 2018 1:37 am, 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
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Fri Oct 12, 2018 1:20 am

What about animated Gifs, lol? I know, it's probably not possible.

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Sat Oct 13, 2018 12:38 pm

First test: it works perfectly! :thumbs:

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Oct 13, 2018 2:23 pm

Pics or it didn't happen. (IE, me no have time to test right now)

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Sat Oct 13, 2018 6:15 pm

I will post something in the XWAUP Super Backdrop patch topic. It need to be updated...

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

Post by JeremyaFr » Sat Oct 20, 2018 1:24 pm

UPDATE
Hello,
I've included the backdrops test hook (xwa_hook_backdrops_test) in the backdrops hook (xwa_hook_backdrops).

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Oct 20, 2018 1:33 pm

Brilliant thank you, has the other Hangar hook been properly tested or is that still at the beta stage?
“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