The Forum is up for sale: XeNTaX Forum looking for new owner
Alpha Prima RES
-
Mr.Mouse
- Site Admin
- Posts: 4073
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 450 times
- Been thanked: 680 times
- Contact:
ok, here's a list of the files in the dat02.res, I wrote a little lister to test the decryption method.
As you can see, it works.
Now for a real converter. 
Code: Select all
Decrypt RES: d:\data\tools\data02.res
SCRIPTS/
SCRIPTS/animset.h
SCRIPTS/class_creature/
SCRIPTS/class_creature/ai.h
SCRIPTS/class_creature/ai2.h
SCRIPTS/class_creature/boss.h
SCRIPTS/class_creature/humanoids.h
SCRIPTS/class_creature/npc.h
SCRIPTS/class_creature/robots.h
SCRIPTS/class_func.h
SCRIPTS/class_info.h
SCRIPTS/class_info_cutscene.h
SCRIPTS/class_item.h
SCRIPTS/class_item_weapon.h
SCRIPTS/class_light.h
SCRIPTS/class_misc_model.h
SCRIPTS/class_misc_physics_model.h
SCRIPTS/class_misc_physics_pack.h
SCRIPTS/class_particle.h
SCRIPTS/class_shot.h
SCRIPTS/class_trigger.h
SCRIPTS/console.h
SCRIPTS/definitions/
SCRIPTS/definitions/anim.h
SCRIPTS/definitions/animset.h
SCRIPTS/definitions/gameplay.h
SCRIPTS/definitions/globals.h
SCRIPTS/definitions/items.h
SCRIPTS/definitions/items_def.h
SCRIPTS/definitions/keys.h
SCRIPTS/definitions/shoteffects.h
SCRIPTS/definitions/sounds.h
SCRIPTS/definitions/soundsets.h
SCRIPTS/definitions/speechset.h
SCRIPTS/definitions/strings.h
SCRIPTS/editor.h
SCRIPTS/editor_links.h
SCRIPTS/editor_main.c
SCRIPTS/editor_path.h
SCRIPTS/func_display.h
SCRIPTS/hud.h
SCRIPTS/menu.h
SCRIPTS/music_player.h
SCRIPTS/player/
SCRIPTS/player/interface.h
SCRIPTS/player/player.h
SCRIPTS/proto.h
SCRIPTS/pviewer.h
SCRIPTS/script.c
SCRIPTS/shaders.h
SCRIPTS/soundset.h
SCRIPTS/super.h
SCRIPTS/super2.h
SCRIPTS/super_actor.h
SCRIPTS/viewer.h
strings.xml
-
Mr.Mouse
- Site Admin
- Posts: 4073
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 450 times
- Been thanked: 680 times
- Contact:
The encryption method for the filenames is as follows:
Code: Select all
// Alpha Prime *.RES - Filename Encryption
// Demystified by M.W.Zuurman (Mr.Mouse/Xentax)
//
// General idea:
//
// 1. The encryption XORs the characters in the strings with a seed value
// 2. The seed value is the ascii-code of a letter picked from the encryption string 'insanity'
//
// The method to pick the right character from the encryption string is:
//
// 1. Take the position of the character to be XORed (starting from 0)
// 2. AND this value with 7
// 3. Look up the character in the encryption string that is at this position
// 4. XOR the character in the original string with the ASCII value of that encryption character
// 5. Loop this until the whole string is encrypted
//
// In raw useless code:
//
// Declare and assign the following variables:
int Count ; // counter to loop through each character in the original string (OString)
int Lookup ; // Lookup value to get the character from the encryption string 'insanity' (EString)
int SSize ; // the size of the original string
while (Count < SSize) {
Lookup = Count AND 7;
DString[Count] = OString[Count] XOR EString[Lookup] ;
Count += 1 ;
}
// That should be it in schematic code.
// Note that the filenames will never be long enough for the 'AND 7' method to fail getting a number between 0 and 7.
-
Rheini
- Moderator
- Posts: 652
- Joined: Wed Oct 18, 2006 9:48 pm
- Location: Germany
- Has thanked: 19 times
- Been thanked: 46 times
- Contact:
Nice encryption methodMr.Mouse wrote:// Note that the filenames will never be long enough for the 'AND 7' method to fail getting a number between 0 and 7.
What do you mean with "will never be long enough"? ANDing a number with 7 always gives you a value between 0 and 7.
Is every string encrypted individually or is it a block encryption?
-
Mr.Mouse
- Site Admin
- Posts: 4073
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 450 times
- Been thanked: 680 times
- Contact:
It's amazing what you can find on the internet these days. Found this command line driven tool on a Russian site. It's by Xplorer and will do that for which I wanted to create a new program.
http://www.xentax.com/uploads/author/mr ... es2zip.zip
This will correct the res file and make it a zip archive again.
http://www.xentax.com/uploads/author/mr ... es2zip.zip
This will correct the res file and make it a zip archive again.

