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

Merge pull request #4 from jam1garner/master

File organization cleanup
This commit is contained in:
jugeeya 2019-03-26 19:58:50 -07:00 committed by GitHub
commit 4a6c625625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 14 deletions

View file

@ -2,14 +2,9 @@
#include "saltysd_core.h"
#include "saltysd_ipc.h"
#include "saltysd_dynamic.h"
#include "acmd_imports.h"
__int64_t (*lib_L2CAgent_pop_lua_stack)(__int64_t, int) = NULL;
#include "l2c_imports.h"
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" );
lib_L2CAgent_pop_lua_stack(l2c_agent, index);
}

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);