mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-20 00:46:34 +00:00
formatting
This commit is contained in:
parent
1eb40592ca
commit
e7bd760b91
1 changed files with 82 additions and 67 deletions
|
@ -31,7 +31,8 @@ void * orig_saved_lr;
|
|||
|
||||
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;
|
||||
|
||||
|
@ -48,7 +49,8 @@ void __libnx_init(void * ctx, Handle main_thread, void * saved_lr) {
|
|||
__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);
|
||||
|
@ -73,10 +75,12 @@ Vector3f id_colors[8] = {
|
|||
#define is_training_mode _ZN3app9smashball16is_training_modeEv
|
||||
extern uint64_t _ZN3app9smashball16is_training_modeEv(void) LINKABLE;
|
||||
|
||||
void AttackModule_clear_all_replace(__int64_t attack_module) {
|
||||
void AttackModule_clear_all_replace(__int64_t attack_module)
|
||||
{
|
||||
AttackModule_clear_all_orig(attack_module);
|
||||
|
||||
if (is_training_mode()) {
|
||||
if (is_training_mode())
|
||||
{
|
||||
__int64_t battle_module_object_accessor = *(__int64_t *)(attack_module + 0x8);
|
||||
|
||||
// Clear graphics every time we clear all hitboxes.
|
||||
|
@ -90,7 +94,8 @@ void AttackModule_clear_all_replace(__int64_t attack_module) {
|
|||
}
|
||||
}
|
||||
|
||||
void lib_L2CAgent_push_color(__int64_t* l2c_agent, Vector3f color) {
|
||||
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};
|
||||
|
@ -100,7 +105,8 @@ void lib_L2CAgent_push_color(__int64_t* l2c_agent, Vector3f color) {
|
|||
lib_L2CAgent_push_lua_stack(l2c_agent, &blue);
|
||||
}
|
||||
|
||||
void app_sv_animcmd_ATTACK_replace(__int64_t a1) {
|
||||
void app_sv_animcmd_ATTACK_replace(__int64_t a1)
|
||||
{
|
||||
SaltySD_printf("In attack code with lua_state ptr: %llx\n", a1);
|
||||
|
||||
__int64_t v1; // x19
|
||||
|
@ -133,12 +139,14 @@ void app_sv_animcmd_ATTACK_replace(__int64_t 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);
|
||||
|
||||
if (is_training_mode()) {
|
||||
if (is_training_mode())
|
||||
{
|
||||
// Replace AttackModule::clear_all()
|
||||
__int64_t battle_module_object_accessor = *(__int64_t *)(*(__int64_t *)(a1 - 8) + 416LL);
|
||||
__int64_t attack_module = *(__int64_t *)(battle_module_object_accessor + 0xA0);
|
||||
__int64_t attack_module_clear_all = *(__int64_t *)(attack_module) + 0x50LL;
|
||||
if (AttackModule_clear_all_orig == 0) {
|
||||
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;
|
||||
|
@ -162,16 +170,20 @@ void app_sv_animcmd_ATTACK_replace(__int64_t a1) {
|
|||
|
||||
// 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) {
|
||||
if (x2.type != L2C_void && y2.type != L2C_void && z2.type != L2C_void)
|
||||
{
|
||||
num_effects = 4;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
x2 = x;
|
||||
y2 = y;
|
||||
z2 = z;
|
||||
num_effects = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_effects; i++) {
|
||||
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 =
|
||||
|
@ -206,14 +218,16 @@ void app_sv_animcmd_ATTACK_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;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SaltySD_printf("SaltySD Plugin: alive\n");
|
||||
|
||||
// Get anchor for imports
|
||||
|
@ -221,7 +235,8 @@ int main(int argc, char * argv[]) {
|
|||
|
||||
char *ver = "Ver. %d.%d.%d";
|
||||
u64 dst_3 = SaltySDCore_findCode(ver, strlen(ver));
|
||||
if (dst_3) {
|
||||
if (dst_3)
|
||||
{
|
||||
SaltySD_Memcpy(dst_3, "Noice v%d%d%d", 13);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue