diff --git a/Makefile b/Makefile index ae2d1d4..6036421 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,9 @@ CFLAGS := -Wall -O2 \ -ffast-math \ $(ARCH) $(DEFINES) -CFLAGS += $(INCLUDE) -DSWITCH +TIMESTAMP := $(shell date "+%m/%d %I:%M%p") + +CFLAGS += $(INCLUDE) -DSWITCH -DBUILD_TS='"$(TIMESTAMP)"' CXXFLAGS := $(CFLAGS) -g3 -fno-rtti -Wno-parentheses -Wno-write-strings -Wno-int-to-pointer-cast -std=gnu++11 diff --git a/source/hitbox_visualizer.h b/source/hitbox_visualizer.h index 7030442..8780ff2 100644 --- a/source/hitbox_visualizer.h +++ b/source/hitbox_visualizer.h @@ -80,20 +80,15 @@ void set_rebound_replace(u64 module_accessor, bool rebound) { } } // namespace app::lua_bind::GrabModule -Vector3f EffectModule_last_get_scale_w(u64 effect_module) { - Vector3f ret; +void EffectModule_last_get_scale_w(u64 effect_module, Vector3f* scale) { uint handle = *(uint *)(effect_module + 36); if (handle && (signed int)handle >= 1) { u64 effect = LOAD64(effect_manager_addr) + 768 * (handle >> 24); bool is_exist_effect = effect && *(uint *)(effect + 4) == handle; if (is_exist_effect) { - float *scale = (float *)(effect + 256); - ret.x = *(float *)(scale); - ret.y = *(float *)(scale + 1); - ret.z = *(float *)(scale + 2); + *scale = *(Vector3f *)(effect + 256); } } - return ret; } void generate_hitbox_effects(L2CAgent *l2c_agent, L2CValue *bone, diff --git a/source/main.cpp b/source/main.cpp index dc54fb2..b4bf160 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -73,7 +73,11 @@ int sprintf_intercept(char* s, const char* format, ...) { minor = va_arg(vl, int); patch = va_arg(vl, int); va_end(vl); +#if defined(DEBUG) && defined(BUILD_TS) + return vsprintf(s, BUILD_TS, vl); +#else return vsprintf(s, "Training Mods v1.5", vl); +#endif } va_list vl; va_start(vl,format); @@ -117,5 +121,16 @@ int main(int argc, char* argv[]) { SaltySDCore_fclose(f); } +#ifdef DEBUG + f = SaltySDCore_fopen("sdmc:/SaltySD/syslog.conf", "w"); + if (f) { + SaltySD_printf("Writing config file...\n"); + char buffer[20]; + snprintf(buffer, 20, "%lx", (u64)&logger); + SaltySDCore_fwrite(buffer, strlen(buffer), 1, f); + SaltySDCore_fclose(f); + } +#endif + __libnx_exit(0); } diff --git a/source/training/common.h b/source/training/common.h index 29f8f7a..bc6d422 100644 --- a/source/training/common.h +++ b/source/training/common.h @@ -3,6 +3,22 @@ #include "useful/const_value_table.h" #include "../taunt_toggles.h" +// Uncomment the line below to debug using syslogger. +// #define DEBUG + +#ifdef DEBUG +struct LogPacket +{ + bool dirty = false; + bool to_sd = false; + char buffer[256]; +} logger; + +#define syslog(...) snprintf(logger.buffer, 256, __VA_ARGS__); logger.dirty = true; logger.to_sd = true; +#else +#define syslog(...) +#endif + using namespace app::lua_bind; int major, minor, patch; diff --git a/source/training/mash.h b/source/training/mash.h index 59ebd5c..da774af 100644 --- a/source/training/mash.h +++ b/source/training/mash.h @@ -57,7 +57,7 @@ void get_command_flag_cat(u64 module_accessor, int category, int& flag) { case MASH_DAIR: flag |= FIGHTER_PAD_CMD_CAT1_FLAG_ATTACK_N; // If we are performing the attack OOS we also need to jump - if(is_in_shieldstun(module_accessor)) + if (is_in_shieldstun(module_accessor)) flag |= FIGHTER_PAD_CMD_CAT1_FLAG_JUMP_BUTTON; break; case MASH_NEUTRAL_B: @@ -152,6 +152,15 @@ bool check_button_on(u64 module_accessor, int button, bool& replace) { } } + if (button == CONTROL_PAD_BUTTON_ATTACK || button == CONTROL_PAD_BUTTON_CATCH) { + if (is_training_mode() && is_operation_cpu(module_accessor)) { + if (menu.MASH_STATE == MASH_ATTACK && menu.ATTACK_STATE == MASH_GRAB && is_in_shieldstun(module_accessor)) { + replace = true; + return true; + } + } + } + replace = false; return false; }