MW2 shell screens
Moderator: Skyfaller
- Skyfaller
- Clan 1st MechWarrior
- Posts: 1017
- Joined: Sat Apr 12, 2008 2:58 am
- Location: Germany
- Contact:
MW2 shell screens
This is as far as I've come with decoding the MW2 shell screens. Any help with decoding the code bytes is welcome.
The shell screens are stored in database.mw2 as PCX files with
an additional compression/obfuscation layer. The layer has three
types of bytes - control bytes, code bytes and data bytes. Control
bytes consist of two opcodes, each of which is stored in a nibble.
The following opcodes have been identified:
0h: Decode 8 bytes (totally read: 8)
1h: Copy one, decode six (totally read: 7)
2h: Decode two, copy one, decode 4 (totally read: 7)
3h: Copy two, decode four (totally read: 6)
4h: Decode four bytes, copy one, decode two
5h: Copy one, decode two, copy one, decode two (totally read: 6)
6h: Decode two, copy two, decode two (totally read: 6)
7h: Copy three bytes, decode two (totally read: 5)
8h: Decode six, copy one (totally read: 7)
9h: Copy one, decode four, copy one (totally read: 6)
Ah: Decode two, copy one, decode two, copy one (totally read: 6)
Bh: Copy two bytes, decode two, copy one (totally read: 5)
Ch: Decode four bytes, copy two (totally read: 6)
Dh: Copy one byte, decode two, then copy two (totally read: 5)
Eh: Decode two bytes, then copy three (totally read: 5)
Fh: Copy four bytes (totally read: 4)
Decoding takes a pair of code bytes to produce output.
There are two theses about decoding code bytes in the EFA:
1. The code bytes refer to data in input or output by absolute or
relative offset
2. There is a separate dictionary somewhere. It is not known where
that dictionary might preside, nor how it is encoded, but it could be
part of the executable.
Data bytes are simply copied to output. To decode an EFA, start by
analyzing the control byte at offset 4 (always EFh). Fully decoding
an EFA produces a PCX file. The PCX signature from offsets 3 to 12h
can be used as a signature:
00 EF 0A 05 01 08 FC 1F 7F 02 DF FF 01 48 00 48
For lack of another naming source, I derived the file type name EFA
from the signature.
Replacing EFA files in 31st's Database.MW2 with EFA from other
versions demonstrates that all EFA's can be displayed with MW2:31stCC's
algorithm. This proves that all EFA's use an identical compression
algorithm and control bytes. However, replacing an EFA with a PCX does
not work, so MW2 relies on "knowing" the file types, even if it is wrong.
The shell screens are stored in database.mw2 as PCX files with
an additional compression/obfuscation layer. The layer has three
types of bytes - control bytes, code bytes and data bytes. Control
bytes consist of two opcodes, each of which is stored in a nibble.
The following opcodes have been identified:
0h: Decode 8 bytes (totally read: 8)
1h: Copy one, decode six (totally read: 7)
2h: Decode two, copy one, decode 4 (totally read: 7)
3h: Copy two, decode four (totally read: 6)
4h: Decode four bytes, copy one, decode two
5h: Copy one, decode two, copy one, decode two (totally read: 6)
6h: Decode two, copy two, decode two (totally read: 6)
7h: Copy three bytes, decode two (totally read: 5)
8h: Decode six, copy one (totally read: 7)
9h: Copy one, decode four, copy one (totally read: 6)
Ah: Decode two, copy one, decode two, copy one (totally read: 6)
Bh: Copy two bytes, decode two, copy one (totally read: 5)
Ch: Decode four bytes, copy two (totally read: 6)
Dh: Copy one byte, decode two, then copy two (totally read: 5)
Eh: Decode two bytes, then copy three (totally read: 5)
Fh: Copy four bytes (totally read: 4)
Decoding takes a pair of code bytes to produce output.
There are two theses about decoding code bytes in the EFA:
1. The code bytes refer to data in input or output by absolute or
relative offset
2. There is a separate dictionary somewhere. It is not known where
that dictionary might preside, nor how it is encoded, but it could be
part of the executable.
Data bytes are simply copied to output. To decode an EFA, start by
analyzing the control byte at offset 4 (always EFh). Fully decoding
an EFA produces a PCX file. The PCX signature from offsets 3 to 12h
can be used as a signature:
00 EF 0A 05 01 08 FC 1F 7F 02 DF FF 01 48 00 48
For lack of another naming source, I derived the file type name EFA
from the signature.
Replacing EFA files in 31st's Database.MW2 with EFA from other
versions demonstrates that all EFA's can be displayed with MW2:31stCC's
algorithm. This proves that all EFA's use an identical compression
algorithm and control bytes. However, replacing an EFA with a PCX does
not work, so MW2 relies on "knowing" the file types, even if it is wrong.
- Skyfaller
- Clan 1st MechWarrior
- Posts: 1017
- Joined: Sat Apr 12, 2008 2:58 am
- Location: Germany
- Contact:
Re: MW2 shell screens
I'm getting close to finishing this. The control words consist of 12 bit (relative) distance and a 4 bit length information. The distance is relative to the current or last 4096 byte boundary in the compressed file. The four byte length information states how many bytes to copy.
This type of compression is called Lempel-Ziv. Some rare errors remain, just enough to mess up some of the images. I hope I'll have it sorted out soon, so I can post the shell screenshots we all know and love.
It might have been possible to take screenshots of MW2 using DosBox, but I don't want to distribute copyrighted material, even if it is unlikely that anybody will sue due to the game's age.
This type of compression is called Lempel-Ziv. Some rare errors remain, just enough to mess up some of the images. I hope I'll have it sorted out soon, so I can post the shell screenshots we all know and love.
It might have been possible to take screenshots of MW2 using DosBox, but I don't want to distribute copyrighted material, even if it is unlikely that anybody will sue due to the game's age.
- Sir MMPD Radick
- Clan Nova Captain
- Posts: 1625
- Joined: Tue Jan 22, 2008 10:07 am
Re: MW2 shell screens
nice job!
As for the screenshots in dosbox.. i do not think that constituites a violation.. it should be under the fair use laws.
As for the screenshots in dosbox.. i do not think that constituites a violation.. it should be under the fair use laws.
James 3:5-10: My Reminder
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.
- Skyfaller
- Clan 1st MechWarrior
- Posts: 1017
- Joined: Sat Apr 12, 2008 2:58 am
- Location: Germany
- Contact:
Re: MW2 shell screens
OK, here are the promised screenshots. The combat variables show settings as you won't see them in DosBox.
Once the screens decode correctly, I can start working on recreating the MW2 shell. The goal could be a stable version of MW2:Mercs, with salvage for the DOS version ...
Once the screens decode correctly, I can start working on recreating the MW2 shell. The goal could be a stable version of MW2:Mercs, with salvage for the DOS version ...
- Attachments
-
- Mercenaries: Mech Hangar
- 13.jpg (42.14 KiB) Viewed 10856 times
-
- Clan Ghost Bear: Clan Hall
- 10.jpg (116.05 KiB) Viewed 10858 times
-
- Clan Jade Falcon Hall
- 17.jpg (52.78 KiB) Viewed 10858 times
-
- Clan Wolf Hall
- 10.jpg (50.14 KiB) Viewed 10857 times
-
- An older version of control configuration? Does not decode correctly yet.
- 3.jpg (61.59 KiB) Viewed 10857 times
-
- Combat Variables with various settings in one image
- 2.jpg (56.45 KiB) Viewed 10858 times
- Sir MMPD Radick
- Clan Nova Captain
- Posts: 1625
- Joined: Tue Jan 22, 2008 10:07 am
Re: MW2 shell screens
nicE!
James 3:5-10: My Reminder
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.
Re: MW2 shell screens
I have 3 words to say about this:
Hot and Spicy!
(and I mean it in a good way)
Hot and Spicy!
(and I mean it in a good way)
Re: MW2 shell screens
What about in-game sprites, like laser hits and explosions?
Or model textures?
Otherwise, this seems to be coming along very nicely.
Or model textures?
Otherwise, this seems to be coming along very nicely.
- Skyfaller
- Clan 1st MechWarrior
- Posts: 1017
- Joined: Sat Apr 12, 2008 2:58 am
- Location: Germany
- Contact:
Re: MW2 shell screens
In-game sprites were decoded years ago: SHP files by Demolishun, the various other in-game 2D graphics formats are simple. Yet there are so many ...
MW3 appears to be simpler: I found only one 2D graphics format in that game's archives ...
I have reassembled the MW2 mechs some time ago. Most of them still need textures. Just download the videos from http://bjoern-ganster.de/MechVM/. I'd be very happy if someone could create nice textures for some of MW2's mechs.
MW3 appears to be simpler: I found only one 2D graphics format in that game's archives ...
I have reassembled the MW2 mechs some time ago. Most of them still need textures. Just download the videos from http://bjoern-ganster.de/MechVM/. I'd be very happy if someone could create nice textures for some of MW2's mechs.
- Skyfaller
- Clan 1st MechWarrior
- Posts: 1017
- Joined: Sat Apr 12, 2008 2:58 am
- Location: Germany
- Contact:
Re: MW2 shell screens
After a bit of code cleanup, everything works nicely. You may download the newest executables and source from mechvm.org and explore DataBase.MW2. The shell screens are listed with an extension of EFA, and can be viewed, exported, or replaced.
- Attachments
-
- Timby.jpg (76.94 KiB) Viewed 10814 times
-
- Mercs-load,save.jpg (58.48 KiB) Viewed 10811 times
-
- mercs-egg.jpg (72.37 KiB) Viewed 10812 times
-
- GBL-orbit.jpg (46.71 KiB) Viewed 10807 times
-
- GBl-egg.jpg (70.92 KiB) Viewed 10809 times
-
- cockpit controls.jpg (45.18 KiB) Viewed 10810 times
Re: MW2 shell screens
Yes, however all the .SHP graphics don't use the right pallette, so the result is usually a completely black or black and brown blob.
Also, what I meant by in-game sprites before were the .XEL graphics, that are the explosions, PPC and other sim-sprites.
Also, what I meant by in-game sprites before were the .XEL graphics, that are the explosions, PPC and other sim-sprites.