1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-19 16:36:35 +00:00

Fix Clippy

This commit is contained in:
jugeeya 2024-03-08 15:12:48 -08:00
parent 5b0b5490cc
commit afecfcc48c
12 changed files with 31 additions and 35 deletions

View file

@ -2,10 +2,8 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/docker-from-docker
{
"name": "Cargo Skyline",
"image": "jugeeya/cargo-skyline:3.2.0-no-dkp",
"mounts": [
"source=ultimatetrainingmodpack-bashhistory,target=/commandhistory,type=volume"
],
"image": "rust:1.73",
"mounts": [],
// // Use this environment variable if you need to bind mount your local source code into a new container.
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"

View file

@ -3,7 +3,6 @@ use std::fs;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use serde::Deserialize;
use toml;
use crate::common::input::*;
use crate::consts::DEV_TOML_PATH;

View file

@ -2,16 +2,14 @@ use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::fs;
use std::io::BufReader;
use std::ptr::addr_of;
use lazy_static::lazy_static;
use parking_lot::Mutex;
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::*;
use crate::consts::MENU_OPTIONS_PATH;
use crate::events::{Event, EVENT_QUEUE};
use crate::input::*;
use crate::logging::*;
@ -53,9 +51,11 @@ pub fn load_from_file() {
info!("Setting initial menu selections...");
unsafe {
let mut app = QUICK_MENU_APP.lock();
app.serialized_default_settings =
serde_json::to_string(&DEFAULTS_MENU).expect("Could not serialize DEFAULTS_MENU");
app.update_all_from_json(&serde_json::to_string(&MENU).expect("Could not serialize MENU"));
app.serialized_default_settings = serde_json::to_string(&*addr_of!(DEFAULTS_MENU))
.expect("Could not serialize DEFAULTS_MENU");
app.update_all_from_json(
&serde_json::to_string(&*addr_of!(MENU)).expect("Could not serialize MENU"),
);
}
}

View file

@ -2,7 +2,6 @@
use crate::common::dialog;
use crate::consts::*;
use crate::logging::*;
use crate::MENU;
use anyhow::{anyhow, Result};
use lazy_static::lazy_static;
use parking_lot::Mutex;

View file

@ -33,7 +33,7 @@ unsafe fn get_angle(module_accessor: &mut app::BattleObjectModuleAccessor) -> Op
STICK_DIRECTION = MENU.air_dodge_dir.get_random();
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
angle
} else {

View file

@ -1,8 +1,6 @@
use skyline::nn::ui2d::ResColor;
use smash::app::BattleObjectModuleAccessor;
use training_mod_consts::OnOff;
use crate::common::consts::FighterId;
use crate::common::*;
use crate::training::*;

View file

@ -58,7 +58,7 @@ unsafe fn mod_handle_di(fighter: &L2CFighterCommon, _arg1: L2CValue) {
roll_di_case();
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
} else {
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);
}
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 player_module_accessor = get_module_accessor(FighterId::Player);
unsafe {
PostureModule::pos_x(player_module_accessor) > PostureModule::pos_x(cpu_module_accessor)
&& ![Direction::LEFT, Direction::RIGHT].contains(direction)
&& ![Direction::LEFT, Direction::RIGHT].contains(&direction)
}
}

View file

@ -17,8 +17,6 @@ pub fn roll_full_hop() {
}
}
/**
*/
pub unsafe fn check_button_on(
module_accessor: &mut app::BattleObjectModuleAccessor,
button: i32,
@ -29,8 +27,6 @@ pub unsafe fn check_button_on(
Some(true)
}
/**
*/
pub unsafe fn check_button_off(
module_accessor: &mut app::BattleObjectModuleAccessor,
button: i32,

View file

@ -1,3 +1,5 @@
use std::ptr::addr_of_mut;
use crate::common::button_config;
use crate::common::consts::{BuffOption, FighterId, MENU};
use crate::common::offsets::*;
@ -836,21 +838,21 @@ pub fn training_mods() {
unsafe {
LookupSymbol(
&mut FIGHTER_MANAGER_ADDR,
addr_of_mut!(FIGHTER_MANAGER_ADDR),
"_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E\u{0}"
.as_bytes()
.as_ptr(),
);
LookupSymbol(
&mut STAGE_MANAGER_ADDR,
addr_of_mut!(STAGE_MANAGER_ADDR),
"_ZN3lib9SingletonIN3app12StageManagerEE9instance_E\u{0}"
.as_bytes()
.as_ptr(),
);
LookupSymbol(
&mut ITEM_MANAGER_ADDR,
addr_of_mut!(ITEM_MANAGER_ADDR),
"_ZN3lib9SingletonIN3app11ItemManagerEE9instance_E\0"
.as_bytes()
.as_ptr(),

View file

@ -20,7 +20,7 @@ pub fn roll_direction() {
unsafe fn get_sdi_direction() -> Option<f64> {
DIRECTION.into_angle().map(|angle| {
if directional_influence::should_reverse_angle(&DIRECTION) {
if directional_influence::should_reverse_angle(DIRECTION) {
PI - angle
} else {
angle

View file

@ -1,3 +1,5 @@
use std::ptr::addr_of_mut;
use skyline::nn::ui2d::*;
use smash::ui2d::{SmashPane, SmashTextBox};
@ -24,8 +26,8 @@ macro_rules! display_txt_fmt {
pub unsafe fn draw(root_pane: &Pane) {
let notification_idx = 0;
let queue = &mut ui::notifications::QUEUE;
let notification = queue.first_mut();
let queue = addr_of_mut!(ui::notifications::QUEUE);
let notification = (*queue).first_mut();
root_pane
.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();
if has_completed {
queue.remove(0);
(*queue).remove(0);
}
}

View file

@ -1,3 +1,5 @@
use std::ptr::addr_of_mut;
use skyline::nn::ui2d::ResColor;
pub static mut QUEUE: Vec<Notification> = vec![];
@ -45,8 +47,8 @@ impl Notification {
pub fn notification(header: String, message: String, len: u32) {
unsafe {
let queue = &mut QUEUE;
queue.push(Notification::new(
let queue = addr_of_mut!(QUEUE);
(*queue).push(Notification::new(
header,
message,
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) {
unsafe {
let queue = &mut QUEUE;
queue.push(Notification::new(header, message, len, color));
let queue = addr_of_mut!(QUEUE);
(*queue).push(Notification::new(header, message, len, color));
}
}
pub fn clear_notifications(header: &'static str) {
unsafe {
let queue = &mut QUEUE;
queue.retain(|notif| notif.header != header);
let queue = addr_of_mut!(QUEUE);
(*queue).retain(|notif| notif.header != header);
}
}