Forum

Descrambling progs.dat?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Descrambling progs.dat?

Postby dayfive » Mon Dec 11, 2006 5:49 am

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?
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby leileilol » Mon Dec 11, 2006 5:59 am

Why would you want to decompile anyway?
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby dayfive » Mon Dec 11, 2006 6:16 am

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.
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby leileilol » Mon Dec 11, 2006 6:23 am

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
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby dayfive » Mon Dec 11, 2006 6:50 am

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....
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby FrikaC » Mon Dec 11, 2006 11:04 am

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).
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby dayfive » Mon Dec 11, 2006 11:43 am

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.
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby Lardarse » Wed Dec 13, 2006 4:15 am

Tried using a hex editor?
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

FINALLY!

Postby Izael » Wed Oct 28, 2009 12:53 pm

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!
Izael
 
Posts: 3
Joined: Wed Oct 21, 2009 6:49 pm

Postby Spike » Wed Oct 28, 2009 10:48 pm

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.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby FrikaC » Thu Oct 29, 2009 4:12 pm

Yeah, I should sit down with the unqcc source one day and make it work with all the language extensions we've made.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby r00k » Thu Oct 29, 2009 6:45 pm

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 ;)
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Spike » Thu Oct 29, 2009 10:27 pm

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!
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby r00k » Fri Oct 30, 2009 5:35 am

: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.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest