Hooks

From XWAU Modding Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Hooks are means of inserting code right into the XWINGALLIANCE.EXE, introduced by JeremyaFr. They enhance, add features to, or fix problems with the game.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11772

This article is incomplete, I'll let Jeremy do the explaining :D

Installation

If you have installed XWAUCP or DSUCP, you already have the hooks installed.

To obtain the most recent hooks, the easy way is to use XwaHooksSetup. Usage:

  1. Run XwaHooksSetup.exe.
  2. It will create a directory named "Hooks" and download the hooks from GitHub into this directory. To redownload the hooks, delete the directory "Hooks".
  3. It will extract the hooks into a directory named "Setup".
  4. Copy the content of the "Setup" directory in your XWA install directory.

See http://www.xwaupgrade.com/phpBB3/viewtopic.php?p=154911#p154911

xwa_hook_main

This is the main dll hook (dinput.dll) that is used to call other hooks.

Each hook is implemented in a separate dll. The name of the dll must begin with "hook_" or "Hook_".

You can find samples at https://github.com/JeremyAnsel/xwa_hooks/tree/master/Samples

xwa_hook_main_no_dinput

If you use a custom Dinput.dll, it will conflict with this hook. In this case, use xwa_hook_main_no_dinput instead of xwa_hook_main.

xwa_hook_32bpp

This hook enables 32-bit mode.

8-bit OPTs are converted to 32 bits and the game can load 32-bit OPTs. The game can load 32-bit DAT images. Existing DAT images are converted to 32 bits.

See https://www.xwaupgrade.com/phpBB3/viewtopic.php?f=33&t=12257


xwa_hook_backdrops

This hook adds starfield backdrops to skirmish mission and permits to replace .dat files for a given mission.

Suppose that the mission is "[MissionDir]\[Mission].tie".

To replace dat images, create a file named "[MissionDir]\[Mission]_Resdata.txt" or create a section named "[Resdata]" in "[MissionDir]\[Mission].ini" and list your new dat files.

The format of this file is the same as "Resdata.txt".

xwa_hook_countermeasures

This hook fixes countermeasures count when reloading.

xwa_hook_d3d

This hook improves FPS.

To enable this hook, set "IsHookD3DEnabled = 1" in "hook_d3d.cfg". It requires a custom DDraw.dll with support for this d3d hook.

xwa_hook_d3dinfos_textures

This hook increases the D3DTextures count limit. When there are more than 1624 textures, the game outputs "Not enough D3DTextures" and uses the last created texture. This hook fixes that.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=10&t=11274

The original D3DInfos count is 1624. By default, the dll will use a value of 10000. You can modify this value in hook_d3dinfos_textures.cfg (Size = value).

xwa_hook_engine_sound

This hook enables setting engine sound and weapon sound behavior for any craft.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11746

mission sounds

Suppose that the mission is "[MissionDir]\[Mission].tie".

To replace sounds for a given mission, create a file named "[MissionDir]\[Mission]_Sounds.txt" or create a section named "[Sounds]" in "[MissionDir]\[Mission].ini".

If a "Sounds.txt" file doesn't exist, no sound is replaced. The format is a line per sound: "Wave\SoundA.wav = Wave\NewSoundA.wav" See "Sounds.txt".

craft and weapon sounds

Suppose that the craft is "FlightModels\[Model].opt".

To define which sound is played, create a file named "FlightModels\[Model]Sound.txt" or create a section named "[Sound]" in "FlightModels\[Model].ini". The format is:

EngineSoundInterior = interior sound type

EngineSoundFlyBy = flyby sound type

EngineSoundWash = wash sound type

WeaponSoundBehavior = behavior value

Use a value of 0 to not select a sound. For engine sounds, it means that no sound is played. For wash sounds, it means that the default sound is played. For weapon sounds, it means that a default sound is played (based on weapon type).

Add a line whith "EngineSoundInterior = value". The value is between 0 and 7:

  • 0 means no sound
  • 1 means EngineIntXW
  • 2 means EngineIntYW
  • 3 means EngineIntAW
  • 4 means EngineIntTI
  • 5 means EngineIntAG
  • 6 means EngineIntCort
  • 7 means EngineIntFalc

Add a line with "EngineSoundFlyBy = value". The value is between 0 and 8, 11 and 18, 21 and 28:

  • 0 means no sound
  • 1 means FlyByXW or FlyByXW3D
  • 2 means FlyByYW or FlyByYW3D
  • 3 means FlyByAW or FlyByAW3D
  • 4 means FlyByTI or FlyByTI3D
  • 5 means FlyByAG or FlyByAG3D
  • 6 means FlyByCort or FlyByCort3D
  • 7 means FlyByCort or FlyByCort3D
  • 8 means custom (first unused/FlyBySlave) or custom3D (second unused/FlyBySlave3D)
  • 11 means FlyByXW
  • 12 means FlyByYW
  • 13 means FlyByAW
  • 14 means FlyByTI
  • 15 means FlyByAG
  • 16 means FlyByCort
  • 17 means FlyByCort
  • 18 means custom (first unused/FlyBySlave)
  • 21 means FlyByXW3D
  • 22 means FlyByYW3D
  • 23 means FlyByAW3D
  • 24 means FlyByTI3D
  • 25 means FlyByAG3D
  • 26 means FlyByCort3D
  • 27 means FlyByCort3D
  • 28 means custom3D (second unused/FlyBySlave3D)

Add a line with "EngineSoundWash = value". The value is between 1 and 2:

  • 1 means EngineWash
  • 2 means EngineWashSD

Add a line with "WeaponSoundBehavior = value". The value is 0, CorellianTransport, TieFighter, TieFighterWithIon, Rebel, RebelTurbo, Empire, EmpireTurbo, Falcon, FalconTurbo, Ion or IonTurbo.

  • 0 means that a default sound is played.
  • CorellianTransport means that Laser and LaserTurbo are replaced with FalconLaser or FalconLaserTurbo.
  • TieFighter means that the open weapon (307) sound is EmpireLaserChChChhh or that laser sounds (RebelLaser, RebelLaserTurbo, EmpireLaser, EmpireLaserTurbo, IonCannon, IonCannonTurbo) are replaced with EmpireLaserChChChhh.
  • TieFighterWithIon means that the open weapon (307) sound is EmpireLaserChChChhh or that laser sounds (RebelLaser, RebelLaserTurbo, EmpireLaser, EmpireLaserTurbo) are replaced with EmpireLaserChChChhh or ion lasers (IonCannon, IonCannonTurbo) are not replaced.
  • Rebel means that the open weapon (307) sound is RebelLaser or that RebelLaser and
  • RebelLaserTurbo are replaced with RebelLaser.
  • RebelTurbo means that the open weapon (307) sound is RebelLaserTurbo or that
  • RebelLaser and RebelLaserTurbo are replaced with RebelLaserTurbo.
  • Empire means that the open weapon (307) sound is EmpireLaser or that EmpireLaser and EmpireLaserTurbo are replaced with EmpireLaser.
  • EmpireTurbo means that the open weapon (307) sound is EmpireLaserTurbo or that EmpireLaser and EmpireLaserTurbo are replaced with EmpireLaserTurbo.
  • Falcon means that the open weapon (307) sound is FalconLaser or that RebelLaser, RebelLaserTurbo, EmpireLaser and EmpireLaserTurbo are replaced with FalconLaser.
  • FalconTurbo means that the open weapon (307) sound is FalconLaserTurbo or that RebelLaser, RebelLaserTurbo, EmpireLaser and EmpireLaserTurbo are replaced with FalconLaserTurbo.
  • Ion means that the open weapon (307) sound is IonCannon or that IonCannon and IonCannonTurbo are replaced with IonCannon.
  • IonTurbo means that the open weapon (307) sound is IonCannonTurbo or that IonCannon and IonCannonTurbo are replaced with IonCannonTurbo.

If the file does not exist, default values are used:

Interior sound:

  • type 1:
    • ModelIndex_001_0_0_Xwing
    • ModelIndex_004_0_3_Bwing
    • ModelIndex_014_0_13_Z_95
    • ModelIndex_015_0_14_R41
    • ModelIndex_031_0_30_SlaveOne
  • type 2:
    • ModelIndex_002_0_1_Ywing
    • ModelIndex_011_0_10_ToscanFighter
    • ModelIndex_023_0_22_CloakshapeFighter
  • type 3:
    • ModelIndex_003_0_2_Awing
    • ModelIndex_010_0_9_IrdFighter
    • ModelIndex_013_0_12_Twing
    • ModelIndex_027_0_26_Piggyback
  • type 4:
    • ModelIndex_005_0_4_TieFighter
    • ModelIndex_006_0_5_TieInterceptor
    • ModelIndex_007_0_6_TieBomber
    • ModelIndex_008_0_7_TieAdvanced
    • ModelIndex_009_0_8_TieDefender
  • type 5:
    • ModelIndex_012_0_11_MissileBoat
    • ModelIndex_016_0_15_AssaultGunboat
    • ModelIndex_024_0_23_RazorFighter
    • ModelIndex_025_0_24_PlanetaryFighter
    • ModelIndex_029_0_28_PreybirdFighter
  • type 6:
    • ModelIndex_017_0_16_SkiprayBlastBoat
    • ModelIndex_058_0_45_CorellianTransport2
    • ModelIndex_065_0_52_FamilyTransport
  • type 7:
    • ModelIndex_026_0_25_SupaFighter
    • ModelIndex_032_0_31_SlaveTwo
    • ModelIndex_059_0_46_MilleniumFalcon2

FlyBy sound:

  • type 1:
    • ModelIndex_001_0_0_Xwing
    • ModelIndex_004_0_3_Bwing
    • ModelIndex_014_0_13_Z_95
    • ModelIndex_015_0_14_R41
    • ModelIndex_031_0_30_SlaveOne
  • type 2:
    • ModelIndex_002_0_1_Ywing
    • ModelIndex_011_0_10_ToscanFighter
    • ModelIndex_023_0_22_CloakshapeFighter
  • type 3:
    • ModelIndex_003_0_2_Awing
    • ModelIndex_010_0_9_IrdFighter
    • ModelIndex_013_0_12_Twing
    • ModelIndex_027_0_26_Piggyback
  • type 4:
    • ModelIndex_005_0_4_TieFighter
    • ModelIndex_006_0_5_TieInterceptor
    • ModelIndex_007_0_6_TieBomber
    • ModelIndex_008_0_7_TieAdvanced
    • ModelIndex_009_0_8_TieDefender
  • type 5:
    • ModelIndex_012_0_11_MissileBoat
    • ModelIndex_016_0_15_AssaultGunboat
    • ModelIndex_024_0_23_RazorFighter
    • ModelIndex_025_0_24_PlanetaryFighter
    • ModelIndex_029_0_28_PreybirdFighter
    • ModelIndex_043_0_32_Tug
    • ModelIndex_044_0_33_CombatUtilityVehicle
    • ModelIndex_045_0_34_HeavyLifter
    • ModelIndex_050_0_37_Shuttle
    • ModelIndex_051_0_38_EscortShuttle
    • ModelIndex_052_0_39_StormtrooperTransport
    • ModelIndex_053_0_40_AssaultTransport
    • ModelIndex_054_0_41_EscortTransport
    • ModelIndex_055_0_42_SystemPatrolCraft
    • ModelIndex_056_0_43_ScoutCraft
  • type 6:
    • ModelIndex_017_0_16_SkiprayBlastBoat
    • ModelIndex_058_0_45_CorellianTransport2
    • ModelIndex_065_0_52_FamilyTransport
  • type 7:
    • ModelIndex_026_0_25_SupaFighter
    • ModelIndex_032_0_31_SlaveTwo
    • ModelIndex_059_0_46_MilleniumFalcon2

For the tie fighters (TieFighter, TieInterceptor, TieBomber, TieAdvanced, TieDefender, TieBizarro, TieBigGun, TieWarheads, TieBomb, TieBooster), laser sounds are replaced with "EmpireLaserChChChhh.wav".

For the Corellian transports (CorellianTransport2, FamilyTransport, MilleniumFalcon2), "LaserRebel" is replaced with "FalconLaser.wav" and "LaserRebelTurbo" is replaced with "FalconLaserTurbo.wav".

See EmptySound.txt and Examples\*Sound.txt.

xwa_hook_exterior

This hook displays the HUD in exterior view.

Suppose that the craft is "FlightModels\[Model].opt".

To set the MFD lod distance, create a file named "FlightModels\[Model]Exterior.txt" or create a section named "[Exterior]" in "FlightModels\[Model].ini". The format is: LodDistance = value

If the file does not exist, default values are used.

See https://xwaupgrade.com/phpBB3/viewtopic.php?f=9&t=12471

xwa_hook_hangars

This hook permits to customize the hangars. The XWA's engine uses two hangar models, Hangar.opt and FamilyBase.opt. If you wanted to use a custom hangar, you had to replace one of them. You can now choose which hangar to use, customize the objects and the camera positions, for a specific craft or for a specific mission. You can also define which crafts appear in the craft selection menu.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11197

hook_hangars.cfg

hook_hangars.cfg is a config file.

The SelectionMode option determines how a hangar is selected. The possible values are:

  • ForceHangar
  • BasedOnModelIndex
  • BasedOnModelIndexAzzameenCampaign

The default value is BasedOnModelIndexAzzameenCampaign

When SelectionMode = ForceHangar:

hangar = Hangar

When SelectionMode = BasedOnModelIndex:

if mission type is family
 hangar = FamilyBase
else
 hangar = Hangar
endif

When SelectionMode = BasedOnModelIndexAzzameenCampaign:

if mission type is family and mission id < 7
 hangar = FamilyBase
else
 hangar = Hangar
endif

The ProvingGroundHangarModel option set the proving ground hangar opt model. The default value is "" or "FlightModels\".

Example:

ProvingGroundHangarModel = FlightModels\ProvingGround.opt

This will load "FlightModels\ProvingGroundHangar.opt" and "FlightModels\ProvingGround.ini" (or txt files). "FlightModels\ProvingGround.opt" may not exist.

hangar files

Suppose that the mission is "[MissionDir]\[Mission].tie". Suppose that the arrival craft is "FlightModels\[Model].opt". Suppose that the player craft is "FlightModels\[Player].opt".

The possible involved files are:

  • "[MissionDir]\[Mission].ini"
  • "[MissionDir]\[Mission]_Hangar.opt"
  • "[MissionDir]\[Mission]_HangarObjects.txt"
  • "[MissionDir]\[Mission]_HangarCamera.txt"
  • "[MissionDir]\[Mission]_FamHangarCamera.txt"
  • "[MissionDir]\[Mission]_HangarMap.txt"
  • "[MissionDir]\[Mission]_FamHangarMap.txt"
  • "FlightModels\[Model].ini"
  • "FlightModels\[Model]Hangar.opt"
  • "FlightModels\[Model]HangarObjects.txt"
  • "FlightModels\[Model]HangarCamera.txt"
  • "FlightModels\[Model]FamHangarCamera.txt"
  • "FlightModels\[Model]HangarMap.txt"
  • "FlightModels\[Model]FamHangarMap.txt"
  • "FlightModels\default.ini"
  • "FlightModels\Hangar.opt"
  • "FlightModels\HangarObjects.txt"
  • "FlightModels\HangarCamera.txt"
  • "FlightModels\FamHangarCamera.txt"
  • "FlightModels\HangarMap.txt"
  • "FlightModels\FamHangarMap.txt"
  • "FlightModels\[Player].ini"
  • "FlightModels\[Player]Camera.txt"
  • "FlightModels\[Player]Size.txt"


To use a custom hangar, name it "FlightModels\[Model]Hangar.opt" or "[MissionDir]\[Mission]_Hangar.opt". The dll searches a "Hangar.opt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_Hangar.opt"
  • "FlightModels\[Model]Hangar.opt"
  • "FlightModels\Hangar.opt"

To replace the objects, create a file named "FlightModels\[Model]HangarObjects.txt" or "[MissionDir]\[Mission]_HangarObjects.txt". Or create a section named "[HangarObjects]" in "FlightModels\[Model].ini" or "[MissionDir]\[Mission].ini". The dll searches a "HangarObjects.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_HangarObjects.txt"
  • "[MissionDir]\[Mission].ini", section "[HangarObjects]"
  • "FlightModels\[Model]HangarObjects.txt"
  • "FlightModels\[Model].ini", section "[HangarObjects]"
  • "FlightModels\HangarObjects.txt"
  • "FlightModels\default.ini", section "[HangarObjects]"

If a "HangarObjects.txt" file doesn't exist, no model is replaced. The format is a line per object:

"FlightModels\ObjectA = FlightModels\NewObjA"

The replacement of a base opt with an exterior opt is ignored: lines like "FlightModels\ObjectA.opt = FlightModels\ObjectAExterior.opt" are ignored. To remove an object, use an empty invisible opt. To not load the shuttle, set "LoadShuttle = 0". To set the shuttle model index, set "ShuttleModelIndex = value". value is an integer. The default value is 50 (Shuttle). To set the shuttle markings, set "ShuttleMarkings = value". value is an integer. The default value is 0. To set the shuttle animation, set "ShuttleAnimation = value". value is "Right", "Top", or "Bottom". The default value is "Right". To set the shuttle straight line animation length, set "ShuttleAnimationStraightLine = value". value is an integer. The default value is 0. To not load the droids, set "LoadDroids = 0". To set the Hangar Roof Crane position, set "HangarRoofCranePositionY = value Y" and "HangarRoofCranePositionZ = value Z". The values are integers. The default value for HangarRoofCranePositionY is 786. The default value for HangarRoofCranePositionZ is -282. To invert the hangar floor, set "IsHangarFloorInverted = 1" in "HangarObjects". When set to 0, the floor is below the player craft. When set to 1, the floor is above the player craft.

See "HangarObjects.txt".

Apply to hangar:

To set the position of the camera, create a file named "FlightModels\[Model]HangarCamera.txt" or "[MissionDir]\[Mission]_HangarCamera.txt". Or create a section named "[HangarCamera]" in "FlightModels\[Model].ini" or "[MissionDir]\[Mission].ini". The dll searches a "HangarCamera.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_HangarCamera.txt"
  • "[MissionDir]\[Mission].ini", section "[HangarCamera]"
  • "FlightModels\[Model]HangarCamera.txt"
  • "FlightModels\[Model].ini", section "[HangarCamera]"
  • "FlightModels\HangarCamera.txt"
  • "FlightModels\default.ini", section "[HangarCamera]"

If a "HangarCamera.txt" file doesn't exist, default values are used. Only the position for keys 1,2,3,6,9 can be set with a "HangarCamera.txt" file. The format is:

"Key1_X = value"
"Key1_Y = value"
"Key1_Z = value"

See "HangarCamera.txt".

Apply to family base:

To set the position of the camera, create a file named "FlightModels\[Model]FamHangarCamera.txt" or "[MissionDir]\[Mission]_FamHangarCamera.txt". Or create a section named "[FamHangarCamera]" in "FlightModels\[Model].ini" or "[MissionDir]\[Mission].ini". The dll searches a "FamHangarCamera.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_FamHangarCamera.txt"
  • "[MissionDir]\[Mission].ini", section "[FamHangarCamera]"
  • "FlightModels\[Model]FamHangarCamera.txt"
  • "FlightModels\[Model].ini", section "[FamHangarCamera]"
  • "FlightModels\FamHangarCamera.txt"
  • "FlightModels\default.ini", section "[FamHangarCamera]"

If a "FamHangarCamera.txt" file doesn't exist, default values are used. Only the position for keys 1,2,3,6,7,8,9 can be set with a "FamHangarCamera.txt" file. The format is:

"FamKey1_X = value"
"FamKey1_Y = value"
"FamKey1_Z = value"

See "FamHangarCamera.txt".

To set the position of the camera for key 7 (hangar) or key 5 (family base), create a file named "FlightModels\[Player]Camera.txt". Or create a section named "[Camera]" in "FlightModels\[Player].ini". If a such file file doesn't exist for a model, default values are used. The format is:

"X = value"
"Y = value"
"Z = value"
"FamX = value"
"FamY = value"
"FamZ = value"

See "PlayerCamera.txt".

Apply to hangar:

To set the hangar map, create a file named "FlightModels\[Model]HangarMap.txt" or "[MissionDir]\[Mission]_HangarMap.txt". Or create a section named "[HangarMap]" in "FlightModels\[Model].ini" or "[MissionDir]\[Mission].ini". The dll searches a "HangarMap.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_HangarMap.txt"
  • "[MissionDir]\[Mission].ini", section "[HangarMap]"
  • "FlightModels\[Model]HangarMap.txt"
  • "FlightModels\[Model].ini", section "[HangarMap]"
  • "FlightModels\HangarMap.txt"
  • "FlightModels\default.ini", section "[HangarMap]"

If a "HangarMap.txt" file doesn't exist, default values are used.

The file must contain at least 4 object line. The format is:

model index, position X, position Y, position Z, heading XY, heading Z.

or:

model index, markings, position X, position Y, position Z, heading XY, heading Z.

The numbers can be written in decimal or hexadecimal (0x) notation. When position Z is set to 0x7FFFFFFF, this means that the object stands at the ground.

See "HangarMap.txt".

Apply to family base:

To set the family hangar map, create a file named "FlightModels\[Model]FamHangarMap.txt" or "[MissionDir]\[Mission]_FamHangarMap.txt". Or create a section named "[FamHangarMap]" in "FlightModels\[Model].ini" or "[MissionDir]\[Mission].ini". The dll searches a "FamHangarMap.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_FamHangarMap.txt"
  • "[MissionDir]\[Mission].ini", section "[FamHangarMap]"
  • "FlightModels\[Model]FamHangarMap.txt"
  • "FlightModels\[Model].ini", section "[FamHangarMap]"
  • "FlightModels\FamHangarMap.txt"
  • "FlightModels\default.ini", section "[FamHangarMap]"

If a "FamHangarMap.txt" file doesn't exist, default values are used.

The file must contain at least 4 object line. The format is:

model index, position X, position Y, position Z, heading XY, heading Z.

or:

model index, markings, position X, position Y, position Z, heading XY, heading Z.

The numbers can be written in decimal or hexadecimal (0x) notation. When position Z is set to 0x7FFFFFFF, this means that the object stands at the ground.

See "FamHangarMap.txt".

To set the elevation of the craft with closed S-Foils, create a file named "FlightModels\[Player]Size.txt". Or create a section named "[Size]" in "FlightModels\[Player].ini". If a such file file doesn't exist for a model, default values are used: if the craft is BWing, elevation = 50, else elevation = model height / 2. If the hangar floor is inverted, the ClosedSFoilsElevationInverted setting is used, else the ClosedSFoilsElevation setting is used. When the ClosedSFoilsElevationInverted setting is not defined, the ClosedSFoilsElevation setting is used. The format is:

"ClosedSFoilsElevation = value"
"ClosedSFoilsElevationInverted = value"

See "BWingSize.txt".

craft selection

To define the list of crafts that appear in the hangar crafts selection menu, create the following files (next to XWingAlliance.exe):

  • "CraftSelectionTransports.txt"
  • "CraftSelectionFighters.txt"
  • "CraftSelectionCrafts.txt"

If the files don't exist, default values are used. CraftSelectionTransports define the crafts that appear when the mission player craft is a transport. CraftSelectionFighters define the crafts that appear when the mission player craft is a fighter. CraftSelectionCrafts define the crafts that appear in the Proving Ground.

See "CraftSelectionTransports.txt", "CraftSelectionFighters.txt", "CraftSelectionCrafts.txt"

Hangar views

For Hangar: Key 0 is the cockpit view. Keys 1,2,3,6,9 are fixed views. Keys 4 and 5 are related to the hangar droids. Key 7 is related to the player model. Key 8 is related to the hangar roof crane.

For FamilyBase: Key 0 is the cockpit view. Keys 1,2,3,6,7,8,9 are fixed views. Key 4 is related to the work droid 1. Key 5 is related to the player model.

xwa_hook_hull_icon

This hook enables setting hull icon for any craft.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11761

To set the hull icon for a craft, open "HullIconList.txt" and change the corresponding line to the desired value. If the file does not exist, default values are used.

See HullIconList.txt.

xwa_hook_interdictor

This hook permits to enable interdictor feature for any craft.

Suppose that the craft is "FlightModels\[Model].opt".

To enable the interdictor feature, create a file named "FlightModels\[Model]Interdictor.txt" or create a section named "[Interdictor]" in "FlightModels\[Model].ini". The format is:

IsInterdictor = 1

or

IsInterdictor = 0

If the file does not exist, default values are used. By default, the ModelIndex 137 Interdictor2 and ModelIndex 141 ModStrikeCruiser are interdictor.

See Interdictor2Interdictor.txt and ModStrikeCruiserInterdictor.txt.

xwa_hook_joystick_ff

This hook permits to select the joystick device with force feedback.

To select a joystick with force feedback, set JoystickDeviceIndex in "hook_joystick_ff.cfg".

The format is:

JoystickDeviceIndex = device index

The default value is 0, which select the first device. When the value is -1, the last device will be selected.

xwa_hook_lightmaps

This hook replaces a static buffer by a dynamic one in lightmaps loading.

xwa_hook_mission_objects

This hook permits to replace mission objects and to enable crafts turrets.

mission objects

Suppose that the mission is "[MissionDir]\[Mission].tie".

The possible involved files are:

  • "[MissionDir]\[Mission].ini"
  • "[MissionDir]\[Mission]_Objects.txt"
  • "FlightModels\Objects.txt"

To replace the objects, create a file named "[MissionDir]\[Mission]_Objects.txt" or create a section named "[Objects]" in "[MissionDir]\[Mission].ini". The dll searches a "Objects.txt" file in this order (from first to last):

  • "[MissionDir]\[Mission]_Objects.txt"
  • "[MissionDir]\[Mission].ini", section "[Objects]"
  • "FlightModels\Objects.txt"

If a "Objects.txt" file doesn't exist, no model is replaced. The format is a line per object: "FlightModels\ObjectA = FlightModels\NewObjA"

See "Objects.txt".

crafts turrets

The craft turrets are no longer limited to CorellianTransport2, MilleniumFalcon2, and FamilyTransport. You can now enable turrets for any craft.

Suppose that the player craft is "FlightModels\[Player].opt".

The possible involved files are:

  • "FlightModels\[Player]Turrets.txt"
  • "FlightModels\[Player].ini", section "[Turrets]"
  • "FlightModels\[Player]Gunner.opt"
  • "FlightModels\[Player]Gunner2.opt"
  • "FlightModels\CorellianTransportGunner.opt"

To define the turrets, create a file named "FlightModels\[Player]Turrets.txt" or create a section named "[Turrets]" in "FlightModels\[Player].ini". If the file does not exist, default values are read from XWingAlliance.exe. The format is a line per turret:

PositionX, PositionY, PositionZ, OrientationX, OrientationY, ArcX, ArcY, OptModel, IsInverted

If a turrets section is not used, there is a limit of 2 turrets per craft. To define a custom gunner opt, create a "[Player]Gunner.opt" file. To define a second custom gunner opt, create a "[Player]Gunner2.opt" file.

To disable the turret forward fire, set "TurretForwardFire = 0". The default value is "1".

By default, the turrets lasers are unlimited. They can be made limited by setting "UnlimitedTurretLaser = 0" in "hook_mission_objects.cfg".

xwa_hook_mission_tie

This hook permits to override the data of mission files.

Suppose that the mission is "[MissionDir]\[Mission].tie".

To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini". The format is a line per replacement.

To replace the flight group markings, the format is: "fg", fg number, "markings", value.

To replace the flight group wingman markings, the format is: "fg", fg number, "index", wingman index, "markings", value.

To replace the flight group iff, the format is: "fg", fg number, "iff", value.

To replace the flight group pilot voice, the format is: "fg", fg number, "pilotvoice", value.

See "mission.txt".

xwa_hook_normals

This hook transmits vertex normals to DDraw via the specular component.

The w part of the specular component is set to 1.0f. The xyz parts contains the normal:

  • 0.0 means -1.0
  • 0.5 means 0.0
  • 1.0 means 1.0

xwa_hook_opt_limit

This hook removes the opt limit of 512 vertices per mesh. It also generates the "spec.rci" file.

The original vertices count limit is 512 per mesh. By default, the dll will use a value of 4096. You can modify this value in hook_opt_limit.cfg (Size = value).

The size of the execute buffer is increased from 0x10000 to 0x200000.

To regenerate the "spec.rci" file, delete it. The file will be generated when you launch the game.

xwa_hook_pilot

This hook enables pilot meshes animation for any craft.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11695

Suppose that the craft is "FlightModels\[Model].opt". To define wich meshes are animated, create a file named "FlightModels\[Model]Pilot.txt" or create a section named "[Pilot]" in "FlightModels\[Model].ini". If the file does not exist, default values are used:

  • X-Wing (meshes 6 and 9)
  • Y-Wing (meshes 8 et 13)
  • A-Wing (meshes 4)
  • Corellian Transport 2 (meshes 19 et 17)
  • Millenium Falcon 2 (meshes 21 and 19)
  • Family Transport (meshes 13 and 9)

The format is a line per mesh:

mesh index, angle, speed, behavior

Speed must be a multiple of 2.

Behavior can be 0, 1, or 2:

  • 0 means constant rotation
  • 1 means rotation with random
  • 2 means rotation with random and pause

To define wich meshes are animated when the cockpit is displayed, create a file named "FlightModels\[Model]PilotCockpit.txt" or create a section named "[PilotCockpit]" in "FlightModels\[Model].ini". When the "[PilotCockpit]" is empty, the values of the "[Pilot]" section are used. The format is the same as the "[Pilot]" section.

See *Pilot.txt.

xwa_hook_res1200

This hook replaces a static buffer with a dynamic one in initializing 2d buffer. It fixes a crash when resolution height > 1200 is used.

It also fixes a crash at offset 0x000d332d.

xwa_hook_resolution

This hook displays the screen resolution in the video options screen.

To enable the auto resolution setting, set the IsAutoResolutionEnabled setting. To define the resolution, set the ResolutionWidth and ResolutionHeight settings.

See hook_resolution.cfg

xwa_hook_reticle

This hook permits to select the reticle image index for any craft.

Suppose that the craft is "FlightModels\[Model].opt".

To select the reticle image index, create a file named "FlightModels\[Model]Reticle.txt" or create a section named "[Reticle]" in "FlightModels\[Model].ini". If the file does not exist, default values are used.

The format is: Reticle_XX = image index

XX is in { 5, 6, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22 }.

The reticle images are in "HUD.dat", group ID 12000. The images are referenced by their position in the group, starting at 1.

xwa_hook_sfoils

This hook enables S-Foils for any craft.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=9&t=11693

Suppose that the craft is "FlightModels\[Model].opt".

To create s-foils, create a file named "FlightModels\[Model]SFoils.txt" or create a section named "[SFoils]" in "FlightModels\[Model].ini". If the file does not exist, default values are used (S-Foils for XWing, BWing, and Shuttle).

The format is a line per mesh:

mesh index, angle, closing speed, opening speed.

To enable or disable the S-Foils closing/opening in before/after hyperspace, create a setting named "CloseSFoilsInHyperspace". To enable, set "1". To disable, set "0". The default value is "0". To slow down the animation, create a setting named "SFoilsAnimationSpeed". For instance, if you set "2", the animation will be slowed down by a factor of 2. The default value is "1" (normal speed).

See XWingSFoils.txt, BWingSFoils.txt, ShuttleSFoils.txt.

To create landing gears, create a file named "FlightModels\[Model]SFoilsLandingGears.txt" or create a section named "[SFoilsLandingGears]" in "FlightModels\[Model].ini". The format is a line per mesh:

mesh index, angle, closing speed, opening speed.

Landing gears are deployed when a craft in is the hangar. When the s-foils are closed in space, the landing gears are not deployed.

To open or close s-foils, use the V key. To deploy or retract landing gears, use the Ctrl+L key.

Suppose that the mission is "[MissionDir]\[Mission].tie".

To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini". The format is a line per replacement.

To replace the flight group s-foils state, the format is: "fg", fg number, "close_SFoils", 1. To replace the flight group landing gears state, the format is: "fg", fg number, "open_LandingGears", 1.

xwa_hook_shield

This hook permits to define shield recharge rates for any craft.

See https://www.xwaupgrade.com/phpBB3/viewtopic.php?f=33&t=12125

Suppose that the mission is "[MissionDir]\[Mission].tie". Suppose that the craft is "FlightModels\[Model].opt".

The possible involved files are:

  • "[MissionDir]\[Mission]_Shield.txt"
  • "[MissionDir]\[Mission].ini", section "[Shield]"
  • "FlightModels\[Model]Shield.txt"
  • "FlightModels\[Model].ini", section "[Shield]"

To define the recharge rate for a craft, create a file named "FlightModels\[Model]Shield.txt" or create a section named "[Shield]" in "FlightModels\[Model].ini". The format is:

UseGenerator = 0 to use RechargeRate or 1 to use PerGeneratorRechargeRate
PerGeneratorRechargeRate = per generator recharge value
RechargeRate =  recharge value

If the file does not exist, default values are used.

By default, the recharge rate is controlled as this: For starfighters the recharge rate is 20. For Interdictor, Victory Star Destroyer, Imperial Star Destroyer, and Super Star Destroyer, the recharge rate is 5 multiplied by the number of shield generators still alive. For other starships, the recharge rate is 5. For other crafts, the recharge rate is 0.

For player craft, if the rate is 0 then it is set to 20.

To define the recharge rate for a craft for a given mission, create a file named "[MissionDir]\[Mission]_Shield.txt" or create a section named "[Shield]" in "[MissionDir]\[Mission].ini". The format is a line per craft:

ModelIndex, UseGenerator, PerGeneratorRechargeRate, RechargeRate

xwa_hook_slam

This hook enables the SLAM system when the K key pressed.

See http://www.xwaupgrade.com/phpBB3/viewtopic.php?f=9&t=12050

Suppose that the craft is "FlightModels\[Model].opt".

To enable the SLAM feature, create a file named "FlightModels\[Model]Slam.txt" or create a section named "[Slam]" in "FlightModels\[Model].ini". The format is:

HasSlam = 1

or

HasSlam = 0

If the file does not exist, default values are used. By default, the Missile Boat has a SLAM system.

See MissileBoatSlam.txt.

xwa_hook_textures_tag

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
    • "opt,optFileName,textureName,color-transparent,mipmapLevel" for transparent color maps
    • "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.

xwa_hook_time

This hook reduces the CPU usage of the game. A side effect is that the framerate is a bit reduced.

See http://www.xwaupgrade.com/phpBB3008/viewtopic.php?f=10&t=11338

xwa_hook_weapon_color

This hook permits to define weapon color for any craft.

Suppose that the craft is "FlightModels\[Model].opt".

To enable weapon switch based on IFF, set "WeaponSwitchBasedOnIff = 1" in "hook_weapon_color.cfg". To disable it, set "WeaponSwitchBasedOnIff = 0". The default value is "0". You can override this value with a setting named "WeaponSwitchBasedOnIff" in the file named "FlightModels\[Model]WeaponColor.txt" or the section named "[WeaponColor]" in "FlightModels\[Model].ini". Set "0" to disable or "1" to enable the feature or "-1" to use the global setting. The default value is "-1".

To define the color, create a file named "FlightModels\[Model]WeaponColor.txt" or create a section named "[WeaponColor]" in "FlightModels\[Model].ini". The format is:

WeaponColor = color marking value
WeaponColor_fgFG_ = color marking value
WeaponColorXXX = color marking value
WeaponColor_fgFG_XXX = color marking value
WeaponImpactColor_3100 = ARGB color
WeaponImpactColor_3200 = ARGB color
WeaponImpactColor_3300 = ARGB color
WeaponImpactColor_3400 = ARGB color
WeaponImpactColor_3500 = ARGB color
WeaponImpactColor_3100_fgFG_ = ARGB color
WeaponImpactColor_3200_fgFG_ = ARGB color
WeaponImpactColor_3300_fgFG_ = ARGB color
WeaponImpactColor_3400_fgFG_ = ARGB color
WeaponImpactColor_3500_fgFG_ = ARGB color
WeaponImpactColorXXX = ARGB color
WeaponImpactColor_fgFG_XXX = ARGB color
EnergyBarColorLaserHigh = ARGB color
EnergyBarColorLaserLow = ARGB color
EnergyBarColorIonHigh = ARGB color
EnergyBarColorIonLow = ARGB color
EnergyBarColorLaserHigh_fgFG_ = ARGB color
EnergyBarColorLaserLow_fgFG_ = ARGB color
EnergyBarColorIonHigh_fgFG_ = ARGB color
EnergyBarColorIonLow_fgFG_ = ARGB color
WeaponLightColorXXX = RGB color
WeaponLightColor_fgFG_XXX = RGB color

The format of the color is ARGB: FF000000 is black, FFFF0000 is red, FF00FF00 is green, FF0000FF is blue.

WeaponColor defines the default value used for all weapons. XXX in WeaponColorXXX goes from 280 to 307. When present, this overrides the default value. You can define a different value for all weapons. The default value is 0.

The default impact colors are:

WeaponImpactColor_3100 = FF0000FF
WeaponImpactColor_3200 = FFFF0000
WeaponImpactColor_3300 = FF00FF00
WeaponImpactColor_3400 = FFFF00FF
WeaponImpactColor_3500 = FFFFFF00

XXX in WeaponImpactColorXXX goes from 280 to 307. When present, this overrides the default impact color. If it is set to 0, the default value will be used. You can define a different impact color for all weapons.

EnergyBarColorLaserHigh and EnergyBarColorLaserLow define the color of the laser energy bar. EnergyBarColorIonHigh and EnergyBarColorIonLow define the color of the ion energy bar.

FG in _fgFG_ defines the flight group markings.

You also need to add a flightgroup color/markings to the weapon OPTs.

See http://www.xwaupgrade.com/phpBB3/viewtopic.php?p=156215#p156215

xwa_hook_weapon_rate

This hook permits to define weapon decharge and recharge rates for any craft.

Suppose that the craft is "FlightModels\[Model].opt".

To define the decharge and recharge rates, create a file named "FlightModels\[Model]WeaponRate.txt" or create a section named "[WeaponRate]" in "FlightModels\[Model].ini". The format is:

DechargeRate = decharge value
RechargeRate = recharge value

If the file does not exist, default values are used.

By default, the decharge rate is controlled as this:

if the ship category is Starfighter,
  if the craft is TieFighter or TieBomber, the decharge rate is 3,
  else the decharge rate is 4.
else
  if the weapon sequence is < 4, the decharge rate is 3,
  else there is no decharge.

By default, the recharge rate is controlled as this:

if the craft is TieFighter or TieBomber, the recharge rate is 3 * PresetLaser,
else the recharge rate is 2 * PresetLaser.

See TieFighterWeaponRate.txt and TieBomberWeaponRate.txt.

xwa_hook_windowed

This hook enables windowed mode.

To set the window position and size, modify "hook_windowed.cfg":

X = left value
Y = top value
Width = width value
Height = height value

The minimum value for "Width" is 640. The minimum value for "Height" is 480.

When "Width" or "Height" is 0, default values are used: the window will be fullscreen.

xwa_hook_wingmen_voices

This hook enables setting wingmen voices for imperial IFF.

To choose an imperial wingman voice, set pilot voice to the desired value or set IFF to 1 (imperial).

For values IP1 to IP12, ISP1.LST to ISP12.LST will be loaded.

If IFF is set to 1 (imperial), random imperial voices will be loaded. Else random rebel voices will be loaded.