]> Chaos Git - corbenik/corbenik.git/commitdiff
Porting to am
authorchaoskagami <chaos.kagami@gmail.com>
Mon, 18 Jul 2016 02:01:19 +0000 (22:01 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Mon, 18 Jul 2016 02:01:19 +0000 (22:01 -0400)
49 files changed:
Makefile
Makefile.am [new file with mode: 0644]
common.mk [new file with mode: 0644]
configure.ac [new file with mode: 0644]
host/copy.sh
include/common.h [new file with mode: 0644]
include/config.h [moved from source/config.h with 100% similarity]
include/firm/decryptor.h [moved from source/firm/decryptor.h with 100% similarity]
include/firm/fcram.h [moved from source/firm/fcram.h with 100% similarity]
include/firm/firm.h [moved from source/firm/firm.h with 100% similarity]
include/firm/headers.h [moved from source/firm/headers.h with 100% similarity]
include/input.h [moved from source/input.h with 100% similarity]
include/interp.h [moved from source/interp.h with 100% similarity]
include/interrupt.h [moved from source/interrupt.h with 100% similarity]
include/patch/emunand.h [moved from source/patch/emunand.h with 100% similarity]
include/patch/patch_file.h [moved from source/patch/patch_file.h with 100% similarity]
include/patch_format.h [moved from source/patch_format.h with 100% similarity]
include/patcher.h [moved from source/patcher.h with 100% similarity]
include/screeninit.h [moved from source/screeninit.h with 100% similarity]
include/std/abort.h [moved from source/std/abort.h with 100% similarity]
include/std/draw.h [moved from source/std/draw.h with 100% similarity]
include/std/fs.h [moved from source/std/fs.h with 100% similarity]
include/std/memory.h [moved from source/std/memory.h with 100% similarity]
include/std/types.h [moved from source/std/types.h with 100% similarity]
include/std/unused.h [moved from source/std/unused.h with 100% similarity]
source/chain.c
source/common.h [deleted file]
source/config.c
source/display.c
source/firm/decryptor.c
source/firm/fcram.c
source/firm/firm.c
source/firm/version.c
source/input.c
source/interp.c
source/interrupt.c
source/main.c
source/menu.c
source/patch/emunand.c
source/patch/module.c
source/patch/reboot.c
source/patch/svc.c
source/patcher.c
source/screeninit.c
source/std/README.txt [deleted file]
source/std/abort.c
source/std/draw.c
source/std/fs.c
source/std/memory.c

index 5e31d6d2f079da9d5e34f1bef82ba9f55f1a586b..3f5cd622a8c7d91f3386ad8f2f7bfbbad0bc7c2c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,57 +1,9 @@
 rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
 
-# Only cygwin is maybe working on windows.
-PATH := $(PATH):$(DEVKITARM)/bin
-
-CROSS_CC := arm-none-eabi-gcc
-CROSS_AS := arm-none-eabi-as
-CROSS_LD := arm-none-eabi-ld
-CROSS_OC := arm-none-eabi-objcopy
-
-CC ?= gcc
-AS ?= as
-LD ?= ld
-OC ?= objcopy
-
-fw_name ?= Corbenik
-
-# If unset, the primary folder is /corbenik.
-fw_folder ?= corbenik
-
-# Other valid options:
-#  shadowhand
-#  cruel
-root ?= clusterfuck
-
-ifeq "$(root)" "clusterfuck"
-  PATHARGS := -DPATH_ROOT=\"\"
-  PATHARGS += -DPATH_DATA=\"/$(fw_folder)\"
-else ifeq "$(root)" "cruel"
-  PATHARGS := -DPATH_ROOT=\"/3ds/apps\"
-  PATHARGS += -DPATH_DATA=\"/3ds/appdata/$(fw_folder)\"
-else ifeq "$(root)" "shadowhand"
-  PATHARGS := -DPATH_ROOT=\"/homebrew/3ds\"
-  PATHARGS += -DPATH_DATA=\"/homebrew/3ds/$(fw_folder)\"
-endif
-
-dir_source := source
-dir_data   := data
-dir_build  := build
-dir_out    := out
-
-REVISION := $(shell git rev-parse HEAD | head -c10)+$(shell git rev-list --count HEAD)
-REL ?= master
-
-# Default to enabling chainloader.
-CHAINLOADER ?= 1
-
-CROSS_ASFLAGS := -mlittle-endian -mcpu=arm946e-s -march=armv5te
-CROSS_CFLAGS  := -MMD -MP -Wall -Wextra -Werror -fomit-frame-pointer -I$(shell pwd)/external/libctr9/out/include -Os $(ASFLAGS) -fshort-wchar -fno-builtin -std=gnu11 -DVERSION=\"$(REVISION)\" -DREL=\"$(REL)\" -DCHAINLOADER=$(CHAINLOADER) -DPATH_CFW=\"/$(fw_folder)\" -DFW_NAME=\"$(fw_name)\" $(PATHARGS)
-CROSS_FLAGS   := dir_out=$(abspath $(dir_out)) --no-print-directory
-CROSS_LDFLAGS := -nostdlib -Wl,-z,defs -lgcc -Wl,-Map,$(dir_build)/link.map -L$(shell pwd)/external/libctr9/out/lib -lctr9
-
-objects_cfw = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \
-                         $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
+include common.mk
+
+objects_cfw = $(patsubst %.s, %.o, \
+                         $(patsubst %.c, %.o, \
                          $(call rwildcard, $(dir_source), *.s *.c)))
 
 .PHONY: all
@@ -102,7 +54,7 @@ patch:
        make -C patch dir_out=$(dir_out) fw_name=$(fw_name) fw_folder=$(fw_folder) root=$(root)
 
 .PHONY: a9lh
-a9lh: $(dir_out)/arm9loaderhax.bin
+a9lh: $(dir_out)/main.bin
        mkdir -p $(dir_out)/$(fw_folder)/bits
 
 .PHONY: reformat
@@ -115,67 +67,23 @@ $(dir_out)/$(fw_folder)/locale: all
 
 .PHONY: clean
 clean:
-       rm -f host/{font-emit,font.h,font_prop.h,termfont.bin}
+       rm -f $(objects_cfw)
        cd external/libctr9 && git clean -fxd
        make -C external dir_out=$(dir_out) fw_folder=$(fw_folder) root=$(root) clean
        make -C patch dir_out=$(dir_out) fw_folder=$(fw_folder) root=$(root) clean
        make -C host/bdfe dir_out=$(dir_out) fw_folder=$(fw_folder) root=$(root) clean
        rm -rf $(dir_out) $(dir_build)
 
-.PHONY: $(dir_out)/arm9loaderhax.bin
-$(dir_out)/arm9loaderhax.bin: $(dir_build)/main.bin
-       @mkdir -p "$(dir_out)"
-       @cp -av $< $@
-
-$(dir_build)/main.bin: $(dir_build)/main.elf
-       $(CROSS_OC) $(CROSS_OCFLAGS) -S -O binary $< $@
-
-$(dir_build)/main.elf: $(objects_cfw)
-       $(CROSS_CC) -T linker.ld $(OUTPUT_OPTION) $^ $(CROSS_LDFLAGS)
-
-$(dir_build)/%.o: $(dir_source)/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c $(OUTPUT_OPTION) $<
-
-$(dir_build)/%.o: $(dir_source)/%.s
-       @mkdir -p "$(@D)"
-       $(CROSS_AS) $(CROSS_ASFLAGS) -c $(OUTPUT_OPTION) $<
-
-$(dir_build)/fatfs/%.o: $(dir_source)/fatfs/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c -Wno-unused-function $(OUTPUT_OPTION) $<
-
-$(dir_build)/fatfs/%.o: $(dir_source)/fatfs/%.s
-       @mkdir -p "$(@D)"
-       $(CROSS_AS) $(CROSS_ASFLAGS) -c $(OUTPUT_OPTION) $<
-
-$(dir_build)/std/%.o: $(dir_source)/std/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c -Wno-unused-function $(OUTPUT_OPTION) $<
-
-$(dir_build)/std/%.o: $(dir_source)/std/%.s
-       @mkdir -p "$(@D)"
-       $(CROSS_AS) $(CROSS_ASFLAGS) -c $(OUTPUT_OPTION) $<
-
-$(dir_build)/firm/%.o: $(dir_source)/firm/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c -Wno-unused-function $(OUTPUT_OPTION) $<
-
-$(dir_build)/firm/%.o: $(dir_source)/firm/%.s
-       @mkdir -p "$(@D)"
-       $(CROSS_AS) $(CROSS_ASFLAGS) -c $(OUTPUT_OPTION) $<
-
-$(dir_build)/patch/%.o: $(dir_source)/patch/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c -Wno-unused-function $(OUTPUT_OPTION) $<
+out/main.bin: out/main.elf
+       $(OC) $(OCFLAGS) -S -O binary $< $@
 
-$(dir_build)/patch/%.o: $(dir_source)/patch/%.s
-       @mkdir -p "$(@D)"
-       $(CROSS_AS) $(CROSS_ASFLAGS) -c $(OUTPUT_OPTION) $<
+out/main.elf: $(objects_cfw)
+       $(CC) $(LDFLAGS) -T linker.ld -o $@ $<
 
-$(dir_build)/misc/%.o: $(dir_source)/misc/%.c
-       @mkdir -p "$(@D)"
-       $(CROSS_CC) $(CROSS_CFLAGS) -c -Wno-unused-function $(OUTPUT_OPTION) $<
+%.o: %.c
+       $(CC) $(CFLAGS) -c -o $@ $<
 
+%.o: %.s
+       $(AS) $(ASFLAGS) -c -o $@ $<
 
 include $(call rwildcard, $(dir_build), *.d)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..4491836
--- /dev/null
@@ -0,0 +1,16 @@
+include common.mk
+
+corbenik_SOURCES = aes.c ctr_nand_crypto_interface.c ctr_sd_interface.c sha.c \
+       ctr_io_interface.c ctr_nand_interface.c sdmmc/delay.s sdmmc/sdmmc.c i2c.c \
+       ctr_rtc.c fatfs/diskio.c fatfs/ff.c fatfs/option/unicode.c ctr_system.c \
+       ctr_fatfs_interface.c fatfs/ctr_fatfs_disk.c ctr_disks.c \
+       fatfs/ctr_fatfs_disk.c ctr_fatfs.c ctr_interrupt.c ctr_system_ARM.c \
+       ctr_interrupt_asm.s ctr_screen.c ctr_hid.c ctr_pxi.c gamecart/command_ctr.c\
+       gamecart/command_ntr.c  gamecart/protocol.c  gamecart/protocol_ctr.c  \
+       gamecart/protocol_ntr.c ctr_cart_interface.c gamecart/delay.s ctr_headers.c \
+       ctr_timer.c ctr_irq.c ctr_system_clock.c
+
+
+includedirectory = include
+
+corbenik_HEADERS = $(includedirectory)/
diff --git a/common.mk b/common.mk
new file mode 100644 (file)
index 0000000..36cc9bc
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,67 @@
+INCPATHS=-I$(top_srcdir)/include
+C9FLAGS=-mcpu=arm946e-s -march=armv5te -mlittle-endian -mword-relocations
+
+SIZE_OPTIMIZATION = -Wl,--gc-sections -ffunction-sections
+
+CFLAGS= -std=gnu11 -O2 -g -fomit-frame-pointer -ffast-math \
+       -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual \
+       -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op \
+       -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls \
+       -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wswitch-default \
+       -Wundef -Wno-unused $(THUMBFLAGS) $(SIZE_OPTIMIZATION) $(INCPATHS) $(C9FLAGS) \
+       -I$(shell pwd)/external/libctr9/out/include -I$(shell pwd)/include -Os $(ASFLAGS) \
+       -fshort-wchar -fno-builtin -std=gnu11 -DVERSION=\"$(REVISION)\" -DREL=\"$(REL)\" \
+       -DCHAINLOADER=$(CHAINLOADER) -DPATH_CFW=\"/$(fw_folder)\" -DFW_NAME=\"$(fw_name)\" \
+       $(PATHARGS)
+
+
+LDFLAGS=-Wl,--use-blx,--pic-veneer,-q -nostdlib -Wl,-z,defs -lgcc \
+       -Wl,-Map,$(dir_out)/link.map -L$(shell pwd)/external/libctr9/out/lib -lctr9
+
+OCFLAGS=--set-section-flags .bss=alloc,load,contents
+
+# Only cygwin is maybe working on windows.
+PATH := $(PATH):$(DEVKITARM)/bin
+
+CC := arm-none-eabi-gcc
+AS := arm-none-eabi-as
+LD := arm-none-eabi-ld
+OC := arm-none-eabi-objcopy
+
+BUILD_CC ?= gcc
+BUILD_AS ?= as
+BUILD_LD ?= ld
+BUILD_OC ?= objcopy
+
+fw_name ?= Corbenik
+
+# If unset, the primary folder is /corbenik.
+fw_folder ?= corbenik
+
+# Other valid options:
+#  shadowhand
+#  cruel
+root ?= clusterfuck
+
+ifeq "$(root)" "clusterfuck"
+  PATHARGS := -DPATH_ROOT=\"\"
+  PATHARGS += -DPATH_DATA=\"/$(fw_folder)\"
+else ifeq "$(root)" "cruel"
+  PATHARGS := -DPATH_ROOT=\"/3ds/apps\"
+  PATHARGS += -DPATH_DATA=\"/3ds/appdata/$(fw_folder)\"
+else ifeq "$(root)" "shadowhand"
+  PATHARGS := -DPATH_ROOT=\"/homebrew/3ds\"
+  PATHARGS += -DPATH_DATA=\"/homebrew/3ds/$(fw_folder)\"
+endif
+
+dir_source := source
+dir_data   := data
+dir_build  := build
+dir_out    := out
+
+REVISION := $(shell git rev-parse HEAD | head -c10)+$(shell git rev-list --count HEAD)
+REL ?= master
+
+# Default to enabling chainloader.
+CHAINLOADER ?= 1
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..e64afe5
--- /dev/null
@@ -0,0 +1,15 @@
+AC_INIT([libctr9], [0.0.1], [], [])
+AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects])
+
+#Find AR and RANLIB for lto support before initializing libtool
+AC_CHECK_TOOL([AR],gcc-ar)
+AC_CHECK_TOOL([RANLIB],gcc-ranlib)
+LT_INIT
+
+AC_PROG_CC
+AM_PROG_AS
+AC_CHECK_TOOL([OBJCOPY],objcopy)
+
+AC_CONFIG_FILES([Makefile src/Makefile test/Makefile examples/Makefile])
+
+AC_OUTPUT
index cd53e5e1fe26c6410d019f41362b8a01caede630..38d6fa91e63dc26ef290289174156525fcd043fd 100755 (executable)
@@ -13,6 +13,8 @@ rm -rf $mnt/corbenik
 cp -r out/* $mnt/ || exit 0
 cp -r input/* $mnt/ || exit 0
 cp out/arm9loaderhax.bin $mnt/corbenik/chain/Corbenik || exit 0
+cp out/arm9loaderhax.bin $mnt/arm9loaderhax_si.bin || exit 0
+rm -f $mnt/arm9loaderhax.bin || exit 0
 umount $mnt || exit 0
 sync || exit 0
 eject ${dev} || exit 0
diff --git a/include/common.h b/include/common.h
new file mode 100644 (file)
index 0000000..df7e569
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef __COMMON_H
+#define __COMMON_H
+
+#include "std/types.h"
+#include "std/draw.h"
+#include "std/fs.h"
+#include "std/memory.h"
+#include "std/abort.h"
+#include "std/unused.h"
+
+#include "firm/fcram.h"
+#include "firm/headers.h"
+
+#include "patch_format.h"
+#include "config.h"
+#include "input.h"
+#include "patcher.h"
+
+#endif
+
+#include 
+<patch/emunand.h>
+#include 
+<patch/patch_file.h>
+#include 
+<std/memory.h>
+#include 
+<std/draw.h>
+#include 
+<std/abort.h>
+#include 
+<std/types.h>
+#include 
+<std/fs.h>
+#include 
+<std/unused.h>
+#include 
+<firm/decryptor.h>
+#include 
+<firm/headers.h>
+#include 
+<firm/firm.h>
+#include 
+<firm/fcram.h>
+#include 
+<screeninit.h>
+#include 
+<interrupt.h>
+#include 
+<config.h>
+#include 
+<input.h>
+#include 
+<interp.h>
+#include 
+<patch_format.h>
+#include <common.h>
+#include <patcher.h>
similarity index 100%
rename from source/config.h
rename to include/config.h
similarity index 100%
rename from source/firm/fcram.h
rename to include/firm/fcram.h
similarity index 100%
rename from source/firm/firm.h
rename to include/firm/firm.h
similarity index 100%
rename from source/firm/headers.h
rename to include/firm/headers.h
similarity index 100%
rename from source/input.h
rename to include/input.h
similarity index 100%
rename from source/interp.h
rename to include/interp.h
similarity index 100%
rename from source/interrupt.h
rename to include/interrupt.h
similarity index 100%
rename from source/patch_format.h
rename to include/patch_format.h
similarity index 100%
rename from source/patcher.h
rename to include/patcher.h
similarity index 100%
rename from source/screeninit.h
rename to include/screeninit.h
similarity index 100%
rename from source/std/abort.h
rename to include/std/abort.h
similarity index 100%
rename from source/std/draw.h
rename to include/std/draw.h
similarity index 100%
rename from source/std/fs.h
rename to include/std/fs.h
similarity index 100%
rename from source/std/memory.h
rename to include/std/memory.h
similarity index 100%
rename from source/std/types.h
rename to include/std/types.h
similarity index 100%
rename from source/std/unused.h
rename to include/std/unused.h
index 6f95a24b90d8ebf19b9b13d3f3d5b2b8acf461ac..10d52665bdf2b708c944766860721d2919ba1350 100644 (file)
@@ -1,9 +1,9 @@
 #if defined(CHAINLOADER) && CHAINLOADER == 1
 
-#include "common.h"
-#include "screeninit.h"
-#include "firm/firm.h"
-#include "firm/headers.h"
+#include <common.h>
+#include <screeninit.h>
+#include <firm/firm.h>
+#include <firm/headers.h>
 
 uint32_t current_chain_index = 0;
 
diff --git a/source/common.h b/source/common.h
deleted file mode 100644 (file)
index 4113dda..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __COMMON_H
-#define __COMMON_H
-
-#include "std/types.h"
-#include "std/draw.h"
-#include "std/fs.h"
-#include "std/memory.h"
-#include "std/abort.h"
-#include "std/unused.h"
-
-#include "firm/fcram.h"
-#include "firm/headers.h"
-
-#include "patch_format.h"
-#include "config.h"
-#include "input.h"
-#include "patcher.h"
-
-#endif
index b0bf8f10152d26c13e1afa92140562af2e14cddd..f0660936be591fd752b318a206e28ca3116bfbb3 100644 (file)
@@ -1,4 +1,4 @@
-#include "common.h"
+#include <common.h>
 
 FILE *conf_handle;
 
index 34cae21bbdad27519fd79fcdfd8f9a8ffb203a43..a58dd00d2ed086af5c17bddd7625f59c80acf217 100644 (file)
@@ -1,6 +1,4 @@
-#include "common.h"
-#include "firm/firm.h"
-#include "firm/headers.h"
+#include <common.h>
 
 void header(char *append);
 
index db47a6f9f35a685d286b9142fc515e7994256e62..099ecb514553aa30a44565e441a96e5bd468fbe9 100644 (file)
@@ -2,13 +2,10 @@
   This is all fairly minimal and based on @d0k3's decrypt9 code.
 */
 
-#include "../std/memory.h"
+#include <common.h>
 #include <ctr9/aes.h>
 #include <ctr9/sha.h>
 
-#include "firm.h"
-#include "decryptor.h"
-
 void
 ncch_getctr(const ncch_h *ncch, uint8_t *ctr, uint8_t type)
 {
@@ -53,19 +50,15 @@ aes_batch(void *dst, const void *src, uint32_t blockCount)
     while (rbc) {
         if (wbc && ((*REG_AESCNT & 0x1F) <= 0xC)) // There's space for at least 4 ints
         {
-            *REG_AESWRFIFO = *src32++;
-            *REG_AESWRFIFO = *src32++;
-            *REG_AESWRFIFO = *src32++;
-            *REG_AESWRFIFO = *src32++;
+                       for(int i=0; i < 4; i++)
+                   *REG_AESWRFIFO = *src32++;
             wbc--;
         }
 
         if (rbc && ((*REG_AESCNT & (0x1F << 0x5)) >= (0x4 << 0x5))) // At least 4 ints available for read
         {
-            *dst32++ = *REG_AESRDFIFO;
-            *dst32++ = *REG_AESRDFIFO;
-            *dst32++ = *REG_AESRDFIFO;
-            *dst32++ = *REG_AESRDFIFO;
+                       for(int i=0; i < 4; i++)
+                   *dst32++ = *REG_AESRDFIFO;
             rbc--;
         }
     }
index 7b81b3286003c83d1053ecbac08a638574c8c817..8b5d428189344ec85276b482ad639a3594cdd6e5 100644 (file)
@@ -1,4 +1,4 @@
-#include "fcram.h"
+#include <common.h>
 
 void *fcram_temp = (void *)0x23000000;
 
index d1db7cfab8bc82c18fcde8472f60613fa8a60583..0a54d640113b1141af8797f747c8b162fbe9ff04 100644 (file)
@@ -1,16 +1,10 @@
-#include "firm.h"
-
 #include <stdint.h>
 #include <stddef.h>
 
 #include <ctr9/io.h>
 #include <ctr9/aes.h>
 #include <ctr9/sha.h>
-
-#include "../common.h"
-#include <ctr9/io.h>
-
-#include "decryptor.h"
+#include <common.h>
 
 firm_h *firm_loc = (firm_h *)FCRAM_FIRM_LOC;
 uint32_t firm_size = FCRAM_SPACING;
index 4fd31822e06588e66be48ea580efaba388d92c16..a6663398fa6b7b7fc2426b236b698073dc7412fd 100644 (file)
@@ -1,5 +1,4 @@
-#include "firm.h"
-#include "../common.h"
+#include <common.h>
 
 // We use the firm's section 0's hash to identify the version
 struct firm_signature firm_signatures[] = {
index deb998b6c4e0b6c4463976c2b8d599373f115014..12978aa558770211df518d3b86ad5a52e7d1af53 100644 (file)
@@ -1,7 +1,5 @@
 #include <stdint.h>
-#include "std/unused.h"
-#include "std/draw.h"
-#include "input.h"
+#include <common.h>
 
 extern void waitcycles(uint32_t cycles);
 
index 35423e4884f6fa0de8d6ece4058cd48ecd68e01e..dbcfdba4fc5557ac14fd0249167719320cbcbd28 100644 (file)
@@ -3,11 +3,7 @@
 #include "std/unused.h"
 
 #ifndef LOADER
-  #include "std/memory.h"
-  #include "firm/firm.h"
-  #include "config.h"
-  #include "common.h"
-  #include "firm/fcram.h"
+  #include <common.h>
 #else
   #include <string.h>
 #endif
index 49f0847cefe7b556dabbe295bd4a8b12ba367c20..23753a77b2af6292cd236117aa371f8a3f4dc413 100644 (file)
@@ -1,5 +1,6 @@
-#include "common.h"
+#include <common.h>
 #include <ctr9/ctr_interrupt.h>
+#include <ctr9/ctr_irq.h>
 
 void dump_state_printf(uint32_t* regs) {
        fprintf(stderr, "  cpsr:%x sp:%x lr:%x\n"
@@ -40,10 +41,6 @@ void databrt_INT(uint32_t* regs) {
        abort("Cannot continue. Halting.\n");
 }
 
-void irq_INT(_UNUSED uint32_t* regs) {
-       fprintf(stderr, "IRQ called. Returning.\n");
-}
-
 void fiq_INT(_UNUSED uint32_t* regs) {
        fprintf(stderr, "FIQ called. Returning.\n");
 }
@@ -51,12 +48,12 @@ void fiq_INT(_UNUSED uint32_t* regs) {
 
 void install_interrupts() {
        ctr_interrupt_prepare();
+    ctr_irq_initialize();
 
     ctr_interrupt_set(CTR_INTERRUPT_RESET,   reset_INT);
     ctr_interrupt_set(CTR_INTERRUPT_UNDEF,   undef_INT);
     ctr_interrupt_set(CTR_INTERRUPT_SWI,     swi_INT);
     ctr_interrupt_set(CTR_INTERRUPT_PREABRT, preabrt_INT);
     ctr_interrupt_set(CTR_INTERRUPT_DATABRT, databrt_INT);
-    ctr_interrupt_set(CTR_INTERRUPT_IRQ,     irq_INT);
     ctr_interrupt_set(CTR_INTERRUPT_FIQ,     fiq_INT);
 }
index 172d1fc24f8966346e732eecab52724c0e6366b7..852a30f9802d9a6dd05bbb9b80784f19034d329d 100644 (file)
@@ -1,12 +1,6 @@
 #include <ctr9/ctr_hid.h>
 
-#include "common.h"
-#include "firm/firm.h"
-#include "input.h"
-#include "config.h"
-#include "screeninit.h"
-#include "std/abort.h"
-#include "interrupt.h"
+#include <common.h>
 
 int is_n3ds = 0;
 int doing_autoboot = 0;
index 61adc3166e10be606f34d41ecd455e09226e6ee2..d0111c0ba865f7341d9d0446e1d4f86582af2a1a 100644 (file)
@@ -1,8 +1,4 @@
-#include "common.h"
-#include "firm/firm.h"
-#include "firm/headers.h"
-#include "std/unused.h"
-
+#include <common.h>
 #include <ctr9/ctr_system.h>
 
 #define MAX_PATCHES ((FCRAM_SPACING / 2) / sizeof(struct options_s))
index fa4b236e4c976c6c1d9dd6b8be2d12d84529ccbe..7c0013261c67e56f1a9427aec016d3949ae26a3a 100644 (file)
@@ -2,17 +2,8 @@
 *   emunand.c
 */
 
-#include "emunand.h"
-#include "../std/memory.h"
-#include "../std/draw.h"
-#include "../std/fs.h"
-#include "../std/abort.h"
-#include "../firm/firm.h"
-#include "../firm/fcram.h"
 #include <ctr9/io.h>
-#include "../firm/headers.h"
-#include "../patch_format.h"
-#include "../config.h"
+#include <common.h>
 
 uint8_t *emunand_temp = (uint8_t *)FCRAM_JUNK_LOC;
 
index 08f3e96b22ff4b8dc76d9201234258eec225f1b3..264394496d2579e5e567634031c5dbdc32b4cb61 100644 (file)
@@ -1,4 +1,4 @@
-#include "patch_file.h"
+#include <common.h>
 
 /* Not possible to be implemented as bytecode. Hey, can't win em all. */
 
index df4fa71c08d996b25306476b332b87c7c3deaf2d..e787c6d64e2edae2f5e8f569c8d45f52f6666b17 100644 (file)
@@ -1,13 +1,5 @@
-#include "emunand.h"
-#include "../std/memory.h"
-#include "../std/draw.h"
-#include "../std/fs.h"
-#include "../std/abort.h"
-#include "../firm/firm.h"
-#include "../firm/fcram.h"
+#include <common.h>
 #include <ctr9/io.h>
-#include "../firm/headers.h"
-#include "../patch_format.h"
 
 int wait();
 
index dfb6e1fcf0f3607027991eb4b6f5ffaca61428a4..97cca8021049dce1711108591700332c28607ada 100644 (file)
@@ -1,4 +1,4 @@
-#include "patch_file.h"
+#include <common.h>
 
 uint8_t *arm11Section1 = NULL;
 uint32_t *svc_tab_open = NULL, *exceptionsPage = NULL, *svcTable = NULL;
index 3a3c277cf1b14e64e7b4570743b0d3a4e8f34969..2d6f9c56cd3b745921e08175997896b6c734fee1 100644 (file)
@@ -1,11 +1,5 @@
+#include <common.h>
 #include <stdint.h>
-#include "std/unused.h"
-#include "std/memory.h"
-#include "firm/firm.h"
-#include "config.h"
-#include "common.h"
-#include "interp.h"
-#include "patch/emunand.h"
 
 // TODO - Basically all this needs to move to patcher programs.
 
index 1108ff1becc49c55d5d9faa0108aa08d3faa53df..22e14ac4f3653a084486a59a6f8edd30a7785c39 100644 (file)
@@ -1,9 +1,7 @@
+#include <common.h>
 #include <ctr9/io.h>
 #include <ctr9/ctr_screen.h>
 #include <ctr9/i2c.h>
-#include "common.h"
-#include "std/fs.h"
-#include "patch_format.h"
 
 #define PDN_GPU_CNT (*(volatile uint8_t *)0x10141200)
 
diff --git a/source/std/README.txt b/source/std/README.txt
deleted file mode 100644 (file)
index 3dc3d2e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-This is (sort of) an implementation of C99 std. It is pathetically uncompliant but may be of interest to people wishing to have a usable 16-color printf function.
index 414e37a0dc57f7522c8fecb1763a7f89df05c988..d2179501347174523597284e7a011415c9a1e3a4 100644 (file)
@@ -2,7 +2,7 @@
 #define __ABORT_H
 
 #include <stdarg.h>
-#include "draw.h"
+#include <common.h>
 
 void poweroff();
 uint32_t wait_key(int sleep);
index b5f88649856ab9bf021d0eb7d9cd21ef7c0c6eea..8b6029788c0d14238c6f0cd59b3ce063b39c00a0 100644 (file)
@@ -1,16 +1,8 @@
-#include "draw.h"
-
 #include <stdint.h>
 #include <assert.h>
 #include <stdarg.h>
-#include "memory.h"
+#include <common.h>
 #include <ctr9/io.h>
-#include "../firm/fcram.h"
-#include "fs.h"
-#include "unused.h"
-#include "../config.h"
-#include "../patch_format.h"
-#include "abort.h"
 
 static unsigned int top_cursor_x = 0, top_cursor_y = 0;
 static unsigned int bottom_cursor_x = 0, bottom_cursor_y = 0;
index b2a13f1ac04c937ba309ae05856e93b74f37616b..e6c026054d4d3c7ef31608767805ff7c9e4bdfe8 100644 (file)
@@ -1,10 +1,6 @@
 #include <stddef.h>
-#include "fs.h"
-#include "memory.h"
 #include <ctr9/io.h>
-#include "draw.h"
-#include "memory.h"
-#include "../config.h"
+#include <common.h>
 
 // ctr_nand_crypto_interface ctr_io;
 // ctr_nand_crypto_interface twl_io;
index bb33b684a09247cc911d54089642dc5c3d33a0a5..d015daeca70ba4d22d843e4babe449b1c7194cf8 100644 (file)
@@ -1,4 +1,4 @@
-#include "memory.h"
+#include <common.h>
 
 #include <stdint.h>
 #include <stddef.h>