Bye bye fileSize!
This commit is contained in:
commit
180b2a6f4d
12
Makefile
12
Makefile
@ -48,10 +48,7 @@ a9lh: $(dir_out)/arm9loaderhax.bin
|
||||
ninjhax: $(dir_out)/3ds/$(name)
|
||||
|
||||
.PHONY: release
|
||||
release: $(dir_out)/$(name).zip
|
||||
|
||||
.PHONY: pathchanger
|
||||
pathchanger: $(dir_out)/pathchanger
|
||||
release: $(dir_out)/$(name)$(version).7z
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@ -65,9 +62,6 @@ clean:
|
||||
$(dir_out):
|
||||
@mkdir -p "$(dir_out)/aurei/payloads"
|
||||
|
||||
$(dir_out)/pathchanger: $(dir_out)
|
||||
@cc pathchanger/pathchanger.c -o out/pathchanger
|
||||
|
||||
$(dir_out)/$(name).dat: $(dir_build)/main.bin $(dir_out)
|
||||
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
||||
@dd if=$(dir_build)/main.bin of=$@ bs=512 seek=144
|
||||
@ -80,8 +74,8 @@ $(dir_out)/3ds/$(name): $(dir_out)
|
||||
@$(MAKE) $(FLAGS) -C $(dir_ninjhax)
|
||||
@mv $(dir_out)/$(name).3dsx $(dir_out)/$(name).smdh $@
|
||||
|
||||
$(dir_out)/$(name).zip: launcher a9lh ninjhax
|
||||
@cd "$(@D)" && zip -9 -r $(name) *
|
||||
$(dir_out)/$(name)$(version).7z: launcher a9lh ninjhax
|
||||
@7z a -mx $@ ./$(@D)/*
|
||||
|
||||
$(dir_build)/main.bin: $(dir_build)/main.elf
|
||||
$(OC) -S -O binary $< $@
|
||||
|
@ -194,24 +194,10 @@ static inline void loadFirm(u32 firmType, u32 externalFirm)
|
||||
{
|
||||
section = firm->section;
|
||||
|
||||
u32 firmSize;
|
||||
|
||||
if(externalFirm)
|
||||
{
|
||||
const char path[] = "/aurei/firmware.bin";
|
||||
firmSize = fileSize(path);
|
||||
|
||||
if(firmSize)
|
||||
{
|
||||
fileRead(firm, path, firmSize);
|
||||
|
||||
//Check that the loaded FIRM matches the console
|
||||
if((((u32)section[2].address >> 8) & 0xFF) != (console ? 0x60 : 0x68)) firmSize = 0;
|
||||
}
|
||||
}
|
||||
else firmSize = 0;
|
||||
|
||||
if(!firmSize)
|
||||
/* If the conditions to load the external FIRM aren't met, or reading fails, or the FIRM
|
||||
doesn't match the console, load it from CTRNAND */
|
||||
if(!externalFirm || !fileRead(firm, "/aurei/firmware.bin", 0) ||
|
||||
(((u32)section[2].address >> 8) & 0xFF) != (console ? 0x60 : 0x68))
|
||||
{
|
||||
const char *firmFolders[3][2] = {{ "00000002", "20000002" },
|
||||
{ "00000102", "20000102" },
|
||||
@ -383,7 +369,8 @@ static inline void patchTwlAgbFirm(u32 firmType)
|
||||
|
||||
/* Calculate the amount of patches to apply. Only count the boot screen patch for AGB_FIRM
|
||||
if the matching option was enabled (keep it as last) */
|
||||
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) : (sizeof(agbPatches) / sizeof(patchData) - !CONFIG(7));
|
||||
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) :
|
||||
(sizeof(agbPatches) / sizeof(patchData) - !CONFIG(7));
|
||||
const patchData *patches = firmType == 1 ? twlPatches : agbPatches;
|
||||
|
||||
//Patch
|
||||
|
13
source/fs.c
13
source/fs.c
@ -51,19 +51,6 @@ u32 fileWrite(const void *buffer, const char *path, u32 size)
|
||||
return fr ? 0 : 1;
|
||||
}
|
||||
|
||||
u32 fileSize(const char *path)
|
||||
{
|
||||
FIL fp;
|
||||
u32 size = 0;
|
||||
|
||||
if(f_open(&fp, path, FA_READ) == FR_OK)
|
||||
size = f_size(&fp);
|
||||
|
||||
f_close(&fp);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 defPayloadExists(void)
|
||||
{
|
||||
DIR dir;
|
||||
|
@ -11,6 +11,5 @@
|
||||
u32 mountFs(void);
|
||||
u32 fileRead(void *dest, const char *path, u32 size);
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size);
|
||||
u32 fileSize(const char *path);
|
||||
u32 defPayloadExists(void);
|
||||
void firmRead(void *dest, const char *firmFolder);
|
Reference in New Issue
Block a user