Descrambling progs.dat?

Discuss programming in the QuakeC language.
Post Reply
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Descrambling progs.dat?

Post by dayfive »

there are some progs.dat files that appear to be scrambled and cause a segmentation fault in many decompilers.

Is there a counter application to SCRAM.EXE that allows for unscrambling a scrambled progs.dat file?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

Why would you want to decompile anyway?
i should not be here
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

CheapAlert wrote:Why would you want to decompile anyway?
why wouldn't you want to decompile? sometimes it's just easier when the sources aren't available.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

dayfive wrote:
CheapAlert wrote:Why would you want to decompile anyway?
why wouldn't you want to decompile? .
Because it would produce horrible, malformed, hard-to-read "code"
i should not be here
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

some semblance of source code is much much better than none at all.

i find it quite useful to see at least some structure of what's going on, so i don't have to look at the game behaviour in game and reverse engineer it....
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

I don't know if you've tried frikdec, but it more or less nullifies what SCRAMBLER! does. Then again, because it's also based on unqcc (as are most all decompilers) there may be certain cases that aren't accounted for (unqcc is a real disaster).
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

FrikaC wrote:I don't know if you've tried frikdec, but it more or less nullifies what SCRAMBLER! does. Then again, because it's also based on unqcc (as are most all decompilers) there may be certain cases that aren't accounted for (unqcc is a real disaster).
Actually, I've been using frikdec! On a little endian P4 processor running GNU/Linux (debian/sid)

Here's the output (when trying to decompile a scrambled progs.dat)

Code: Select all

Decompiling...
Read Data from progs.dat:
Total Size is 644552
Version Code is 6
CRC is 5927
113612 strofs
 39157 numstatements
  2118 numfunctions
  5872 numglobaldefs
   241 numfielddefs
 23118 numpr_globals
----------------------
Segmentation fault
(qwprogs.dat)

Code: Select all

Decompiling...
Read Data from qwprogs.dat:
Total Size is 443368
Version Code is 6
CRC is 54730
 69696 strofs
 29910 numstatements
   763 numfunctions
  3902 numglobaldefs
   248 numfielddefs
 18416 numpr_globals
----------------------
Segmentation fault
If the progs.dat isn't scrambled, it works for sure. I've tried it successfully many times.
Lardarse
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Post by Lardarse »

Tried using a hex editor?
Izael
Posts: 3
Joined: Wed Oct 21, 2009 6:49 pm

FINALLY!

Post by Izael »

WOW! I've been struggling with trying to decompile progs.dat using various qcc programs for weeks! I think I downloaded every qc compiler known to man just to try and get this done. I want to make some small changes to certain mods, or implement certain aspects of some mods into other ones... *IE KILLER QUAKE PATCH + SUPER DUPER QUAKE WEAPONS! YES!

/me = super n00b

so now just a quick question... decompiling progs.dat from Neil Manke's Starship map, and I get this...

frikdec progs.dat
decompliling...
"" defs.qc
"" subs.qc
fatal error - index (15988) out of bounds.

does this mean that defs.qc and subs.qc are the only .qc files contained within progs.dat? I could live with that. And then...

frikqcc -dec progs.src

defs.qc
subs.qc
subs.qc (123 to 133): warning: Too many closing braces
subs.qc (123 to 133): error: "}" is not a type

./progs.dat - 11 error(s), 11 warning(s)

Should I be worried about these? lol

Basically for the starship maps I want to add a second shotgun weapon, one that will shoot the laser.

thanks!
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

subs.qc (123 to 133): warning: Too many closing braces
subs.qc (123 to 133): error: "}" is not a type

those messages are more likely to be caused by a mod that was optimised, rather than scrambled.

sadly, scrambled mods are easier to decompile than optimised ones...
certain optimisations can make an utter utter mess.

alternatively, they just used a 'for' statement, which is an easy way to confuse qc decompilers without even using a scrambler or optimisations - generally the decompiler doesn't know what the heck a 'for' statement is, and certainly not what the bytecode looks like.
but if it is just one of these, fix the function, the rest will be fine.

And I've no idea what index out of bounds would be caused by, other than optimisations.
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

Yeah, I should sit down with the unqcc source one day and make it work with all the language extensions we've made.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

FrikaC wrote:I don't know if you've tried frikdec, but it more or less nullifies what SCRAMBLER! does. Then again, because it's also based on unqcc (as are most all decompilers) there may be certain cases that aren't accounted for (unqcc is a real disaster).
I purposely put this code in my defs.qc to debunk most decompilers

Code: Select all

void () decompiler_error =
{
	local string dopefish;	
	dopefish = ("dont smoke fish, drink bud.\n");	
};
maybe frikaC can tell you why it craps the decompiler but so far it works enough ;)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

FrikaC wrote:Yeah, I should sit down with the unqcc source one day and make it work with all the language extensions we've made.
If you manage it, I will forever hail you as 'FrikaC the awesome'.
Good luck with that. :P


r00k... what the hell? lol!
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

:P i know it makes sense only to us, i guess.
If you try to decompile CAx (http://www.quakeone.com/cax), it spits out void() decompiler_error as the last line,

Code: Select all

void (entity , entity , entity , float ) T_Damage;
float (entity , entity , string ) CanDamage;
float modelindex_eyes    = 0;
float modelindex_player    = 0;

void () decompiler_error =
{
	local string ;
thus forcing the end user to think its corrupt ;)
I suppose the decompiler cant assign a value to a variable intermittently or whatever, but this keeps "little kiddies" from taking a competitive multiplayer mod and hacking it and putting up a skewed server. I dunno, maybe this is outdated. Open source is one thing that keeps the world humble.

If anyone wanting to start up a new multiplayer mod, you should check out this lost treasure www.quakeone.com/qrack/elohim22.zip
The old (Jan. 1998) open source of the Clan Elohim DM server (aka CRMOD) by J.P.Grossman and Paul Baker . (shub hub it ?? i think i have the only version?!!)
Great resource to learn quakeC.
Post Reply