diff --git a/.gitignore b/.gitignore index 8768f944..635e1743 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ ISLE.EXE LEGO1.DLL build/ *.swp +*.i diff --git a/tools/makectx.py b/tools/makectx.py index 8a844bc4..66a5bf78 100644 --- a/tools/makectx.py +++ b/tools/makectx.py @@ -1,43 +1,15 @@ #!/usr/bin/python3 -# Tool to make simple context, currently the basic Mx* structures. +import argparse import os -import shutil -ctxfile = open('ctx.h', 'w') +parser = argparse.ArgumentParser(allow_abbrev=False, + description='Verify Exports: Compare the exports of two DLLs.') +parser.add_argument('cppfile', metavar='cppfile', help='Path to the C++ File to preprocess.') -# These are the only files we can include, hopefully soon decomp.me can deal with DirectX files. There is no need to bundle all the thousands of lines DX5 headers have, its not like all of it is probably going to be used. -ctxfile.write('#include \n') -ctxfile.write('#include \n') +args = parser.parse_args() +if not os.path.isfile(args.cppfile): + parser.error('Specified C++ file does not exist.') -# The order is important! -# In the future, *all* the files can be done - but there will always be some headers that need to be placed in before others. -# Later, when this initial list is complete, and DirectX header files are available on decomp.me, then we can bundle in everything that is not order-dependent (that isn't already in the list.) -# This will periodically need updating depending on what classes include stuff from others - for now, these are the most likely basics. -# This context should be enough to match basic functions, once manually adding in context for the intended class. -# This pastebin shows class inheritance. This can help us a lot: https://pastebin.com/AQAiurwC -headerfiles = [ - # Basic definitions/types/base classes - 'LEGO1/compat.h', - 'LEGO1/mxtypes.h', +os.system('cl.exe /EP /P ' + args.cppfile) - 'LEGO1/mxcore.h', - 'LEGO1/mxstring.h', - 'LEGO1/mxhashtable.h', - 'LEGO1/mxvariable.h', - 'LEGO1/mxvariabletable.h', - - 'LEGO1/mxcriticalsection.h', - 'LEGO1/mxomni.h', - - 'LEGO1/legostate.h', - - 'LEGO1/mxentity.h', - 'LEGO1/legoentity.h', -] - -for i in headerfiles: - ctxfile.write('\n// Start of ' + i + '\n') - for line in open(i): - if not line.startswith('#include'): - ctxfile.write(line) - ctxfile.write('\n// End of ' + i + '\n') \ No newline at end of file +print('Preprocessed file. It will be in the directory you executed in this command as "(filename).i".') \ No newline at end of file