The Dink Network

Decompilers needed

March 27th 2008, 03:10 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Does anyone here have an .ff (graphics) and .d (scripts) decompiler? I need to look into some stuff from Dinkers that aren't really around here anymore, so asking them won't do much good.
March 27th 2008, 04:48 PM
duckdie.gif
The Undink source project file has a ff decompiler. I think I've found my D decompiler, so I can re-send it to you if you want (although you should still have it) .
March 27th 2008, 06:06 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Plese re-send it Ducklord, I think I lost it when you sent it to me, sorry.
March 28th 2008, 02:30 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
A D decompiler? Hey, would you mind emailing it to me as well, I really would like to check one of these out.
March 28th 2008, 06:55 AM
duckdie.gif
The decompiler has been sent to both of you. A little warning, though, it doesn't work on overy computer because I think I accidentally used the wrong parameters when compiling it (sorry). I am unable to recompile it right now (I will try to so soon.

Here's the source code, if anyone's interested :

/* expand.c -- Byte Pair Encoding decompression */
/* Copyright 1996 Philip Gage */

#include <stdio.h>

void decompress (FILE *in, FILE *out)
{ unsigned char stack[16], pair[128][2]; short c, top = 0;
 /* Check for optional pair count and pair table */ if ((c = getc(in)) > 127) fread(pair,2,c-128,in); else putc(c,out);
 for (;  {
 /* Pop byte from stack or read byte from file */ if (top) c = stack[--top]; else if ((c = getc(in)) == EOF) break; /* Push pair on stack or output byte to file */ if (c > 127) { stack[top++] = pair[c-128][1]; stack[top++] = pair[c-128][0]; } else putc(c,out); }
}

int main (int argc, char **argv)
{ FILE *in, *out;
char crap[100];
char crap2[100];

printf("\nDinkC Decompiler V1.00 - Ducklord\n\n");
if (argc > 1)
{
//printf("Char is %c",argv[1][strlen(argv[1])-2]); if (argv[1][strlen(argv[1])-2] != '.')
{  strcpy(crap, argv[1]);
strcat(crap, ".d");
strcpy(crap2, argv[1]);
strcat(crap2, ".c");
} else
{
 strcpy(crap, argv[1]);
strcpy(crap2, argv[1]);
crap2[strlen(crap2)-1] = 'c';

}
}
 if (argc != 2) printf("Usage: decompile crap [.d] (a file called crap.c will be made)\n"); else if ((in=fopen(crap,"rb"))==NULL) printf("Error opening input %s\n",crap); else if ((out=fopen(crap2,"wb"))==NULL) printf("Error opening output %s\n",crap2); else {  printf("Creating %s....", crap2);  decompress(in,out); fclose(out); fclose(in); printf("Done!\n"); 
  } return 0;
}


(As a sidenote, Philip Gage's script required quite a bit of tweaking to make it work .)
March 28th 2008, 07:01 AM
duckdie.gif
Whoops. What's that smiley doing in the middle of my script? Stupid board.
March 28th 2008, 08:35 PM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
As a sidenote, Philip Gage's script required quite a bit of tweaking to make it work

Would probably have been less work to extract the relevant part out of the Dink source code.
March 29th 2008, 02:18 AM
bonca.gif
megadog
Peasant He/Him New Zealand
Woof! 
Why don't you release the .D compiler. I sure would like it!
March 29th 2008, 04:18 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
I'm not sure, but it may mean cheaters could cheat. And we don't want cheaters cheating, because cheating is bad.
March 29th 2008, 07:50 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
And then the cheaters can't finish the game! Mwhahahahaaa!!
April 4th 2008, 06:20 PM
bonca.gif
megadog
Peasant He/Him New Zealand
Woof! 
Could you send this to me? Please?
April 9th 2008, 06:21 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
I wonder what kind of nonsense an empty for loop is... Why not just use while (1) rather than for (;; )?
April 9th 2008, 08:02 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
I don't think you're in a position to comment on the code of others, DaVince...
April 9th 2008, 08:57 AM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Why isn't he exactly?
April 9th 2008, 09:15 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Because his comment offers no technical insight on the proposed change (i.e. the technical benefits of making this change), it just comes across as: 'I know how you should've written your code'. As for not being in the position to comment: I don't get the impression from his website/projects that he has the C-background to comment on this.
April 9th 2008, 09:28 AM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
It could be me, but the only thing I see is DaVince trying to help and even offering an alternative. I have no knowledge about C whatsoever, but in my opinion it's kind of rude to say what you said.

You probably have no knowledge about playing the saxophone (just a wild guess), does that mean you cannot comment on someone's lousy saxophone playing, maybe even telling him to hold the saxophone with two hands instead of one? (yes, terrible analogy, sue me)
April 9th 2008, 09:51 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
If you have no knowledge of playing a saxophone, then in most cases, your suggestions won't improve the other's play and as such, they won't make sense. You can still comment by using common sense and other background knowledge (for example, about playing musical instruments in general) of course.

In this case, the two statements are just different ways of doing the same thing. So, to my knowledge, there's only personal preference of one over the other (differences in the resulting binary, if any, will be minor anyway). So why call the code of someone else 'nonsense' when it's just as valid way of doing it?
April 10th 2008, 02:28 AM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
Because I am a geek, hur, I just checked this. (Why not get the facts on the table?

These are the two files I used to test:

===== wh.c =====
void loop(void) {
int i = 0;
while(1)
i++;
}

===== fl.c =====
void loop(void) {
int i = 0;
for( ;; )
i++;
}

I "compiled" both to assembler using the command "gcc -O0 -S <file>.c", which gave me these two files: (I've removed unnecessary, unrelated crud)

===== wh.s =====
loop:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movl $0, -8(%ebp)
.L2:
movl $0, -4(%ebp)
movl -8(%ebp), %eax
addl %eax, %eax
addl %eax, -4(%ebp)
jmp .L2

===== fl.s =====
loop:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movl $0, -8(%ebp)
.L2:
movl $0, -4(%ebp)
movl -8(%ebp), %eax
addl %eax, %eax
addl %eax, -4(%ebp)
jmp .L2

If you see any difference between the two outputs, then congratulations. You see something I don't. So, to all of you discussing this, it's settled. They both result in the exact same code, case closed, it's entirely up to personal preference.