
When "load external firms and modules" is enabled, Loader will load the sysmodule from /luma/sysmodule/<titleid>.cxi (all uppercase, and with the N3DS title ID bit if relevant) and skip patching. Note that this is a title ID here, not a process name (unlike what we do for KIPs). While this is aimed at enabling people to easily load replacements for official sysmodules, you can load your own custom sysmodules that don't correspond to anything installed. You can use gdb to do so: set remote exec-file <tid> run
54 lines
1.6 KiB
C
54 lines
1.6 KiB
C
#pragma once
|
|
|
|
#include <3ds/types.h>
|
|
#include <3ds/exheader.h>
|
|
#include "ifile.h"
|
|
#include "util.h"
|
|
|
|
#define MAKE_BRANCH(src,dst) (0xEA000000 | ((u32)((((u8 *)(dst) - (u8 *)(src)) >> 2) - 2) & 0xFFFFFF))
|
|
#define MAKE_BRANCH_LINK(src,dst) (0xEB000000 | ((u32)((((u8 *)(dst) - (u8 *)(src)) >> 2) - 2) & 0xFFFFFF))
|
|
|
|
#define CONFIG(a) (((config >> (a)) & 1) != 0)
|
|
#define MULTICONFIG(a) ((multiConfig >> (2 * (a))) & 3)
|
|
#define BOOTCONFIG(a, b) ((bootConfig >> (a)) & (b))
|
|
|
|
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
|
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
|
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
|
|
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(7, 1)
|
|
|
|
enum multiOptions
|
|
{
|
|
DEFAULTEMU = 0,
|
|
BRIGHTNESS,
|
|
SPLASH,
|
|
PIN,
|
|
NEWCPU,
|
|
AUTOBOOTMODE,
|
|
};
|
|
|
|
enum singleOptions
|
|
{
|
|
AUTOBOOTEMU = 0,
|
|
USEEMUFIRM,
|
|
LOADEXTFIRMSANDMODULES,
|
|
PATCHGAMES,
|
|
PATCHVERSTRING,
|
|
SHOWGBABOOT,
|
|
PATCHUNITINFO,
|
|
DISABLEARM11EXCHANDLERS,
|
|
ENABLESAFEFIRMROSALINA,
|
|
};
|
|
|
|
extern u32 config, multiConfig, bootConfig;
|
|
extern bool isN3DS, isSdMode;
|
|
|
|
void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 roSize, u32 dataSize, u32 roAddress, u32 dataAddress);
|
|
bool loadTitleCodeSection(u64 progId, u8 *code, u32 size);
|
|
bool loadTitleExheaderInfo(u64 progId, ExHeader_Info *exheaderInfo);
|
|
|
|
Result openSysmoduleCxi(IFile *outFile, u64 progId);
|
|
bool readSysmoduleCxiNcchHeader(Ncch *outNcchHeader, IFile *file);
|
|
bool readSysmoduleCxiExHeaderInfo(ExHeader_Info *outExhi, const Ncch *ncchHeader, IFile *file);
|
|
bool readSysmoduleCxiCode(u8 *outCode, u32 *outSize, u32 maxSize, IFile *file, const Ncch *ncchHeader);
|