Merge branch 'master' into developer
Conflicts: source/firm.c source/patches.c source/patches.h
This commit is contained in:
commit
a13fdeecf6
@ -19,18 +19,6 @@ typedef struct __attribute__((packed))
|
|||||||
|
|
||||||
CFWInfo info = {0};
|
CFWInfo info = {0};
|
||||||
|
|
||||||
int __attribute__((naked)) svcGetCFWInfo(CFWInfo __attribute__((unused)) *out)
|
|
||||||
{
|
|
||||||
__asm__ volatile("svc 0x2E; bx lr");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadCFWInfo(void)
|
|
||||||
{
|
|
||||||
static bool infoLoaded = false;
|
|
||||||
if(!infoLoaded) svcGetCFWInfo(&info);
|
|
||||||
infoLoaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 255
|
#define PATH_MAX 255
|
||||||
#define CONFIG(a) (((info.config >> (a + 16)) & 1) != 0)
|
#define CONFIG(a) (((info.config >> (a + 16)) & 1) != 0)
|
||||||
@ -118,6 +106,26 @@ static int fileOpen(IFile *file, FS_ArchiveID archiveId, const char *path, int f
|
|||||||
return IFile_Open(file, archiveId, archivePath, filePath, flags);
|
return IFile_Open(file, archiveId, archivePath, filePath, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __attribute__((naked)) svcGetCFWInfo(CFWInfo __attribute__((unused)) *out)
|
||||||
|
{
|
||||||
|
__asm__ volatile("svc 0x2E; bx lr");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void loadCFWInfo(void)
|
||||||
|
{
|
||||||
|
static bool infoLoaded = false;
|
||||||
|
if(!infoLoaded)
|
||||||
|
{
|
||||||
|
svcGetCFWInfo(&info);
|
||||||
|
IFile file;
|
||||||
|
if(R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ))) //init SD card for firmlaunch patches
|
||||||
|
{
|
||||||
|
IFile_Close(&file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
infoLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool secureInfoExists(void)
|
static bool secureInfoExists(void)
|
||||||
{
|
{
|
||||||
static bool exists = false;
|
static bool exists = false;
|
||||||
|
@ -43,7 +43,7 @@ static inline int strlen(const char *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
|
||||||
if(getFileSize("/luma/splash.bin") + getFileSize("/luma/splash.bin") == 0)
|
if(getFileSize("/luma/splash.bin") + getFileSize("/luma/splashbottom.bin") == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
initScreens();
|
initScreens();
|
||||||
|
@ -397,7 +397,7 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType)
|
|||||||
u8 *pos = arm11Section0, *end = pos + section[0].size;
|
u8 *pos = arm11Section0, *end = pos + section[0].size;
|
||||||
u32 n = 0;
|
u32 n = 0;
|
||||||
|
|
||||||
u32 loaderIndex = 0;
|
u32 loaderIndex = 0, twlBgIndex = 0;
|
||||||
|
|
||||||
while(pos < end)
|
while(pos < end)
|
||||||
{
|
{
|
||||||
@ -421,20 +421,35 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(firmType == NATIVE_FIRM && memcmp(modules[n].name, "loader", 7) == 0) loaderIndex = n;
|
if(firmType == NATIVE_FIRM && memcmp(modules[n].name, "loader", 7) == 0) loaderIndex = n;
|
||||||
|
else if(firmType == TWL_FIRM && memcmp(modules[n].name, "TwlBg", 6) == 0) twlBgIndex = n;
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 twlBgSize = 0;
|
||||||
|
|
||||||
if(firmType == NATIVE_FIRM && modules[loaderIndex].addr != NULL)
|
if(firmType == NATIVE_FIRM && modules[loaderIndex].addr != NULL)
|
||||||
{
|
{
|
||||||
modules[loaderIndex].size = injector_size;
|
modules[loaderIndex].size = injector_size;
|
||||||
modules[loaderIndex].addr = injector;
|
modules[loaderIndex].addr = injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(firmType == TWL_FIRM)
|
||||||
|
{
|
||||||
|
twlBgSize = getFileSize("/luma/TwlBg.cxi");
|
||||||
|
if(twlBgSize != 0)
|
||||||
|
{
|
||||||
|
modules[twlBgIndex].size = twlBgSize;
|
||||||
|
modules[twlBgIndex].addr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pos = section[0].address;
|
pos = section[0].address;
|
||||||
for(u32 i = 0; i < n; i++)
|
for(u32 i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if(modules[i].addr != NULL)
|
if(firmType == TWL_FIRM && i == twlBgIndex && twlBgSize != 0)
|
||||||
|
fileRead(pos, "/luma/TwlBg.cxi");
|
||||||
|
else if(modules[i].addr != NULL)
|
||||||
memcpy(pos, modules[i].addr, modules[i].size);
|
memcpy(pos, modules[i].addr, modules[i].size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -53,5 +53,4 @@ void patchP9AccessChecks(u8 *pos, u32 size);
|
|||||||
void patchUnitInfoValueSet(u8 *pos, u32 size);
|
void patchUnitInfoValueSet(u8 *pos, u32 size);
|
||||||
void reimplementSvcBackdoor(u8 *pos, u32 size);
|
void reimplementSvcBackdoor(u8 *pos, u32 size);
|
||||||
void implementSvcGetCFWInfo(u8 *pos, u32 size);
|
void implementSvcGetCFWInfo(u8 *pos, u32 size);
|
||||||
void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType);
|
void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType);
|
||||||
u8 *getUnitInfoValueSet(u8 *pos, u32 size);
|
|
Reference in New Issue
Block a user