mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-07-11 05:16:43 +00:00
@ -2,14 +2,9 @@
|
|||||||
#include "saltysd_core.h"
|
#include "saltysd_core.h"
|
||||||
#include "saltysd_ipc.h"
|
#include "saltysd_ipc.h"
|
||||||
#include "saltysd_dynamic.h"
|
#include "saltysd_dynamic.h"
|
||||||
#include "acmd_imports.h"
|
#include "l2c_imports.h"
|
||||||
|
|
||||||
__int64_t (*lib_L2CAgent_pop_lua_stack)(__int64_t, int) = NULL;
|
|
||||||
|
|
||||||
void get_lua_stack(__int64_t* l2c_agent, int index, __int64_t* l2c_val) {
|
void get_lua_stack(__int64_t* l2c_agent, int index, __int64_t* l2c_val) {
|
||||||
if (lib_L2CAgent_pop_lua_stack == NULL)
|
|
||||||
lib_L2CAgent_pop_lua_stack = (__int64_t (*)(__int64_t, int))(SaltySDCore_FindSymbol("_ZN3lib8L2CAgent13pop_lua_stackEi"));
|
|
||||||
|
|
||||||
asm("mov x8, %x0" : : "r"(l2c_val) : "x8" );
|
asm("mov x8, %x0" : : "r"(l2c_val) : "x8" );
|
||||||
lib_L2CAgent_pop_lua_stack(l2c_agent, index);
|
lib_L2CAgent_pop_lua_stack(l2c_agent, index);
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
#include "l2c_imports.h"
|
#include "l2c_imports.h"
|
||||||
#include "acmd_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;
|
u32 __nx_applet_type = AppletType_None;
|
||||||
|
|
||||||
static char g_heap[0x8000];
|
static char g_heap[0x8000];
|
||||||
@ -171,17 +167,14 @@ void _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace(__int64_t a1) {
|
|||||||
*(__int32_t *)(v2 + 8) = 0;
|
*(__int32_t *)(v2 + 8) = 0;
|
||||||
}
|
}
|
||||||
*(__int64_t *)(v1 + 16) = i;
|
*(__int64_t *)(v1 + 16) = i;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SaltySD_printf("SaltySD Plugin: alive\n");
|
SaltySD_printf("SaltySD Plugin: alive\n");
|
||||||
|
|
||||||
// Get anchor for imports
|
// Get anchor for imports
|
||||||
ANCHOR_REL = 0x7101942070;
|
ANCHOR_ABS = SaltySDCore_getCodeStart();
|
||||||
ANCHOR_ABS = SaltySDCore_FindSymbol("_ZN3app10sv_animcmd6ATTACKEP9lua_State");
|
|
||||||
|
|
||||||
// Get necessary functions
|
// Get necessary functions
|
||||||
app_sv_animcmd_EFFECT_FOLLOW_COLOR = (__int64_t (*)(__int64_t))(IMPORT(0x7101955F10));
|
app_sv_animcmd_EFFECT_FOLLOW_COLOR = (__int64_t (*)(__int64_t))(IMPORT(0x7101955F10));
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "saltysd_ipc.h"
|
#include "saltysd_ipc.h"
|
||||||
#include "saltysd_dynamic.h"
|
#include "saltysd_dynamic.h"
|
||||||
|
|
||||||
|
u64 ANCHOR_ABS;
|
||||||
|
|
||||||
int SaltySD_function_replace(u64 addr, u64 new_func) {
|
int SaltySD_function_replace(u64 addr, u64 new_func) {
|
||||||
if (addr) {
|
if (addr) {
|
||||||
SaltySD_Memcpy(addr, "\x49\x00\x00\x58", 4); // LDR X9, .+8
|
SaltySD_Memcpy(addr, "\x49\x00\x00\x58", 4); // LDR X9, .+8
|
||||||
|
@ -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(u64 addr, u64 new_func);
|
||||||
int SaltySD_function_replace_sym(char* function_sym, u64 new_func);
|
int SaltySD_function_replace_sym(char* function_sym, u64 new_func);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user