XWA.Exe Patches

Need help editing the game? Check for help here!

Moderators: Darksaber, General_Trageton, Forceflow

Post Reply

XWA.Exe Patches

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Feb 10, 2015 9:36 pm

Here is a list of patches for XWINGALLIANCE.EXE that were dispersed throughout the forum.

DISCLAIMER
Never apply a patch if you are not sure of what it does.
It is recommended to make a backup of XWingAlliance.exe.

To make it easy to apply patches, I've create a GUI tool:
XwaExePatcher.png
XwaExePatcher.png (27.52 KiB) Viewed 7448 times
download link:
https://github.com/JeremyAnsel/XwaExePa ... ses/latest

The patches are defined in an xml file "patcher.xml". The format of this file is defined in "patcher.xsd".

patcher.xsd:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="ArrayOfPatch">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="Patch">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="Item">
                <xs:complexType>
                  <xs:attribute name="Offset" type="xs:string" use="required" />
                  <xs:attribute name="From" type="xs:string" use="required" />
                  <xs:attribute name="To" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Name" type="xs:string" use="required" />
            <xs:attribute name="Description" type="xs:string" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
patcher.xml:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfPatch>
  <Patch Name="[Recommended] triangling to infinity" Description="Fix the 'triangling to infinity' glitch.">
    <Item Offset="193C4A" From="750C" To="9090" />
    <Item Offset="193C53" From="02" To="08" />
  </Patch>
  <Patch Name="[Recommended] disable briefing wireframe overlay" Description="Disable the briefing wireframe overlay.">
    <Item Offset="07E09C" From="7D" To="EB"/>
    <Item Offset="07E12E" From="7D" To="EB"/>
    <Item Offset="07E1B9" From="47" To="90"/>
  </Patch>
  <Patch Name="remove joystick check" Description="Remove the joystick check.">
    <Item Offset="138CB4" From="754E" To="EB4E" />
  </Patch>
  <Patch Name="show framerate" Description="Show in-flight framerate">
    <Item Offset="05A3EA" From="85C07405" To="90909090" />
    <Item Offset="0F165A" From="85C07405" To="90909090" />
    <Item Offset="07978B" From="746F" To="EB6F" />
  </Patch>
  <Patch Name="show framerate, vertices, triangles" Description="Show in-flight framerate, SceneNumVerts, SceneNumTris, SceneNumTexChanges, SceneNumStateChanges">
    <Item Offset="05A3EA" From="85C07405" To="90909090" />
    <Item Offset="0F165A" From="85C07405" To="90909090" />
    <Item Offset="07978B" From="746F" To="EB36" />
  </Patch>
  <Patch Name="show framerate, video memory" Description="Show in-flight framerate, TexThrash, TotalTex">
    <Item Offset="05A3EA" From="85C07405" To="90909090" />
    <Item Offset="0F165A" From="85C07405" To="90909090" />
    <Item Offset="07978B" From="746F" To="EB0A" />
  </Patch>
  <Patch Name="crafts count per region" Description="Replace the craft count per region from 96 to 192.">
    <Item Offset="14C2E" From="60000000C1E305" To="C0000000C1E306"/>
  </Patch>
  <Patch Name ="backdrop scaling factor from 256.0f to 512.0f">
    <Item Offset="1A83AC" From="00008043" To="00000044"/>
  </Patch>
  <Patch Name ="backdrop scaling factor from 256.0f to 128.0f">
    <Item Offset="1A83AC" From="00008043" To="00000043"/>
  </Patch>
  <Patch Name ="backdrop scaling factor from 256.0f to 64.0f">
    <Item Offset="1A83AC" From="00008043" To="00008042"/>
  </Patch>
  <Patch Name ="backdrop scaling factor from 256.0f to 32.0f">
    <Item Offset="1A83AC" From="00008043" To="00000042"/>
  </Patch>
  <Patch Name="remove textures size limit" Description="Remove the 256x256 texture size limit.">
    <Item Offset="19564A" From="81790C000100007717" To="909090909090909090" />
    <Item Offset="1956C2" From="817A10000100007717" To="909090909090909090" />
  </Patch>
  <Patch Name="opt textures count limit from 200 to 1024">
    <Item Offset="0CC432" From="2003" To="0010" />
    <Item Offset="0CC43A" From="2803" To="0810" />
    <Item Offset="0CC445" From="2C03" To="0C10" />
    <Item Offset="0CC44C" From="2003" To="0010" />
    <Item Offset="0CC466" From="C800" To="0004" />
    <Item Offset="0CC497" From="3003" To="1010" />
    <Item Offset="0CC4C9" From="3003" To="1010" />
    <Item Offset="0CC4E6" From="3003" To="1010" />
    <Item Offset="0CC4EE" From="2003" To="0010" />
  </Patch>
  <Patch Name="[Fix] 32-bit bmp screenshot" Description="Fix misaligned flightscreen*.bmp screenshots.">
    <Item Offset="136CDA" From="740140" To="909090"/>
    <Item Offset="136D00" From="18" To="20"/>
    <Item Offset="136B2E" From="03" To="04"/>
    <Item Offset="136B35" From="0F8C50FFFFFFF6C3017445" To="9090909090909090909090"/>
    <Item Offset="136B56" From="6A0056E8C237FFFF0FBFC083C408" To="8B44245C3BD80F8C29FFFFFFEB21"/>
    <Item Offset="136C3B" From="03" To="04"/>
    <Item Offset="136C43" From="7C8CF6C3017447" To="90909090909090"/>
    <Item Offset="136C60" From="6A0056E8B836FFFF0FBFC083C408" To="8B44245C3BD80F8C65FFFFFFEB23"/>
  </Patch>
  <Patch Name="[Fix] disable a3d" Description="Disable the creation of an A3D device.">
    <Item Offset="1A7CA1" From="558BEC83EC20C745" To="B8FFFFFFFFC20C00"/>
  </Patch>
  <Patch Name="[Experimental] replace malloc with calloc">
    <Item Offset="19BCE0" From="A1B81E7B008B4C24045051E810000000" To="8B4C2404516A0190909090E8C0000000" />
  </Patch>
</ArrayOfPatch>
Last edited by JeremyaFr on Sat Nov 24, 2018 7:46 pm, edited 2 times in total.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 9528
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Feb 10, 2015 11:32 pm

Thanks Jeremy :D

Just a couple of questions I understand all of them apart from the last two, I don't think you've published these offsets before

Replace malloc with calloc, what is it and what does it do?
Disable a3d = Disable the creation of a A3D device, but what exactly is an A3D device and what does it do?

Thanks
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Rasalas
Cadet 2nd Class
Posts: 50
Joined: Fri Jan 17, 2014 8:09 pm

Post by Rasalas » Wed Feb 11, 2015 12:26 am

Darksaber wrote:Disable a3d = Disable the creation of a A3D device, but what exactly is an A3D device and what does it do?
That's the Aureal 3D sound engine: http://en.wikipedia.org/wiki/A3D
Jeremy, does using this patch have any benefits compared to disabling A3D in XWA's sound menue?

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Feb 11, 2015 12:37 am

Darksaber wrote:Disable a3d = Disable the creation of a A3D device, but what exactly is an A3D device and what does it do?
From Update202.rtf:
Aureal A3D Interactive(TM) sound support: Provides hardware accelerated 3d positional audio. To enable this support go to the sound options menu in the game, and select on for 3d sound enabled. If you have an Aureal supported sound card it will default to A3D support.

Improvements to Direct Sound 3D support: We have made adjustments to our sound system to create a more fulfilling experience for users with Direct Sound 3D supported soundcards.
On a system where an Aureal sound card was present and the a3d dlls are still installed, XWA may crash when 3D sound is enabled. Disabling the A3D device fix that crash.
Darksaber wrote:Replace malloc with calloc, what is it and what does it do?
malloc allocates memory without initializing it.
calloc allocates memory and fills it with 0.
I do not recommend to use this patch. I have made it for debugging purposes.

User avatar
Forceflow

Fleet Admiral (Administrator)
Posts: 5159
Joined: Wed Oct 20, 1999 11:01 pm
Contact:

Post by Forceflow » Wed Feb 11, 2015 4:39 pm

Great work!
Maybe you should add a 'Not recommended' to the settings you deem unsafe to use or have a 'recommended' setting for the patches.
Murphy was an optimist! I am a pessimist!
And always remember that a smile is cheaper than a bullet! (District 9)
Webmaster of the X-Wing Alliance Upgrade Project

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Feb 12, 2015 11:06 pm

UPDATE:
I've added Recommended, Fix, Experimental tags to the patches.

User avatar
Trevor
Cadet 2nd Class
Posts: 82
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri Feb 13, 2015 5:28 pm

Hi Jeremya.

None of your stuff load in 98.
I wanted to try the hangar stuff but the patcher requires net4.

Ill try patching manually and then test the dlls

Edit:
Ok, its confirmed that none of these new features will work in 9x based systems.

Those of us using 9x to play this game are stuck with the official stuff except for the Opts and Texture stuff

The last version of MSVC that I know works in 9x is MSVCR90.dll (MSVC 2008)
It doesnt work in Vanilla 98 but with Kex it does.

trev

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Mar 04, 2015 11:26 pm

Hello Trevor,
I have no plan to support systems older than Windows XP.

User avatar
Atx
Lieutenant Commander
Posts: 1214
Joined: Mon Feb 11, 2002 12:01 am

Post by Atx » Mon Apr 13, 2015 12:46 pm

As a former staunch supporter of win98 I agree its no longer worth supporting. Now if someone has Win98 still using it as a Dosbox (sheepishly looks away) then I advise you get KernelEx and all its numerous add ons.
Add ons are still being made for it by the community I believe.
http://kernelex.sourceforge.net/

Nice work on breaking the features ;)

JeremyFr - thanks for all your EXE insights and a huge thanks for all the neat tools. I know it's a lot of hard work (and a lot of your free time) but it is truly appreciated by the community here. :D
The Navbuoy is closed...long live the XWAU!!!

User avatar
DTM
Lieutenant Commander
XWAU Member
Posts: 1099
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Sat Apr 25, 2015 6:15 am

Great work as always!
What are the patches already included into the XWAU Craft Pack?

MTD industries
WIPs: Fixing missions and new editing for the REBCP, Resistance Mon Calamari Cruiser, New advanced base OPT files for all playable XWAUP crafts.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 9528
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Apr 25, 2015 8:22 am

Using Disc and Gog versions
[Recommended] triangling to infinity
[Recommended] disable briefing wireframe overlay
crafts count per region
backdrop scaling factor from 256.0f to 128.0f
remove textures size limit
opt textures count limit from 200 to 1024
[Fix] 32-bit bmp screenshot
[Fix] disable a3d
To setup the dinput hook
To call the hook that selects the hangar type
To call the hook that selects the inside animation
To call the hook that selects the hangar model index
To call the hook that loads hangar opt
To remove the opt filter
To call the hook that sets the hangar camera
To call the hook that sets the hangar map
To call the hook that sets the family hangar map
To call the hook that remove D3DInfos count limit

If using Gog version (Only)
Removed
Force 800 mode
Fixed Z Clear
32 bit Mode
No CD Check

Reapplied
Correct No CD Check
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Bman
Lieutenant JG
Posts: 525
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sat Apr 14, 2018 10:47 pm

Hi Jeremy, just wanted to confirm... these general patches are Not already part of your recent runtime .dll files? My understanding is these offset patches are included in the installers and applied through XWAUCP or DSUCP packs, correct ?
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Apr 15, 2018 11:56 am

Hi Bman,
These general patches are not part of the hook DLLs. They are included in the craft packs (see the above list except the hook patches).

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Apr 15, 2018 12:22 pm

Hello,
I've added "disable gun turret random rotation" patch to XwaExePatcher.
It will disable the gun turret rotation when there is no targetted craft.
See viewtopic.php?p=153940#p153940

Bman
Lieutenant JG
Posts: 525
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sun Apr 15, 2018 5:24 pm

Awesome. I will test it in near future. Thank you!

EDIT: Hi Jeremy, I just noticed in the patcher.xml file for XWA.Exe patches, should we remove the following script lines ?

Code: Select all

  </Patch>
  <Patch Name="disable S-Foil model filter">
    <Item Offset="0FB86E" From="7419" To="EB19"/>
  </Patch>
Because this is already included in the hook_sfoils.dll file? I was wondering if it was redundant.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Apr 26, 2018 3:38 pm

Hello,
Yes, it is redundant since this patch is included in the sfoils hook.

Bman
Lieutenant JG
Posts: 525
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sun May 06, 2018 12:10 am

Hi Jeremy, I was wondering if the below could be added to your patcher.xml file for enhancing quality of sounds by using superior .wav samples. I know the game engine is limited to 2 channels (stereo) 8 bit or 16 bit, (maybe 24 bit PCM ?) The secondary buffers feed the primary buffers. But maybe replace the primary buffers which are currently capped at 22,050 kHz for .wav file content with optional 44.100 kHz, 48.000 kHz, 88.200 kHz, and 96.000 kHz.

Code: Select all

WAVEFORMATEX wf;
    wf.wFormatTag = WAVE_FORMAT_PCM;
    wf.nChannels = 2;
    wf.nSamplesPerSec = 22050;
    wf.nAvgBytesPerSec = 88200;
    wf.nBlockAlign = 4;
    wf.wBitsPerSample = 16;
For example, to replace the default wf.nSamplesPerSec = 22.050 with 44.100:

Code: Select all

  </Patch>
  <Patch Name="To Allow higher kHz Sound samples beyond 22kHz" Description="From 22,050 kHz to 44,100 kHz">
    <Item Offset="1379E9" From="22560000" To="44AC0000" />
    <Item Offset="1379FF" From="88580100" To="10B10200" />
    <Item Offset="1376D2" From="22560000" To="44AC0000" />
    <Item Offset="1376E8" From="88580100" To="10B10200" />
  </Patch>
I'm not sure what the values would be for 48.000 kHz, 88.200 kHz, and 96.000 kHz. Too bad wf.nChannels can't be greater than 2. Hope this helps. Thanks.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun May 06, 2018 12:29 pm

Hello,

The game engine sets the primary wave format to 22050 Hz.

Wav data are loaded into secondary buffers. The format of a secondary buffer matches the format of the wav data.
When the sound is played, its format is converted to the format of the primary buffer.
MSDN Library wrote: DirectSound Playback Objects

Primary buffer:
Mixes and plays sounds from secondary buffers, and controls global 3D parameters.

Secondary buffer:
Manages a static or streaming sound and plays it into the primary buffer.
The wave format is defined as this:

Code: Select all

WAVEFORMATEX wf;
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = 2;
wf.nSamplesPerSec = 22050;
wf.nAvgBytesPerSec = 88200;
wf.nBlockAlign = 4;
wf.wBitsPerSample = 16;
The game engine works with 2 sound channels.

Code: Select all

nBlockAlign = nChannels * (wBitsPerSample / 8)
nAvgBytesPerSec = nSamplesPerSec * nBlockAlign
The following modifications will replace nSamplesPerSec and nAvgBytesPerSec:

Code: Select all

# sound format from 22050 Hz to 44100 Hz
At offset 1379E9, replace 22560000 with 44AC0000.
At offset 1379FF, replace 88580100 with 10B10200.
At offset 1376D2, replace 22560000 with 44AC0000.
At offset 1376E8, replace 88580100 with 10B10200.

# sound format from 22050 Hz to 48000 Hz
At offset 1379E9, replace 22560000 with 80BB0000.
At offset 1379FF, replace 88580100 with 00EE0200.
At offset 1376D2, replace 22560000 with 80BB0000.
At offset 1376E8, replace 88580100 with 00EE0200.

# sound format from 22050 Hz to 88200 Hz
At offset 1379E9, replace 22560000 with 88580100.
At offset 1379FF, replace 88580100 with 20620500.
At offset 1376D2, replace 22560000 with 88580100.
At offset 1376E8, replace 88580100 with 20620500.

# sound format from 22050 Hz to 96000 Hz
At offset 1379E9, replace 22560000 with 00770100.
At offset 1379FF, replace 88580100 with 00DC0500.
At offset 1376D2, replace 22560000 with 00770100.
At offset 1376E8, replace 88580100 with 00DC0500.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun May 06, 2018 12:34 pm

UPDATE:
I've updated XwaExePatcher.
Here is the changelog:
  • Remove disable S-Foil model filter. It is included in hook_sfoils.
  • Add remove warhead count limit.
  • Add sound format. You can choose between 22050 Hz, 44100 Hz, 48000 Hz, 88200 Hz and 96000 Hz.

Bman
Lieutenant JG
Posts: 525
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sun May 06, 2018 5:19 pm

Awesome. Thank you!
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Aug 31, 2018 7:41 pm

UPDATE

Hello,
I've included the 'triangling to infinity' path to the opt limit hook. So you no longer have to apply it. The patch will be applied by the hook.
Last edited by JeremyaFr on Sat Sep 01, 2018 7:54 am, edited 1 time in total.

User avatar
DTM
Lieutenant Commander
XWAU Member
Posts: 1099
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Fri Aug 31, 2018 9:04 pm

I've just updated all Hooks. There is a problem, I think with the Hook_Opt_Limit.dll file.
This message is shown at game's launch:

xwa_hook_main (Dinput.dll)
"triangling to infinity patch" is not correctly initialized.

In game S-Foils don't work (your craft does not have S-Foils)
If i restore the old Hook_Opt_Limit.dll file, everything is ok.

EDIT:
:doh: ...I must disable "triangling to infinity" patch !

MTD industries
WIPs: Fixing missions and new editing for the REBCP, Resistance Mon Calamari Cruiser, New advanced base OPT files for all playable XWAUP crafts.

JeremyaFr
Lieutenant
XWAU Member
Posts: 917
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Nov 24, 2018 7:50 pm

UPDATE
Hello,
I've removed the Recommended tag for the 'triangling to infinity' patch and I've indicated that this patch is included in the opt limit hook.

Post Reply