2020-04-08 10:28:33 +00:00
|
|
|
#![feature(proc_macro_hygiene)]
|
2020-04-30 23:13:49 +00:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(non_snake_case)]
|
|
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
#![feature(with_options)]
|
2020-04-08 04:21:52 +00:00
|
|
|
|
2020-04-30 23:13:49 +00:00
|
|
|
mod hitbox_visualizer;
|
2020-05-01 00:36:56 +00:00
|
|
|
mod training;
|
2020-04-30 23:13:49 +00:00
|
|
|
mod common;
|
2020-04-08 10:28:33 +00:00
|
|
|
|
2020-05-13 20:36:55 +00:00
|
|
|
use crate::common::*;
|
|
|
|
use crate::common::consts::*;
|
|
|
|
|
2020-04-30 23:13:49 +00:00
|
|
|
use smash::lib::lua_const::{*};
|
2020-05-13 20:36:55 +00:00
|
|
|
use smash::lib::L2CValue;
|
2020-04-30 23:13:49 +00:00
|
|
|
use smash::app::lua_bind::{*};
|
|
|
|
use smash::app::sv_system::{self};
|
2020-05-13 19:20:52 +00:00
|
|
|
use smash::lua2cpp::L2CFighterCommon;
|
2020-05-13 20:36:55 +00:00
|
|
|
use skyline::libc::{c_void, fopen, fwrite, fclose};
|
|
|
|
use skyline::{c_str};
|
2020-05-05 01:55:19 +00:00
|
|
|
use skyline::nro::{self, NroInfo};
|
2020-04-08 10:28:33 +00:00
|
|
|
|
2020-05-05 01:55:19 +00:00
|
|
|
#[allow(unused_unsafe)]
|
2020-05-13 19:20:52 +00:00
|
|
|
#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_sub_guard_cont)]
|
|
|
|
pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue {
|
|
|
|
let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent);
|
|
|
|
if (*menu).MASH_STATE == MASH_ATTACK && (*menu).ATTACK_STATE == MASH_GRAB {
|
|
|
|
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
|
|
|
|
if WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_INVALID_CATCH_FRAME) == 0 {
|
|
|
|
if WorkModule::is_enable_transition_term(module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CATCH) {
|
|
|
|
fighter.fighter_base.change_status(L2CValue::new_int(*FIGHTER_STATUS_KIND_CATCH as u64), L2CValue::new_bool(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
original!()(fighter)
|
2020-05-05 01:55:19 +00:00
|
|
|
}
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-05-05 01:55:19 +00:00
|
|
|
fn nro_main(nro: &NroInfo) {
|
|
|
|
match nro.name {
|
|
|
|
"common" =>
|
|
|
|
{
|
|
|
|
println!("Loaded common NRO!");
|
2020-05-13 19:20:52 +00:00
|
|
|
skyline::install_hook!(handle_sub_guard_cont);
|
2020-05-05 01:55:19 +00:00
|
|
|
},
|
|
|
|
_ => ()
|
|
|
|
}
|
2020-04-09 06:15:39 +00:00
|
|
|
}
|
|
|
|
|
2020-04-30 23:13:49 +00:00
|
|
|
#[skyline::main(name = "test")]
|
2020-04-16 04:55:22 +00:00
|
|
|
pub fn main() {
|
2020-04-30 23:13:49 +00:00
|
|
|
println!("Training modpack initialized.");
|
2020-05-13 19:20:52 +00:00
|
|
|
hitbox_visualizer::hitbox_visualization();
|
2020-05-01 00:36:56 +00:00
|
|
|
training::training_mods();
|
2020-05-05 01:55:19 +00:00
|
|
|
nro::add_hook(nro_main).unwrap();
|
2020-04-09 09:10:23 +00:00
|
|
|
|
2020-05-07 00:50:31 +00:00
|
|
|
unsafe {
|
2020-05-13 19:20:52 +00:00
|
|
|
common::menu = &mut common::menu_struct;
|
|
|
|
let buffer = format!("{:x}", common::menu as u64);
|
|
|
|
println!("Writing training_modpack.log with {}...\n", buffer);
|
2020-05-07 00:50:31 +00:00
|
|
|
let f = fopen("sd:/SaltySD/training_modpack.log\u{0}".as_bytes().as_ptr(), "w\u{0}".as_bytes().as_ptr());
|
|
|
|
|
|
|
|
println!("File pointer: {:#?}", f);
|
|
|
|
if !f.is_null() {
|
|
|
|
fwrite(c_str(&buffer) as *const c_void, 1, buffer.len(), f);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
2020-04-16 04:55:22 +00:00
|
|
|
}
|