32-bit mode hook

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

Moderator: JeremyaFr

Re: 32-bit mode hook

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

Post by Justagai » Sat Jul 27, 2019 10:56 pm

Based on what I've read in the topic...
I also recommend that you use an updated ddraw.dll that include the commit to reduce memory usage (mine has version v1.3.7). Else the game way run out of memory and crahes in kernelbase.dll.
rogue518, check your ddraw.dll version. Most likely its older than 1.3.7.

Link to Jeremy's latest ddraw:
https://github.com/JeremyAnsel/xwa_ddraw_d3d11/releases

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

Post by JeremyaFr » Sun Jul 28, 2019 8:29 am

Yes, the crash in kernelbase.dll probably means that the game has run out of memory.
Please retry with the updated ddraw.dll.

User avatar
rogue518
XWAU Member
Posts: 2856
Joined: Wed Jul 12, 2000 11:01 pm
Contact:

Post by rogue518 » Mon Jul 29, 2019 10:44 pm

Thank You JeremyaFr and Justagai…. have 1 little problem... the black bars... in-game. I have no solution to make a full screen.


Edit: I figured it out,,,, :2thumbs: Thanks

Re-Edit: Wow.. JeremyaFr and Justagai…. I think I am going to hold off on the Reshade. Man.. the 32-bit mode really does enhance Xwing Alliance!!! well done! For all who was evolved.






Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'

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

Post by JeremyaFr » Thu Aug 01, 2019 6:56 pm

UPDATE
I've improved a bit the hook performance.

I've uploaded the source code of the hook to GitHub.

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

Post by Darksaber » Thu Aug 01, 2019 7:44 pm

Hi Jeremy, first thanks for the update
JeremyaFr wrote:
Thu Jul 25, 2019 8:16 pm
For projectiles, the game set the ambient color to 1.0.
When diffuse lighting is disabled, the game set the color to 0.4.
When diffuse lighting is enabled, the game initializes the color to 0.0 and adds the diffuse lights. The hook initializes the color to 0.2.
I've notice since installing the 32 bit Hook and with the adjustment in ambient lighting, the lasers aren't so bright as they used to be.

Are you able to isolate the lasers and projectiles and increase the brightness or ambient color as they seem so dulled now

I've tested with the new lasers, the original XWA lasers and both just seem dull

If you can't don't worry about it, I prefer the lighting as it is now

-Thanks
“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: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Aug 01, 2019 8:01 pm

The illumination of the laser OPTs may need to be redone.

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

Post by Darksaber » Thu Aug 01, 2019 8:13 pm

Like I said I've tested with the original xwa laser opts and the new ones, I'm testing brightening the textures of the lasers at the moment but they just seem as dull :(

Just to add there is no illumination on the laser opts, plus you can't add illumination to textures with alpha channel, the illumination of the lasers is done with the exe
“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: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Aug 01, 2019 8:35 pm

Is this a limitation of the tools or the exe?
A texture can be partially transparent and partially illuminated. Each pixel is either illuminated or transparent or solid (not transparent and not illuminated). When a pixel is defined as both transparent and illuminated, the pixel becomes illuminated and not transparent.

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

Post by Darksaber » Thu Aug 01, 2019 8:56 pm

I don't think it's a limitation of the tools

True you can't add PNG alpha textures in Optech, only BMP files, you can only add PNG file in XWA Opt Editor, this doesn't bother me, I'm ok with that :)

I've never had to add illumination to a laser opt, even when we had to make the lasers in Optech

But using XWA Opt Editor to add illumination to a alpha texture results in this, it's illuminated alright, but not the way you want it

I should add that this texture should also be transparent, but the transparent part as you can see it white
flightscreen35.jpg
You do not have the required permissions to view the files attached to this post.
“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: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Aug 02, 2019 8:33 am

JeremyaFr wrote:
Thu Aug 01, 2019 8:35 pm
When a pixel is defined as both transparent and illuminated, the pixel becomes illuminated and not transparent.
I can invert this to make the pixel become transparent instead of illuminated.

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

Post by Darksaber » Fri Aug 02, 2019 9:03 am

This isn't what I asked though, my original question was

Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?

A Yes or No answer would be fine :)

Also like I said I've never had to illuminated a laser texture before, I don't really want to start, when the game illuminates them automatically :D

Thanks
“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: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Aug 02, 2019 12:25 pm

No, it is not currently possible.

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

Post by Darksaber » Fri Aug 02, 2019 12:31 pm

Thank you that's fine :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
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Aug 13, 2019 4:44 pm

UPDATE
Hello,
I've fixed a possible bug with illumination.

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

Post by JeremyaFr » Tue Aug 13, 2019 6:05 pm

WIP
Hello,
Here is a WIP of the hook.

I've changed the default behavior when a pixel is both transparent and illuminated.
Before, the pixel becomed illuminated.
Now it will be transparent.


EDIT: link removed

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

Post by Bman » Wed Aug 14, 2019 11:34 pm

Thanks
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by JeremyaFr » Thu Aug 15, 2019 4:35 pm

UPDATE
Hello,
I've merged the changes from the WIP hook to the stable hook.

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

Post by blue_max » Sat Aug 17, 2019 6:26 am

Darksaber wrote:
Fri Aug 02, 2019 9:03 am
Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?
I think this is possible in ddraw. It's a bit of a hack; but it kind of works?
x-wing-32-bit-lasers-fix.jpg
tie-fighter-32-bit-laser-fix.jpg
The basic idea is that laser textures are identified by name, using the texture tag hook. Then, when a laser texture is about to be rendered, we send a flag from ddraw to the pixel shader to increase the saturation and lightness (I probably overdid the effect in the images above -- that can be configured). Something similar should be doable for missiles and other objects, I guess.

On the other hand, a more elegant fix would be to apply these lightness/saturation changes inside the 32-bit mode hook itself; but it would have to interact with the texture tag hook, so I don't know how difficult this would be.
You do not have the required permissions to view the files attached to this post.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Aug 17, 2019 9:52 am

Darksaber wrote:
Fri Aug 02, 2019 9:03 am
Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?
JeremyaFr wrote:
Fri Aug 02, 2019 12:25 pm
No, it is not currently possible.
this is why I never understood this statement, it had to be possible even if doing it by texture id/name.

good work.

Trev

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

Post by Driftwood » Sat Aug 17, 2019 1:56 pm

So my thought is , "so what" if it is in the texture tag hook rather than 32bit hook at this point? If both are default installs due to the new features they add to the game and are in line with the projects direction forward, and it requires the tag to function (assuming there isnt a better way) then does it matter?

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

Post by keiranhalcyon7 » Sat Aug 17, 2019 6:28 pm

Do we know why the lasers are becoming dulled in the first place? What's special about them? Or are there other things also being dulled that haven't been found yet?

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

Post by blue_max » Sun Aug 18, 2019 3:55 am

keiranhalcyon7 wrote:
Sat Aug 17, 2019 6:28 pm
Do we know why the lasers are becoming dulled in the first place? What's special about them? Or are there other things also being dulled that haven't been found yet?
I think I know what's going on now -- and how to fix it. The 32-bit hook converts indexed textures to 32-bit textures; but in the process, it looks like it's dulling the lasers a little bit.

I manually extracted the original lasers from the OPT and made 32-bit PNG versions of them. When I replace the lasers at run-time with the versions I made, the lasers look bright again:
A-wing-32-bit-lasers.jpg
So one way to fix this properly -- without any hacks -- would be to redo the OPTs for the lasers and upgrade them manually to 32-bits so that the hook doesn't convert them.

@Jeremy: can this 32-bit hook load 32-bit OPTs? Also, what happened to the "light" textures? It looks like the illumination information is also gone?
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Sun Aug 18, 2019 4:45 am

Looks like the 32-bit mode hook can load 32-bit OPTs; but it still processes 32-bit textures (?) and makes lasers dull again.

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

Post by Bman » Sun Aug 18, 2019 4:56 am

BlueMax, yes. Trick I came across is using XWAOptEditor. Select each 32-bit ARGB FG texture and click the "Reset Illumination" button then save. If there is a way to maintain the pixels' transparency with illumination applied, that would be best of both worlds even without using ReShade. Don't know if that's possible currently.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by blue_max » Sun Aug 18, 2019 5:10 am

Hey Bman, I don't know about that (I'm still learning about OPTing). If I reset the illumination on all the laser textures, nothing changes. If I export the textures manually to 32-bit PNGs they keep the alpha channel. I can then load these external PNGs inside ddraw and replace the textures coming from the OPT and thus keep illumination (fully bright) and transparency (effectively bypassing the 32-bit mode hook). But it looks like, in general, the 32-bit mode hook still has to process 32-bit textures to apply illumination information and other stuff.

So, it looks like the problem is more complex than I originally thought. I can provide a flag in ddraw.cfg to apply the hack to all lasers to make them brighter in the meantime.

Post Reply