mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-03 21:32:19 +00:00
formatting
This commit is contained in:
parent
22d3346d98
commit
fc9ad5b7ab
1 changed files with 119 additions and 116 deletions
|
@ -34,8 +34,7 @@ __int64_t (*app_sv_animcmd_EFFECT_FOLLOW_COLOR)(__int64_t);
|
|||
|
||||
void (* AttackModule_clear_all_orig)(__int64_t);
|
||||
|
||||
void __libnx_init(void* ctx, Handle main_thread, void* saved_lr)
|
||||
{
|
||||
void __libnx_init(void * ctx, Handle main_thread, void * saved_lr) {
|
||||
extern char * fake_heap_start;
|
||||
extern char * fake_heap_end;
|
||||
|
||||
|
@ -47,14 +46,15 @@ void __libnx_init(void* ctx, Handle main_thread, void* saved_lr)
|
|||
orig_saved_lr = saved_lr;
|
||||
|
||||
// Call constructors.
|
||||
void __libc_init_array(void);
|
||||
void
|
||||
__libc_init_array(void);
|
||||
__libc_init_array();
|
||||
}
|
||||
|
||||
void __attribute__((weak)) NORETURN __libnx_exit(int rc)
|
||||
{
|
||||
void __attribute__((weak)) NORETURN __libnx_exit(int rc) {
|
||||
// Call destructors.
|
||||
void __libc_fini_array(void);
|
||||
void
|
||||
__libc_fini_array(void);
|
||||
__libc_fini_array();
|
||||
|
||||
SaltySD_printf("SaltySD Plugin: jumping to %p\n", orig_saved_lr);
|
||||
|
@ -72,14 +72,15 @@ void AttackModule_clear_all_replace(__int64_t attack_module) {
|
|||
|
||||
// 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, __int64_t, __int64_t) = (void (*)(__int64_t, __int64_t, __int64_t, __int64_t))(*(__int64_t*)(*(__int64_t *)(effect_module) + 0xE0LL));
|
||||
void (* EffectModule_kill_kind)(__int64_t, __int64_t, __int64_t,
|
||||
__int64_t) =
|
||||
(void (*)(__int64_t, __int64_t, __int64_t, __int64_t))(*(__int64_t *) (*(__int64_t *) (effect_module) + 0xE0LL));
|
||||
|
||||
Hash40 shieldEffectHash = { .hash = 0xAFAE75F05LL };
|
||||
EffectModule_kill_kind(effect_module, shieldEffectHash.hash, 0, 1);
|
||||
}
|
||||
|
||||
void _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace(__int64_t a1) {
|
||||
|
||||
SaltySD_printf("In attack code with lua_state ptr: %llx\n", a1);
|
||||
|
||||
__int64_t v1; // x19
|
||||
|
@ -149,9 +150,12 @@ void _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace(__int64_t a1) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < num_effects; i++) {
|
||||
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};
|
||||
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);
|
||||
|
@ -173,16 +177,14 @@ void _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace(__int64_t a1) {
|
|||
|
||||
// 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) )
|
||||
{
|
||||
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;
|
||||
}
|
||||
} /* _ZN3app10sv_animcmd6ATTACKEP9lua_State_replace */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char * argv[]) {
|
||||
SaltySD_printf("SaltySD Plugin: alive\n");
|
||||
|
||||
// Get anchor for imports
|
||||
|
@ -198,7 +200,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
// Install animCMD function replacement
|
||||
SaltySD_function_replace_sym("_ZN3app10sv_animcmd6ATTACKEP9lua_State", &_ZN3app10sv_animcmd6ATTACKEP9lua_State_replace);
|
||||
SaltySD_function_replace_sym("_ZN3app10sv_animcmd6ATTACKEP9lua_State",
|
||||
&_ZN3app10sv_animcmd6ATTACKEP9lua_State_replace);
|
||||
|
||||
__libnx_exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue