This repository has been archived on 2022-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Luma3DS-3GX/injector/source/patcher.h

47 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <3ds/types.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))
2017-05-17 14:53:29 +02:00
#define CONFIG(a) (((info.config >> (a + 17)) & 1) != 0)
#define MULTICONFIG(a) ((info.config >> (a * 2 + 7)) & 3)
#define BOOTCONFIG(a, b) ((info.config >> a) & b)
#define LOADERFLAG(a) ((info.flags >> (a + 4)) & 1) != 0
2016-09-11 19:17:56 +02:00
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
2017-05-17 14:53:29 +02:00
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
2016-09-11 19:17:56 +02:00
enum multiOptions
{
DEFAULTEMU = 0,
BRIGHTNESS,
2016-09-19 14:03:55 +02:00
SPLASH,
2016-09-11 19:17:56 +02:00
PIN,
2017-04-13 03:38:36 +02:00
NEWCPU
2016-09-11 19:17:56 +02:00
};
2016-09-11 19:17:56 +02:00
enum singleOptions
{
2017-05-17 14:53:29 +02:00
AUTOBOOTEMU = 0,
USEEMUFIRM,
2016-10-08 01:52:04 +02:00
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
PATCHVERSTRING,
2016-09-11 19:17:56 +02:00
SHOWGBABOOT,
2017-03-05 14:03:15 +01:00
PATCHACCESS,
PATCHUNITINFO,
ENABLEEXCEPTIONHANDLERS
2016-09-11 19:17:56 +02:00
};
2016-09-08 18:53:21 +02:00
enum flags
{
ISN3DS = 0,
ISSAFEMODE,
ISSDMODE
};
void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 roSize, u32 dataSize, u32 roAddress, u32 dataAddress);