mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-14 02:16:10 +00:00
formatting; minimize makefile warnings; LOAD64 macro
This commit is contained in:
parent
11af0e0bee
commit
60d5416059
9 changed files with 360 additions and 360 deletions
2
Makefile
2
Makefile
|
@ -41,7 +41,7 @@ EXEFS_SRC := exefs_src
|
|||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -fno-plt -export-dynamic -s
|
||||
|
||||
CFLAGS := -w -Wall -O2 \
|
||||
CFLAGS := -Wall -O2 \
|
||||
-ffast-math \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
#include <switch.h>
|
||||
|
||||
// app::sv::animcmd::EFFECT(lua_State* a1)
|
||||
//__int64_t (*app_sv_animcmd_EFFECT)(__int64_t);
|
||||
//u64 (*app_sv_animcmd_EFFECT)(u64);
|
||||
#define app_sv_animcmd_EFFECT _ZN3app10sv_animcmd6EFFECTEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd6EFFECTEP9lua_State(__int64_t unk1) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd6EFFECTEP9lua_State(u64 unk1) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_FOLLOW_FLIP_COLOR(lua_State* a1)
|
||||
//__int64_t (*app_sv_animcmd_EFFECT_FOLLOW_FLIP_COLOR)(__int64_t);
|
||||
//u64 (*app_sv_animcmd_EFFECT_FOLLOW_FLIP_COLOR)(u64);
|
||||
#define app_sv_animcmd_EFFECT_FOLLOW_FLIP_COLOR _ZN3app10sv_animcmd24EFFECT_FOLLOW_FLIP_COLOREP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd24EFFECT_FOLLOW_FLIP_COLOREP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd24EFFECT_FOLLOW_FLIP_COLOREP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_FOLLOW_NO_SCALE(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_FOLLOW_NO_SCALE _ZN3app10sv_animcmd22EFFECT_FOLLOW_NO_SCALEEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd22EFFECT_FOLLOW_NO_SCALEEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd22EFFECT_FOLLOW_NO_SCALEEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_FOLLOW(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_FOLLOW _ZN3app10sv_animcmd13EFFECT_FOLLOWEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd13EFFECT_FOLLOWEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd13EFFECT_FOLLOWEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_ATTR(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_ATTR _ZN3app10sv_animcmd11EFFECT_ATTREP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd11EFFECT_ATTREP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd11EFFECT_ATTREP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_REMOVE_ATTR(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_REMOVE_ATTR _ZN3app10sv_animcmd18EFFECT_REMOVE_ATTREP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd18EFFECT_REMOVE_ATTREP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd18EFFECT_REMOVE_ATTREP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv::animcmd::EFFECT_FOLLOW_arg11(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_FOLLOW_arg11 _ZN3app10sv_animcmd19EFFECT_FOLLOW_arg11EP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd19EFFECT_FOLLOW_arg11EP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd19EFFECT_FOLLOW_arg11EP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_module_access::effect(lua_State * a1)
|
||||
#define app_sv_module_access_effect _ZN3app16sv_module_access6effectEP9lua_State
|
||||
extern uint64_t _ZN3app16sv_module_access6effectEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app16sv_module_access6effectEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_animcmd::EFFECT_FLW_POS(lua_State * a1)
|
||||
#define app_sv_animcmd_EFFECT_FLW_POS _ZN3app10sv_animcmd14EFFECT_FLW_POSEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd14EFFECT_FLW_POSEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd14EFFECT_FLW_POSEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_animcmd::LAST_EFFECT_SET_COLOR(lua_State * a1)
|
||||
#define app_sv_animcmd_LAST_EFFECT_SET_COLOR _ZN3app10sv_animcmd21LAST_EFFECT_SET_COLOREP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd21LAST_EFFECT_SET_COLOREP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd21LAST_EFFECT_SET_COLOREP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_animcmd::LAST_EFFECT_SET_SCALE_W(lua_State * a1)
|
||||
#define app_sv_animcmd_LAST_EFFECT_SET_SCALE_W _ZN3app10sv_animcmd23LAST_EFFECT_SET_SCALE_WEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd23LAST_EFFECT_SET_SCALE_WEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd23LAST_EFFECT_SET_SCALE_WEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_animcmd::LAST_EFFECT_SET_RATE(lua_State * a1)
|
||||
#define app_sv_animcmd_LAST_EFFECT_SET_RATE _ZN3app10sv_animcmd20LAST_EFFECT_SET_RATEEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd20LAST_EFFECT_SET_RATEEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd20LAST_EFFECT_SET_RATEEP9lua_State(u64) LINKABLE;
|
||||
|
||||
// app::sv_animcmd::LAST_EFFECT_SET_ALPHA(lua_State * a1)
|
||||
#define app_sv_animcmd_LAST_EFFECT_SET_ALPHA _ZN3app10sv_animcmd21LAST_EFFECT_SET_ALPHAEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd21LAST_EFFECT_SET_ALPHAEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd21LAST_EFFECT_SET_ALPHAEP9lua_State(u64) LINKABLE;
|
||||
|
||||
#define app_sv_animcmd_frame _ZN3app10sv_animcmd5frameEP9lua_Statef
|
||||
extern uint64_t _ZN3app10sv_animcmd5frameEP9lua_Statef(__int64_t, float) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd5frameEP9lua_Statef(u64, float) LINKABLE;
|
||||
|
||||
#define app_sv_animcmd_is_excute _ZN3app10sv_animcmd9is_excuteEP9lua_State
|
||||
extern uint64_t _ZN3app10sv_animcmd9is_excuteEP9lua_State(__int64_t) LINKABLE;
|
||||
extern u64 _ZN3app10sv_animcmd9is_excuteEP9lua_State(u64) LINKABLE;
|
|
@ -74,8 +74,9 @@ uint32_t crc32(const void *buf, size_t size)
|
|||
return crc ^ ~0U;
|
||||
}
|
||||
|
||||
uint64_t hash40(const void* data, size_t len)
|
||||
uint64_t hash40(const void* data)
|
||||
{
|
||||
size_t len = strlen(data);
|
||||
return crc32(data, len) | (len & 0xFF) << 32;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#include <switch.h>
|
||||
#include "l2c.h"
|
||||
|
||||
// lib::L2CAgent::L2CAgent(L2CAgent*, lua_State *)
|
||||
//__int64_t (*lib_L2CAgent)(__int64_t*, __int64_t);
|
||||
//u64 (*lib_L2CAgent)(u64*, u64);
|
||||
#define lib_L2CAgent _ZN3lib8L2CAgentC2EP9lua_State
|
||||
extern uint64_t _ZN3lib8L2CAgentC2EP9lua_State(__int64_t* unk1, __int64_t unk2) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CAgentC2EP9lua_State(L2CAgent* unk1, u64 unk2) LINKABLE;
|
||||
|
||||
// L2CAgent *__fastcall lib::L2CAgent::push_lua_stack(L2CAgent *result, const lib::L2CValue *a2)
|
||||
//__int64_t (*lib_L2CAgent_push_lua_stack)(__int64_t, const __int64_t*);
|
||||
//u64 (*lib_L2CAgent_push_lua_stack)(u64, const u64*);
|
||||
#define lib_L2CAgent_push_lua_stack _ZN3lib8L2CAgent14push_lua_stackERKNS_8L2CValueE
|
||||
extern uint64_t _ZN3lib8L2CAgent14push_lua_stackERKNS_8L2CValueE(__int64_t unk1, const __int64_t* unk2) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CAgent14push_lua_stackERKNS_8L2CValueE(L2CAgent* unk1, const L2CValue* unk2) LINKABLE;
|
||||
|
||||
// pop_lua_stack
|
||||
// Notes:
|
||||
|
@ -21,20 +22,20 @@ extern uint64_t _ZN3lib8L2CAgent14push_lua_stackERKNS_8L2CValueE(__int64_t unk1,
|
|||
// position indicated by the second argument.
|
||||
// This index is either positive, meaning absolute position in the stack, or negative,
|
||||
// which is more traditional, i.e. -1 is the top of the stack.
|
||||
//__int64_t (*lib_L2CAgent_pop_lua_stack)(__int64_t, int);
|
||||
//u64 (*lib_L2CAgent_pop_lua_stack)(u64, int);
|
||||
#define lib_L2CAgent_pop_lua_stack _ZN3lib8L2CAgent13pop_lua_stackEi
|
||||
extern uint64_t _ZN3lib8L2CAgent13pop_lua_stackEi(__int64_t unk1, int unk2) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CAgent13pop_lua_stackEi(L2CAgent* unk1, int unk2) LINKABLE;
|
||||
|
||||
// L2CAgent *__fastcall lib::L2CAgent::clear_lua_stack(L2CAgent *result)
|
||||
// __int64_t (*lib_L2CAgent_clear_lua_stack)(__int64_t);
|
||||
// u64 (*lib_L2CAgent_clear_lua_stack)(u64);
|
||||
#define lib_L2CAgent_clear_lua_stack _ZN3lib8L2CAgent15clear_lua_stackEv
|
||||
extern uint64_t _ZN3lib8L2CAgent15clear_lua_stackEv(__int64_t unk1) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CAgent15clear_lua_stackEv(L2CAgent* unk1) LINKABLE;
|
||||
|
||||
#define lib_utility_Variadic_get_format _ZN3lib7utility8VariadicC1Ev
|
||||
extern uint64_t _ZN3lib7utility8VariadicC1Ev(__int64_t unk1) LINKABLE;
|
||||
extern u64 _ZN3lib7utility8VariadicC1Ev(u64 unk1) LINKABLE;
|
||||
|
||||
#define lib_L2CValue_push_variadic _ZN3lib8L2CValue13push_variadicEmPKcRNS_7utility8VariadicE
|
||||
extern uint64_t _ZN3lib8L2CValue13push_variadicEmPKcRNS_7utility8VariadicE(__int64_t unk1, __int64_t unk2, __int64_t unk3, __int64_t unk4) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CValue13push_variadicEmPKcRNS_7utility8VariadicE(u64 unk1, u64 unk2, u64 unk3, u64 unk4) LINKABLE;
|
||||
|
||||
#define lib_L2CValue_del_L2CValue _ZN3lib8L2CValueD1Ev
|
||||
extern uint64_t _ZN3lib8L2CValueD1Ev(__int64_t unk1) LINKABLE;
|
||||
extern u64 _ZN3lib8L2CValueD1Ev(u64 unk1) LINKABLE;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include <switch.h>
|
||||
|
||||
#define StatusModule__change_status_request_from_script _ZN3app8lua_bind52StatusModule__change_status_request_from_script_implEPNS_26BattleObjectModuleAccessorEib
|
||||
extern uint64_t _ZN3app8lua_bind52StatusModule__change_status_request_from_script_implEPNS_26BattleObjectModuleAccessorEib(__int64_t, int, bool) LINKABLE;
|
||||
#define StatusModule_change_status_request_from_script _ZN3app8lua_bind52StatusModule__change_status_request_from_script_implEPNS_26BattleObjectModuleAccessorEib
|
||||
extern u64 _ZN3app8lua_bind52StatusModule__change_status_request_from_script_implEPNS_26BattleObjectModuleAccessorEib(u64, int, bool) LINKABLE;
|
||||
|
||||
#define StatusModule_status_kind _ZN3app8lua_bind30StatusModule__status_kind_implEPNS_26BattleObjectModuleAccessorE
|
||||
extern int _ZN3app8lua_bind30StatusModule__status_kind_implEPNS_26BattleObjectModuleAccessorE(__int64_t) LINKABLE;
|
||||
extern int _ZN3app8lua_bind30StatusModule__status_kind_implEPNS_26BattleObjectModuleAccessorE(u64) LINKABLE;
|
||||
|
||||
#define FighterInformation_is_operation_cpu _ZN3app8lua_bind41FighterInformation__is_operation_cpu_implEPNS_18FighterInformationE
|
||||
extern bool _ZN3app8lua_bind41FighterInformation__is_operation_cpu_implEPNS_18FighterInformationE(__int64_t) LINKABLE;
|
||||
extern bool _ZN3app8lua_bind41FighterInformation__is_operation_cpu_implEPNS_18FighterInformationE(u64) LINKABLE;
|
||||
|
||||
#define WorkModule_get_int _ZN3app8lua_bind24WorkModule__get_int_implEPNS_26BattleObjectModuleAccessorEi
|
||||
extern int _ZN3app8lua_bind24WorkModule__get_int_implEPNS_26BattleObjectModuleAccessorEi(__int64_t, int) LINKABLE;
|
||||
extern int _ZN3app8lua_bind24WorkModule__get_int_implEPNS_26BattleObjectModuleAccessorEi(u64, int) LINKABLE;
|
||||
|
||||
#define FighterManager_get_fighter_information _ZN3app8lua_bind44FighterManager__get_fighter_information_implEPNS_14FighterManagerENS_14FighterEntryIDE
|
||||
extern void* _ZN3app8lua_bind44FighterManager__get_fighter_information_implEPNS_14FighterManagerENS_14FighterEntryIDE(__int64_t, int) LINKABLE;
|
||||
extern u64 _ZN3app8lua_bind44FighterManager__get_fighter_information_implEPNS_14FighterManagerENS_14FighterEntryIDE(u64, int) LINKABLE;
|
||||
|
||||
#define lib_lua_bind_get_value _ZN3lib18lua_bind_get_valueIiEEbmRT_
|
||||
extern bool _ZN3lib18lua_bind_get_valueIiEEbmRT_(uint64_t, int*) LINKABLE;
|
||||
extern bool _ZN3lib18lua_bind_get_valueIiEEbmRT_(u64, int*) LINKABLE;
|
|
@ -3,8 +3,9 @@
|
|||
#include "saltysd_ipc.h"
|
||||
#include "saltysd_dynamic.h"
|
||||
#include "l2c_imports.h"
|
||||
#include "l2c.h"
|
||||
|
||||
void get_lua_stack(__int64_t* l2c_agent, int index, __int64_t* l2c_val) {
|
||||
void get_lua_stack(L2CAgent* l2c_agent, int index, L2CValue* l2c_val) {
|
||||
asm("mov x8, %x0" : : "r"(l2c_val) : "x8" );
|
||||
lib_L2CAgent_pop_lua_stack(l2c_agent, index);
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
void get_lua_stack(__int64_t* l2c_agent, int index, __int64_t* l2c_val);
|
||||
#include "l2c.h"
|
||||
|
||||
void get_lua_stack(L2CAgent* l2c_agent, int index, L2CValue* l2c_val);
|
||||
|
|
635
source/main.c
635
source/main.c
|
@ -1,27 +1,28 @@
|
|||
#include <switch.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <switch/kernel/ipc.h>
|
||||
#include <sys/iosupport.h>
|
||||
#include <sys/reent.h>
|
||||
#include <switch/kernel/ipc.h>
|
||||
|
||||
#include "useful.h"
|
||||
#include "crc32.h"
|
||||
#include "useful.h"
|
||||
|
||||
#include "saltysd_core.h"
|
||||
#include "saltysd_ipc.h"
|
||||
#include "saltysd_dynamic.h"
|
||||
#include "saltysd_ipc.h"
|
||||
|
||||
#include "lua/lua.h"
|
||||
#include "lua/lstate.h"
|
||||
#include "lua/lua.h"
|
||||
|
||||
#include "l2c.h"
|
||||
#include "saltysd_helper.h"
|
||||
#include "l2c_imports.h"
|
||||
#include "acmd_imports.h"
|
||||
#include "l2c.h"
|
||||
#include "l2c_imports.h"
|
||||
#include "lua_bind.h"
|
||||
#include "lua_helper.h"
|
||||
#include "saltysd_helper.h"
|
||||
|
||||
#include "taunt_toggles.h"
|
||||
|
||||
|
@ -38,360 +39,352 @@ u64 fighter_manager_addr;
|
|||
|
||||
u64 sv_set_function_hash_addr;
|
||||
|
||||
void (*AttackModule_set_attack_lua_state)(__int64_t, __int64_t);
|
||||
void (*AttackModule_set_attack_lua_state)(u64, u64);
|
||||
|
||||
void (*AttackModule_clear_all_orig)(__int64_t);
|
||||
void (*AttackModule_clear_orig)(__int64_t, int);
|
||||
void (*AttackModule_clear_all_orig)(u64);
|
||||
void (*AttackModule_clear_orig)(u64, int);
|
||||
|
||||
void __libnx_init(void *ctx, Handle main_thread, void *saved_lr)
|
||||
{
|
||||
extern char *fake_heap_start;
|
||||
extern char *fake_heap_end;
|
||||
void __libnx_init(void *ctx, Handle main_thread, void *saved_lr) {
|
||||
extern char *fake_heap_start;
|
||||
extern char *fake_heap_end;
|
||||
|
||||
fake_heap_start = &g_heap[0];
|
||||
fake_heap_end = &g_heap[sizeof g_heap];
|
||||
fake_heap_start = &g_heap[0];
|
||||
fake_heap_end = &g_heap[sizeof g_heap];
|
||||
|
||||
orig_ctx = ctx;
|
||||
orig_main_thread = main_thread;
|
||||
orig_saved_lr = saved_lr;
|
||||
orig_ctx = ctx;
|
||||
orig_main_thread = main_thread;
|
||||
orig_saved_lr = saved_lr;
|
||||
|
||||
// Call constructors.
|
||||
void
|
||||
__libc_init_array(void);
|
||||
__libc_init_array();
|
||||
// Call constructors.
|
||||
void __libc_init_array(void);
|
||||
__libc_init_array();
|
||||
}
|
||||
|
||||
void __attribute__((weak)) NORETURN __libnx_exit(int rc)
|
||||
{
|
||||
// Call destructors.
|
||||
void
|
||||
__libc_fini_array(void);
|
||||
__libc_fini_array();
|
||||
void __attribute__((weak)) NORETURN __libnx_exit(int rc) {
|
||||
// Call destructors.
|
||||
void __libc_fini_array(void);
|
||||
__libc_fini_array();
|
||||
|
||||
SaltySD_printf("SaltySD Plugin: jumping to %p\n", orig_saved_lr);
|
||||
SaltySD_printf("SaltySD Plugin: jumping to %p\n", orig_saved_lr);
|
||||
|
||||
__nx_exit(0, orig_saved_lr);
|
||||
__nx_exit(0, orig_saved_lr);
|
||||
while (true);
|
||||
}
|
||||
|
||||
Vector3f id_colors[8] = {
|
||||
{1.0f, 0.0f, 0.0f},
|
||||
{0.7843f, 0.3529f, 1.0f},
|
||||
{1.0f, 0.7843f, 0.7843f},
|
||||
{0.0f, 1.0f, 0.8431f},
|
||||
{1.0f, 0.4706f, 0.0f},
|
||||
{0.7843f, 0.7059f, 0.0f},
|
||||
{0.7843f, 0.0f, 1.0f},
|
||||
{0.3765f, 0.2863f, 0.5294f},
|
||||
{1.0f, 0.0f, 0.0f}, {0.7843f, 0.3529f, 1.0f},
|
||||
{1.0f, 0.7843f, 0.7843f}, {0.0f, 1.0f, 0.8431f},
|
||||
{1.0f, 0.4706f, 0.0f}, {0.7843f, 0.7059f, 0.0f},
|
||||
{0.7843f, 0.0f, 1.0f}, {0.3765f, 0.2863f, 0.5294f},
|
||||
};
|
||||
|
||||
#define is_training_mode _ZN3app9smashball16is_training_modeEv
|
||||
extern uint64_t _ZN3app9smashball16is_training_modeEv(void) LINKABLE;
|
||||
extern u64 _ZN3app9smashball16is_training_modeEv(void) LINKABLE;
|
||||
|
||||
void AttackModule_clear_all_replace(__int64_t attack_module)
|
||||
{
|
||||
AttackModule_clear_all_orig(attack_module);
|
||||
void AttackModule_clear_all_replace(u64 attack_module) {
|
||||
AttackModule_clear_all_orig(attack_module);
|
||||
|
||||
if (is_training_mode())
|
||||
{
|
||||
__int64_t battle_object_module_accessor = *(__int64_t *)(attack_module + 0x8);
|
||||
if (is_training_mode()) {
|
||||
u64 battle_object_module_accessor = LOAD64(attack_module + 0x8);
|
||||
|
||||
// Clear graphics every time we clear all hitboxes.
|
||||
__int64_t effect_module = *(__int64_t *)(battle_object_module_accessor + 0x140);
|
||||
void (*EffectModule_kill_kind)(__int64_t, __int64_t, bool, bool) =
|
||||
(void (*)(__int64_t, __int64_t, bool, bool))(*(__int64_t *)(*(__int64_t *)(effect_module) + 0xE0LL));
|
||||
// Clear graphics every time we clear all hitboxes.
|
||||
u64 effect_module = LOAD64(battle_object_module_accessor + 0x140);
|
||||
void (*EffectModule_kill_kind)(u64, u64, bool, bool) = (void (*)(
|
||||
u64, u64, bool, bool))(LOAD64(LOAD64(effect_module) + 0xE0LL));
|
||||
|
||||
Hash40 shieldEffectHash = {.hash = 0xAFAE75F05LL};
|
||||
EffectModule_kill_kind(effect_module, shieldEffectHash.hash, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void AttackModule_clear_replace(__int64_t attack_module, int id)
|
||||
{
|
||||
AttackModule_clear_orig(attack_module, id);
|
||||
|
||||
// TODO: Kill effect based on hitbox ID
|
||||
}
|
||||
|
||||
void lib_L2CAgent_push_color(__int64_t *l2c_agent, Vector3f color)
|
||||
{
|
||||
L2CValue red = {.raw_float = color.x, .type = L2C_number};
|
||||
L2CValue green = {.raw_float = color.y, .type = L2C_number};
|
||||
L2CValue blue = {.raw_float = color.z, .type = L2C_number};
|
||||
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &red);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &green);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &blue);
|
||||
}
|
||||
|
||||
void generate_hitbox_effects(L2CAgent* l2c_agent, L2CValue *id, L2CValue *bone, L2CValue *size, L2CValue *x, L2CValue *y, L2CValue *z, L2CValue *x2, L2CValue *y2, L2CValue *z2) {
|
||||
__int64_t battle_object_module_accessor = *(__int64_t *)(*(__int64_t *)(l2c_agent->lua_state_agent - 8) + 416LL);
|
||||
|
||||
float sizeMult = 19.0 / 200.0;
|
||||
Hash40 shieldEffectHash = {.hash = 0xAFAE75F05LL};
|
||||
|
||||
L2CValue shieldEffect = {.raw = shieldEffectHash.hash, .type = L2C_hash};
|
||||
L2CValue xRot = {.raw_float = (float)0.0, .type = L2C_number};
|
||||
L2CValue yRot = {.raw_float = (float)0.0, .type = L2C_number};
|
||||
L2CValue zRot = {.raw_float = (float)0.0, .type = L2C_number};
|
||||
L2CValue terminate = {.raw = (bool)1, .type = L2C_bool};
|
||||
// for EFFECT_ATTR: NO_JOINT_SCALE | FOLLOW | SYNC_STOP | CONCLUDE_STATUS
|
||||
L2CValue attribute = {.raw = 0x101C000, .type = L2C_integer};
|
||||
L2CValue l2c_true = {.raw = (bool)1, .type = L2C_bool};
|
||||
L2CValue l2c_false = {.raw = (bool)0, .type = L2C_bool};
|
||||
L2CValue effectSize = {.raw_float = (float)size->raw_float * sizeMult, .type = L2C_number};
|
||||
|
||||
L2CValue rate = {.raw_float = 8.0f, .type = L2C_number};
|
||||
|
||||
__int64_t last_handle;
|
||||
L2CValue alpha = {.raw_float = 0.0f, .type = L2C_number };
|
||||
|
||||
// Extended Hitboxes if x2, y2, z2 are not L2CValue::nil
|
||||
int num_effects;
|
||||
if (x2->type != L2C_void && y2->type != L2C_void && z2->type != L2C_void)
|
||||
{
|
||||
num_effects = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x2 = *x;
|
||||
*y2 = *y;
|
||||
*z2 = *z;
|
||||
num_effects = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_effects; i++)
|
||||
{
|
||||
// EFFECT_FOLLOW_NO_SCALE(graphic, bone, x, y, z, xrot, yrot, zrot, size, terminate)
|
||||
L2CValue currX =
|
||||
{.raw_float = (float)x->raw_float + ((x2->raw_float - x->raw_float) / 3 * i), .type = L2C_number};
|
||||
L2CValue currY =
|
||||
{.raw_float = (float)y->raw_float + ((y2->raw_float - y->raw_float) / 3 * i), .type = L2C_number};
|
||||
L2CValue currZ =
|
||||
{.raw_float = (float)z->raw_float + ((z2->raw_float - z->raw_float) / 3 * i), .type = L2C_number};
|
||||
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &shieldEffect);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, bone);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currX);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currY);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currZ);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &xRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &yRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &zRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &effectSize);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &terminate);
|
||||
last_handle = app_sv_animcmd_EFFECT_FOLLOW_NO_SCALE(l2c_agent->lua_state_agent);
|
||||
|
||||
// Set to hitbox ID color
|
||||
// LAST_EFFECT_SET_COLOR(Red, Green, Blue)
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_color(l2c_agent, id_colors[id->raw % 8]);
|
||||
app_sv_animcmd_LAST_EFFECT_SET_COLOR(l2c_agent->lua_state_agent);
|
||||
|
||||
// Speed up animation by rate to remove pulsing effect
|
||||
// LAST_EFFECT_SET_RATE(Rate)
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &rate);
|
||||
app_sv_animcmd_LAST_EFFECT_SET_RATE(l2c_agent->lua_state_agent);
|
||||
}
|
||||
EffectModule_kill_kind(effect_module, shieldEffectHash.hash, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void app_sv_animcmd_ATTACK_replace(__int64_t a1)
|
||||
{
|
||||
__int64_t v1; // x19
|
||||
uint64_t v2; // x9
|
||||
uint64_t i; // x8
|
||||
void AttackModule_clear_replace(u64 attack_module, int id) {
|
||||
AttackModule_clear_orig(attack_module, id);
|
||||
|
||||
// Instantiate our own L2CAgent with the given lua_State
|
||||
L2CAgent l2c_agent;
|
||||
lib_L2CAgent(&l2c_agent, a1);
|
||||
|
||||
// Get all necessary hitbox params
|
||||
L2CValue id, bone, damage, angle, kbg, wkb, bkb, size, x, y, z, x2, y2, z2;
|
||||
get_lua_stack(&l2c_agent, 1, &id);
|
||||
get_lua_stack(&l2c_agent, 3, &bone);
|
||||
get_lua_stack(&l2c_agent, 4, &damage);
|
||||
get_lua_stack(&l2c_agent, 5, &angle);
|
||||
get_lua_stack(&l2c_agent, 6, &kbg);
|
||||
get_lua_stack(&l2c_agent, 7, &wkb);
|
||||
get_lua_stack(&l2c_agent, 8, &bkb);
|
||||
get_lua_stack(&l2c_agent, 9, &size);
|
||||
get_lua_stack(&l2c_agent, 10, &x);
|
||||
get_lua_stack(&l2c_agent, 11, &y);
|
||||
get_lua_stack(&l2c_agent, 12, &z);
|
||||
get_lua_stack(&l2c_agent, 13, &x2);
|
||||
get_lua_stack(&l2c_agent, 14, &y2);
|
||||
get_lua_stack(&l2c_agent, 15, &z2);
|
||||
|
||||
// original code: parse lua stack and call AttackModule::set_attack()
|
||||
v1 = a1;
|
||||
AttackModule_set_attack_lua_state(*(__int64_t *)(*(__int64_t *)(a1 - 8) + 416LL), a1);
|
||||
|
||||
if (HITBOX_VIS && is_training_mode())
|
||||
{
|
||||
// Replace AttackModule::clear_all() and AttackModule::clear(int)
|
||||
__int64_t battle_object_module_accessor = *(__int64_t *)(*(__int64_t *)(a1 - 8) + 416LL);
|
||||
__int64_t attack_module = *(__int64_t *)(battle_object_module_accessor + 0xA0);
|
||||
__int64_t attack_module_clear_all = *(__int64_t *)(attack_module) + 0x50LL;
|
||||
if (AttackModule_clear_all_orig == 0)
|
||||
{
|
||||
AttackModule_clear_all_orig = (void (*)(__int64_t))(*(__int64_t *)(attack_module_clear_all));
|
||||
}
|
||||
*(__int64_t *)(attack_module_clear_all) = AttackModule_clear_all_replace;
|
||||
|
||||
__int64_t attack_module_clear = *(__int64_t *)(attack_module) + 0x58LL;
|
||||
if (AttackModule_clear_orig == 0)
|
||||
{
|
||||
AttackModule_clear_orig = (void (*)(__int64_t))(*(__int64_t *)(attack_module_clear));
|
||||
}
|
||||
*(__int64_t *)(attack_module_clear) = AttackModule_clear_replace;
|
||||
|
||||
// Generate hitbox effect(s)
|
||||
generate_hitbox_effects(&l2c_agent, &id, &bone, &size, &x, &y, &z, &x2, &y2, &z2);
|
||||
}
|
||||
|
||||
// original code: clear_lua_stack section
|
||||
v2 = *(__int64_t *)(v1 + 16);
|
||||
for (i = **(__int64_t **)(v1 + 32) + 16LL; v2 < i; v2 = *(__int64_t *)(v1 + 16))
|
||||
{
|
||||
*(__int64_t *)(v1 + 16) = v2 + 16;
|
||||
*(__int32_t *)(v2 + 8) = 0;
|
||||
}
|
||||
*(__int64_t *)(v1 + 16) = i;
|
||||
// TODO: Kill effect based on hitbox ID
|
||||
}
|
||||
|
||||
bool is_operation_cpu(__int64_t battle_object_module_accessor) {
|
||||
//int entry_id_var = 0x10000000;
|
||||
int entry_id_var;
|
||||
if ( lib_lua_bind_get_value(0xF370199DB936C5ED, &entry_id_var) & 1 ) {
|
||||
int entry_id = WorkModule_get_int(battle_object_module_accessor, entry_id_var);
|
||||
void* fighter_information = FighterManager_get_fighter_information(*(__int64_t*) fighter_manager_addr, entry_id);
|
||||
return FighterInformation_is_operation_cpu(fighter_information);
|
||||
}
|
||||
void lib_L2CAgent_push_color(L2CAgent *l2c_agent, Vector3f color) {
|
||||
L2CValue red = {.raw_float = color.x, .type = L2C_number};
|
||||
L2CValue green = {.raw_float = color.y, .type = L2C_number};
|
||||
L2CValue blue = {.raw_float = color.z, .type = L2C_number};
|
||||
|
||||
return false;
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &red);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &green);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &blue);
|
||||
}
|
||||
|
||||
uint64_t WorkModule_enable_transition_term_group_impl_replace(__int64_t battle_object_module_accessor, __int64_t transition_group) {
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE && is_training_mode()) {
|
||||
// 0x1F00000D for airdodge
|
||||
if (transition_group == 0x1F00000D) {
|
||||
if ( is_operation_cpu(battle_object_module_accessor)) {
|
||||
int status_kind = StatusModule_status_kind(battle_object_module_accessor);
|
||||
// Damage -> DamageFall
|
||||
if (status_kind >= 0x48 && status_kind <= 0x50)
|
||||
StatusModule__change_status_request_from_script(battle_object_module_accessor, 0x22, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
void generate_hitbox_effects(L2CAgent *l2c_agent, L2CValue *id, L2CValue *bone,
|
||||
L2CValue *size, L2CValue *x, L2CValue *y,
|
||||
L2CValue *z, L2CValue *x2, L2CValue *y2,
|
||||
L2CValue *z2) {
|
||||
|
||||
// call original WorkModule::enable_transition_term_group_impl
|
||||
__int64_t work_module = *(__int64_t *)(battle_object_module_accessor + 0x50);
|
||||
__int64_t enable_transition_term_group_impl = *(__int64_t *)(work_module) + 0x140LL;
|
||||
float sizeMult = 19.0 / 200.0;
|
||||
Hash40 shieldEffectHash = {.hash = 0xAFAE75F05LL};
|
||||
|
||||
uint64_t (*work_module_enable_transition_term_group_impl)(__int64_t, __int64_t) =
|
||||
(uint64_t (*)(__int64_t, __int64_t))(*(__int64_t *)(enable_transition_term_group_impl));
|
||||
|
||||
return work_module_enable_transition_term_group_impl(work_module, transition_group);
|
||||
L2CValue shieldEffect = {.raw = shieldEffectHash.hash, .type = L2C_hash};
|
||||
L2CValue xRot = {.raw_float = 0.0, .type = L2C_number};
|
||||
L2CValue yRot = {.raw_float = 0.0, .type = L2C_number};
|
||||
L2CValue zRot = {.raw_float = 0.0, .type = L2C_number};
|
||||
L2CValue terminate = {.raw = 1, .type = L2C_bool};
|
||||
L2CValue effectSize = {.raw_float = (float)size->raw_float * sizeMult,
|
||||
.type = L2C_number};
|
||||
|
||||
L2CValue rate = {.raw_float = 8.0f, .type = L2C_number};
|
||||
|
||||
// Extended Hitboxes if x2, y2, z2 are not L2CValue::nil
|
||||
int num_effects;
|
||||
if (x2->type != L2C_void && y2->type != L2C_void && z2->type != L2C_void) {
|
||||
num_effects = 4;
|
||||
} else {
|
||||
*x2 = *x;
|
||||
*y2 = *y;
|
||||
*z2 = *z;
|
||||
num_effects = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_effects; i++) {
|
||||
// EFFECT_FOLLOW_NO_SCALE(graphic, bone, x, y, z, xrot, yrot, zrot, size,
|
||||
// terminate)
|
||||
L2CValue currX = {
|
||||
.raw_float = x->raw_float + ((x2->raw_float - x->raw_float) / 3 * i),
|
||||
.type = L2C_number};
|
||||
L2CValue currY = {
|
||||
.raw_float = y->raw_float + ((y2->raw_float - y->raw_float) / 3 * i),
|
||||
.type = L2C_number};
|
||||
L2CValue currZ = {
|
||||
.raw_float = z->raw_float + ((z2->raw_float - z->raw_float) / 3 * i),
|
||||
.type = L2C_number};
|
||||
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &shieldEffect);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, bone);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currX);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currY);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &currZ);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &xRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &yRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &zRot);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &effectSize);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &terminate);
|
||||
app_sv_animcmd_EFFECT_FOLLOW_NO_SCALE(l2c_agent->lua_state_agent);
|
||||
|
||||
// Set to hitbox ID color
|
||||
// LAST_EFFECT_SET_COLOR(Red, Green, Blue)
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_color(l2c_agent, id_colors[id->raw % 8]);
|
||||
app_sv_animcmd_LAST_EFFECT_SET_COLOR(l2c_agent->lua_state_agent);
|
||||
|
||||
// Speed up animation by rate to remove pulsing effect
|
||||
// LAST_EFFECT_SET_RATE(Rate)
|
||||
lib_L2CAgent_clear_lua_stack(l2c_agent);
|
||||
lib_L2CAgent_push_lua_stack(l2c_agent, &rate);
|
||||
app_sv_animcmd_LAST_EFFECT_SET_RATE(l2c_agent->lua_state_agent);
|
||||
}
|
||||
}
|
||||
|
||||
float WorkModule_get_float_replace(__int64_t battle_object_module_accessor, int var) {
|
||||
if (DI_STATE == DI_RIGHT && is_training_mode()) {
|
||||
if (is_operation_cpu(battle_object_module_accessor)) {
|
||||
int status_kind = StatusModule_status_kind(battle_object_module_accessor);
|
||||
// Damage -> DamageFall
|
||||
if (status_kind >= 0x48 && status_kind <= 0x50) {
|
||||
int DI_stick_x_ID;
|
||||
int DI_stick_y_ID;
|
||||
void app_sv_animcmd_ATTACK_replace(u64 a1) {
|
||||
u64 v1; // x19
|
||||
u64 v2; // x9
|
||||
u64 i; // x8
|
||||
|
||||
if ( lib_lua_bind_get_value(0xA4D50A730E36970E, &DI_stick_x_ID) && var == DI_stick_x_ID)
|
||||
return 1.0;
|
||||
|
||||
if ( lib_lua_bind_get_value(0xEED4095B229D825B, &DI_stick_y_ID) && var == DI_stick_y_ID)
|
||||
return 1.0;
|
||||
}
|
||||
}
|
||||
// Instantiate our own L2CAgent with the given lua_State
|
||||
L2CAgent l2c_agent;
|
||||
lib_L2CAgent(&l2c_agent, a1);
|
||||
|
||||
// Get all necessary hitbox params
|
||||
L2CValue id, bone, damage, angle, kbg, wkb, bkb, size, x, y, z, x2, y2, z2;
|
||||
get_lua_stack(&l2c_agent, 1, &id);
|
||||
get_lua_stack(&l2c_agent, 3, &bone);
|
||||
get_lua_stack(&l2c_agent, 4, &damage);
|
||||
get_lua_stack(&l2c_agent, 5, &angle);
|
||||
get_lua_stack(&l2c_agent, 6, &kbg);
|
||||
get_lua_stack(&l2c_agent, 7, &wkb);
|
||||
get_lua_stack(&l2c_agent, 8, &bkb);
|
||||
get_lua_stack(&l2c_agent, 9, &size);
|
||||
get_lua_stack(&l2c_agent, 10, &x);
|
||||
get_lua_stack(&l2c_agent, 11, &y);
|
||||
get_lua_stack(&l2c_agent, 12, &z);
|
||||
get_lua_stack(&l2c_agent, 13, &x2);
|
||||
get_lua_stack(&l2c_agent, 14, &y2);
|
||||
get_lua_stack(&l2c_agent, 15, &z2);
|
||||
|
||||
// original code: parse lua stack and call AttackModule::set_attack()
|
||||
v1 = a1;
|
||||
AttackModule_set_attack_lua_state(LOAD64(LOAD64(a1 - 8) + 416LL), a1);
|
||||
|
||||
if (HITBOX_VIS && is_training_mode()) {
|
||||
// Replace AttackModule::clear_all() and AttackModule::clear(int)
|
||||
u64 battle_object_module_accessor = LOAD64(LOAD64(a1 - 8) + 416LL);
|
||||
u64 attack_module = LOAD64(battle_object_module_accessor + 0xA0);
|
||||
u64 attack_module_clear_all = LOAD64(attack_module) + 0x50LL;
|
||||
if (AttackModule_clear_all_orig == 0) {
|
||||
AttackModule_clear_all_orig =
|
||||
(void (*)(u64))(LOAD64(attack_module_clear_all));
|
||||
}
|
||||
|
||||
// call original WorkModule::get_float_impl
|
||||
__int64_t work_module = *(__int64_t *)(battle_object_module_accessor + 0x50);
|
||||
__int64_t get_float_impl = *(__int64_t *)(work_module) + 0x58LL;
|
||||
LOAD64(attack_module_clear_all) = (u64) AttackModule_clear_all_replace;
|
||||
|
||||
float (*work_module_get_float_impl)(__int64_t, int) =
|
||||
(float (*)(__int64_t, int))(*(__int64_t *)(get_float_impl));
|
||||
|
||||
return work_module_get_float_impl(work_module, var);
|
||||
u64 attack_module_clear = LOAD64(attack_module) + 0x58LL;
|
||||
if (AttackModule_clear_orig == 0) {
|
||||
AttackModule_clear_orig = (void (*)(u64, int))(LOAD64(attack_module_clear));
|
||||
}
|
||||
LOAD64(attack_module_clear) = (u64) AttackModule_clear_replace;
|
||||
|
||||
// Generate hitbox effect(s)
|
||||
generate_hitbox_effects(&l2c_agent, &id, &bone, &size, &x, &y, &z, &x2, &y2,
|
||||
&z2);
|
||||
}
|
||||
|
||||
// original code: clear_lua_stack section
|
||||
v2 = LOAD64(v1 + 16);
|
||||
for (i = **(u64 **)(v1 + 32) + 16LL; v2 < i; v2 = LOAD64(v1 + 16)) {
|
||||
LOAD64(v1 + 16) = v2 + 16;
|
||||
*(__int32_t *)(v2 + 8) = 0;
|
||||
}
|
||||
LOAD64(v1 + 16) = i;
|
||||
}
|
||||
|
||||
void MotionModule_change_motion_replace(__int64_t battle_object_module_accessor,
|
||||
__int64_t hash, float start_frame, float frame_speed_mult,
|
||||
bool unk1, float unk2, bool unk3, bool unk4) {
|
||||
const char* down_taunt_l = "appeal_lw_l";
|
||||
const char* down_taunt_r = "appeal_lw_r";
|
||||
const char* up_taunt_l = "appeal_hi_l";
|
||||
const char* up_taunt_r = "appeal_hi_r";
|
||||
const char* side_taunt_l = "appeal_s_l";
|
||||
const char* side_taunt_r = "appeal_s_r";
|
||||
bool is_operation_cpu(u64 battle_object_module_accessor) {
|
||||
// entry_id_var: 0x10000000;
|
||||
int entry_id_var;
|
||||
if (lib_lua_bind_get_value(0xF370199DB936C5ED, &entry_id_var) & 1) {
|
||||
int entry_id =
|
||||
WorkModule_get_int(battle_object_module_accessor, entry_id_var);
|
||||
u64 fighter_information = FighterManager_get_fighter_information(
|
||||
*(u64 *)fighter_manager_addr, entry_id);
|
||||
return FighterInformation_is_operation_cpu(fighter_information);
|
||||
}
|
||||
|
||||
// Down Taunt
|
||||
if (hash == hash40(down_taunt_l, strlen(down_taunt_l)) ||
|
||||
hash == hash40(down_taunt_r, strlen(down_taunt_r))) {
|
||||
TOGGLE_STATE = (TOGGLE_STATE + 1) % NUM_TOGGLE_STATES;
|
||||
}
|
||||
// Up Taunt
|
||||
else if (hash == hash40(up_taunt_l, strlen(up_taunt_l)) ||
|
||||
hash == hash40(up_taunt_r, strlen(up_taunt_r))) {
|
||||
HITBOX_VIS = !HITBOX_VIS;
|
||||
}
|
||||
// Side Taunt
|
||||
else if (hash == hash40(side_taunt_l, strlen(side_taunt_l)) ||
|
||||
hash == hash40(side_taunt_r, strlen(side_taunt_r))) {
|
||||
DI_STATE = (DI_STATE + 1) % NUM_DI_STATES;
|
||||
}
|
||||
|
||||
|
||||
// call original WorkModule::enable_transition_term_group_impl
|
||||
__int64_t motion_module = *(__int64_t *)(battle_object_module_accessor + 0x88);
|
||||
__int64_t change_motion_impl = *(__int64_t *)(motion_module) + 0xD8LL;
|
||||
|
||||
void (*motion_module_change_motion_impl)(__int64_t, __int64_t, float, float, bool, float, bool, bool) =
|
||||
(void (*)(__int64_t, __int64_t, float, float, bool, float, bool, bool))(*(__int64_t *)(change_motion_impl));
|
||||
|
||||
motion_module_change_motion_impl(motion_module, hash, start_frame, frame_speed_mult,
|
||||
unk1, unk2, unk3, unk4);
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SaltySD_printf("SaltySD Plugin: alive\n");
|
||||
|
||||
// Get anchor for imports
|
||||
ANCHOR_ABS = SaltySDCore_getCodeStart();
|
||||
|
||||
char *ver = "Ver. %d.%d.%d";
|
||||
u64 dst_3 = SaltySDCore_findCode(ver, strlen(ver));
|
||||
if (dst_3)
|
||||
{
|
||||
SaltySD_Memcpy(dst_3, "Noice v%d%d%d", 13);
|
||||
u64 WorkModule_enable_transition_term_group_impl_replace(
|
||||
u64 battle_object_module_accessor, u64 transition_group) {
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE && is_training_mode()) {
|
||||
// 0x1F00000D for airdodge
|
||||
if (transition_group == 0x1F00000D) {
|
||||
if (is_operation_cpu(battle_object_module_accessor)) {
|
||||
int status_kind =
|
||||
StatusModule_status_kind(battle_object_module_accessor);
|
||||
// Damage -> DamageFall
|
||||
if (status_kind >= 0x48 && status_kind <= 0x50)
|
||||
StatusModule_change_status_request_from_script(
|
||||
battle_object_module_accessor, 0x22, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
effect_manager_addr = SaltySDCore_FindSymbol("_ZN3lib9SingletonINS_13EffectManagerEE9instance_E");
|
||||
fighter_manager_addr = SaltySDCore_FindSymbol("_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E");
|
||||
// call original WorkModule::enable_transition_term_group_impl
|
||||
u64 work_module = LOAD64(battle_object_module_accessor + 0x50);
|
||||
u64 enable_transition_term_group_impl = LOAD64(work_module) + 0x140LL;
|
||||
|
||||
AttackModule_set_attack_lua_state = SaltySDCore_FindSymbol("_ZN3app10sv_animcmd6ATTACKEP9lua_State") + 0xD0 - 0x70;
|
||||
u64 (*work_module_enable_transition_term_group_impl)(u64, u64) =
|
||||
(u64(*)(u64, u64))(LOAD64(enable_transition_term_group_impl));
|
||||
|
||||
// Install animCMD function replacement
|
||||
SaltySD_function_replace_sym("_ZN3app10sv_animcmd6ATTACKEP9lua_State",
|
||||
&app_sv_animcmd_ATTACK_replace);
|
||||
|
||||
SaltySD_function_replace_sym("_ZN3app8lua_bind45WorkModule__enable_transition_term_group_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
&WorkModule_enable_transition_term_group_impl_replace);
|
||||
|
||||
SaltySD_function_replace_sym("_ZN3app8lua_bind26WorkModule__get_float_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
&WorkModule_get_float_replace);
|
||||
|
||||
SaltySD_function_replace_sym("_ZN3app8lua_bind32MotionModule__change_motion_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40Effbfbb",
|
||||
&MotionModule_change_motion_replace);
|
||||
|
||||
__libnx_exit(0);
|
||||
return work_module_enable_transition_term_group_impl(work_module,
|
||||
transition_group);
|
||||
}
|
||||
|
||||
float WorkModule_get_float_replace(u64 battle_object_module_accessor, int var) {
|
||||
if (DI_STATE == DI_RIGHT && is_training_mode()) {
|
||||
if (is_operation_cpu(battle_object_module_accessor)) {
|
||||
int status_kind = StatusModule_status_kind(battle_object_module_accessor);
|
||||
// Damage -> DamageFall
|
||||
if (status_kind >= 0x48 && status_kind <= 0x50) {
|
||||
int DI_stick_x_ID;
|
||||
int DI_stick_y_ID;
|
||||
|
||||
if (lib_lua_bind_get_value(0xA4D50A730E36970E, &DI_stick_x_ID) &&
|
||||
var == DI_stick_x_ID)
|
||||
return 1.0;
|
||||
|
||||
if (lib_lua_bind_get_value(0xEED4095B229D825B, &DI_stick_y_ID) &&
|
||||
var == DI_stick_y_ID)
|
||||
return 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// call original WorkModule::get_float_impl
|
||||
u64 work_module = LOAD64(battle_object_module_accessor + 0x50);
|
||||
u64 get_float_impl = LOAD64(work_module) + 0x58LL;
|
||||
|
||||
float (*work_module_get_float_impl)(u64, int) =
|
||||
(float (*)(u64, int))(LOAD64(get_float_impl));
|
||||
|
||||
return work_module_get_float_impl(work_module, var);
|
||||
}
|
||||
|
||||
void MotionModule_change_motion_replace(u64 battle_object_module_accessor,
|
||||
u64 hash, float start_frame,
|
||||
float frame_speed_mult, bool unk1,
|
||||
float unk2, bool unk3, bool unk4) {
|
||||
const char *down_taunt_l = "appeal_lw_l";
|
||||
const char *down_taunt_r = "appeal_lw_r";
|
||||
const char *up_taunt_l = "appeal_hi_l";
|
||||
const char *up_taunt_r = "appeal_hi_r";
|
||||
const char *side_taunt_l = "appeal_s_l";
|
||||
const char *side_taunt_r = "appeal_s_r";
|
||||
|
||||
// Down Taunt
|
||||
if (hash == hash40(down_taunt_l) || hash == hash40(down_taunt_r)) {
|
||||
TOGGLE_STATE = (TOGGLE_STATE + 1) % NUM_TOGGLE_STATES;
|
||||
}
|
||||
// Up Taunt
|
||||
else if (hash == hash40(up_taunt_l) || hash == hash40(up_taunt_r)) {
|
||||
HITBOX_VIS = !HITBOX_VIS;
|
||||
}
|
||||
// Side Taunt
|
||||
else if (hash == hash40(side_taunt_l) || hash == hash40(side_taunt_r)) {
|
||||
DI_STATE = (DI_STATE + 1) % NUM_DI_STATES;
|
||||
}
|
||||
|
||||
// call original WorkModule::enable_transition_term_group_impl
|
||||
u64 motion_module = LOAD64(battle_object_module_accessor + 0x88);
|
||||
u64 change_motion_impl = LOAD64(motion_module) + 0xD8LL;
|
||||
|
||||
void (*motion_module_change_motion_impl)(u64, u64, float, float, bool, float,
|
||||
bool, bool) =
|
||||
(void (*)(u64, u64, float, float, bool, float, bool, bool))(
|
||||
LOAD64(change_motion_impl));
|
||||
|
||||
motion_module_change_motion_impl(motion_module, hash, start_frame,
|
||||
frame_speed_mult, unk1, unk2, unk3, unk4);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
SaltySD_printf("SaltySD Plugin: alive\n");
|
||||
|
||||
// Get anchor for imports
|
||||
ANCHOR_ABS = SaltySDCore_getCodeStart();
|
||||
|
||||
const char* ver = "Ver. %d.%d.%d";
|
||||
u64 dst_3 = SaltySDCore_findCode((u8*)ver, strlen(ver));
|
||||
if (dst_3) {
|
||||
SaltySD_Memcpy(dst_3, (u64) "Noice v%d%d%d", 13);
|
||||
}
|
||||
|
||||
effect_manager_addr = SaltySDCore_FindSymbol("_ZN3lib9SingletonINS_13EffectManagerEE9instance_E");
|
||||
fighter_manager_addr = SaltySDCore_FindSymbol("_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E");
|
||||
|
||||
AttackModule_set_attack_lua_state =
|
||||
(void (*)(u64, u64)) SaltySDCore_FindSymbol("_ZN3app10sv_animcmd6ATTACKEP9lua_State") + 0xD0 -
|
||||
0x70;
|
||||
|
||||
// Install animCMD function replacement
|
||||
SaltySD_function_replace_sym("_ZN3app10sv_animcmd6ATTACKEP9lua_State",
|
||||
(u64)&app_sv_animcmd_ATTACK_replace);
|
||||
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind45WorkModule__enable_transition_term_group_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
(u64)&WorkModule_enable_transition_term_group_impl_replace);
|
||||
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind26WorkModule__get_float_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
(u64)&WorkModule_get_float_replace);
|
||||
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind32MotionModule__change_motion_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40Effbfbb",
|
||||
(u64)&MotionModule_change_motion_replace);
|
||||
|
||||
__libnx_exit(0);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define LOAD64(x) *(u64 *)(x)
|
||||
|
||||
#define LINKABLE __attribute__ ((weak))
|
||||
|
||||
#define debug_log(...) \
|
||||
|
|
Loading…
Add table
Reference in a new issue