Replace pinKeyToLetter with a C implementation, minor cleanup
This commit is contained in:
parent
46227e6763
commit
abf7c8e565
@ -22,10 +22,10 @@ LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
|||||||
|
|
||||||
INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include)
|
INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include)
|
||||||
|
|
||||||
ARCH := -mcpu=mpcore -mfloat-abi=hard -mtp=soft
|
ASFLAGS := -mcpu=mpcore -mfloat-abi=hard -mtp=soft
|
||||||
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ARCH) -fno-builtin -std=c11 -O2 -flto -ffast-math -mword-relocations \
|
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
|
-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, \
|
objects = $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
|
||||||
$(call rwildcard, $(dir_source), *.s *.c))
|
$(call rwildcard, $(dir_source), *.s *.c))
|
||||||
@ -51,6 +51,5 @@ $(dir_build)/%.o: $(dir_source)/%.c
|
|||||||
|
|
||||||
$(dir_build)/%.o: $(dir_source)/%.s
|
$(dir_build)/%.o: $(dir_source)/%.s
|
||||||
@mkdir -p "$(@D)"
|
@mkdir -p "$(@D)"
|
||||||
$(COMPILE.c) $(OUTPUT_OPTION) $<
|
$(COMPILE.s) $(OUTPUT_OPTION) $<
|
||||||
|
|
||||||
include $(call rwildcard, $(dir_build), *.d)
|
include $(call rwildcard, $(dir_build), *.d)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <3ds.h>
|
|
||||||
|
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
char magic[4];
|
char magic[4];
|
||||||
|
@ -39,7 +39,7 @@ static char pinKeyToLetter(u32 pressed)
|
|||||||
const char keys[] = "AB--------XY";
|
const char keys[] = "AB--------XY";
|
||||||
|
|
||||||
u32 i;
|
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];
|
return keys[31 - i];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user