aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2011-11-23 02:27:43 +0000
committerD G Turner2011-11-23 02:27:43 +0000
commit0026c842cad367d70655a108356b8dbf2c82d4b8 (patch)
treeab93fdf527022ea9f6f2a216832ad5cd48c74a77
parentf5e945c7d1276be68881ffdd395a91dd6a2266f1 (diff)
downloadscummvm-rg350-0026c842cad367d70655a108356b8dbf2c82d4b8.tar.gz
scummvm-rg350-0026c842cad367d70655a108356b8dbf2c82d4b8.tar.bz2
scummvm-rg350-0026c842cad367d70655a108356b8dbf2c82d4b8.zip
DEVTOOLS: Add flag to tasm-recover tool to skip dispatch call function.
This flag when set omits the dispatch call function from the dreamgen.* output.
-rwxr-xr-xdevtools/tasmrecover/tasm-recover2
-rw-r--r--devtools/tasmrecover/tasm/cpp.py33
2 files changed, 22 insertions, 13 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index a903e4f33f..c86da47a69 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -283,5 +283,5 @@ generator = cpp(context, "DreamGen", blacklist = [
'inventory',
'mainscreen',
'doload',
- ])
+ ], skip_dispatch_call = False)
generator.generate('dreamweb') #start routine
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index 61edb41fb2..6ffce010ce 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -33,7 +33,7 @@ def parse_bin(s):
return v
class cpp:
- def __init__(self, context, namespace, skip_first = 0, blacklist = [], skip_output = []):
+ def __init__(self, context, namespace, skip_first = 0, blacklist = [], skip_output = [], skip_dispatch_call = False):
self.namespace = namespace
fname = namespace.lower() + ".cpp"
header = namespace.lower() + ".h"
@@ -80,6 +80,7 @@ class cpp:
self.blacklist = blacklist
self.failed = list(blacklist)
self.skip_output = skip_output
+ self.skip_dispatch_call = skip_dispatch_call
self.translated = []
self.proc_addr = []
self.used_data_offsets = set()
@@ -596,6 +597,7 @@ namespace %s {
elif (n & 0x3) == 0:
comment += " "
data_impl += "};\n\tds.assign(src, src + sizeof(src));\n"
+
self.hd.write(
"""\n#include "dreamweb/runtime.h"
@@ -604,11 +606,16 @@ namespace %s {
class %sContext : public Context {
public:
void __start();
- void __dispatch_call(uint16 addr);
-#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
-
-"""
+"""
%(self.namespace, self.namespace))
+ if self.skip_dispatch_call == False:
+ self.hd.write(
+""" void __dispatch_call(uint16 addr);
+""")
+ self.hd.write(
+"""#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
+
+""")
for name,addr in self.proc_addr:
self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
@@ -639,11 +646,13 @@ public:
self.fd.write("\nvoid %sContext::__start() { %s%s(); \n}\n" %(self.namespace, data_impl, start))
- self.fd.write("\nvoid %sContext::__dispatch_call(uint16 addr) {\n\tswitch(addr) {\n" %self.namespace)
- self.proc_addr.sort(cmp = lambda x, y: x[1] - y[1])
- for name,addr in self.proc_addr:
- self.fd.write("\t\tcase addr_%s: %s(); break;\n" %(name, name))
- self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)ax);")
- self.fd.write("\n\t}\n}\n\n} /*namespace*/\n")
-
+ if self.skip_dispatch_call == False:
+ self.fd.write("\nvoid %sContext::__dispatch_call(uint16 addr) {\n\tswitch(addr) {\n" %self.namespace)
+ self.proc_addr.sort(cmp = lambda x, y: x[1] - y[1])
+ for name,addr in self.proc_addr:
+ self.fd.write("\t\tcase addr_%s: %s(); break;\n" %(name, name))
+ self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)ax);")
+ self.fd.write("\n\t}\n}")
+
+ self.fd.write("\n\n} /*namespace*/\n")
self.fd.close()