mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-27 20:34:03 +00:00
Format; Optimize Imports (#477)
* Run IntelliJ's optimize imports + formatter * Clippy
This commit is contained in:
parent
94ff25a921
commit
228ff77673
40 changed files with 329 additions and 286 deletions
3
ryujinx_build.ps1
vendored
3
ryujinx_build.ps1
vendored
|
@ -1,4 +1,5 @@
|
|||
$IP=(Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address).IPAddressToString
|
||||
cargo skyline build --release --features layout_arc_from_file
|
||||
Copy-Item target/aarch64-skyline-switch/release/libtraining_modpack.nro 'C:\Users\Jdsam\AppData\Roaming\Ryujinx\mods\contents\01006A800016E000\romfs\skyline\plugins\'
|
||||
cargo skyline listen --ip=$IP
|
||||
cargo skyline listen --ip=$IP
|
||||
# C:\Users\Jdsam\Documents\Games\Emulators\ryujinx-1.1.299-win_x64\publish\BLAH.exe C:\Users\Jdsam\Documents\Games\Emulators\ryujinx-1.1.299-win_x64\publish\Ryujinx.exe "C:\Users\Jdsam\Documents\Games\SmashRoms\UltimateXCI\ultimate.xci"
|
|
@ -1,9 +1,10 @@
|
|||
use lazy_static::lazy_static;
|
||||
use serde::Deserialize;
|
||||
use smash::app::lua_bind::ControlModule;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use log::info;
|
||||
use serde::Deserialize;
|
||||
use smash::app::lua_bind::ControlModule;
|
||||
use strum::IntoEnumIterator;
|
||||
use strum_macros::EnumIter;
|
||||
use toml;
|
||||
|
@ -53,7 +54,7 @@ pub enum ButtonCombo {
|
|||
SaveState,
|
||||
LoadState,
|
||||
PrevSaveStateSlot,
|
||||
NextSaveStateSlot
|
||||
NextSaveStateSlot,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
|
@ -68,7 +69,7 @@ struct BtnComboConfig {
|
|||
save_state: BtnList,
|
||||
load_state: BtnList,
|
||||
previous_save_state_slot: BtnList,
|
||||
next_save_state_slot: BtnList
|
||||
next_save_state_slot: BtnList,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -210,9 +211,9 @@ fn combo_passes(
|
|||
.map(|hold| *BUTTON_MAPPING.get(&*hold.to_uppercase()).unwrap())
|
||||
.all(|hold| ControlModule::check_button_on(module_accessor, hold))
|
||||
&& press
|
||||
.iter()
|
||||
.map(|press| *BUTTON_MAPPING.get(&*press.to_uppercase()).unwrap())
|
||||
.all(|press| ControlModule::check_button_trigger(module_accessor, press));
|
||||
.iter()
|
||||
.map(|press| *BUTTON_MAPPING.get(&*press.to_uppercase()).unwrap())
|
||||
.all(|press| ControlModule::check_button_trigger(module_accessor, press));
|
||||
|
||||
this_combo_passes
|
||||
}
|
||||
|
@ -220,7 +221,7 @@ fn combo_passes(
|
|||
|
||||
pub fn combo_passes_exclusive(
|
||||
module_accessor: *mut smash::app::BattleObjectModuleAccessor,
|
||||
combo: ButtonCombo
|
||||
combo: ButtonCombo,
|
||||
) -> bool {
|
||||
let other_combo_passes = ButtonCombo::iter()
|
||||
.filter(|other_combo| *other_combo != combo)
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
pub use training_mod_consts::*;
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use std::fs;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use serde::Deserialize;
|
||||
use skyline::nn::hid::NpadGcState;
|
||||
use crate::logging::info;
|
||||
use std::fs;
|
||||
use toml;
|
||||
|
||||
use crate::logging::info;
|
||||
|
||||
/// Hot-reloadable configs for quicker development
|
||||
///
|
||||
|
@ -29,8 +30,7 @@ use toml;
|
|||
/// quit_menu_text.as_textbox().set_text_string(&dev_config.quit_menu_title);
|
||||
/// ```
|
||||
#[derive(Deserialize, Default)]
|
||||
pub struct DevConfig {
|
||||
}
|
||||
pub struct DevConfig {}
|
||||
|
||||
pub unsafe fn config() -> &'static DevConfig {
|
||||
&*DEV_CONFIG.data_ptr()
|
||||
|
@ -48,7 +48,7 @@ impl DevConfig {
|
|||
let dev_config_str = fs::read_to_string(dev_path).unwrap_or_else(|_| panic!("Could not read {}", dev_path));
|
||||
return toml::from_str(&dev_config_str).expect("Could not parse dev config");
|
||||
}
|
||||
|
||||
|
||||
DevConfig::default()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use std::convert::TryInto;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use skyline::libc::c_void;
|
||||
use skyline::nn::{account, oe, time};
|
||||
use std::convert::TryInto;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use crate::common::release::CURRENT_VERSION;
|
||||
|
||||
|
@ -183,3 +184,25 @@ fn smash_version() -> String {
|
|||
.into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn events_loop() {
|
||||
loop {
|
||||
std::thread::sleep(std::time::Duration::from_secs(10));
|
||||
unsafe {
|
||||
while let Some(event) = EVENT_QUEUE.pop() {
|
||||
let host = "https://my-project-1511972643240-default-rtdb.firebaseio.com";
|
||||
let path = format!(
|
||||
"/event/{}/device/{}/{}.json",
|
||||
event.event_name, event.device_id, event.event_time
|
||||
);
|
||||
|
||||
let url = format!("{host}{path}");
|
||||
minreq::post(url)
|
||||
.with_json(&event)
|
||||
.expect("Failed to send info to firebase")
|
||||
.send()
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
use std::fs;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use skyline::nn::hid::{GetNpadStyleSet, NpadGcState};
|
||||
use training_mod_consts::MenuJsonStruct;
|
||||
|
||||
use training_mod_tui::AppPage;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::events::{Event, EVENT_QUEUE};
|
||||
use crate::logging::*;
|
||||
|
||||
use skyline::nn::hid::{GetNpadStyleSet, NpadGcState};
|
||||
use training_mod_consts::MenuJsonStruct;
|
||||
|
||||
// This is a special frame counter that will tick on draw()
|
||||
// We'll count how long the menu has been open
|
||||
pub static mut FRAME_COUNTER : u32 = 0;
|
||||
const MENU_INPUT_WAIT_FRAMES : u32 = 30;
|
||||
const MENU_CLOSE_WAIT_FRAMES : u32 = 60;
|
||||
pub static mut FRAME_COUNTER: u32 = 0;
|
||||
const MENU_INPUT_WAIT_FRAMES: u32 = 30;
|
||||
const MENU_CLOSE_WAIT_FRAMES: u32 = 60;
|
||||
pub static mut QUICK_MENU_ACTIVE: bool = false;
|
||||
|
||||
pub unsafe fn menu_condition(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
|
@ -33,8 +38,12 @@ pub fn load_from_file() {
|
|||
}
|
||||
} else {
|
||||
warn!("Previous menu found but is invalid. Deleting...");
|
||||
fs::remove_file(menu_conf_path)
|
||||
.unwrap_or_else(|_| panic!("{} has invalid schema but could not be deleted!", menu_conf_path));
|
||||
fs::remove_file(menu_conf_path).unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"{} has invalid schema but could not be deleted!",
|
||||
menu_conf_path
|
||||
)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
info!("No previous menu file found.");
|
||||
|
@ -48,7 +57,7 @@ pub unsafe fn set_menu_from_json(message: &str) {
|
|||
// Includes both MENU and DEFAULTS_MENU
|
||||
MENU = message_json.menu;
|
||||
DEFAULTS_MENU = message_json.defaults_menu;
|
||||
std::fs::write(
|
||||
fs::write(
|
||||
MENU_CONF_PATH,
|
||||
serde_json::to_string_pretty(&message_json).unwrap(),
|
||||
)
|
||||
|
@ -57,7 +66,7 @@ pub unsafe fn set_menu_from_json(message: &str) {
|
|||
skyline::error::show_error(
|
||||
0x70,
|
||||
"Could not parse the menu response!\nPlease send a screenshot of the details page to the developers.\n\0",
|
||||
&format!("{message:#?}\0")
|
||||
&format!("{message:#?}\0"),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -227,17 +236,15 @@ pub fn handle_get_npad_state(state: *mut NpadGcState, _controller_id: *const u32
|
|||
}
|
||||
}
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use training_mod_tui::AppPage;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref QUICK_MENU_APP: Mutex<training_mod_tui::App<'static>> =
|
||||
Mutex::new(training_mod_tui::App::new(
|
||||
unsafe { ui_menu(MENU) },
|
||||
unsafe { (ui_menu(DEFAULTS_MENU), serde_json::to_string(&DEFAULTS_MENU).unwrap())}
|
||||
pub static ref QUICK_MENU_APP: Mutex<training_mod_tui::App<'static>> = Mutex::new(
|
||||
training_mod_tui::App::new(unsafe { ui_menu(MENU) }, unsafe {
|
||||
(
|
||||
ui_menu(DEFAULTS_MENU),
|
||||
serde_json::to_string(&DEFAULTS_MENU).unwrap(),
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
pub unsafe fn quick_menu_loop() {
|
||||
|
@ -257,7 +264,8 @@ pub unsafe fn quick_menu_loop() {
|
|||
potential_controller_ids.push(0x20);
|
||||
if potential_controller_ids
|
||||
.iter()
|
||||
.all(|i| GetNpadStyleSet(i as *const _).flags == 0) {
|
||||
.all(|i| GetNpadStyleSet(i as *const _).flags == 0)
|
||||
{
|
||||
QUICK_MENU_ACTIVE = false;
|
||||
continue;
|
||||
}
|
||||
|
@ -324,4 +332,4 @@ pub unsafe fn quick_menu_loop() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
pub mod button_config;
|
||||
pub mod consts;
|
||||
pub mod events;
|
||||
pub mod menu;
|
||||
pub mod raygun_printer;
|
||||
pub mod release;
|
||||
pub mod dev_config;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lua2cpp::L2CFighterCommon;
|
||||
|
||||
pub use crate::common::consts::MENU;
|
||||
pub static mut DEFAULTS_MENU: TrainingModpackMenu = crate::common::consts::DEFAULTS_MENU;
|
||||
use crate::common::consts::*;
|
||||
|
||||
pub mod button_config;
|
||||
pub mod consts;
|
||||
pub mod dev_config;
|
||||
pub mod events;
|
||||
pub mod menu;
|
||||
pub mod raygun_printer;
|
||||
pub mod release;
|
||||
|
||||
pub static mut DEFAULTS_MENU: TrainingModpackMenu = consts::DEFAULTS_MENU;
|
||||
pub static mut BASE_MENU: TrainingModpackMenu = unsafe { DEFAULTS_MENU };
|
||||
pub static mut FIGHTER_MANAGER_ADDR: usize = 0;
|
||||
pub static mut ITEM_MANAGER_ADDR: usize = 0;
|
||||
|
@ -99,6 +100,7 @@ pub fn is_in_hitstun(module_accessor: &mut app::BattleObjectModuleAccessor) -> b
|
|||
// TODO: Should this be *FIGHTER_STATUS_KIND_DAMAGE..*FIGHTER_STATUS_KIND_DAMAGE_AIR ?
|
||||
(*FIGHTER_STATUS_KIND_DAMAGE..*FIGHTER_STATUS_KIND_DAMAGE_FALL).contains(&status_kind)
|
||||
}
|
||||
|
||||
pub fn is_in_footstool(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
let status_kind = unsafe { StatusModule::status_kind(module_accessor) };
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::logging::*;
|
||||
use skyline_web::DialogOk;
|
||||
use std::fs;
|
||||
|
||||
use skyline_web::DialogOk;
|
||||
|
||||
use crate::logging::*;
|
||||
|
||||
pub const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const VERSION_FILE_PATH: &str = "sd:/TrainingModpack/version.txt";
|
||||
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
#![allow(dead_code)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_variables)]
|
||||
use crate::common::consts::*;
|
||||
use crate::logging::*;
|
||||
|
||||
use skyline::error::show_error;
|
||||
use skyline::hook;
|
||||
use skyline::hooks::A64InlineHook;
|
||||
use skyline::text_iter::{add_get_imm, adrp_get_imm, Instruction::*, TextIter};
|
||||
use smash::app::smashball::is_training_mode;
|
||||
|
||||
use HazardState::*;
|
||||
use HookState::*;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use crate::logging::*;
|
||||
|
||||
enum HazardState {
|
||||
Begin,
|
||||
Adrp1,
|
||||
|
@ -24,9 +29,6 @@ enum HookState {
|
|||
Ldrsw2,
|
||||
}
|
||||
|
||||
use HazardState::*;
|
||||
use HookState::*;
|
||||
|
||||
fn get_hazard_flag_address() -> usize {
|
||||
let mut state = HazardState::Begin;
|
||||
let mut flag_pos = 0;
|
||||
|
@ -98,7 +100,7 @@ fn mod_handle_hazards() {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe fn validate_hazards_addrs() -> std::result::Result<(), ()> {
|
||||
unsafe fn validate_hazards_addrs() -> Result<(), ()> {
|
||||
HAZARD_FLAG_ADDRESS = get_hazard_flag_address() as *mut u8;
|
||||
LOAD_ADDRESS = get_hazard_hook_address();
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use crate::common::{consts::*, *};
|
||||
use crate::logging::*;
|
||||
use smash::app::{self, lua_bind::*, sv_animcmd, sv_system};
|
||||
use smash::lib::{lua_const::*, L2CAgent, L2CValue};
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
use crate::common::{consts::*, *};
|
||||
use crate::logging::*;
|
||||
|
||||
pub const ID_COLORS: &[Vector3f] = &[
|
||||
// used to tint the hitbox effects -- make sure that at least one component
|
||||
// is equal to 1.0
|
||||
|
@ -107,44 +108,24 @@ pub unsafe fn generate_hitbox_effects(
|
|||
z: 0.0,
|
||||
};
|
||||
|
||||
if false {
|
||||
// is_fighter(module_accessor) {
|
||||
EffectModule::req_on_joint(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
Hash40::new_raw(bone),
|
||||
&pos,
|
||||
&zeros,
|
||||
size * size_mult,
|
||||
&zeros,
|
||||
&zeros,
|
||||
true,
|
||||
*EFFECT_SUB_ATTRIBUTE_NO_JOINT_SCALE as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_FOLLOW as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_CONCLUDE_STATUS as u32,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
} else {
|
||||
EffectModule::req_follow(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
Hash40::new_raw(bone),
|
||||
&pos,
|
||||
&zeros,
|
||||
size * size_mult,
|
||||
true,
|
||||
*EFFECT_SUB_ATTRIBUTE_NO_JOINT_SCALE as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_FOLLOW as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_CONCLUDE_STATUS as u32,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
}
|
||||
EffectModule::req_follow(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
Hash40::new_raw(bone),
|
||||
&pos,
|
||||
&zeros,
|
||||
size * size_mult,
|
||||
true,
|
||||
*EFFECT_SUB_ATTRIBUTE_NO_JOINT_SCALE as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_FOLLOW as u32
|
||||
| *EFFECT_SUB_ATTRIBUTE_CONCLUDE_STATUS as u32,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
|
||||
// set to hitbox ID color
|
||||
EffectModule::set_rgb_partial_last(module_accessor, color.x, color.y, color.z);
|
||||
|
|
60
src/lib.rs
60
src/lib.rs
|
@ -4,17 +4,28 @@
|
|||
#![feature(once_cell)]
|
||||
#![feature(c_variadic)]
|
||||
#![allow(
|
||||
clippy::borrow_interior_mutable_const,
|
||||
clippy::declare_interior_mutable_const,
|
||||
clippy::not_unsafe_ptr_arg_deref,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::fn_null_check,
|
||||
// Look into why for this one
|
||||
clippy::transmute_num_to_bytes
|
||||
clippy::borrow_interior_mutable_const,
|
||||
clippy::declare_interior_mutable_const,
|
||||
clippy::not_unsafe_ptr_arg_deref,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::fn_null_check,
|
||||
clippy::transmute_num_to_bytes
|
||||
)]
|
||||
|
||||
use std::fs;
|
||||
|
||||
use skyline::libc::mkdir;
|
||||
use skyline::nro::{self, NroInfo};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::events::events_loop;
|
||||
use crate::events::{Event, EVENT_QUEUE};
|
||||
use crate::logging::*;
|
||||
use crate::menu::quick_menu_loop;
|
||||
use crate::training::ui::notifications::notification;
|
||||
|
||||
pub mod common;
|
||||
mod hazard_manager;
|
||||
mod hitbox_visualizer;
|
||||
|
@ -22,17 +33,6 @@ mod training;
|
|||
|
||||
mod logging;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::events::{Event, EVENT_QUEUE};
|
||||
|
||||
use skyline::libc::mkdir;
|
||||
use skyline::nro::{self, NroInfo};
|
||||
use std::fs;
|
||||
|
||||
use crate::logging::*;
|
||||
use crate::menu::quick_menu_loop;
|
||||
use crate::training::ui::notifications::notification;
|
||||
|
||||
fn nro_main(nro: &NroInfo<'_>) {
|
||||
if nro.module.isLoaded {
|
||||
return;
|
||||
|
@ -105,25 +105,7 @@ pub fn main() {
|
|||
menu::load_from_file();
|
||||
button_config::load_from_file();
|
||||
|
||||
std::thread::spawn(|| loop {
|
||||
std::thread::sleep(std::time::Duration::from_secs(10));
|
||||
unsafe {
|
||||
while let Some(event) = EVENT_QUEUE.pop() {
|
||||
let host = "https://my-project-1511972643240-default-rtdb.firebaseio.com";
|
||||
let path = format!(
|
||||
"/event/{}/device/{}/{}.json",
|
||||
event.event_name, event.device_id, event.event_time
|
||||
);
|
||||
|
||||
let url = format!("{host}{path}");
|
||||
minreq::post(url)
|
||||
.with_json(&event)
|
||||
.expect("Failed to send info to firebase")
|
||||
.send()
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
});
|
||||
std::thread::spawn(events_loop);
|
||||
|
||||
std::thread::spawn(|| unsafe { quick_menu_loop() });
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use core::f64::consts::PI;
|
||||
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::directional_influence::should_reverse_angle;
|
||||
use core::f64::consts::PI;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
static mut STICK_DIRECTION: Direction = Direction::empty();
|
||||
|
||||
|
@ -39,7 +41,7 @@ unsafe fn get_angle(module_accessor: &mut app::BattleObjectModuleAccessor) -> Op
|
|||
module_accessor,
|
||||
*FIGHTER_KINETIC_ENERGY_ID_DAMAGE,
|
||||
)
|
||||
as *mut smash::app::KineticEnergy);
|
||||
as *mut app::KineticEnergy);
|
||||
// If we're launched left, reverse stick X
|
||||
if launch_speed_x < 0.0 {
|
||||
PI - angle
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use smash::app::{self};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
|
||||
static mut DIRECTION: AttackAngle = AttackAngle::UP;
|
||||
|
||||
pub fn roll_direction() {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use crate::is_operation_cpu;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::handle_add_limit;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
static mut BUFF_DELAY_COUNTER: usize = 0;
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::mash;
|
||||
use smash::app;
|
||||
use smash::app::lua_bind::*;
|
||||
use smash::app::ItemKind;
|
||||
|
@ -8,6 +5,10 @@ use smash::app::{ArticleOperationTarget, BattleObjectModuleAccessor, Item};
|
|||
use smash::cpp::l2c_value::LuaConst;
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::mash;
|
||||
|
||||
pub struct CharItem {
|
||||
pub fighter_kind: LuaConst,
|
||||
pub item_kind: Option<LuaConst>,
|
||||
|
@ -354,7 +355,7 @@ unsafe fn apply_single_item(player_fighter_kind: i32, item: &CharItem) {
|
|||
let item_ptr = ItemManager::get_active_item(item_mgr, 0);
|
||||
ItemModule::have_item_instance(
|
||||
player_module_accessor,
|
||||
item_ptr as *mut smash::app::Item,
|
||||
item_ptr as *mut Item,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
|
@ -512,9 +513,9 @@ static GAFT_OFFSET: usize = 0x03d40a0;
|
|||
|
||||
#[skyline::hook(offset = GAFT_OFFSET)]
|
||||
pub unsafe fn handle_generate_article_for_target(
|
||||
article_module_accessor: *mut app::BattleObjectModuleAccessor,
|
||||
article_module_accessor: *mut BattleObjectModuleAccessor,
|
||||
int_1: i32,
|
||||
module_accessor: *mut app::BattleObjectModuleAccessor, // this is always 0x0 normally
|
||||
module_accessor: *mut BattleObjectModuleAccessor, // this is always 0x0 normally
|
||||
bool_1: bool,
|
||||
int_2: i32,
|
||||
) -> u64 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
|
@ -11,7 +11,8 @@ pub struct SteveState {
|
|||
pub mat_gold: i32,
|
||||
pub mat_redstone: i32,
|
||||
pub mat_diamond: i32,
|
||||
pub sword_mat: char, // is actually FighterPickelMaterialKind, but char is same size and works
|
||||
pub sword_mat: char,
|
||||
// is actually FighterPickelMaterialKind, but char is same size and works
|
||||
pub sword_durability: f32,
|
||||
pub axe_mat: char,
|
||||
pub axe_durability: f32,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use serde::{Serialize, Deserialize};
|
||||
use smash::app::{self, lua_bind::*, ArticleOperationTarget, FighterFacial, FighterUtil};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smash::app::{self, ArticleOperationTarget, FighterFacial, FighterUtil, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::mash;
|
||||
use smash::app::lua_bind::{ControlModule, EffectModule};
|
||||
use smash::app::BattleObjectModuleAccessor;
|
||||
use smash::app::lua_bind::{ControlModule, EffectModule};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::mash;
|
||||
|
||||
static mut COUNTER: u32 = 0;
|
||||
static mut WAS_IN_CLATTER_FLAG: bool = false;
|
||||
static mut CLATTER_STEP: f32 = 8.0;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use skyline::nn::ui2d::ResColor;
|
||||
use training_mod_consts::OnOff;
|
||||
use crate::common::consts::FighterId;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::FighterId;
|
||||
use crate::training::*;
|
||||
|
||||
pub static mut FRAME_ADVANTAGE: i32 = 0;
|
||||
|
@ -59,7 +60,7 @@ fn update_frame_advantage(new_frame_adv: i32) {
|
|||
x if x < 0 => ResColor { r: 200, g: 8, b: 8, a: 255 },
|
||||
x if x == 0 => ResColor { r: 0, g: 0, b: 0, a: 255 },
|
||||
_ => ResColor { r: 31, g: 198, b: 0, a: 255 },
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -82,10 +83,10 @@ pub unsafe fn is_enable_transition_term(
|
|||
|
||||
if !PLAYER_ACTIONABLE
|
||||
&& ((is
|
||||
&& actionable_statuses!()
|
||||
.iter()
|
||||
.any(|actionable_transition| *actionable_transition == transition_term))
|
||||
|| (CancelModule::is_enable_cancel(module_accessor)))
|
||||
&& actionable_statuses!()
|
||||
.iter()
|
||||
.any(|actionable_transition| *actionable_transition == transition_term))
|
||||
|| (CancelModule::is_enable_cancel(module_accessor)))
|
||||
{
|
||||
PLAYER_ACTIVE_FRAME = frame_counter::get_frame_count(FRAME_COUNTER_INDEX);
|
||||
PLAYER_ACTIONABLE = true;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::common::consts::OnOff;
|
||||
use crate::common::*;
|
||||
use smash::app::{lua_bind::StatusModule, BattleObjectModuleAccessor};
|
||||
use smash::app::{BattleObjectModuleAccessor, lua_bind::StatusModule};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::OnOff;
|
||||
|
||||
pub unsafe fn mod_get_stick_y(module_accessor: &mut BattleObjectModuleAccessor) -> Option<f32> {
|
||||
if !is_operation_cpu(module_accessor) {
|
||||
return None;
|
||||
|
@ -11,13 +12,13 @@ pub unsafe fn mod_get_stick_y(module_accessor: &mut BattleObjectModuleAccessor)
|
|||
|
||||
if MENU.crouch == OnOff::On
|
||||
&& [
|
||||
*FIGHTER_STATUS_KIND_WAIT,
|
||||
*FIGHTER_STATUS_KIND_SQUAT,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_B,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_F,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_RV,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_WAIT,
|
||||
]
|
||||
*FIGHTER_STATUS_KIND_WAIT,
|
||||
*FIGHTER_STATUS_KIND_SQUAT,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_B,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_F,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_RV,
|
||||
*FIGHTER_STATUS_KIND_SQUAT_WAIT,
|
||||
]
|
||||
.contains(&fighter_status_kind)
|
||||
{
|
||||
Some(-1.0)
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use core::f64::consts::PI;
|
||||
|
||||
use smash::app::{self, lua_bind::*, sv_system};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lua2cpp::L2CFighterCommon;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
|
||||
static mut DI_CASE: Direction = Direction::empty();
|
||||
|
||||
pub fn roll_di_case() {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use crate::common::*;
|
||||
use crate::training::frame_counter;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::training::frame_counter;
|
||||
|
||||
static mut FRAME_COUNTER: usize = 0;
|
||||
|
||||
// The current fastfall delay
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::common::*;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
|
||||
// the current full hop status
|
||||
static mut FULL_HOP: bool = false;
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use crate::common::MENU;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use skyline::nn::hid::{GetNpadStyleSet, NpadGcState};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use crate::common::MENU;
|
||||
|
||||
lazy_static! {
|
||||
static ref P1_DELAYED_NPAD_STATES: Mutex<VecDeque<NpadGcState>> = Mutex::new(VecDeque::new());
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
use crate::training::input_delay::p1_controller_id;
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use skyline::nn::hid::NpadHandheldState;
|
||||
use smash::app::{lua_bind::*, BattleObjectModuleAccessor};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use InputRecordState::*;
|
||||
|
||||
use crate::training::input_delay::p1_controller_id;
|
||||
|
||||
lazy_static! {
|
||||
static ref P1_NPAD_STATES: Mutex<[NpadHandheldState; 90]> =
|
||||
Mutex::new([{ NpadHandheldState::default() }; 90]);
|
||||
}
|
||||
|
||||
pub static mut INPUT_RECORD: InputRecordState = InputRecordState::None;
|
||||
pub static mut INPUT_RECORD: InputRecordState = None;
|
||||
pub static mut INPUT_RECORD_FRAME: usize = 0;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
@ -20,8 +23,6 @@ pub enum InputRecordState {
|
|||
Playback,
|
||||
}
|
||||
|
||||
use InputRecordState::*;
|
||||
|
||||
pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAccessor) {
|
||||
let entry_id_int = WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID);
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::mash;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::mash;
|
||||
|
||||
const NOT_SET: u32 = 9001;
|
||||
static mut LEDGE_DELAY: u32 = NOT_SET;
|
||||
static mut LEDGE_DELAY_COUNTER: usize = 0;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
use crate::common::consts::*;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::{attack_angle, save_states};
|
||||
use crate::training::character_specific;
|
||||
use crate::training::fast_fall;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::full_hop;
|
||||
use crate::training::shield;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
const DISTANCE_CLOSE_THRESHOLD: f32 = 16.0;
|
||||
const DISTANCE_MID_THRESHOLD: f32 = 37.0;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
use crate::common::{is_training_mode, menu, FIGHTER_MANAGER_ADDR, ITEM_MANAGER_ADDR, STAGE_MANAGER_ADDR, dev_config};
|
||||
use crate::hitbox_visualizer;
|
||||
use crate::logging::*;
|
||||
use crate::training::character_specific::items;
|
||||
use skyline::hooks::{getRegionAddress, InlineCtx, Region};
|
||||
use skyline::nn::hid::*;
|
||||
use skyline::nn::ro::LookupSymbol;
|
||||
|
@ -10,6 +6,13 @@ use smash::lib::lua_const::*;
|
|||
use smash::params::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
use crate::common::{
|
||||
dev_config, is_training_mode, menu, FIGHTER_MANAGER_ADDR, ITEM_MANAGER_ADDR, STAGE_MANAGER_ADDR,
|
||||
};
|
||||
use crate::hitbox_visualizer;
|
||||
use crate::logging::*;
|
||||
use crate::training::character_specific::items;
|
||||
|
||||
pub mod buff;
|
||||
pub mod charge;
|
||||
pub mod clatter;
|
||||
|
@ -29,11 +32,11 @@ mod attack_angle;
|
|||
mod character_specific;
|
||||
mod fast_fall;
|
||||
mod full_hop;
|
||||
pub(crate) mod input_delay;
|
||||
pub mod input_delay;
|
||||
mod input_record;
|
||||
mod mash;
|
||||
mod reset;
|
||||
pub(crate) mod save_states;
|
||||
pub mod save_states;
|
||||
mod shield_tilt;
|
||||
|
||||
#[skyline::hook(replace = WorkModule::get_param_float)]
|
||||
|
@ -321,7 +324,9 @@ fn params_main(params_info: &ParamsInfo<'_>) {
|
|||
}
|
||||
}
|
||||
|
||||
static CLOUD_ADD_LIMIT_OFFSET: usize = 0x008dc140; // this function is used to add limit to Cloud's limit gauge. Hooking it here so we can call it in buff.rs
|
||||
static CLOUD_ADD_LIMIT_OFFSET: usize = 0x008dc140;
|
||||
|
||||
// this function is used to add limit to Cloud's limit gauge. Hooking it here so we can call it in buff.rs
|
||||
#[skyline::hook(offset = CLOUD_ADD_LIMIT_OFFSET)]
|
||||
pub unsafe fn handle_add_limit(
|
||||
add_limit: f32,
|
||||
|
@ -369,8 +374,9 @@ pub unsafe fn handle_check_doyle_summon_dispatch(
|
|||
|
||||
// Set Stale Moves to On
|
||||
static STALE_OFFSET: usize = 0x013e88a4;
|
||||
|
||||
// One instruction after stale moves toggle register is set to 0
|
||||
#[skyline::hook(offset=STALE_OFFSET, inline)]
|
||||
#[skyline::hook(offset = STALE_OFFSET, inline)]
|
||||
unsafe fn stale_handle(ctx: &mut InlineCtx) {
|
||||
let x22 = ctx.registers[22].x.as_mut();
|
||||
let training_structure_address = (*x22 + 0xb60) as *mut u8;
|
||||
|
@ -379,8 +385,9 @@ unsafe fn stale_handle(ctx: &mut InlineCtx) {
|
|||
|
||||
// Set Stale Moves to On in the menu text
|
||||
static STALE_MENU_OFFSET: usize = 0x013e88a0;
|
||||
|
||||
// One instruction after menu text register is set to off
|
||||
#[skyline::hook(offset=STALE_MENU_OFFSET, inline)]
|
||||
#[skyline::hook(offset = STALE_MENU_OFFSET, inline)]
|
||||
unsafe fn stale_menu_handle(ctx: &mut InlineCtx) {
|
||||
// Set the text pointer to where "mel_training_on" is located
|
||||
let on_text_ptr = (getRegionAddress(Region::Text) as u64) + 0x42b215e;
|
||||
|
@ -461,7 +468,9 @@ pub unsafe fn handle_effect(
|
|||
)
|
||||
}
|
||||
|
||||
static CAN_FUTTOBI_BACK_OFFSET: usize = 0x0260f950; // can_futtobi_back, checks if stage allows for star KOs
|
||||
static CAN_FUTTOBI_BACK_OFFSET: usize = 0x0260f950;
|
||||
|
||||
// can_futtobi_back, checks if stage allows for star KOs
|
||||
#[skyline::hook(offset = CAN_FUTTOBI_BACK_OFFSET)]
|
||||
pub unsafe fn handle_star_ko(my_long_ptr: &mut u64) -> bool {
|
||||
let ori = original!()(my_long_ptr);
|
||||
|
@ -512,7 +521,7 @@ pub fn training_mods() {
|
|||
.as_ptr(),
|
||||
);
|
||||
|
||||
smash::params::add_hook(params_main).unwrap();
|
||||
add_hook(params_main).unwrap();
|
||||
}
|
||||
|
||||
skyline::install_hooks!(
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::ledge;
|
||||
|
@ -5,8 +8,6 @@ use crate::training::mash;
|
|||
use crate::training::sdi;
|
||||
use crate::training::shield_tilt;
|
||||
use crate::training::throw;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
pub fn check_reset(module_accessor: &mut app::BattleObjectModuleAccessor) {
|
||||
if !is_operation_cpu(module_accessor) {
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use log::info;
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smash::app::{self, Item, lua_bind::*};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
use training_mod_consts::{CharacterItem, SaveDamage};
|
||||
|
||||
use SaveState::*;
|
||||
|
||||
use crate::{is_ptrainer, ITEM_MANAGER_ADDR};
|
||||
use crate::common::button_config;
|
||||
use crate::common::consts::FighterId;
|
||||
use crate::common::consts::get_random_float;
|
||||
use crate::common::consts::get_random_int;
|
||||
use crate::common::consts::FighterId;
|
||||
use crate::common::consts::OnOff;
|
||||
use crate::common::consts::SaveStateMirroring;
|
||||
use crate::common::is_dead;
|
||||
|
@ -12,17 +26,6 @@ use crate::training::character_specific::steve;
|
|||
use crate::training::charge::{self, ChargeState};
|
||||
use crate::training::items::apply_item;
|
||||
use crate::training::reset;
|
||||
use crate::{is_ptrainer, ITEM_MANAGER_ADDR};
|
||||
use SaveState::*;
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use smash::app::{self, lua_bind::*, Item};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
use std::collections::HashMap;
|
||||
use log::info;
|
||||
use training_mod_consts::{CharacterItem, SaveDamage};
|
||||
use crate::training::ui::notifications;
|
||||
|
||||
extern "C" {
|
||||
|
@ -98,15 +101,15 @@ pub struct SaveStateSlots {
|
|||
cpu: [SavedState; NUM_SAVE_STATE_SLOTS],
|
||||
}
|
||||
|
||||
const NUM_SAVE_STATE_SLOTS : usize = 5;
|
||||
const NUM_SAVE_STATE_SLOTS: usize = 5;
|
||||
// I actually had to do it this way, a simple load-from-file in main() caused crashes.
|
||||
lazy_static::lazy_static! {
|
||||
static ref SAVE_STATE_SLOTS : Mutex<SaveStateSlots> = Mutex::new(load_from_file());
|
||||
}
|
||||
static mut SAVE_STATE_SLOT : usize = 0;
|
||||
static mut SAVE_STATE_SLOT: usize = 0;
|
||||
|
||||
pub fn load_from_file() -> SaveStateSlots {
|
||||
let defaults = SaveStateSlots{
|
||||
let defaults = SaveStateSlots {
|
||||
player: [default_save_state!(); NUM_SAVE_STATE_SLOTS],
|
||||
cpu: [default_save_state!(); NUM_SAVE_STATE_SLOTS],
|
||||
};
|
||||
|
@ -291,7 +294,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
*FIGHTER_KIND_EDGE,
|
||||
*FIGHTER_KIND_WIIFIT,
|
||||
]
|
||||
.contains(&fighter_kind);
|
||||
.contains(&fighter_kind);
|
||||
|
||||
if !is_operation_cpu(module_accessor) &&
|
||||
button_config::combo_passes_exclusive(module_accessor, button_config::ButtonCombo::PrevSaveStateSlot) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::directional_influence;
|
||||
use core::f64::consts::PI;
|
||||
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::Vector2f;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::directional_influence;
|
||||
|
||||
static mut COUNTER: u32 = 0;
|
||||
|
||||
static mut DIRECTION: Direction = Direction::NEUTRAL;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::{frame_counter, save_states};
|
||||
use crate::training::mash;
|
||||
use smash::app;
|
||||
use smash::app::lua_bind::*;
|
||||
use smash::app::sv_system;
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lua2cpp::L2CFighterCommon;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::{frame_counter, save_states};
|
||||
use crate::training::mash;
|
||||
|
||||
// How many hits to hold shield until picking an Out Of Shield option
|
||||
static mut MULTI_HIT_OFFSET: u32 = 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use smash::app::{self};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
|
||||
static mut STICK_DIRECTION: Direction = Direction::OUT;
|
||||
|
||||
pub fn roll_direction() {
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::{frame_counter, mash};
|
||||
use smash::app::{self, lua_bind::*, sv_system, BattleObjectModuleAccessor};
|
||||
use smash::app::{lua_bind::*, sv_system, BattleObjectModuleAccessor};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lua2cpp::L2CFighterBase;
|
||||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::{frame_counter, mash};
|
||||
|
||||
static mut TECH_ROLL_DIRECTION: Direction = Direction::empty();
|
||||
static mut MISS_TECH_ROLL_DIRECTION: Direction = Direction::empty();
|
||||
static mut FRAME_COUNTER: usize = 0;
|
||||
|
@ -66,7 +67,7 @@ unsafe fn mod_handle_change_status(
|
|||
}
|
||||
|
||||
unsafe fn handle_grnd_tech(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
module_accessor: &mut BattleObjectModuleAccessor,
|
||||
status_kind: &mut L2CValue,
|
||||
unk: &mut L2CValue,
|
||||
status_kind_int: i32,
|
||||
|
@ -122,7 +123,7 @@ unsafe fn handle_grnd_tech(
|
|||
}
|
||||
|
||||
unsafe fn handle_wall_tech(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
module_accessor: &mut BattleObjectModuleAccessor,
|
||||
status_kind: &mut L2CValue,
|
||||
unk: &mut L2CValue,
|
||||
status_kind_int: i32,
|
||||
|
@ -164,7 +165,7 @@ unsafe fn handle_wall_tech(
|
|||
}
|
||||
|
||||
unsafe fn handle_ceil_tech(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
module_accessor: &mut BattleObjectModuleAccessor,
|
||||
status_kind: &mut L2CValue,
|
||||
unk: &mut L2CValue,
|
||||
status_kind_int: i32,
|
||||
|
@ -194,7 +195,7 @@ unsafe fn handle_ceil_tech(
|
|||
true
|
||||
}
|
||||
|
||||
pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) {
|
||||
pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAccessor) {
|
||||
if !is_operation_cpu(module_accessor) || MENU.tech_state == TechFlags::empty() {
|
||||
return;
|
||||
}
|
||||
|
@ -263,7 +264,7 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModule
|
|||
}
|
||||
|
||||
pub unsafe fn change_motion(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
module_accessor: &mut BattleObjectModuleAccessor,
|
||||
motion_kind: u64,
|
||||
) -> Option<u64> {
|
||||
if !is_operation_cpu(module_accessor) {
|
||||
|
@ -297,9 +298,7 @@ pub unsafe fn change_motion(
|
|||
None
|
||||
}
|
||||
|
||||
unsafe fn get_snake_laydown_lockout_time(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
) -> u32 {
|
||||
unsafe fn get_snake_laydown_lockout_time(module_accessor: &mut BattleObjectModuleAccessor) -> u32 {
|
||||
let base_lockout_time: f32 = WorkModule::get_param_float(
|
||||
module_accessor,
|
||||
hash40("common"),
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::mash;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::mash;
|
||||
|
||||
const NOT_SET: u32 = 9001;
|
||||
static mut THROW_DELAY: u32 = NOT_SET;
|
||||
static mut THROW_DELAY_COUNTER: usize = 0;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::common::{get_player_dmg_digits, is_ready_go, is_training_mode};
|
||||
use crate::consts::FighterId;
|
||||
use skyline::nn::ui2d::*;
|
||||
use smash::ui2d::SmashPane;
|
||||
|
||||
use crate::common::{get_player_dmg_digits, is_ready_go, is_training_mode};
|
||||
use crate::consts::FighterId;
|
||||
|
||||
pub unsafe fn iterate_anim_list(
|
||||
anim_transform_node: &mut AnimTransformNode,
|
||||
layout_name: Option<&str>,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::training::ui;
|
||||
use skyline::nn::ui2d::*;
|
||||
use smash::ui2d::{SmashPane, SmashTextBox};
|
||||
|
||||
use crate::training::ui;
|
||||
|
||||
macro_rules! display_parent_fmt {
|
||||
($x:ident) => {
|
||||
format!("TrModDisp{}", $x).as_str()
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{common, common::menu::QUICK_MENU_ACTIVE};
|
||||
use skyline::nn::ui2d::*;
|
||||
use smash::ui2d::{SmashPane, SmashTextBox};
|
||||
|
||||
use training_mod_tui::{App, AppPage};
|
||||
use training_mod_tui::gauge::GaugeState;
|
||||
|
||||
use crate::{common, common::menu::QUICK_MENU_ACTIVE};
|
||||
|
||||
pub static NUM_MENU_TEXT_OPTIONS: usize = 33;
|
||||
pub static _NUM_MENU_TABS: usize = 3;
|
||||
|
||||
|
@ -319,35 +321,35 @@ pub unsafe fn draw(root_pane: &mut Pane) {
|
|||
});
|
||||
[(0xE0E2, "SaveDefaults"), (0xE0E4, "ResetCurrentDefaults"), (0xE0E5, "ResetAllDefaults")].iter()
|
||||
.for_each(|(key, name)| {
|
||||
let key_help_pane = root_pane.find_pane_by_name_recursive(name)
|
||||
.unwrap();
|
||||
let key_help_pane = root_pane.find_pane_by_name_recursive(name)
|
||||
.unwrap();
|
||||
|
||||
let icon_pane = key_help_pane.find_pane_by_name_recursive("set_txt_icon")
|
||||
.unwrap().as_textbox();
|
||||
icon_pane.set_text_string("");
|
||||
let it = icon_pane.text_buf as *mut u16;
|
||||
icon_pane.text_len = 1;
|
||||
*it = *key as u16;
|
||||
*(it.add(1)) = 0x0;
|
||||
let icon_pane = key_help_pane.find_pane_by_name_recursive("set_txt_icon")
|
||||
.unwrap().as_textbox();
|
||||
icon_pane.set_text_string("");
|
||||
let it = icon_pane.text_buf as *mut u16;
|
||||
icon_pane.text_len = 1;
|
||||
*it = *key as u16;
|
||||
*(it.add(1)) = 0x0;
|
||||
|
||||
// PascalCase to Title Case
|
||||
let title_case = name
|
||||
.chars()
|
||||
.fold(vec![], |mut acc, ch| {
|
||||
if ch.is_uppercase() {
|
||||
acc.push(String::new());
|
||||
}
|
||||
if let Some(last) = acc.last_mut() {
|
||||
last.push(ch);
|
||||
}
|
||||
acc
|
||||
})
|
||||
.into_iter()
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ");
|
||||
key_help_pane.find_pane_by_name_recursive("set_txt_help")
|
||||
.unwrap().as_textbox().set_text_string(title_case.as_str());
|
||||
});
|
||||
// PascalCase to Title Case
|
||||
let title_case = name
|
||||
.chars()
|
||||
.fold(vec![], |mut acc, ch| {
|
||||
if ch.is_uppercase() {
|
||||
acc.push(String::new());
|
||||
}
|
||||
if let Some(last) = acc.last_mut() {
|
||||
last.push(ch);
|
||||
}
|
||||
acc
|
||||
})
|
||||
.into_iter()
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ");
|
||||
key_help_pane.find_pane_by_name_recursive("set_txt_help")
|
||||
.unwrap().as_textbox().set_text_string(title_case.as_str());
|
||||
});
|
||||
|
||||
match app.page {
|
||||
AppPage::SUBMENU => render_submenu_page(app, root_pane),
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::common::{is_ready_go, is_training_mode};
|
||||
use sarc::SarcFile;
|
||||
use skyline::nn::ui2d::*;
|
||||
use training_mod_consts::{OnOff, MENU};
|
||||
use training_mod_consts::{MENU, OnOff};
|
||||
|
||||
use crate::common::{is_ready_go, is_training_mode};
|
||||
|
||||
mod damage;
|
||||
mod display;
|
||||
|
@ -33,7 +34,7 @@ pub unsafe fn handle_draw(layout: *mut Layout, draw_info: u64, cmd_buffer: u64)
|
|||
// We'll keep some sane max size here; we shouldn't reach above 600KiB is the idea,
|
||||
// but we can try higher if we need to.
|
||||
#[cfg(feature = "layout_arc_from_file")]
|
||||
static mut LAYOUT_ARC : &mut [u8; 600000] = &mut [0u8; 600000];
|
||||
static mut LAYOUT_ARC: &mut [u8; 600000] = &mut [0u8; 600000];
|
||||
|
||||
/// We are editing the info_training/layout.arc and replacing the original file with our
|
||||
/// modified version from `sd://TrainingModpack/layout.arc` or, in the case of Ryujinx for the cool
|
||||
|
@ -82,7 +83,7 @@ unsafe fn handle_layout_arc_malloc(
|
|||
let decompressed_size = *ctx.registers[1].x.as_ref() as usize;
|
||||
|
||||
let layout_arc = SarcFile::read(
|
||||
std::slice::from_raw_parts(decompressed_file,decompressed_size)
|
||||
std::slice::from_raw_parts(decompressed_file, decompressed_size)
|
||||
).unwrap();
|
||||
let training_layout = layout_arc.files.iter().find(|f| {
|
||||
f.name.is_some() && f.name.as_ref().unwrap() == &String::from("blyt/info_training.bflyt")
|
||||
|
@ -92,7 +93,7 @@ unsafe fn handle_layout_arc_malloc(
|
|||
}
|
||||
|
||||
let inject_arc;
|
||||
let inject_arc_size : u64;
|
||||
let inject_arc_size: u64;
|
||||
|
||||
#[cfg(feature = "layout_arc_from_file")] {
|
||||
let inject_arc_from_file = std::fs::read("sd:/TrainingModpack/layout.arc").unwrap();
|
||||
|
|
|
@ -7,7 +7,7 @@ pub struct Notification {
|
|||
pub header: String,
|
||||
pub message: String,
|
||||
length: u32,
|
||||
pub color: ResColor
|
||||
pub color: ResColor,
|
||||
}
|
||||
|
||||
impl Notification {
|
||||
|
@ -16,7 +16,7 @@ impl Notification {
|
|||
header,
|
||||
message,
|
||||
length,
|
||||
color
|
||||
color,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ pub fn notification(header: String, message: String, len: u32) {
|
|||
r: 0,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 255
|
||||
a: 255,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue