[Scummvm-cvs-logs] CVS: tools descumm.cpp,1.27,1.28 descumm6.cpp,1.92,1.93
Max Horn
fingolfin at users.sourceforge.net
Thu May 8 16:45:04 CEST 2003
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv15685
Modified Files:
descumm.cpp descumm6.cpp
Log Message:
updated help string; more descumm / descumm6 syncing
Index: descumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- descumm.cpp 8 May 2003 23:32:29 -0000 1.27
+++ descumm.cpp 8 May 2003 23:44:07 -0000 1.28
@@ -131,6 +131,7 @@
bool alwaysShowOffs = 0;
bool dontOutputIfs = 0;
+bool dontOutputWhile = 0;
bool dontOutputElse = 0;
bool dontOutputElseif = 0;
bool dontShowOpcode = 0;
@@ -147,6 +148,11 @@
bool emit_if(char *before, char *after);
+int get_curoffs()
+{
+ return cur_pos - org_pos;
+}
+
int get_byte()
{
return (byte)(*cur_pos++);
@@ -159,6 +165,12 @@
return i;
}
+int get_gotopos()
+{
+ int j = get_word();
+ return (short)(j + get_curoffs());
+}
+
char *strecpy(char *buf, const char *src)
{
strcpy(buf, src);
@@ -548,11 +560,6 @@
}
}
-int HavependingElse()
-{
- return pendingElse;
-}
-
void do_decodeparsestring_v2(char *buf, byte opcode)
{
byte buffer[256];
@@ -1511,40 +1518,29 @@
}
-int get_curoffs()
-{
- return cur_pos - org_pos;
-}
-
-int get_gotopos()
-{
- int j = get_word();
- return (short)(j + get_curoffs());
-}
-
bool emit_if(char *before, char *after)
{
- int i = get_gotopos();
+ int to = get_gotopos();
before[0] = 0;
after[0] = 0;
- if (!dontOutputElseif && HavependingElse()) {
- if (maybeAddElseIf(get_curoffs(), pendingElseTo, i)) {
- sprintf(after, alwaysShowOffs ? ") /*%.4X*/ {" : ") {", i);
- strcpy(before, "} else ");
+ if (!dontOutputElseif && pendingElse) {
+ if (maybeAddElseIf(get_curoffs(), pendingElseTo, to)) {
pendingElse = false;
haveElse = true;
+ sprintf(after, alwaysShowOffs ? ") /*%.4X*/ {" : ") {", to);
+ strcpy(before, "} else ");
return true;
}
}
- if (!dontOutputIfs && maybeAddIf(get_curoffs(), i)) {
- sprintf(after, alwaysShowOffs ? ") /*%.4X*/ {" : ") {", i);
+ if (!dontOutputIfs && maybeAddIf(get_curoffs(), to)) {
+ sprintf(after, alwaysShowOffs ? ") /*%.4X*/ {" : ") {", to);
return true;
}
- sprintf(after, ") goto %.4X;", i);
+ sprintf(after, ") goto %.4X;", to);
return false;
}
@@ -3108,22 +3104,23 @@
void ShowHelpAndExit()
{
- printf("SCUMM Script discompiler\n"
- "Syntax:\n"
- "\tdescumm [-o] filename\n"
- "Flags:\n"
- "\t-2\tInput Script is v2\n"
- "\t-3\tInput Script is v3\n"
- "\t-5\tInput Script is v5\n"
- "\t-n\tUse Indy3-256 specific hacks\n"
- "\t-u\tScript is Unblocked/has no header\n"
- "\t-o\tAlways Show offsets\n"
- "\t-i\tDon't output ifs\n"
- "\t-e\tDon't output else\n"
- "\t-f\tDon't output else-if\n"
- "\t-c\tDon't show opcode\n"
- "\t-x\tDon't show offsets\n"
- "\t-h\tHalt on error\n");
+ printf("SCUMM Script decompiler\n"
+ "Syntax:\n"
+ "\tdescumm [-o] filename\n"
+ "Flags:\n"
+ "\t-2\tInput Script is v2\n"
+ "\t-3\tInput Script is v3\n"
+ "\t-5\tInput Script is v5\n"
+ "\t-n\tUse Indy3-256 specific hacks\n"
+ "\t-u\tScript is Unblocked/has no header\n"
+ "\t-o\tAlways Show offsets\n"
+ "\t-i\tDon't output ifs\n"
+ "\t-e\tDon't output else\n"
+ "\t-f\tDon't output else-if\n"
+ "\t-w\tDon't output while\n"
+ "\t-c\tDon't show opcode\n"
+ "\t-x\tDon't show offsets\n"
+ "\t-h\tHalt on error\n");
exit(0);
}
@@ -3204,25 +3201,28 @@
break;
case 'o':
- alwaysShowOffs = 1;
+ alwaysShowOffs = true;
break;
case 'i':
- dontOutputIfs = 1;
+ dontOutputIfs = true;
break;
case 'e':
- dontOutputElse = 1;
+ dontOutputElse = true;
break;
case 'f':
- dontOutputElseif = 1;
+ dontOutputElseif = true;
+ break;
+ case 'w':
+ dontOutputWhile = true;
break;
case 'c':
- dontShowOpcode = 1;
+ dontShowOpcode = true;
break;
case 'x':
- dontShowOffsets = 1;
+ dontShowOffsets = true;
break;
case 'h':
- haltOnError = 1;
+ haltOnError = true;
break;
default:
ShowHelpAndExit();
Index: descumm6.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm6.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- descumm6.cpp 8 May 2003 23:32:30 -0000 1.92
+++ descumm6.cpp 8 May 2003 23:44:07 -0000 1.93
@@ -174,11 +174,6 @@
int offs_of_line;
-int get_curoffs()
-{
- return cur_pos - org_pos;
-}
-
bool alwaysShowOffs = 0;
bool dontOutputIfs = 0;
bool dontOutputElse = 0;
@@ -677,6 +672,11 @@
return strchr(buf, 0);
}
+int get_curoffs()
+{
+ return cur_pos - org_pos;
+}
+
int get_byte()
{
return (byte)(*cur_pos++);
@@ -2777,16 +2777,21 @@
void ShowHelpAndExit()
{
- printf("DOTT Script discompiler\nSyntax:\n"
- "\tdottdis [-o] filename\nFlags:\n"
- "\t-o\tAlways Show offsets\n"
- "\t-i\tDon't output ifs\n"
- "\t-e\tDon't output else\n"
- "\t-f\tDon't output else-if\n"
- "\t-c\tDon't show opcode\n"
- "\t-x\tDon't show offsets\n"
- "\t-h\tHalt on error\n"
- "\t-7\tAssume V7 scripts\n");
+ printf("SCUMM Script decompiler\n"
+ "Syntax:\n"
+ "\tdescumm6 [-o] filename\n"
+ "Flags:\n"
+ "\t-6\tInput Script is v6\n"
+ "\t-7\tInput Script is v7\n"
+ "\t-8\tInput Script is v8\n"
+ "\t-o\tAlways Show offsets\n"
+ "\t-i\tDon't output ifs\n"
+ "\t-e\tDon't output else\n"
+ "\t-f\tDon't output else-if\n"
+ "\t-w\tDon't output while\n"
+ "\t-c\tDon't show opcode\n"
+ "\t-x\tDon't show offsets\n"
+ "\t-h\tHalt on error\n");
exit(0);
}
@@ -2808,41 +2813,42 @@
s++;
while (*s) {
switch (tolower(*s)) {
+ case '6':
+ scriptVersion = 6;
+ g_jump_opcode = 0x73;
+ break;
+ case '7':
+ scriptVersion = 7;
+ g_jump_opcode = 0x73;
+ break;
+ case '8':
+ scriptVersion = 8;
+ g_jump_opcode = 0x66;
+ break;
+
case 'o':
- alwaysShowOffs = 1;
+ alwaysShowOffs = true;
break;
case 'i':
- dontOutputIfs = 1;
+ dontOutputIfs = true;
break;
case 'e':
- dontOutputElse = 1;
+ dontOutputElse = true;
break;
case 'f':
- dontOutputElseif = 1;
+ dontOutputElseif = true;
break;
case 'w':
- dontOutputWhile = 1;
+ dontOutputWhile = true;
break;
case 'c':
- dontShowOpcode = 1;
+ dontShowOpcode = true;
break;
case 'x':
- dontShowOffsets = 1;
+ dontShowOffsets = true;
break;
case 'h':
- haltOnError = 1;
- break;
- case '6':
- scriptVersion = 6;
- g_jump_opcode = 0x73;
- break;
- case '7':
- scriptVersion = 7;
- g_jump_opcode = 0x73;
- break;
- case '8':
- scriptVersion = 8;
- g_jump_opcode = 0x66;
+ haltOnError = true;
break;
default:
ShowHelpAndExit();
More information about the Scummvm-git-logs
mailing list