diff --git a/LEGO1/mxdsactionlist.h b/LEGO1/mxdsactionlist.h index 4ae6e2a6..127dd142 100644 --- a/LEGO1/mxdsactionlist.h +++ b/LEGO1/mxdsactionlist.h @@ -25,4 +25,13 @@ class MxDSActionList : public MxList typedef MxListCursorChild MxDSActionListCursor; +// OFFSET: LEGO1 0x100c9d20 TEMPLATE +// MxListParent::Destroy + +// OFFSET: LEGO1 0x100c9cd0 TEMPLATE +// MxListParent::~MxListParent + +// OFFSET: LEGO1 0x100c9d30 TEMPLATE +// MxList::~MxList + #endif // MXDSACTIONLIST_H diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h index 0de71903..ed4c2802 100644 --- a/LEGO1/mxlist.h +++ b/LEGO1/mxlist.h @@ -31,15 +31,11 @@ class MxListParent : public MxCore m_count = 0; m_customDestructor = Destroy; } - // OFFSET: LEGO1 0x1001cdd0 + virtual ~MxListParent() {} - - // OFFSET: LEGO1 0x1001cd30 - static void Destroy(T *) {}; - - // OFFSET: LEGO1 0x1001cd20 virtual MxS8 Compare(T *, T *) = 0; + static void Destroy(T *) {}; protected: MxU32 m_count; // +0x8 void (*m_customDestructor)(T *); // +0xc @@ -114,7 +110,6 @@ class MxListCursorChildChild : public MxListCursorChild }; template -// OFFSET: LEGO1 0x1001ce20 MxList::~MxList() { DeleteAll(); diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index fe48c7c2..1b097067 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -182,4 +182,4 @@ MxResult MxNotificationManager::Send(MxCore *p_listener, MxParam *p_param) } return FAILURE; -} +} \ No newline at end of file diff --git a/LEGO1/mxpresenterlist.h b/LEGO1/mxpresenterlist.h index 5b36e2d8..71a7f9aa 100644 --- a/LEGO1/mxpresenterlist.h +++ b/LEGO1/mxpresenterlist.h @@ -26,4 +26,13 @@ class MxPresenterList : public MxPresenterListParent typedef MxListCursorChildChild MxPresenterListCursor; +// OFFSET: LEGO1 0x1001cd30 TEMPLATE +// MxListParent::Destroy + +// OFFSET: LEGO1 0x1001cdd0 TEMPLATE +// MxListParent::~MxListParent + +// OFFSET: LEGO1 0x1001ce20 TEMPLATE +// MxList::~MxList + #endif // MXPRESENTERLIST_H diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 113dea2c..e0962534 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -10,6 +10,7 @@ import os import sys import colorama +import html import re parser = argparse.ArgumentParser(allow_abbrev=False, @@ -43,7 +44,7 @@ verbose = int(args.verbose, 16) except ValueError: parser.error('invalid verbose argument') -html = args.html +html_path = args.html plain = args.no_color @@ -140,6 +141,7 @@ def get_file_in_script_dir(fn): class SymInfo: funcs = {} lines = {} + names = {} def __init__(self, pdb, file, wine_path_converter): call = [get_file_in_script_dir('cvdump.exe'), '-l', '-s'] @@ -183,6 +185,7 @@ def __init__(self, pdb, file, wine_path_converter): info.name = line[77:] + self.names[info.name] = info self.funcs[addr] = info elif current_section == 'LINES' and line.startswith(' ') and not line.startswith(' '): sourcepath = line.split()[0] @@ -238,6 +241,14 @@ def get_recompiled_address(self, filename, line): else: logger.error('Failed to find function symbol with filename and line: %s:%d', filename, line) + def get_recompiled_address_from_name(self, name): + logger.debug('Looking for %s', name) + + if name in self.names: + return self.names[name] + else: + logger.error('Failed to find function symbol with name: %s', name) + wine_path_converter = None if os.name != 'nt': wine_path_converter = WinePathConverter(source) @@ -419,14 +430,24 @@ def can_resolve_register_differences(original_asm, new_asm): else: continue - find_open_bracket = line - while '{' not in find_open_bracket: - find_open_bracket = srcfile.readline() - line_no += 1 + if line.endswith("TEMPLATE"): + line = srcfile.readline() + line_no += 1 + # Name comes after // comment + name = line[2:].strip() - recinfo = syminfo.get_recompiled_address(srcfilename, line_no) - if not recinfo: - continue + recinfo = syminfo.get_recompiled_address_from_name(name) + if not recinfo: + continue + else: + find_open_bracket = line + while '{' not in find_open_bracket: + find_open_bracket = srcfile.readline() + line_no += 1 + + recinfo = syminfo.get_recompiled_address(srcfilename, line_no) + if not recinfo: + continue # The effective_ratio is the ratio when ignoring differing register # allocation vs the ratio is the true ratio. @@ -511,14 +532,14 @@ def can_resolve_register_differences(original_asm, new_asm): print("\n%s is only %s similar to the original, diff above" % (recinfo.name, percenttext)) # If html, record the diffs to an HTML file - if html: + if html_path: escaped = '\\n'.join(udiff).replace('"', '\\"').replace('\n', '\\n').replace('<', '<').replace('>', '>') - htmlinsert.append('{address: "%s", name: "%s", matching: %s, diff: "%s"}' % (hex(addr), recinfo.name, str(effective_ratio), escaped)) + htmlinsert.append('{address: "%s", name: "%s", matching: %s, diff: "%s"}' % (hex(addr), html.escape(recinfo.name), str(effective_ratio), escaped)) except UnicodeDecodeError: break -def gen_html(html, data): +def gen_html(html_path, data): templatefile = open(get_file_in_script_dir('template.html'), 'r') if not templatefile: print('Failed to find HTML template file, can\'t generate HTML summary') @@ -529,9 +550,9 @@ def gen_html(html, data): templatedata = templatedata.replace('/* INSERT DATA HERE */', ','.join(data), 1) - htmlfile = open(html, 'w') + htmlfile = open(html_path, 'w') if not htmlfile: - print('Failed to write to HTML file %s' % html) + print('Failed to write to HTML file %s' % html_path) return htmlfile.write(templatedata) @@ -580,8 +601,8 @@ def gen_svg(svg, name, icon, implemented_funcs, total_funcs, raw_accuracy): svgfile.write(templatedata) svgfile.close() -if html: - gen_html(html, htmlinsert) +if html_path: + gen_html(html_path, htmlinsert) if verbose: if not found_verbose_target: