Replace pinKeyToLetter with a C implementation, minor cleanup

This commit is contained in:
Aurora 2016-08-29 18:11:59 +02:00
parent 46227e6763
commit abf7c8e565
4 changed files with 6 additions and 9 deletions

View File

@ -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)

View File

@ -1,7 +1,5 @@
#pragma once
#include <3ds.h>
typedef struct __attribute__((packed))
{
char magic[4];

View File

@ -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

View File

@ -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];
}