Hack Swat 3's Executable To Give High Res

More
3 years 11 months ago - 2 days 18 hours ago #2 by Slippery Jim
Hack Swat 3's Executable To Give High Res was created by Slippery Jim
The following thread is for mod makers only. It contains notes on how to modify Swat 3 files. This thread combines all our knowledge of how to hack Swat 3 to get a higher resolution in the 2D menus. Most of the credit goes to AlienAbducter and his magnificent hex editor/debugger.

All of Swat 3's menus run in 800x600. This resolution is hard coded right into the game's executable. Although you can get the game's 3D portion of the game to run in a higher resolution, all the 2D menus such as the weapon selection screen and chat lobby are stuck on 800x600. To force it to run custom menus we have to use a hacked version of the executable.

To hack the executable you need a version that has it's copy protection removed.


To hack Swat 3 so 2D menus are in 1024x768:
- First get yourself a Hex editor, and a version 2.1 "No-CD" crack of Swat 3.

- Open the Swat executable with the hex editor, search for the first occurrence of:
0x20 0x03 0x00 0x00 0xb9 0x58 0x02 0x00 0x00

(You will find it at decimal offset 13457)

- replace it with:
0x00 0x04 0x00 0x00 0xb9 0x00 0x03 0x00 0x00


For those who don't want to search the specific offsets to change the NOCD cracks are:
13457 (or in hex 0x00003491) - change it to 00
13458 (or in hex 0x00003492) - change it to 04
13462 (or in hex 0x00003496) - change it to 00
13463 (or in hex 0x00003497) - change it to 03


Here are the hex values you need for 1440x900:

0xA0 0x05 0x00 0x00 gives you 1440
0x84 0x03 0x00 0x00 gives you 900






There is an additional 800x600 reference that was being used after the game went to debrief:


Decimal offset 01191630 (or 0x00122ECE in hex)

0x58 0x02 0x00 0x00 0x68 0x20 0x03 0x00 0x00


changed to (for 1024 x 768):
0x00 0x03 0x00 0x00 0x68 0x00 0x04 0x00 0x00


or

changed to (for 1440 x 900):
0x84 0x03 0x00 0x00 0x68 0xA0 0x05 0x00 0x00






Swat 3 only allows texture sizes of 256x256 by default. The game can be hacked to take advantage of modern video cards that contain a lot of memory. We can hack the game to force it to allow texture resolutions of 1024x1024.


To force the game to allow 1024x1024 textures replace the following hex strings:

81 FF 00 01 00 00 7F 08 81 FB 00 01 00 00 (offset 1466240)
with
81 FF 00 04 00 00 7F 08 81 FB 00 04 00 00

and

81 FE 00 01 00 00 77 08 81 FB 00 01 00 00 (offset 1466998)
with
81 FE 00 04 00 00 77 08 81 FB 00 04 00 00


(Note: to get only 512x512 textures use 00 02







Additions Notes:

- There are several additional references to 0x20 0x03 0x00 0x00 fairly close to other 0x58 0x02 0x00 0x00 references. Not sure if these are resolution related because there are more data between them than usual. I have not experimented to see what they do.

You can find the small cluster of these references starting at decimal offset 02792636 if someone knows what they are for.


- It appears that you can't use the hacked .exe file when working in Worldcraft. You will have to use the virgin crack while making and testing maps and then switch back to the hacked version to play the game normally.






Swat Movies (updated May 26, 2019):

I have now also successfully converted and enlarged Swat 3's movies to use the XVID codec and MPEG 4 codec.

The videos were enlarged to 800x600 instead of the default 640x480 (and can be run at 24 fps instead of 15fps but the fps change didn't improve quality of course). Even with the enlargement the movie files are still a lot smaller in terms of total file size. The XVID codec is very efficient. The MPEG4 code is less efficient than XVID in terms of filesizes.

To get the movies to display properly I had to hack a location in the Swat 3 executable. This handles the 5 movies that play full screen. All other movies in Swat 3 are smaller and play within a window with other graphics around them.

The 640x480 movies:

swat_intro.avi
sierra.avi
explosion.avi
career_won.avi
career_lost.avi

To find the location to hack in the Swat 3 executable do a search for the resolutions 640 and 480. 640 translates as 0x8002 and 480 translates as 0xE001

To replicate the enlarged movie experiment you will want to replace them with 800 (0x2003) and 600 (0x5802)

* Decimal offset 18929 and 18934
The topic has been locked.
More
3 years 11 months ago #3 by Slippery Jim
Replied by Slippery Jim on topic Hack Swat 3's Executable To Give High Res
Found the reference to the size of the bitmaps (map loading screens)

Decimal offset 301365 (or 0x00049935 in hex)

0x58 0x02 0x00 0x00


Decimal offset 301372 (or 0x0004993C in hex)

0x20 0x03 0x00 0x00
The topic has been locked.
More
3 years 11 months ago - 9 months 1 day ago #4 by Slippery Jim
Replied by Slippery Jim on topic Hack Swat 3's Executable To Give High Res
There are additional 640x480 calls that I am not sure what they are for. What these additional calls could be are for the creation of the DirectDraw windows. If the window creation succeeds then it is resized and fully drawn.

640x480 (0x8002 0xE001):

* Decimal offset 13489 and 13494
* Decimal offset 31847 and 31852
* Decimal offset 34890 and 34895
* Decimal offset 34970 and 34975
* Decimal offset 35050 and 35055
* Decimal offset 35130 and 35135
* Decimal offset 35203 and 35208
* Decimal offset 260837 and 260842
* Decimal offset 264925 and 264932 (this has two bytes in between the height and width compared to all other calls that normally just have 1 byte separating them)

There are also a few others that may additional calls related to the movies. All of the other calls to the movies reversed the resolution in the executable (480 x 640).

480x640 (0xE001 0x8002):

* Decimal offset 18929 and 18934 (movies!)

* Decimal offset 31909 and 31915 (this has two bytes in between the height and width compared to all other calls that normally just have 1 byte separating them) (note: is this movie related also?)


Here are the decimal offsets to change:
The topic has been locked.
More
3 years 8 months ago - 3 years 8 months ago #69 by Slippery Jim
Replied by Slippery Jim on topic Hack Swat 3's Executable To Give High Res
There is still problems with the resolution hacks. Rather than being centered some of the menus are located at the top left.

* When you select "Mission (Standard)" games aren't being centered
* When you select "Career (New)" the officer selection screen isn't being centered

I assume I need to locate and change more 800x600 or 640x480 calls.

UPDATE: I searched and tested for both 800x600 and 640x480 calls and they had no affect on the remaining screens. Perhaps on some screen calls there is a flag that is used to center the screen?
The topic has been locked.
More
2 days 18 hours ago - 2 days 18 hours ago #1269 by Slippery Jim
Replied by Slippery Jim on topic Hack Swat 3's Executable To Give High Res
Copy-Cat discovered the draw distance setting in Swat 3!

If you use the Steam/GOG unprotected game executable look at decimal offset 25846 for the 32-bit float number 0000AF44 (decimal 1400).

To double the view distance in game change it to 00002F45 (decimal 2800).

Note: Swat 3 appears to use inches in some settings. This would translate as original view distance of 116 feet. Double that view distance with the new hack would give 233 feet.
The topic has been locked.
Time to create page: 0.164 seconds
Powered by Kunena Forum