feat: mangler script (experimental)#89
Open
DexrnZacAttack wants to merge 2 commits intoGRAnimated:mainfrom
Open
feat: mangler script (experimental)#89DexrnZacAttack wants to merge 2 commits intoGRAnimated:mainfrom
DexrnZacAttack wants to merge 2 commits intoGRAnimated:mainfrom
Conversation
Collaborator
|
This is up to @GRAnimated if that should be merged. |
GRAnimated
requested changes
Nov 27, 2025
| # my least favorite language | ||
|
|
||
| # https://www.geeksforgeeks.org/python/command-line-arguments-in-python/#using-argparse-module | ||
| parser = argparse.ArgumentParser(description = "Allows you to mangle symbols with our modified toolchain") |
Owner
There was a problem hiding this comment.
Move argument parsing into a main function and call it in an if __name__ == "__main__".
| os.makedirs(d, exist_ok=True) | ||
|
|
||
|
|
||
| with open(f, 'w') as t: |
Owner
There was a problem hiding this comment.
Move each step of the process into its own function
| t.write("\n__attribute__((used))\n") | ||
| t.write(f"DEFAULT_TYPE {args.gvar} = {dv};") | ||
|
|
||
| c = subprocess.run([os.path.join(sd, "../toolchain/clang-4.0.1/bin/clang++"), f"-I{os.path.join(sd, '../src')}", f"-I{os.path.join(sd, '../src/Minecraft.World')}", f"-I{os.path.join(sd, '../src/4JLibraries_Source')}", f"-I{os.path.join(sd, '../src/Minecraft.Client')}", f"-I{os.path.join(sd, '../src/PlatformLibraries_Source')}", f"-I{os.path.join(sd, '../lib/nnheaders/include')}", "-stdlib=libc++", "-O3", "-g2", "-std=c++1z", "-fno-rtti", "-fno-exceptions", "-fno-strict-aliasing", "-c", "-Wno-return-type", f, "-o", o], |
Owner
There was a problem hiding this comment.
Please write some small infrastructure around testing this script that can be used in a --test flag. Ensure to include test cases that pass and some that fail, so we have a tangible goal for improving this script later on.
Collaborator
Author
There was a problem hiding this comment.
I'll look at doing this when available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I made this script a long time ago, it's usable but definitely needs improvement.