Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Hotfixes #2275

Merged
merged 12 commits into from
Feb 20, 2024
1 change: 1 addition & 0 deletions dynamic/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ pub mod vars {
pub mod instance {
// flags
pub const SPECIAL_HI_CANCEL_ESCAPE_AIR: i32 = 0x0100;
pub const SPECIAL_S_PIKMIN_DETONATE_IS_DETACH_FOR_DETONATE: i32 = 0x0101;
}
pub mod status {
// flags
Expand Down
2 changes: 1 addition & 1 deletion fighters/common/src/function_hooks/attack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ unsafe fn get_damage_frame_mul(ctx: &mut skyline::hooks::InlineCtx) {
}
}

#[skyline::hook(offset = 0x406bd4, inline)]
#[skyline::hook(offset = 0x406bf4, inline)]
unsafe fn get_hitstop_frame_add(ctx: &mut skyline::hooks::InlineCtx) {
match utils::game_modes::get_custom_mode() {
Some(modes) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::*;
#[skyline::from_offset(0xb2f820)]
extern "C" fn jack_customizer(module_accessor: *mut BattleObjectModuleAccessor, customize_to: u32);

#[skyline::hook(offset = 0xb30934, inline)]
#[skyline::hook(offset = 0xb30954, inline)]
unsafe fn check_doyle_summon_dispatch_hook(ctx: &mut skyline::hooks::InlineCtx) {
let module_accessor = *ctx.registers[21].x.as_ref() as *mut BattleObjectModuleAccessor;
WorkModule::off_flag(module_accessor, *FIGHTER_JACK_INSTANCE_WORK_ID_FLAG_DOYLE_EXIST);
Expand Down
41 changes: 19 additions & 22 deletions fighters/common/src/function_hooks/get_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,27 @@ pub fn install() {
//skyline::nro::add_hook(item_nro_hook);
}

static INT_OFFSET: usize = 0x4e5380; // 12.0.0
static FLOAT_OFFSET: usize = 0x4e53C0; // 12.0.0

// #[skyline::hook(offset=0x720540)]
// unsafe fn get_offset(arg0: u64, arg1: u64) {
// static mut ONCE: bool = true;
// if ONCE {
// ONCE = false;
// //debug::dump_trace();
// }
// original!()(arg0, arg1);
// }

#[skyline::hook(offset=0x720540)]
unsafe fn get_offset(arg0: u64, arg1: u64) {
static mut ONCE: bool = true;
if ONCE {
ONCE = false;
//debug::dump_trace();
}
original!()(arg0, arg1);
}

#[skyline::hook(offset=0x1f8810c, inline)]
unsafe fn get_inline_offset(ctx: &InlineCtx) {
static mut ONCE: bool = true;
if ONCE {
ONCE = false;
println!("{:#x}", ctx.registers[3].x.as_ref() - getRegionAddress(Region::Text) as u64);
}
}
// #[skyline::hook(offset=0x1f8810c, inline)]
// unsafe fn get_inline_offset(ctx: &InlineCtx) {
// static mut ONCE: bool = true;
// if ONCE {
// ONCE = false;
// println!("{:#x}", ctx.registers[3].x.as_ref() - getRegionAddress(Region::Text) as u64);
// }
// }

#[skyline::hook(offset=INT_OFFSET)]
#[skyline::hook(offset=0x4E53A0)]
pub unsafe fn get_param_int_hook(x0: u64, x1: u64, x2 :u64) -> i32 {
let mut boma = *((x0 as *mut u64).offset(1)) as *mut BattleObjectModuleAccessor;
let boma_reference = &mut *boma;
Expand Down Expand Up @@ -122,7 +119,7 @@ pub unsafe fn get_param_int_hook(x0: u64, x1: u64, x2 :u64) -> i32 {
original!()(x0, x1, x2)
}

#[skyline::hook(offset=FLOAT_OFFSET)]
#[skyline::hook(offset=0x4E53E0)]
pub unsafe fn get_param_float_hook(x0 /*boma*/: u64, x1 /*param_type*/: u64, x2 /*param_hash*/: u64) -> f32 {
let mut boma = *((x0 as *mut u64).offset(1)) as *mut BattleObjectModuleAccessor;
let boma_reference = &mut *boma;
Expand Down
2 changes: 1 addition & 1 deletion fighters/common/src/function_hooks/hitstun.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#[skyline::hook(offset=0x6a70e0)]
#[skyline::hook(offset=0x6a7100)] // unadjusted for 13.0.2?
pub fn stub_kill_screen() {}

pub fn install() {
Expand Down
2 changes: 1 addition & 1 deletion fighters/common/src/function_hooks/shotos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub fn install() {
disable_negative_edge,
// enable_terry_inputs_for_shotos
);
skyline::patching::Patch::in_text(0x10d45a4).data(0x14000014u32); // enables terry's command inputs for shotos
skyline::patching::Patch::in_text(0x10D45C4).data(0x14000014u32); // enables terry's command inputs for shotos
}

// disables negative edge check for both shotos
Expand Down
14 changes: 7 additions & 7 deletions fighters/common/src/general_statuses/shield/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,13 @@ pub unsafe fn sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue {
return true.into();
}

// check parry
if fighter.is_parry_input() {
fighter.change_status(FIGHTER_STATUS_KIND_GUARD_OFF.into(), true.into());
VarModule::on_flag(fighter.object(), vars::common::instance::IS_PARRY_FOR_GUARD_OFF);
return true.into();
}

// check jump
if
fighter.sub_check_button_jump().get_bool() ||
Expand Down Expand Up @@ -452,13 +459,6 @@ pub unsafe fn sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue {
return true.into();
}

// check parry
if fighter.is_parry_input() {
fighter.change_status(FIGHTER_STATUS_KIND_GUARD_OFF.into(), true.into());
VarModule::on_flag(fighter.object(), vars::common::instance::IS_PARRY_FOR_GUARD_OFF);
return true.into();
}

return false.into();
}

Expand Down
2 changes: 1 addition & 1 deletion fighters/lucario/src/status/special_hi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ unsafe extern "C" fn lucario_special_hi_metered_cancel(fighter: &mut L2CFighterC
WorkModule::enable_transition_term(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ATTACK_AIR);
if fighter.sub_transition_group_check_air_attack().get_bool() {
KineticModule::mul_speed(fighter.module_accessor, &Vector3f{x: 0.5, y: 0.5, z: 0.5}, *FIGHTER_KINETIC_ENERGY_ID_STOP);
MeterModule::drain_direct(fighter.object(), MeterModule::meter_per_level(fighter.object()) * 2.0);
MeterModule::drain_direct(fighter.battle_object, MeterModule::meter_per_level(fighter.battle_object));
let frames = 120.max(VarModule::get_int(fighter.object(), vars::lucario::instance::METER_PAUSE_REGEN_FRAME));
VarModule::set_int(fighter.object(), vars::lucario::instance::METER_PAUSE_REGEN_FRAME, frames);
VarModule::on_flag(fighter.object(), vars::lucario::instance::IS_USPECIAL_ATTACK_CANCEL);
Expand Down
9 changes: 4 additions & 5 deletions fighters/marth/src/acmd/aerials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,18 @@ unsafe fn marth_attack_air_hi_game(fighter: &mut L2CAgentBase) {
frame(lua_state, 3.0);
if is_excute(fighter) {
WorkModule::on_flag(boma, *FIGHTER_STATUS_ATTACK_AIR_FLAG_ENABLE_LANDING);
FT_MOTION_RATE(fighter, 2.0 / 2.5);
}
frame(lua_state, 5.45);
frame(lua_state, 5.0);
FT_MOTION_RATE_RANGE(fighter, 5.0, 13.0, 6.0);
if is_excute(fighter) {
FT_MOTION_RATE(fighter, 5.0 / 6.0);
ATTACK(fighter, 0, 0, Hash40::new("sword1"), 13.0, 90, 70, 0, 45, 4.0, 0.0, 0.0, 7.75, None, None, None, 1.0, 1.0, *ATTACK_SETOFF_KIND_ON, *ATTACK_LR_CHECK_POS, false, 0, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, Hash40::new("collision_attr_cutup"), *ATTACK_SOUND_LEVEL_M, *COLLISION_SOUND_ATTR_MARTH_SWORD, *ATTACK_REGION_SWORD);
ATTACK(fighter, 1, 0, Hash40::new("sword1"), 10.0, 80, 70, 0, 30, 4.0, 0.0, 0.0, 3.0, None, None, None, 0.8, 1.0, *ATTACK_SETOFF_KIND_ON, *ATTACK_LR_CHECK_POS, false, 0, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, Hash40::new("collision_attr_cutup"), *ATTACK_SOUND_LEVEL_M, *COLLISION_SOUND_ATTR_CUTUP, *ATTACK_REGION_SWORD);
ATTACK(fighter, 2, 0, Hash40::new("armr"), 9.0, 80, 70, 0, 20, 3.5, 0.0, 1.0, 0.0, None, None, None, 0.8, 1.0, *ATTACK_SETOFF_KIND_ON, *ATTACK_LR_CHECK_POS, false, 0, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, Hash40::new("collision_attr_cutup"), *ATTACK_SOUND_LEVEL_M, *COLLISION_SOUND_ATTR_CUTUP, *ATTACK_REGION_SWORD);
ATTACK(fighter, 3, 0, Hash40::new("claviclel"), 9.0, 80, 70, 0, 18, 3.5, 0.0, 0.0, 0.0, None, None, None, 0.8, 1.0, *ATTACK_SETOFF_KIND_ON, *ATTACK_LR_CHECK_POS, false, 0, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, Hash40::new("collision_attr_cutup"), *ATTACK_SOUND_LEVEL_S, *COLLISION_SOUND_ATTR_CUTUP, *ATTACK_REGION_SWORD);
}
frame(lua_state, 11.45);
frame(lua_state, 13.0);
FT_MOTION_RATE(fighter, 1.0);
if is_excute(fighter) {
FT_MOTION_RATE(fighter, 1.0);
AttackModule::clear_all(boma);
}
frame(lua_state, 38.0);
Expand Down
34 changes: 18 additions & 16 deletions fighters/pikmin/src/pikmin/acmd/specials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ unsafe fn game_spsremved(fighter: &mut L2CAgentBase) {
let boma = fighter.boma();
let variation = WorkModule::get_int(boma, *WEAPON_PIKMIN_PIKMIN_INSTANCE_WORK_ID_INT_VARIATION);
let p = PikminInfo::from(variation);
if is_excute(fighter) {
AttackModule::clear_all(boma);
let dmg = 4.8;
// special case for yellow pikmin
// reduces the length of the paralyze effect
let hitlag = if variation == 1 {
0.4
} else {
1.0
};
ATTACK(fighter, 0, 0, Hash40::new("waist"), dmg * p.dmg, 90, 105, 0, 65, 6.0, 0.0, 0.0, 0.0, None, None, None, hitlag * p.hitlag, 0.5, *ATTACK_SETOFF_KIND_OFF, *ATTACK_LR_CHECK_POS, false, dmg * p.shield_dmg, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, p.attr_special, *ATTACK_SOUND_LEVEL_L, p.sound, *ATTACK_REGION_PIKMIN);
}
frame(lua_state, 6.0);
if is_excute(fighter) {
AttackModule::clear_all(boma);
fighter.change_status_req(WEAPON_PIKMIN_PIKMIN_STATUS_KIND_DEATH.into(), false.into());
if VarModule::is_flag(fighter.battle_object, vars::pikmin::instance::SPECIAL_S_PIKMIN_DETONATE_IS_DETACH_FOR_DETONATE) {
if is_excute(fighter) {
AttackModule::clear_all(boma);
let dmg = 4.8;
// special case for yellow pikmin
// reduces the length of the paralyze effect
let hitlag = if variation == 1 {
0.4
} else {
1.0
};
ATTACK(fighter, 0, 0, Hash40::new("waist"), dmg * p.dmg, 90, 105, 0, 65, 6.0, 0.0, 0.0, 0.0, None, None, None, hitlag * p.hitlag, 0.5, *ATTACK_SETOFF_KIND_OFF, *ATTACK_LR_CHECK_POS, false, dmg * p.shield_dmg, 0.0, 0, false, false, false, false, true, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, p.attr_special, *ATTACK_SOUND_LEVEL_L, p.sound, *ATTACK_REGION_PIKMIN);
}
frame(lua_state, 6.0);
if is_excute(fighter) {
AttackModule::clear_all(boma);
fighter.change_status_req(WEAPON_PIKMIN_PIKMIN_STATUS_KIND_DEATH.into(), false.into());
}
}
}

Expand Down
36 changes: 26 additions & 10 deletions fighters/pikmin/src/pikmin/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ use globals::*;

pub fn install() {
install_status_scripts!(
special_s_cling_main
special_s_cling_main,
special_s_cling_remove_end,
);
}

// WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING

#[status_script(agent = "pikmin_pikmin", status = WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_MAIN)]
pub unsafe fn special_s_cling_main(fighter: &mut L2CFighterCommon) -> L2CValue {
fighter.off_flag(*WEAPON_PIKMIN_PIKMIN_STATUS_SPECIAL_S_WORK_FLAG_POKEMON_CHANGE_START);
Expand Down Expand Up @@ -36,6 +39,7 @@ pub unsafe fn special_s_cling_main(fighter: &mut L2CFighterCommon) -> L2CValue {
let p = PikminInfo::from(variation);
VarModule::set_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER, 0);
VarModule::off_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME);
VarModule::off_flag(fighter.battle_object, vars::pikmin::instance::SPECIAL_S_PIKMIN_DETONATE_IS_DETACH_FOR_DETONATE);

fighter.fastshift(L2CValue::Ptr(special_s_cling_main_loop as *const () as _))
}
Expand All @@ -47,15 +51,19 @@ unsafe extern "C" fn special_s_cling_main_loop(fighter: &mut L2CFighterCommon) -
let variation = fighter.get_int(*WEAPON_PIKMIN_PIKMIN_INSTANCE_WORK_ID_INT_VARIATION);
let p = PikminInfo::from(variation);

let is_attack = AttackModule::is_attack(fighter.module_accessor, 0, false);
if is_attack && !VarModule::is_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME) {
VarModule::inc_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER);
}
VarModule::set_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME, is_attack);

if VarModule::get_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER) >= p.cling_frame{
fighter.change_status(WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING_REMOVE.into(), false.into());
return 1.into();
if !fighter.global_table[IS_STOPPING].get_bool()
&& !StatusModule::is_changing(fighter.module_accessor)
{
let is_attack = AttackModule::is_attack(fighter.module_accessor, 0, false);
if is_attack && !VarModule::is_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME) {
VarModule::inc_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER);
}
VarModule::set_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME, is_attack);
if VarModule::get_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER) >= p.cling_frame{
VarModule::on_flag(fighter.battle_object, vars::pikmin::instance::SPECIAL_S_PIKMIN_DETONATE_IS_DETACH_FOR_DETONATE);
fighter.change_status(WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING_REMOVE.into(), false.into());
return 1.into();
}
}

if fighter.is_flag(*WEAPON_PIKMIN_PIKMIN_INSTANCE_WORK_ID_FLAG_IS_SPECIAL_S_CLING_ENEMY)
Expand All @@ -78,4 +86,12 @@ unsafe extern "C" fn special_s_cling_main_loop(fighter: &mut L2CFighterCommon) -
}

return 0.into();
}

// WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING_REMOVE

#[status_script(agent = "pikmin_pikmin", status = WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING_REMOVE, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_END)]
pub unsafe fn special_s_cling_remove_end(fighter: &mut L2CFighterCommon) -> L2CValue {
VarModule::off_flag(fighter.battle_object, vars::pikmin::instance::SPECIAL_S_PIKMIN_DETONATE_IS_DETACH_FOR_DETONATE);
original!(fighter)
}
Loading