aboutsummaryrefslogtreecommitdiff
path: root/devtools/tasmrecover
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-08-17 23:22:49 +0200
committerWillem Jan Palenstijn2011-08-18 00:18:08 +0200
commit0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0 (patch)
tree2f3c7035d985e2695aeb11cc85c378106f7cdee7 /devtools/tasmrecover
parentf1a0df46dc9bbdae6fd3215d6fa78af4174fff54 (diff)
downloadscummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.tar.gz
scummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.tar.bz2
scummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.zip
DREAMWEB: Emit symbolic constants for data offsets
Diffstat (limited to 'devtools/tasmrecover')
-rw-r--r--devtools/tasmrecover/tasm/cpp.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index 4ed89f650d..db7855e0d0 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -82,6 +82,7 @@ class cpp:
self.skip_output = skip_output
self.translated = []
self.proc_addr = []
+ self.used_data_offsets = set()
self.methods = []
self.fd.write("""%s
@@ -99,11 +100,13 @@ namespace %s {
if self.indirection == -1:
try:
offset,p,p = self.context.get_offset(name)
- print "OFFSET = %d" %offset
- self.indirection = 0
- return str(offset)
except:
pass
+ else:
+ print "OFFSET = %d" %offset
+ self.indirection = 0
+ self.used_data_offsets.add((name,offset))
+ return "offset_%s" % (name,)
g = self.context.get_global(name)
if isinstance(g, op.const):
@@ -604,6 +607,10 @@ public:
for name,addr in self.proc_addr:
self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
+
+ for name,addr in self.used_data_offsets:
+ self.hd.write("\tstatic const uint16 offset_%s = 0x%04x;\n" %(name, addr))
+
offsets = []
for k, v in self.context.get_globals().items():
if isinstance(v, op.var):