mirror of
https://github.com/pret/pokediamond.git
synced 2026-04-25 07:26:54 -05:00
m2ctx for usage with decomp.me
This commit is contained in:
parent
a5e6a7bfa6
commit
f10505f4cc
1
.gitattributes
vendored
1
.gitattributes
vendored
|
|
@ -1,2 +1,3 @@
|
|||
*.sha1 text eol=lf
|
||||
charmap.txt text eol=crlf
|
||||
m2ctx.sh text eol=lf
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -53,3 +53,5 @@ files/**/*.c
|
|||
|
||||
# MacOS garbage
|
||||
.DS_Store
|
||||
#decomp.me helper files
|
||||
ctx.c
|
||||
|
|
|
|||
40
m2ctx.sh
Normal file
40
m2ctx.sh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
OUT_FILE=ctx.c
|
||||
|
||||
GCC=gcc
|
||||
FLAGS="-E -P -dD -undef"
|
||||
INCLUDES="-Iinclude -Iinclude/constants -Iinclude/nitro -Iinclude-mw -Ifiles -Iarm9/lib/NitroSDK/include -Iarm9/lib/libc/include -Iarm9/lib/libnns/include -Iarm9/modules/21/include -Iarm9/modules/52/include -Iarm9/modules/59/include -include global.h"
|
||||
DEFINES="-DDIAMOND"
|
||||
|
||||
|
||||
generate-ctx () {
|
||||
# Remove any line containing a predefined macro. If not removed, mwccarm
|
||||
# generates compiler warnings.
|
||||
grep "^#include " "$1" | $GCC $FLAGS $INCLUDES $DEFINES -x c - | sed '/__STDC__\|__STDC_VERSION__\|__STDC_VERSION__\|__STDC_HOSTED__/d' > $OUT_FILE
|
||||
}
|
||||
|
||||
usage () {
|
||||
echo "Generate a context file for decomp.me."
|
||||
echo "Usage: $0 [-h] [FILEPATH]"
|
||||
echo ""
|
||||
echo "Arguments:"
|
||||
echo " FILEPATH Source file used to generate ctx.c"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h Show this message and exit"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
generate-ctx "$1"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Loading…
Reference in New Issue
Block a user