Page 1 of 1

Textures Tag Hook

Posted: Fri Jul 26, 2019 12:21 pm
by JeremyaFr
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

Re: Textures Tag Hook

Posted: Fri Jul 26, 2019 8:51 pm
by blue_max
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.

Re: Textures Tag Hook

Posted: Sat Jul 27, 2019 5:39 pm
by Justagai
Well done.

Re: Textures Tag Hook

Posted: Sat Jul 27, 2019 9:30 pm
by keiranhalcyon7
Yes, very clever to use an empty reserved field to hold a pointer to the extra info.

Re: Textures Tag Hook

Posted: Mon Jul 29, 2019 4:21 pm
by JeremyaFr
UPDATE
I've added a "-transparent" tag to transparent textures.

Re: Textures Tag Hook

Posted: Mon Jul 29, 2019 8:51 pm
by blue_max
Thank you Jeremy, this is awesome

Re: Textures Tag Hook

Posted: Tue Mar 10, 2020 7:05 am
by Vince T
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?

Re: Textures Tag Hook

Posted: Tue Mar 10, 2020 4:30 pm
by JeremyaFr
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.

Re: Textures Tag Hook

Posted: Tue Mar 10, 2020 4:32 pm
by JeremyaFr
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.

Re: Textures Tag Hook

Posted: Thu Jul 02, 2020 7:09 pm
by JeremyaFr
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

Re: Textures Tag Hook

Posted: Sun Jul 19, 2020 12:25 pm
by JeremyaFr
UPDATE

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

Re: Textures Tag Hook

Posted: Thu Jul 23, 2020 11:28 am
by JeremyaFr
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.