Textures Tag Hook

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

Moderator: JeremyaFr

Post Reply

Textures Tag Hook

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

Post by JeremyaFr » Fri Jul 26, 2019 12:21 pm

Hello,
Here is a new hook.

This hook set a tag to the textures. The tag can then be read from ddraw.dll.

The tag can be read from the CreateSurface method of the IDirectDraw interface. The dwReserved variable of the DDSURFACEDESC structure is set to a pointer to the tag string (const char*).

The format of the tag is:
- for dat images: "dat,groupId,ImageId,mipmapLevel"
- for opt textures:
"opt,optFileName,textureName,color,mipmapLevel" for color maps
or "opt,optFileName,textureName,color-transparent,mipmapLevel" for transparent color maps
or "opt,optFileName,textureName,light,mipmapLevel" for light maps

To help debugging, the hook can optionally write the tags to the debug ouput that can be read with DebugView.
See "hook_textures_tag.cfg".

xwa_hook_textures_tag.zip

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jul 26, 2019 8:51 pm

Thank you, Jeremy. I appreciate your help with this hook. I must also say that this was a very, very clever way to implement it.

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

Post by Justagai » Sat Jul 27, 2019 5:39 pm

Well done.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Jul 27, 2019 9:30 pm

Yes, very clever to use an empty reserved field to hold a pointer to the extra info.

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

Post by JeremyaFr » Mon Jul 29, 2019 4:21 pm

UPDATE
I've added a "-transparent" tag to transparent textures.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Jul 29, 2019 8:51 pm

Thank you Jeremy, this is awesome

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Tue Mar 10, 2020 7:05 am

Hey Jeremy, sorry for necromancing the thread but I was wondering: How do the texture tags correspond with the info stored within the OPT?
For example if I had used OPTech to add illumination and/or transparency and then added lightmaps or alpha maps to the same texture, would they overwrite the original OPT properties or vice versa?

Also could I use this hook to add both illumination and transparency to the same texture?
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

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

Post by JeremyaFr » Tue Mar 10, 2020 4:30 pm

Hello,
This hook doesn't modify the OPTs.
It adds a tag to the textures when they are loaded.

When a texture has no transparency and no illumination, there will be a "color" tag.
When a texture has transparency and no illumination, there will be a "color-transparent" tag.
When a texture has no transparency and illumination, there will be a texture with a "color" tag and a texture with a "light" tag.
When a texture has transparency and illumination, there will be a texture with a "color-transparent" tag and a texture with a "light" tag.

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

Post by JeremyaFr » Tue Mar 10, 2020 4:32 pm

UPDATE
Hello,
I've updated the textures tag hook.

I've fixed an incorrect detection of transparent textures. This fix requires an updated 32bit hook.

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

Post by JeremyaFr » Thu Jul 02, 2020 7:09 pm

WIP

Hello,
Here is a WIP version of the textures tag hook.

During the mission loading screen, if an OPT is not found, then the game crashes at offset 0x000849c7.
This WIP will show an error box before the crash with a message containing the OPT filename.

EDIT: link removed

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

Post by JeremyaFr » Sun Jul 19, 2020 12:25 pm

UPDATE

Hello,
I've merged the changes from the WIP version into the stable version.

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

Post by JeremyaFr » Thu Jul 23, 2020 11:28 am

UPDATE

Hello,
I've fixed a bug in the textures tag hook.

Now, when an OPT model is not found, there will be no error shown for the cockpit and exterior models.

Post Reply