Inside3D!
     

Descrambling progs.dat?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Dec 11, 2006 5:49 am    Post subject: Descrambling progs.dat? Reply with quote

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?
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Mon Dec 11, 2006 5:59 am    Post subject: Reply with quote

Why would you want to decompile anyway?
_________________
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Dec 11, 2006 6:16 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Mon Dec 11, 2006 6:23 am    Post subject: Reply with quote

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"
_________________
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Dec 11, 2006 6:50 am    Post subject: Reply with quote

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....
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Mon Dec 11, 2006 11:04 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message Send e-mail
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Dec 11, 2006 11:43 am    Post subject: Reply with quote

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:

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:

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.
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Wed Dec 13, 2006 4:15 am    Post subject: Reply with quote

Tried using a hex editor?
Back to top
View user's profile Send private message
Izael



Joined: 21 Oct 2009
Posts: 3

PostPosted: Wed Oct 28, 2009 12:53 pm    Post subject: FINALLY! Reply with quote

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!
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Oct 28, 2009 10:48 pm    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Thu Oct 29, 2009 4:12 pm    Post subject: Reply with quote

Yeah, I should sit down with the unqcc source one day and make it work with all the language extensions we've made.
Back to top
View user's profile Send private message Send e-mail
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Thu Oct 29, 2009 6:45 pm    Post subject: Reply with quote

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:

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 Wink
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Oct 29, 2009 10:27 pm    Post subject: Reply with quote

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!
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Fri Oct 30, 2009 5:35 am    Post subject: Reply with quote

Razz 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:

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 Wink
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group