mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-02-17 14:40:31 +00:00
clean up warnings, remove shine replace
This commit is contained in:
parent
ddd53cd0fb
commit
b7c26e7c12
9 changed files with 24 additions and 52 deletions
2
Makefile
2
Makefile
|
@ -47,7 +47,7 @@ CFLAGS := -Wall -O2 \
|
|||
|
||||
CFLAGS += $(INCLUDE) -DSWITCH
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fpermissive -std=gnu++11
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fpermissive -Wno-parentheses -Wno-write-strings -Wno-pointer-arith -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=$(TOPDIR)/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
|
|
@ -111,8 +111,8 @@ struct ACMD
|
|||
void wrap( u64 (*acmd_func)(u64), std::initializer_list<L2CValue> list )
|
||||
{
|
||||
l2c_agent->clear_lua_stack();
|
||||
for( auto elem : list )
|
||||
l2c_agent->push_lua_stack(&L2CValue(elem));
|
||||
for( L2CValue elem : list )
|
||||
l2c_agent->push_lua_stack(&elem);
|
||||
|
||||
acmd_func(l2c_agent->lua_state_agent);
|
||||
l2c_agent->clear_lua_stack();
|
||||
|
|
|
@ -53,16 +53,16 @@ void AttackModule_clear_all_replace(u64 module_accessor) {
|
|||
}
|
||||
}
|
||||
|
||||
void push_color(L2CAgent *l2c_agent, Vector3f color) {
|
||||
l2c_agent->push_lua_stack(&L2CValue(color.x));
|
||||
l2c_agent->push_lua_stack(&L2CValue(color.y));
|
||||
l2c_agent->push_lua_stack(&L2CValue(color.z));
|
||||
}
|
||||
|
||||
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) {
|
||||
Vector3f color = id_colors[id->raw % 8];
|
||||
L2CValue red(color.x);
|
||||
L2CValue green(color.y);
|
||||
L2CValue blue(color.z);
|
||||
|
||||
|
||||
float sizeMult = 19.0 / 200.0;
|
||||
Hash40 shieldEffectHash = {.hash = 0xAFAE75F05LL};
|
||||
|
||||
|
@ -91,16 +91,13 @@ void generate_hitbox_effects(L2CAgent *l2c_agent, L2CValue *id, L2CValue *bone,
|
|||
L2CValue currY(y->raw_float + ((y2->raw_float - y->raw_float) / 3 * i));
|
||||
L2CValue currZ(z->raw_float + ((z2->raw_float - z->raw_float) / 3 * i));
|
||||
|
||||
ACMD acmd{.l2c_agent = l2c_agent};
|
||||
ACMD acmd(l2c_agent);
|
||||
acmd.wrap(EFFECT_FOLLOW_NO_SCALE,
|
||||
{shieldEffect, *bone, currX, currY, currZ, xRot, yRot, zRot, effectSize, terminate}
|
||||
);
|
||||
|
||||
// Set to hitbox ID color
|
||||
// LAST_EFFECT_SET_COLOR(Red, Green, Blue)
|
||||
l2c_agent->clear_lua_stack();
|
||||
push_color(l2c_agent, id_colors[id->raw % 8]);
|
||||
LAST_EFFECT_SET_COLOR(l2c_agent->lua_state_agent);
|
||||
acmd.wrap(LAST_EFFECT_SET_COLOR, {red, green, blue});
|
||||
|
||||
// Speed up animation by rate to remove pulsing effect
|
||||
// LAST_EFFECT_SET_RATE(Rate)
|
||||
|
@ -109,10 +106,6 @@ void generate_hitbox_effects(L2CAgent *l2c_agent, L2CValue *id, L2CValue *bone,
|
|||
}
|
||||
|
||||
void app_sv_animcmd_ATTACK_replace(u64 a1) {
|
||||
u64 v1; // x19
|
||||
u64 v2; // x9
|
||||
u64 i; // x8
|
||||
|
||||
// Instantiate our own L2CAgent with the given lua_State
|
||||
L2CAgent l2c_agent;
|
||||
l2c_agent.L2CAgent_constr(a1);
|
||||
|
@ -135,7 +128,6 @@ void app_sv_animcmd_ATTACK_replace(u64 a1) {
|
|||
l2c_agent.get_lua_stack(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()) {
|
||||
|
@ -143,6 +135,9 @@ void app_sv_animcmd_ATTACK_replace(u64 a1) {
|
|||
generate_hitbox_effects(&l2c_agent, &id, &bone, &size, &x, &y, &z, &x2, &y2, &z2);
|
||||
}
|
||||
|
||||
u64 v1, v2, i;
|
||||
v1 = a1;
|
||||
|
||||
// original code: clear_lua_stack section
|
||||
v2 = LOAD64(v1 + 16);
|
||||
for (i = **(u64 **)(v1 + 32) + 16LL; v2 < i; v2 = LOAD64(v1 + 16)) {
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace lib
|
|||
pop_lua_stack(index);
|
||||
}
|
||||
|
||||
u64 sv_set_function_hash(void* func, u64 hash) asm("_ZN3lib8L2CAgent20sv_set_function_hashEPvN3phx6Hash40E") LINKABLE;
|
||||
u64 sv_set_function_hash(u64 (*func)(L2CAgent*, void*), u64 hash) asm("_ZN3lib8L2CAgent20sv_set_function_hashEPvN3phx6Hash40E") LINKABLE;
|
||||
u64 clear_lua_stack() asm("_ZN3lib8L2CAgent15clear_lua_stackEv") LINKABLE;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
uint64_t lua_bind_hash(void* data_, size_t len) {
|
||||
int64_t *data = data_;
|
||||
uint64_t lua_bind_hash(const void* data_, size_t len) {
|
||||
int64_t *data = (int64_t*)data_;
|
||||
size_t hash = len;
|
||||
int64_t hash_add = 0x27d4eb2f165667c4;
|
||||
int64_t* data_end = (int64_t *)((int64_t)data + len);
|
||||
|
@ -92,6 +92,6 @@ uint64_t lua_bind_hash(void* data_, size_t len) {
|
|||
return final_hash ^ final_hash >> 0x20;
|
||||
}
|
||||
|
||||
uint64_t lua_bind_hash_str(char* str) {
|
||||
uint64_t lua_bind_hash_str(const char* str) {
|
||||
return lua_bind_hash(str, strlen(str));
|
||||
}
|
|
@ -64,6 +64,7 @@ void __attribute__((weak)) NORETURN __libnx_exit(int rc)
|
|||
SaltySD_printf("SaltySD Plugin: jumping to %p\n", orig_saved_lr);
|
||||
|
||||
__nx_exit(0, orig_saved_lr);
|
||||
while (true);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
@ -183,7 +183,7 @@ void print_string( u64 module_accessor, const char* print_str) {
|
|||
line_num = 1;
|
||||
horiz_offset = 0;
|
||||
char_num = 0;
|
||||
for (int i = 0; i < strlen(print_str); i++) {
|
||||
for (size_t i = 0; i < strlen(print_str); i++) {
|
||||
char curr_char = print_str[i];
|
||||
if (curr_char == '\n') {
|
||||
horiz_offset = 0;
|
||||
|
|
|
@ -26,19 +26,9 @@ u64 appeal_lw_replace(L2CAgent* l2c_agent, void* variadic);
|
|||
u64 appeal_hi_replace(L2CAgent* l2c_agent, void* variadic);
|
||||
u64 appeal_s_replace(L2CAgent* l2c_agent, void* variadic);
|
||||
|
||||
void replace_scripts(L2CAgent* l2c_agent, u8 category, uint kind) {
|
||||
void replace_scripts(L2CAgent* l2c_agent, u8 category, int kind) {
|
||||
// fighter
|
||||
if (category == BATTLE_OBJECT_CATEGORY_FIGHTER) {
|
||||
// fox
|
||||
if (kind == FIGHTER_KIND_FOX) {
|
||||
l2c_agent->sv_set_function_hash(&shine_replace, hash40("game_speciallwstart"));
|
||||
l2c_agent->sv_set_function_hash(&shine_replace, hash40("game_specialairlwstart"));
|
||||
}
|
||||
|
||||
// peach
|
||||
if (kind == FIGHTER_KIND_PEACH) {
|
||||
}
|
||||
|
||||
l2c_agent->sv_set_function_hash(&appeal_lw_replace, hash40("effect_appeallwl"));
|
||||
l2c_agent->sv_set_function_hash(&appeal_lw_replace, hash40("effect_appeallwr"));
|
||||
l2c_agent->sv_set_function_hash(&appeal_hi_replace, hash40("effect_appealhil"));
|
||||
|
@ -78,20 +68,6 @@ u64 appeal_hi_replace(L2CAgent* l2c_agent, void* variadic) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void show_angle(u64 module_accessor, float y, float x, float zrot) {
|
||||
Hash40 raygunShot = {.hash = 0x11e470b07fLL};
|
||||
Hash40 top = {.hash = 0x031ed91fcaLL};
|
||||
|
||||
Vector3f pos = {.x = x, .y = y, .z = 0};
|
||||
Vector3f rot = {.x = 0, .y = 90, .z = zrot};
|
||||
Vector3f random = {.x = 0, .y = 0, .z = 0};
|
||||
|
||||
float size = 0.5;
|
||||
|
||||
EffectModule::req_on_joint(module_accessor, raygunShot.hash, top.hash, &pos,
|
||||
&rot, size, &random, &random, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
u64 appeal_s_replace(L2CAgent* l2c_agent, void* variadic) {
|
||||
ACMD acmd = ACMD(l2c_agent);
|
||||
|
||||
|
@ -142,7 +118,7 @@ u64 clear_lua_stack_replace(u64 l2c_agent) {
|
|||
u64 lua_state = LOAD64(l2c_agent + 8);
|
||||
if (lua_state-8 && LOAD64(lua_state-8) && LOAD64(LOAD64(lua_state - 8) + 416LL)) {
|
||||
u8 battle_object_category = *(u8 *)(LOAD64(lua_state - 8) + 404LL);
|
||||
uint battle_object_kind = *(uint *)(LOAD64(lua_state - 8) + 408LL);
|
||||
int battle_object_kind = *(int *)(LOAD64(lua_state - 8) + 408LL);
|
||||
replace_scripts((L2CAgent*)l2c_agent, battle_object_category, battle_object_kind);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
#define NONE 0
|
||||
|
||||
// Up Taunt
|
||||
extern bool HITBOX_VIS = 1;
|
||||
bool HITBOX_VIS = 1;
|
||||
|
||||
// Side Taunt
|
||||
// 0, 0.785398, 1.570796, 2.356194, -3.14159, -2.356194, -1.570796, -0.785398
|
||||
// 0, pi/4, pi/2, 3pi/4, pi, 5pi/4, 3pi/2, 7pi/4
|
||||
|
||||
extern int DI_STATE = 0;
|
||||
int DI_STATE = 0;
|
||||
#define NUM_DI_STATES 9
|
||||
|
||||
// Down Taunt
|
||||
|
|
Loading…
Reference in a new issue