From 1cad18818eaf64b97b6bddb2945dfb82b8103cc5 Mon Sep 17 00:00:00 2001 From: 0NONE <0none@cumallover.me> Date: Wed, 12 Dec 2018 21:15:17 +0100 Subject: [PATCH 1/5] Fixed folders not being created when building repo --- build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index fcf2dfa..486ace8 100644 --- a/build.py +++ b/build.py @@ -26,10 +26,16 @@ def run(cmd): #print(cmd); os.system(cmd) +# Check if required folders exist +if not os.path.exists("obj"): + os.makedirs("obj"); +if not os.path.exists("bin"): + os.makedirs("bin"); + cwd = os.getcwd() run("rm obj/*.o") run("rm bin/*.elf") -run(CC+ " -Os -s -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/battle/*.c') + allFile('source/rng/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian "); +print(CC+ " -Os -s -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/battle/*.c') + allFile('source/rng/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian "); run(CC+" -Os " + allFile('source/libntrplg/*.s') + allFile('source/ns/*.s') + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian "); run(LD + ' ' + LIBPATH + " -pie --print-gc-sections -T 3ds.ld -Map=homebrew.map " + allFile("*.o") + " " + allFile("lib/*.o") + " " + allFile("lib/*.a") + " -lc --nostdlib") From 8b7ddc1632c848feefb4cdb5db1a63363718727c Mon Sep 17 00:00:00 2001 From: 0NONE <0none@cumallover.me> Date: Wed, 12 Dec 2018 22:42:59 +0100 Subject: [PATCH 2/5] Added linux building tool --- build.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..bfd1d92 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#! /bin/bash +PATH=$PATH:$DEVKITARM/bin +python3 build.py From 90b1eef1867b06ccec03cc04d623b3cc1728a2e9 Mon Sep 17 00:00:00 2001 From: 0none <0none@cock.li> Date: Fri, 14 Dec 2018 22:18:05 +0100 Subject: [PATCH 3/5] Mitigated need for path setting by using absolute paths in build.py --- build.py | 10 +++++----- build.sh | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) delete mode 100755 build.sh diff --git a/build.py b/build.py index 486ace8..d7a1afc 100644 --- a/build.py +++ b/build.py @@ -7,12 +7,12 @@ # the path plugin was copied to COPYTOPATH = 'cheat.plg' -CC = "arm-none-eabi-gcc" -CP = "arm-none-eabi-g++" -OC = "arm-none-eabi-objcopy" -LD = "arm-none-eabi-ld" -CTRULIB = '../libctru' DEVKITARM = os.environ['DEVKITARM'] +CC = DEVKITARM + "/bin/arm-none-eabi-gcc" +CP = DEVKITARM + "/bin/arm-none-eabi-g++" +OC = DEVKITARM + "/bin/arm-none-eabi-objcopy" +LD = DEVKITARM + "/bin/arm-none-eabi-ld" +CTRULIB = '../libctru' LIBPATH = '-L ' + DEVKITARM + '/lib/gcc/arm-none-eabi/5.3.0/' + ' -L ' + DEVKITARM + '/arm-none-eabi/lib/ -L obj' diff --git a/build.sh b/build.sh deleted file mode 100755 index bfd1d92..0000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash -PATH=$PATH:$DEVKITARM/bin -python3 build.py From cc1802a1a3ac5fa910158921e010efe49de271a0 Mon Sep 17 00:00:00 2001 From: 0none <0none@cumallover.me> Date: Fri, 14 Dec 2018 22:34:15 +0100 Subject: [PATCH 4/5] Forgot to change that back. --- build.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index d7a1afc..15de6ff 100644 --- a/build.py +++ b/build.py @@ -7,7 +7,9 @@ # the path plugin was copied to COPYTOPATH = 'cheat.plg' +# get devkitarm environment variable DEVKITARM = os.environ['DEVKITARM'] +# set paths to local compilers CC = DEVKITARM + "/bin/arm-none-eabi-gcc" CP = DEVKITARM + "/bin/arm-none-eabi-g++" OC = DEVKITARM + "/bin/arm-none-eabi-objcopy" @@ -15,7 +17,7 @@ CTRULIB = '../libctru' LIBPATH = '-L ' + DEVKITARM + '/lib/gcc/arm-none-eabi/5.3.0/' + ' -L ' + DEVKITARM + '/arm-none-eabi/lib/ -L obj' - +# define function to get all files in a folder based on pattern def allFile(pattern): s = ""; for file in glob.glob(pattern): @@ -26,16 +28,19 @@ def run(cmd): #print(cmd); os.system(cmd) -# Check if required folders exist +# check if required folders exist if not os.path.exists("obj"): os.makedirs("obj"); if not os.path.exists("bin"): os.makedirs("bin"); + +# actually build the thing cwd = os.getcwd() +# clean up files from previous build run("rm obj/*.o") run("rm bin/*.elf") -print(CC+ " -Os -s -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/battle/*.c') + allFile('source/rng/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian "); +run(CC+ " -Os -s -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/battle/*.c') + allFile('source/rng/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian "); run(CC+" -Os " + allFile('source/libntrplg/*.s') + allFile('source/ns/*.s') + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian "); run(LD + ' ' + LIBPATH + " -pie --print-gc-sections -T 3ds.ld -Map=homebrew.map " + allFile("*.o") + " " + allFile("lib/*.o") + " " + allFile("lib/*.a") + " -lc --nostdlib") From 41a5e6dae4149dea3794dacd974b529f14e14eef Mon Sep 17 00:00:00 2001 From: 0none <0none@cumallover.me> Date: Fri, 14 Dec 2018 22:41:03 +0100 Subject: [PATCH 5/5] added very basic makefile --- makefile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 makefile diff --git a/makefile b/makefile new file mode 100644 index 0000000..00e7300 --- /dev/null +++ b/makefile @@ -0,0 +1,2 @@ +PokemonCheatPlugin: + python3 build.py