mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-27 20:34:03 +00:00
Fix Clippy
This commit is contained in:
parent
5b0b5490cc
commit
afecfcc48c
12 changed files with 31 additions and 35 deletions
6
.devcontainer/devcontainer.json
vendored
6
.devcontainer/devcontainer.json
vendored
|
@ -2,10 +2,8 @@
|
||||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/docker-from-docker
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/docker-from-docker
|
||||||
{
|
{
|
||||||
"name": "Cargo Skyline",
|
"name": "Cargo Skyline",
|
||||||
"image": "jugeeya/cargo-skyline:3.2.0-no-dkp",
|
"image": "rust:1.73",
|
||||||
"mounts": [
|
"mounts": [],
|
||||||
"source=ultimatetrainingmodpack-bashhistory,target=/commandhistory,type=volume"
|
|
||||||
],
|
|
||||||
// // Use this environment variable if you need to bind mount your local source code into a new container.
|
// // Use this environment variable if you need to bind mount your local source code into a new container.
|
||||||
"remoteEnv": {
|
"remoteEnv": {
|
||||||
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
|
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
|
||||||
|
|
|
@ -3,7 +3,6 @@ use std::fs;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use toml;
|
|
||||||
|
|
||||||
use crate::common::input::*;
|
use crate::common::input::*;
|
||||||
use crate::consts::DEV_TOML_PATH;
|
use crate::consts::DEV_TOML_PATH;
|
||||||
|
|
|
@ -2,16 +2,14 @@ use once_cell::sync::Lazy;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
|
use std::ptr::addr_of;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use skyline::nn::hid::GetNpadStyleSet;
|
use skyline::nn::hid::GetNpadStyleSet;
|
||||||
use training_mod_consts::{create_app, MenuJsonStruct};
|
|
||||||
use training_mod_tui::AppPage;
|
|
||||||
|
|
||||||
use crate::common::button_config::button_mapping;
|
use crate::common::button_config::button_mapping;
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
use crate::consts::MENU_OPTIONS_PATH;
|
|
||||||
use crate::events::{Event, EVENT_QUEUE};
|
use crate::events::{Event, EVENT_QUEUE};
|
||||||
use crate::input::*;
|
use crate::input::*;
|
||||||
use crate::logging::*;
|
use crate::logging::*;
|
||||||
|
@ -53,9 +51,11 @@ pub fn load_from_file() {
|
||||||
info!("Setting initial menu selections...");
|
info!("Setting initial menu selections...");
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut app = QUICK_MENU_APP.lock();
|
let mut app = QUICK_MENU_APP.lock();
|
||||||
app.serialized_default_settings =
|
app.serialized_default_settings = serde_json::to_string(&*addr_of!(DEFAULTS_MENU))
|
||||||
serde_json::to_string(&DEFAULTS_MENU).expect("Could not serialize DEFAULTS_MENU");
|
.expect("Could not serialize DEFAULTS_MENU");
|
||||||
app.update_all_from_json(&serde_json::to_string(&MENU).expect("Could not serialize MENU"));
|
app.update_all_from_json(
|
||||||
|
&serde_json::to_string(&*addr_of!(MENU)).expect("Could not serialize MENU"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
use crate::common::dialog;
|
use crate::common::dialog;
|
||||||
use crate::consts::*;
|
use crate::consts::*;
|
||||||
use crate::logging::*;
|
use crate::logging::*;
|
||||||
use crate::MENU;
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
|
@ -33,7 +33,7 @@ unsafe fn get_angle(module_accessor: &mut app::BattleObjectModuleAccessor) -> Op
|
||||||
|
|
||||||
STICK_DIRECTION = MENU.air_dodge_dir.get_random();
|
STICK_DIRECTION = MENU.air_dodge_dir.get_random();
|
||||||
STICK_DIRECTION.into_angle().map(|angle| {
|
STICK_DIRECTION.into_angle().map(|angle| {
|
||||||
if !should_reverse_angle(&STICK_DIRECTION) {
|
if !should_reverse_angle(STICK_DIRECTION) {
|
||||||
// Direction is LEFT/RIGHT, so don't perform any adjustment
|
// Direction is LEFT/RIGHT, so don't perform any adjustment
|
||||||
angle
|
angle
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use skyline::nn::ui2d::ResColor;
|
use skyline::nn::ui2d::ResColor;
|
||||||
use smash::app::BattleObjectModuleAccessor;
|
|
||||||
use training_mod_consts::OnOff;
|
use training_mod_consts::OnOff;
|
||||||
|
|
||||||
use crate::common::consts::FighterId;
|
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
use crate::training::*;
|
use crate::training::*;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ unsafe fn mod_handle_di(fighter: &L2CFighterCommon, _arg1: L2CValue) {
|
||||||
roll_di_case();
|
roll_di_case();
|
||||||
|
|
||||||
let angle_tuple = DI_CASE.into_angle().map_or((0.0, 0.0), |angle| {
|
let angle_tuple = DI_CASE.into_angle().map_or((0.0, 0.0), |angle| {
|
||||||
let a = if should_reverse_angle(&DI_CASE) {
|
let a = if should_reverse_angle(DI_CASE) {
|
||||||
PI - angle
|
PI - angle
|
||||||
} else {
|
} else {
|
||||||
angle
|
angle
|
||||||
|
@ -70,12 +70,12 @@ unsafe fn mod_handle_di(fighter: &L2CFighterCommon, _arg1: L2CValue) {
|
||||||
set_x_y(module_accessor, angle_tuple.0 as f32, angle_tuple.1 as f32);
|
set_x_y(module_accessor, angle_tuple.0 as f32, angle_tuple.1 as f32);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_reverse_angle(direction: &Direction) -> bool {
|
pub fn should_reverse_angle(direction: Direction) -> bool {
|
||||||
let cpu_module_accessor = get_module_accessor(FighterId::CPU);
|
let cpu_module_accessor = get_module_accessor(FighterId::CPU);
|
||||||
let player_module_accessor = get_module_accessor(FighterId::Player);
|
let player_module_accessor = get_module_accessor(FighterId::Player);
|
||||||
unsafe {
|
unsafe {
|
||||||
PostureModule::pos_x(player_module_accessor) > PostureModule::pos_x(cpu_module_accessor)
|
PostureModule::pos_x(player_module_accessor) > PostureModule::pos_x(cpu_module_accessor)
|
||||||
&& ![Direction::LEFT, Direction::RIGHT].contains(direction)
|
&& ![Direction::LEFT, Direction::RIGHT].contains(&direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ pub fn roll_full_hop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
pub unsafe fn check_button_on(
|
pub unsafe fn check_button_on(
|
||||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||||
button: i32,
|
button: i32,
|
||||||
|
@ -29,8 +27,6 @@ pub unsafe fn check_button_on(
|
||||||
Some(true)
|
Some(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
pub unsafe fn check_button_off(
|
pub unsafe fn check_button_off(
|
||||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||||
button: i32,
|
button: i32,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::ptr::addr_of_mut;
|
||||||
|
|
||||||
use crate::common::button_config;
|
use crate::common::button_config;
|
||||||
use crate::common::consts::{BuffOption, FighterId, MENU};
|
use crate::common::consts::{BuffOption, FighterId, MENU};
|
||||||
use crate::common::offsets::*;
|
use crate::common::offsets::*;
|
||||||
|
@ -836,21 +838,21 @@ pub fn training_mods() {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
LookupSymbol(
|
LookupSymbol(
|
||||||
&mut FIGHTER_MANAGER_ADDR,
|
addr_of_mut!(FIGHTER_MANAGER_ADDR),
|
||||||
"_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E\u{0}"
|
"_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E\u{0}"
|
||||||
.as_bytes()
|
.as_bytes()
|
||||||
.as_ptr(),
|
.as_ptr(),
|
||||||
);
|
);
|
||||||
|
|
||||||
LookupSymbol(
|
LookupSymbol(
|
||||||
&mut STAGE_MANAGER_ADDR,
|
addr_of_mut!(STAGE_MANAGER_ADDR),
|
||||||
"_ZN3lib9SingletonIN3app12StageManagerEE9instance_E\u{0}"
|
"_ZN3lib9SingletonIN3app12StageManagerEE9instance_E\u{0}"
|
||||||
.as_bytes()
|
.as_bytes()
|
||||||
.as_ptr(),
|
.as_ptr(),
|
||||||
);
|
);
|
||||||
|
|
||||||
LookupSymbol(
|
LookupSymbol(
|
||||||
&mut ITEM_MANAGER_ADDR,
|
addr_of_mut!(ITEM_MANAGER_ADDR),
|
||||||
"_ZN3lib9SingletonIN3app11ItemManagerEE9instance_E\0"
|
"_ZN3lib9SingletonIN3app11ItemManagerEE9instance_E\0"
|
||||||
.as_bytes()
|
.as_bytes()
|
||||||
.as_ptr(),
|
.as_ptr(),
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub fn roll_direction() {
|
||||||
|
|
||||||
unsafe fn get_sdi_direction() -> Option<f64> {
|
unsafe fn get_sdi_direction() -> Option<f64> {
|
||||||
DIRECTION.into_angle().map(|angle| {
|
DIRECTION.into_angle().map(|angle| {
|
||||||
if directional_influence::should_reverse_angle(&DIRECTION) {
|
if directional_influence::should_reverse_angle(DIRECTION) {
|
||||||
PI - angle
|
PI - angle
|
||||||
} else {
|
} else {
|
||||||
angle
|
angle
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::ptr::addr_of_mut;
|
||||||
|
|
||||||
use skyline::nn::ui2d::*;
|
use skyline::nn::ui2d::*;
|
||||||
use smash::ui2d::{SmashPane, SmashTextBox};
|
use smash::ui2d::{SmashPane, SmashTextBox};
|
||||||
|
|
||||||
|
@ -24,8 +26,8 @@ macro_rules! display_txt_fmt {
|
||||||
pub unsafe fn draw(root_pane: &Pane) {
|
pub unsafe fn draw(root_pane: &Pane) {
|
||||||
let notification_idx = 0;
|
let notification_idx = 0;
|
||||||
|
|
||||||
let queue = &mut ui::notifications::QUEUE;
|
let queue = addr_of_mut!(ui::notifications::QUEUE);
|
||||||
let notification = queue.first_mut();
|
let notification = (*queue).first_mut();
|
||||||
|
|
||||||
root_pane
|
root_pane
|
||||||
.find_pane_by_name_recursive(display_parent_fmt!(notification_idx))
|
.find_pane_by_name_recursive(display_parent_fmt!(notification_idx))
|
||||||
|
@ -58,6 +60,6 @@ pub unsafe fn draw(root_pane: &Pane) {
|
||||||
|
|
||||||
let has_completed = notification.check_completed();
|
let has_completed = notification.check_completed();
|
||||||
if has_completed {
|
if has_completed {
|
||||||
queue.remove(0);
|
(*queue).remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::ptr::addr_of_mut;
|
||||||
|
|
||||||
use skyline::nn::ui2d::ResColor;
|
use skyline::nn::ui2d::ResColor;
|
||||||
|
|
||||||
pub static mut QUEUE: Vec<Notification> = vec![];
|
pub static mut QUEUE: Vec<Notification> = vec![];
|
||||||
|
@ -45,8 +47,8 @@ impl Notification {
|
||||||
|
|
||||||
pub fn notification(header: String, message: String, len: u32) {
|
pub fn notification(header: String, message: String, len: u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let queue = &mut QUEUE;
|
let queue = addr_of_mut!(QUEUE);
|
||||||
queue.push(Notification::new(
|
(*queue).push(Notification::new(
|
||||||
header,
|
header,
|
||||||
message,
|
message,
|
||||||
len,
|
len,
|
||||||
|
@ -62,14 +64,14 @@ pub fn notification(header: String, message: String, len: u32) {
|
||||||
|
|
||||||
pub fn color_notification(header: String, message: String, len: u32, color: ResColor) {
|
pub fn color_notification(header: String, message: String, len: u32, color: ResColor) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let queue = &mut QUEUE;
|
let queue = addr_of_mut!(QUEUE);
|
||||||
queue.push(Notification::new(header, message, len, color));
|
(*queue).push(Notification::new(header, message, len, color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_notifications(header: &'static str) {
|
pub fn clear_notifications(header: &'static str) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let queue = &mut QUEUE;
|
let queue = addr_of_mut!(QUEUE);
|
||||||
queue.retain(|notif| notif.header != header);
|
(*queue).retain(|notif| notif.header != header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue