From abf7c8e565bec97310bad0df434e4806f8891d42 Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 29 Aug 2016 18:11:59 +0200 Subject: [PATCH] Replace pinKeyToLetter with a C implementation, minor cleanup --- injector/Makefile | 9 ++++----- injector/source/CFWInfo.h | 2 -- source/patches.c | 2 +- source/pin.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/injector/Makefile b/injector/Makefile index 1e96f56..6fa5844 100755 --- a/injector/Makefile +++ b/injector/Makefile @@ -22,10 +22,10 @@ LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include) -ARCH := -mcpu=mpcore -mfloat-abi=hard -mtp=soft -CFLAGS := -Wall -Wextra -MMD -MP -marm $(ARCH) -fno-builtin -std=c11 -O2 -flto -ffast-math -mword-relocations \ +ASFLAGS := -mcpu=mpcore -mfloat-abi=hard -mtp=soft +CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -std=c11 -O2 -flto -ffast-math -mword-relocations \ -ffunction-sections -fdata-sections $(INCLUDE) -DARM11 -D_3DS -LDFLAGS := -Xlinker --defsym="__start__=0x14000000" -specs=3dsx.specs $(ARCH) +LDFLAGS := -Xlinker --defsym="__start__=0x14000000" -specs=3dsx.specs $(ASFLAGS) objects = $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \ $(call rwildcard, $(dir_source), *.s *.c)) @@ -51,6 +51,5 @@ $(dir_build)/%.o: $(dir_source)/%.c $(dir_build)/%.o: $(dir_source)/%.s @mkdir -p "$(@D)" - $(COMPILE.c) $(OUTPUT_OPTION) $< - + $(COMPILE.s) $(OUTPUT_OPTION) $< include $(call rwildcard, $(dir_build), *.d) diff --git a/injector/source/CFWInfo.h b/injector/source/CFWInfo.h index 0e9d63f..bf2c489 100644 --- a/injector/source/CFWInfo.h +++ b/injector/source/CFWInfo.h @@ -1,7 +1,5 @@ #pragma once -#include <3ds.h> - typedef struct __attribute__((packed)) { char magic[4]; diff --git a/source/patches.c b/source/patches.c index 4cb4ef3..b6f3e5b 100644 --- a/source/patches.c +++ b/source/patches.c @@ -216,7 +216,7 @@ void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType) void patchTwlBg(u8 *pos) { - u8 *dst = pos + (isN3DS ? 0xFEA4 : 0xFCA0); + u8 *dst = pos + (isN3DS ? 0xFEA4 : 0xFCA0); memcpy(dst, twl_k11modules, twl_k11modules_size); //Install K11 hook diff --git a/source/pin.c b/source/pin.c index 1ea64e8..0f52200 100644 --- a/source/pin.c +++ b/source/pin.c @@ -39,7 +39,7 @@ static char pinKeyToLetter(u32 pressed) const char keys[] = "AB--------XY"; u32 i; - __asm__ volatile("clz %[i], %[pressed]" : [i] "=r" (i) : [pressed] "r" (pressed)); + for(i = 31; pressed > 1; i--) pressed /= 2; return keys[31 - i]; }