Textures Tag Hook
Moderator: JeremyaFr
Textures Tag Hook
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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
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
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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.
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
Yes, very clever to use an empty reserved field to hold a pointer to the extra info.
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
I've added a "-transparent" tag to transparent textures.
I've added a "-transparent" tag to transparent textures.
- Vince T
- Posts: 14052
- Joined: Fri Apr 27, 2001 11:01 pm
- Contact:
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?
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
Vince T's X-Wing HQ - where the bad guys get their gear
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
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.
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
Hello,
I've updated the textures tag hook.
I've fixed an incorrect detection of transparent textures. This fix requires an updated 32bit hook.
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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
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
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
Hello,
I've merged the changes from the WIP version into the stable version.
Hello,
I've merged the changes from the WIP version into the stable version.
- JeremyaFr
- Posts: 3983
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
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.