Fix some of the bugs

This commit is contained in:
TuxSH 2018-05-26 12:25:24 +02:00
parent a65f7fbf88
commit f3b2a6c30d
7 changed files with 7 additions and 33 deletions

View File

@ -22,7 +22,7 @@ $(NAME)$(REVISION).zip: boot.firm exception_dump_parser
boot.firm: $(SUBFOLDERS) boot.firm: $(SUBFOLDERS)
@firmtool build $@ -D sysmodules/sysmodules.bin arm11/arm11.elf arm9/arm9.elf k11_extension/k11_extension.elf \ @firmtool build $@ -D sysmodules/sysmodules.bin arm11/arm11.elf arm9/arm9.elf k11_extension/k11_extension.elf \
-A 0x18180000 0x18000000 -C XDMA XDMA NDMA XDMA -A 0x18180000 -C XDMA XDMA NDMA XDMA
@echo built... $(notdir $@) @echo built... $(notdir $@)
$(SUBFOLDERS): $(SUBFOLDERS):

View File

@ -89,9 +89,7 @@ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export DEPSDIR := $(CURDIR)/$(BUILD) export DEPSDIR := $(CURDIR)/$(BUILD)
ifeq ($(strip $(APP_TITLE)),) export APP_TITLE := $(notdir $(TOPDIR)/..)
APP_TITLE := $(notdir $(OUTPUT))
endif
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))

View File

@ -36,6 +36,7 @@
#include "emunand.h" #include "emunand.h"
#include "utils.h" #include "utils.h"
#include "alignedseqmemcpy.h" #include "alignedseqmemcpy.h"
#include "strings.h"
#include "fatfs/sdmmc/sdmmc.h" #include "fatfs/sdmmc/sdmmc.h"
/**************************************************************** /****************************************************************
@ -581,9 +582,7 @@ void kernel9Loader(Arm9Bin *arm9Section)
u8 arm9BinSlot = k9lVersion == 0 ? 0x15 : 0x16; u8 arm9BinSlot = k9lVersion == 0 ? 0x15 : 0x16;
// Get size // Get size
u32 arm9SectionSize = 0; u32 arm9SectionSize = decAtoi(arm9Section->size, 8);
for(u32 i = 0; i < 8; i++)
arm9SectionSize = (arm9Section->size[i] - '0') + 10*arm9SectionSize;
//Set keyX //Set keyX
__attribute__((aligned(4))) u8 keyX[AES_BLOCK_SIZE]; __attribute__((aligned(4))) u8 keyX[AES_BLOCK_SIZE];

View File

@ -36,6 +36,7 @@
#include "buttons.h" #include "buttons.h"
#include "firm.h" #include "firm.h"
#include "crypto.h" #include "crypto.h"
#include "strings.h"
static FATFS sdFs, static FATFS sdFs,
nandFs; nandFs;
@ -272,10 +273,7 @@ u32 firmRead(void *dest, u32 firmType)
//Not a cxi //Not a cxi
if(info.fname[9] != 'a' || strlen(info.fname) != 12) continue; if(info.fname[9] != 'a' || strlen(info.fname) != 12) continue;
u32 tempVersion = 0; u32 tempVersion = hexAtoi(info.altname, 8);
char *tmp = info.fname;
for(u32 i = 0; i < 8 && *tmp != 0; tmp++, i++)
tempVersion = (*tmp > '9' ? (*tmp >= 'A' ? *tmp - 'A' : *tmp - 'a') + 10 : *tmp - '0') + (tempVersion << 4);
//Found an older cxi //Found an older cxi
if(tempVersion < firmVersion) firmVersion = tempVersion; if(tempVersion < firmVersion) firmVersion = tempVersion;

View File

@ -25,25 +25,6 @@
*/ */
#include "strings.h" #include "strings.h"
#include "memory.h"
u32 strlen(const char *string)
{
char *stringEnd = (char *)string;
while(*stringEnd != 0) stringEnd++;
return stringEnd - string;
}
u32 strnlen(const char *string, u32 maxlen)
{
u32 size;
for(size = 0; size < maxlen && *string; string++, size++);
return size;
}
u32 hexAtoi(const char *in, u32 digits) u32 hexAtoi(const char *in, u32 digits)
{ {

View File

@ -28,7 +28,5 @@
#include "types.h" #include "types.h"
u32 strlen(const char *string);
u32 strnlen(const char *string, u32 maxlen);
u32 hexAtoi(const char *in, u32 digits); u32 hexAtoi(const char *in, u32 digits);
u32 decAtoi(const char *in, u32 digits); u32 decAtoi(const char *in, u32 digits);

View File

@ -110,7 +110,7 @@ SECTIONS
*(.bss.*) *(.bss.*)
*(.gnu.linkonce.b*) *(.gnu.linkonce.b*)
*(COMMON) *(COMMON)
. = ALIGN(8); . = ALIGN(0x1000);
PROVIDE (__bss_end__ = ABSOLUTE(.)); PROVIDE (__bss_end__ = ABSOLUTE(.));
PROVIDE (__end__ = ABSOLUTE(.)); PROVIDE (__end__ = ABSOLUTE(.));
} >main :NONE } >main :NONE