aboutsummaryrefslogtreecommitdiff
path: root/devtools/tasmrecover
diff options
context:
space:
mode:
authorBertrand Augereau2011-06-26 15:10:18 +0200
committerBertrand Augereau2011-07-17 13:42:12 +0200
commit4d4d3329c3f60db245038d48ff36a14628a0c10f (patch)
tree924fe19e7f012700269c03550e451089ad533d9d /devtools/tasmrecover
parent69adb13c2f3cadd4dac2bba8164aa0b8a9400abc (diff)
downloadscummvm-rg350-4d4d3329c3f60db245038d48ff36a14628a0c10f.tar.gz
scummvm-rg350-4d4d3329c3f60db245038d48ff36a14628a0c10f.tar.bz2
scummvm-rg350-4d4d3329c3f60db245038d48ff36a14628a0c10f.zip
DREAMWEB: The generator includes a file for custom structs and a file for custom function definitions
It also generates C++ symbols for asm proc addresses
Diffstat (limited to 'devtools/tasmrecover')
-rw-r--r--devtools/tasmrecover/tasm/cpp.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index dfdfb239f4..81c883da1e 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -544,14 +544,19 @@ namespace %s {
"""\n#include "dreamweb/runtime.h"
namespace %s {
-
+#include "structs.h"
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))
+
+ for name,addr in self.proc_addr:
+ self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
+
offsets = []
for k, v in self.context.get_globals().items():
if isinstance(v, op.var):
@@ -564,7 +569,10 @@ public:
self.hd.write("\tconst static uint16 k%s = %s;\n" %o)
self.hd.write("\n")
for p in set(self.methods):
- self.hd.write("\tvoid %s();\n" %p)
+ if p in self.blacklist:
+ self.hd.write("\t//void %s();\n" %p)
+ else:
+ self.hd.write("\tvoid %s();\n" %p)
self.hd.write("};\n}\n\n#endif\n")
self.hd.close()
@@ -574,7 +582,7 @@ public:
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 0x%04x: %s(); break;\n" %(addr, name))
+ 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")