Merge master into developer, use the new string functions
This commit is contained in:
commit
8fc797120f
7
Makefile
7
Makefile
@ -36,7 +36,8 @@ objects = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \
|
|||||||
$(call rwildcard, $(dir_source), *.s *.c)))
|
$(call rwildcard, $(dir_source), *.s *.c)))
|
||||||
|
|
||||||
bundled = $(dir_build)/rebootpatch.h $(dir_build)/emunandpatch.h $(dir_build)/k11modulespatch.h $(dir_build)/svcGetCFWInfopatch.h $(dir_build)/twl_k11modulespatch.h \
|
bundled = $(dir_build)/rebootpatch.h $(dir_build)/emunandpatch.h $(dir_build)/k11modulespatch.h $(dir_build)/svcGetCFWInfopatch.h $(dir_build)/twl_k11modulespatch.h \
|
||||||
$(dir_build)/arm9_exceptions.h $(dir_build)/arm11_exceptions.h $(dir_build)/injector.h $(dir_build)/loader.h
|
$(dir_build)/arm9_exceptions.h $(dir_build)/arm11_exceptions.h $(dir_build)/injector.h $(dir_build)/loader.h
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: launcher a9lh ninjhax
|
all: launcher a9lh ninjhax
|
||||||
|
|
||||||
@ -127,8 +128,8 @@ $(dir_build)/arm9_exceptions.h: $(dir_arm9_exceptions)/Makefile
|
|||||||
$(dir_build)/arm11_exceptions.h: $(dir_arm11_exceptions)/Makefile
|
$(dir_build)/arm11_exceptions.h: $(dir_arm11_exceptions)/Makefile
|
||||||
@$(MAKE) -C $(dir_arm11_exceptions)
|
@$(MAKE) -C $(dir_arm11_exceptions)
|
||||||
@bin2c -o $@ -n arm11_exceptions $(@D)/arm11_exceptions.bin
|
@bin2c -o $@ -n arm11_exceptions $(@D)/arm11_exceptions.bin
|
||||||
|
|
||||||
$(dir_build)/memory.o: CFLAGS += -O3
|
$(dir_build)/memory.o $(dir_build)/strings.o: CFLAGS += -O3
|
||||||
$(dir_build)/config.o: CFLAGS += -DCONFIG_TITLE="\"$(name) $(revision) (dev) configuration\""
|
$(dir_build)/config.o: CFLAGS += -DCONFIG_TITLE="\"$(name) $(revision) (dev) configuration\""
|
||||||
$(dir_build)/patches.o: CFLAGS += -DREVISION=\"$(revision)\" -DCOMMIT_HASH="0x$(commit)"
|
$(dir_build)/patches.o: CFLAGS += -DREVISION=\"$(revision)\" -DCOMMIT_HASH="0x$(commit)"
|
||||||
|
|
||||||
|
@ -26,20 +26,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
#include "strings.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
static inline int strlen(const char *string)
|
|
||||||
{
|
|
||||||
char *stringEnd = (char *)string;
|
|
||||||
|
|
||||||
while(*stringEnd) stringEnd++;
|
|
||||||
|
|
||||||
return stringEnd - string;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool loadSplash(void)
|
bool loadSplash(void)
|
||||||
{
|
{
|
||||||
//Don't delay boot nor init the screens if no splash image is on the SD
|
//Don't delay boot nor init the screens if no splash image is on the SD
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#include "strings.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
@ -103,23 +104,12 @@ void detectAndProcessExceptionDumps(void)
|
|||||||
char fileName[] = "crash_dump_00000000.dmp";
|
char fileName[] = "crash_dump_00000000.dmp";
|
||||||
u32 size = dumpHeader->totalSize;
|
u32 size = dumpHeader->totalSize;
|
||||||
|
|
||||||
char *pathFolder;
|
char *pathFolder = dumpHeader->processor == 9 ? "/luma/dumps/arm9" : "/luma/dumps/arm11";
|
||||||
u32 fileNameSpot;
|
|
||||||
if(dumpHeader->processor == 9)
|
|
||||||
{
|
|
||||||
pathFolder = "/luma/dumps/arm9";
|
|
||||||
fileNameSpot = 16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pathFolder = "/luma/dumps/arm11";
|
|
||||||
fileNameSpot = 17;
|
|
||||||
}
|
|
||||||
|
|
||||||
findDumpFile(pathFolder, fileName);
|
findDumpFile(pathFolder, fileName);
|
||||||
memcpy(path, pathFolder, 17);
|
memcpy(path, pathFolder, strlen(pathFolder));
|
||||||
path[fileNameSpot] = '/';
|
concatenateStrings(path, "/");
|
||||||
memcpy(&path[fileNameSpot + 1], fileName, sizeof(fileName));
|
concatenateStrings(path, fileName);
|
||||||
|
|
||||||
fileWrite((void *)dumpHeader, path, size);
|
fileWrite((void *)dumpHeader, path, size);
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "patches.h"
|
#include "patches.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "strings.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "emunand.h"
|
#include "emunand.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
@ -436,10 +437,8 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType)
|
|||||||
const char *ext = ".cxi";
|
const char *ext = ".cxi";
|
||||||
|
|
||||||
//Read modules from files if they exist
|
//Read modules from files if they exist
|
||||||
u32 nameOff;
|
concatenateStrings(fileName, moduleName);
|
||||||
for(nameOff = 0; nameOff < 8 && moduleName[nameOff] != 0; nameOff++);
|
concatenateStrings(fileName, ext);
|
||||||
memcpy(fileName + 17, moduleName, nameOff);
|
|
||||||
memcpy(fileName + 17 + nameOff, ext, 5);
|
|
||||||
|
|
||||||
u32 fileSize = fileRead(dst, fileName);
|
u32 fileSize = fileRead(dst, fileName);
|
||||||
if(fileSize) dstModuleSize = fileSize;
|
if(fileSize) dstModuleSize = fileSize;
|
||||||
|
12
source/fs.c
12
source/fs.c
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "strings.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "fatfs/ff.h"
|
#include "fatfs/ff.h"
|
||||||
@ -128,8 +129,8 @@ void loadPayload(u32 pressed)
|
|||||||
|
|
||||||
memcpy(loaderAddress, loader, loader_size);
|
memcpy(loaderAddress, loader, loader_size);
|
||||||
|
|
||||||
path[14] = '/';
|
concatenateStrings(path, "/");
|
||||||
memcpy(&path[15], info.altname, 13);
|
concatenateStrings(path, info.altname);
|
||||||
|
|
||||||
loaderAddress[1] = fileRead((void *)0x24F00000, path);
|
loaderAddress[1] = fileRead((void *)0x24F00000, path);
|
||||||
|
|
||||||
@ -149,8 +150,9 @@ u32 firmRead(void *dest, u32 firmType)
|
|||||||
{ "00000202", "20000202" },
|
{ "00000202", "20000202" },
|
||||||
{ "00000003", "20000003" }};
|
{ "00000003", "20000003" }};
|
||||||
|
|
||||||
char path[48] = "1:/title/00040138/00000000/content";
|
char path[48] = "1:/title/00040138/";
|
||||||
memcpy(&path[18], firmFolders[firmType][isN3DS ? 1 : 0], 8);
|
concatenateStrings(path, firmFolders[firmType][isN3DS ? 1 : 0]);
|
||||||
|
concatenateStrings(path, "/content");
|
||||||
|
|
||||||
DIR dir;
|
DIR dir;
|
||||||
FILINFO info;
|
FILINFO info;
|
||||||
@ -180,7 +182,7 @@ u32 firmRead(void *dest, u32 firmType)
|
|||||||
f_closedir(&dir);
|
f_closedir(&dir);
|
||||||
|
|
||||||
//Complete the string with the .app name
|
//Complete the string with the .app name
|
||||||
memcpy(&path[34], "/00000000.app", 14);
|
concatenateStrings(path, "/00000000.app");
|
||||||
|
|
||||||
//Last digit of the .app
|
//Last digit of the .app
|
||||||
u32 i = 42;
|
u32 i = 42;
|
||||||
|
41
source/strings.c
Normal file
41
source/strings.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Luma3DS
|
||||||
|
* Copyright (C) 2016 Aurora Wright, TuxSH
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Additional Terms 7.b of GPLv3 applies to this file: Requiring preservation of specified
|
||||||
|
* reasonable legal notices or author attributions in that material or in the Appropriate Legal
|
||||||
|
* Notices displayed by works containing it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "strings.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
int strlen(const char *string)
|
||||||
|
{
|
||||||
|
char *stringEnd = (char *)string;
|
||||||
|
|
||||||
|
while(*stringEnd) stringEnd++;
|
||||||
|
|
||||||
|
return stringEnd - string;
|
||||||
|
}
|
||||||
|
|
||||||
|
void concatenateStrings(char *destination, const char *source)
|
||||||
|
{
|
||||||
|
int i = strlen(source),
|
||||||
|
j = strlen(destination);
|
||||||
|
|
||||||
|
memcpy(&destination[j], source, i + 1);
|
||||||
|
}
|
28
source/strings.h
Normal file
28
source/strings.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Luma3DS
|
||||||
|
* Copyright (C) 2016 Aurora Wright, TuxSH
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Additional Terms 7.b of GPLv3 applies to this file: Requiring preservation of specified
|
||||||
|
* reasonable legal notices or author attributions in that material or in the Appropriate Legal
|
||||||
|
* Notices displayed by works containing it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
int strlen(const char *string);
|
||||||
|
void concatenateStrings(char *destination, const char *source);
|
Reference in New Issue
Block a user