Skip to content

Commit

Permalink
DREAMWEB: Move generated constants out of class DreamGenContext
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored and wjp committed Dec 7, 2011
1 parent f9fddab commit dc34fc1
Show file tree
Hide file tree
Showing 5 changed files with 553 additions and 545 deletions.
41 changes: 24 additions & 17 deletions devtools/tasmrecover/tasm/cpp.py
Expand Up @@ -617,29 +617,16 @@ def generate(self, start):
namespace %s {
class %sContext : public DreamBase, public Context {
public:
DreamGenContext() : DreamBase(), Context(_realData) {}
void __start();
"""
%(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()
""")
%(self.namespace))

if self.skip_addr_constants == False:
for name,addr in self.proc_addr:
self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
self.hd.write("static 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))
self.hd.write("static const uint16 offset_%s = 0x%04x;\n" %(name, addr))

offsets = []
for k, v in self.context.get_globals().items():
Expand All @@ -650,8 +637,28 @@ class %sContext : public DreamBase, public Context {

offsets = sorted(offsets, key=lambda t: t[1])
for o in offsets:
self.hd.write("\tstatic const uint16 k%s = %s;\n" %o)
self.hd.write("static const uint16 k%s = %s;\n" %o)
self.hd.write("\n")

self.hd.write(
"""
class %sContext : public DreamBase, public Context {
public:
DreamGenContext() : DreamBase(), Context(_realData) {}
void __start();
"""
%(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 p in set(self.methods):
if p in self.blacklist:
if self.header_omit_blacklisted == False:
Expand Down

0 comments on commit dc34fc1

Please sign in to comment.