1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-14 02:16:10 +00:00

Move IMPORT macro to saltysd_helper.h

This commit is contained in:
jam1garner 2019-03-26 22:55:08 -04:00
parent d37d380677
commit c763b3704a
3 changed files with 10 additions and 8 deletions

View file

@ -21,10 +21,6 @@
#include "l2c_imports.h"
#include "acmd_imports.h"
u64 ANCHOR_REL;
u64 ANCHOR_ABS;
#define IMPORT(x) (x - ANCHOR_REL + ANCHOR_ABS)
u32 __nx_applet_type = AppletType_None;
static char g_heap[0x8000];
@ -171,17 +167,14 @@ void _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace(__int64_t a1) {
*(__int32_t *)(v2 + 8) = 0;
}
*(__int64_t *)(v1 + 16) = i;
}
int main(int argc, char *argv[])
{
SaltySD_printf("SaltySD Plugin: alive\n");
// Get anchor for imports
ANCHOR_REL = 0x7101942070;
ANCHOR_ABS = SaltySDCore_FindSymbol("_ZN3app10sv_animcmd6ATTACKEP9lua_State");
ANCHOR_ABS = SaltySDCore_getCodeStart();
// Get necessary functions
app_sv_animcmd_EFFECT_FOLLOW_COLOR = (__int64_t (*)(__int64_t))(IMPORT(0x7101955F10));

View file

@ -3,6 +3,8 @@
#include "saltysd_ipc.h"
#include "saltysd_dynamic.h"
u64 ANCHOR_ABS;
int SaltySD_function_replace(u64 addr, u64 new_func) {
if (addr) {
SaltySD_Memcpy(addr, "\x49\x00\x00\x58", 4); // LDR X9, .+8

View file

@ -1,3 +1,10 @@
#include <switch.h>
#define ANCHOR_REL 0x7100000000
u64 ANCHOR_ABS;
#define IMPORT(x) (x - ANCHOR_REL + ANCHOR_ABS)
int SaltySD_function_replace(u64 addr, u64 new_func);
int SaltySD_function_replace_sym(char* function_sym, u64 new_func);