Textures Tag Hook

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

Moderators: Darksaber, General_Trageton, Forceflow, DTM, JeremyaFr

Post Reply

Textures Tag Hook

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2223
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
Lieutenant
XWAU Member
Posts: 941
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: 214
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: 524
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
Commander
XWAU Member
Posts: 2223
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
Lieutenant
XWAU Member
Posts: 941
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
General_Trageton

Fleet Admiral (Administrator)
Posts: 12679
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by General_Trageton » 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 Modding HQ | My Steam Workshop
Vince T's X-Wing HQ New VXHQ Website WIP

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2223
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
Commander
XWAU Member
Posts: 2223
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.

Post Reply