From dd123979675fed52f1c9b5d959b1c943954da69c Mon Sep 17 00:00:00 2001 From: jugeeya Date: Wed, 24 Apr 2019 12:13:34 -0700 Subject: [PATCH] 3.0.0 support; change to offset-based instead of IMPORT --- source/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/main.c b/source/main.c index a416dd2..dcbd54a 100644 --- a/source/main.c +++ b/source/main.c @@ -29,6 +29,8 @@ Handle orig_main_thread; void *orig_ctx; void *orig_saved_lr; +void (*AttackModule_set_attack_lua_state)(__int64_t, __int64_t); + void (*AttackModule_clear_all_orig)(__int64_t); void __libnx_init(void *ctx, Handle main_thread, void *saved_lr) @@ -136,8 +138,7 @@ void app_sv_animcmd_ATTACK_replace(__int64_t a1) // original code: parse lua stack and call AttackModule::set_attack() v1 = a1; - void (*sub_71019420D0)(__int64_t, __int64_t) = (void (*)(__int64_t, __int64_t))(IMPORT(0x71019420D0)); - sub_71019420D0(*(__int64_t *)(*(__int64_t *)(a1 - 8) + 416LL), a1); + AttackModule_set_attack_lua_state(*(__int64_t *)(*(__int64_t *)(a1 - 8) + 416LL), a1); if (is_training_mode()) { @@ -240,6 +241,8 @@ int main(int argc, char *argv[]) SaltySD_Memcpy(dst_3, "Noice v%d%d%d", 13); } + AttackModule_set_attack_lua_state = SaltySDCore_FindSymbol("_ZN3app10sv_animcmd6ATTACKEP9lua_State") + 0xD0 - 0x70; + // Install animCMD function replacement SaltySD_function_replace_sym("_ZN3app10sv_animcmd6ATTACKEP9lua_State", &app_sv_animcmd_ATTACK_replace);