mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-30 02:02:43 +00:00
Move sync into a separate crate so we can import it in subcrates
This commit is contained in:
parent
9d3e2a975f
commit
8c78561cc7
37 changed files with 42 additions and 36 deletions
|
@ -34,6 +34,7 @@ serde_json = "1"
|
|||
smush_info_shared = { git = "https://github.com/jam1garner/smush_info_shared.git" }
|
||||
toml = "0.5.9"
|
||||
training_mod_consts = { path = "training_mod_consts" }
|
||||
training_mod_sync = { path = "training_mod_sync" }
|
||||
training_mod_tui = { path = "training_mod_tui" }
|
||||
native-tls = { version = "0.2.11", features = ["vendored"] }
|
||||
log = "0.4.17"
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
|||
use crate::common::menu::{MENU_CLOSE_FRAME_COUNTER, QUICK_MENU_ACTIVE};
|
||||
use crate::common::ButtonConfig;
|
||||
use crate::input::{ControllerStyle::*, *};
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::ui::menu::VANILLA_MENU_ACTIVE;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use smash::lib::lua_const::*;
|
||||
pub use training_mod_consts::*;
|
||||
|
||||
use crate::sync::LazyLock;
|
||||
use training_mod_sync::LazyLock;
|
||||
use convert_case::{Case, Casing};
|
||||
use smush_info_shared::Character;
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -5,7 +5,7 @@ use serde::Deserialize;
|
|||
use crate::common::input::*;
|
||||
use crate::consts::DEV_TOML_PATH;
|
||||
use crate::logging::info;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
/// Hot-reloadable configs for quicker development
|
||||
///
|
||||
|
|
|
@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||
use skyline::nn::{account, oe, time};
|
||||
|
||||
use crate::common::release::CURRENT_VERSION;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
pub static EVENT_QUEUE: RwLock<Vec<Event>> = RwLock::new(vec![]);
|
||||
static SESSION_ID: LazyLock<String> = LazyLock::new(|| unsafe {
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::common::{DEFAULTS_MENU, MENU};
|
|||
use crate::events::{Event, EVENT_QUEUE};
|
||||
use crate::input::{ButtonBitfield, ControllerStyle, MappedInputs, SomeControllerStruct};
|
||||
use crate::logging::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
|
||||
use training_mod_consts::{create_app, InputControl, MenuJsonStruct, MENU_OPTIONS_PATH};
|
||||
|
|
|
@ -6,7 +6,7 @@ use smash::lua2cpp::L2CFighterCommon;
|
|||
pub use crate::common::consts::MENU;
|
||||
use crate::common::consts::*;
|
||||
use crate::common::offsets::OFFSET_GET_BATTLE_OBJECT_FROM_ID;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::character_specific::ptrainer;
|
||||
|
||||
pub mod button_config;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// TODO!(Do all these need to be referenced by offset? Or do some of them have symbols?)
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)] // We want the assembly needles to stay in lines of four bytes each
|
||||
use crate::logging::*;
|
||||
use crate::sync::LazyLock;
|
||||
use training_mod_sync::LazyLock;
|
||||
|
||||
// Stolen from HDR who stole it from Arcropolis
|
||||
// https://github.com/HDR-Development/HewDraw-Remix/blob/dev/dynamic/src/util.rs
|
||||
|
|
|
@ -5,7 +5,7 @@ use zip::ZipArchive;
|
|||
use crate::common::dialog;
|
||||
use crate::consts::*;
|
||||
use crate::logging::*;
|
||||
use crate::sync::LazyLock;
|
||||
use training_mod_sync::LazyLock;
|
||||
|
||||
pub static CURRENT_VERSION: LazyLock<String> = LazyLock::new(|| {
|
||||
info!("Initialized lazy static value: CURRENT_VERSION");
|
||||
|
|
|
@ -6,7 +6,7 @@ use smash::app::smashball::is_training_mode;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::logging::*;
|
||||
use crate::sync::LazyLock;
|
||||
use training_mod_sync::LazyLock;
|
||||
|
||||
use HazardState::*;
|
||||
use HookState::*;
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::path::PathBuf;
|
|||
|
||||
use skyline::nro::{self, NroInfo};
|
||||
use training_mod_consts::{OnOff, LEGACY_TRAINING_MODPACK_ROOT};
|
||||
use training_mod_sync::*;
|
||||
|
||||
use crate::common::button_config::DEFAULT_OPEN_MENU_CONFIG;
|
||||
use crate::common::events::events_loop;
|
||||
|
@ -28,7 +29,6 @@ use crate::common::*;
|
|||
use crate::consts::TRAINING_MODPACK_ROOT;
|
||||
use crate::events::{Event, EVENT_QUEUE};
|
||||
use crate::logging::*;
|
||||
use crate::sync::*;
|
||||
use crate::training::ui::notifications::notification;
|
||||
|
||||
pub mod common;
|
||||
|
@ -37,7 +37,6 @@ mod hitbox_visualizer;
|
|||
mod training;
|
||||
|
||||
mod logging;
|
||||
mod sync;
|
||||
|
||||
fn nro_main(nro: &NroInfo<'_>) {
|
||||
if nro.module.isLoaded {
|
||||
|
|
|
@ -5,7 +5,7 @@ use smash::lib::lua_const::*;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::directional_influence::should_reverse_angle;
|
||||
|
||||
static AIRDODGE_STICK_DIRECTION: RwLock<Direction> = RwLock::new(Direction::empty());
|
||||
|
|
|
@ -2,7 +2,7 @@ use smash::app::{self};
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
static ATTACK_ANGLE_DIRECTION: RwLock<AttackAngle> = RwLock::new(AttackAngle::NEUTRAL);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use smash::phx::{Hash40, Vector3f};
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::is_operation_cpu;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::handle_add_limit;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use smash::lib::lua_const::*;
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::offsets::OFFSET_GENERATE_ARTICLE_FOR_TARGET;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::mash;
|
||||
|
||||
pub struct CharItem {
|
||||
|
|
|
@ -5,7 +5,7 @@ use smash::phx::{Hash40, Vector3f};
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
static COUNTER: RwLock<u32> = RwLock::new(0);
|
||||
static CLATTER_STEP: RwLock<f32> = RwLock::new(8.0);
|
||||
|
|
|
@ -3,7 +3,7 @@ use training_mod_consts::OnOff;
|
|||
|
||||
use crate::common::*;
|
||||
use crate::consts::Action;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::ui::notifications;
|
||||
use crate::training::*;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use smash::lua2cpp::L2CFighterCommon;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
static DI_CASE: RwLock<Direction> = RwLock::new(Direction::empty());
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use smash::lib::lua_const::*;
|
|||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::{frame_counter, input_record};
|
||||
|
||||
static DELAY: RwLock<u32> = RwLock::new(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
static COUNTERS: RwLock<Vec<FrameCounter>> = RwLock::new(vec![]);
|
||||
#[derive(PartialEq, Eq)]
|
||||
|
|
|
@ -3,7 +3,7 @@ use smash::app::{self, lua_bind::*};
|
|||
use smash::lib::lua_const::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
// the current full hop status
|
||||
static FULL_HOP: RwLock<bool> = RwLock::new(false);
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::collections::VecDeque;
|
|||
|
||||
use crate::common::input::*;
|
||||
use crate::menu::QUICK_MENU_ACTIVE;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::try_get_module_accessor;
|
||||
use skyline::nn::ui2d::ResColor;
|
||||
use smash::app::{lua_bind::*, utility};
|
||||
|
|
|
@ -3,7 +3,7 @@ use smash::lib::lua_const::*;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::{frame_counter, input_record, mash};
|
||||
|
||||
const NOT_SET: u32 = 9001;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::common::{
|
|||
use crate::hitbox_visualizer;
|
||||
use crate::input::*;
|
||||
use crate::logging::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::character_specific::{items, kirby, pikmin, ptrainer};
|
||||
use skyline::hooks::{getRegionAddress, InlineCtx, Region};
|
||||
use skyline::nn::ro::LookupSymbol;
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::common::get_module_accessor;
|
|||
use crate::common::is_dead;
|
||||
use crate::common::MENU;
|
||||
use crate::is_operation_cpu;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::buff;
|
||||
use crate::training::character_specific::{ptrainer, steve};
|
||||
use crate::training::charge::{self, ChargeState};
|
||||
|
|
|
@ -5,7 +5,7 @@ use smash::Vector2f;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::directional_influence;
|
||||
|
||||
static COUNTER: RwLock<u32> = RwLock::new(0);
|
||||
|
|
|
@ -8,7 +8,7 @@ use smash::lua2cpp::L2CFighterCommon;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::{frame_counter, input_record, mash, save_states};
|
||||
|
||||
// TODO!() We only reset this on save state load or LRA reset
|
||||
|
|
|
@ -2,7 +2,7 @@ use smash::app::{self};
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
static SHIELD_STICK_DIRECTION: RwLock<Direction> = RwLock::new(Direction::OUT);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::common::offsets::{
|
|||
OFFSET_CHANGE_ACTIVE_CAMERA, OFFSET_SET_TRAINING_FIXED_CAMERA_VALUES,
|
||||
};
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::{frame_counter, mash, save_states};
|
||||
|
||||
static TECH_ROLL_DIRECTION: RwLock<Direction> = RwLock::new(Direction::empty());
|
||||
|
|
|
@ -3,7 +3,7 @@ use smash::lib::lua_const::*;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
use crate::training::mash;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use smash::ui2d::{SmashPane, SmashTextBox};
|
|||
|
||||
use crate::common::menu::QUICK_MENU_ACTIVE;
|
||||
use crate::common::TRAINING_MENU_ADDR;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::ui::notifications::*;
|
||||
|
||||
macro_rules! display_parent_fmt {
|
||||
|
|
|
@ -6,7 +6,7 @@ use training_mod_consts::{InputDisplay, MENU};
|
|||
|
||||
use crate::common::consts::status_display_name;
|
||||
use crate::menu::QUICK_MENU_ACTIVE;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::input_log::{
|
||||
DirectionStrength, InputLog, DRAW_LOG_BASE_IDX, NUM_LOGS, P1_INPUT_LOGS, WHITE, YELLOW,
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::common::menu::{
|
|||
QUICK_MENU_ACTIVE, QUICK_MENU_APP,
|
||||
};
|
||||
use crate::input::*;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
use training_mod_consts::TOGGLE_MAX;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::common::offsets::{OFFSET_DRAW, OFFSET_LAYOUT_ARC_MALLOC};
|
|||
use crate::common::{is_ready_go, is_training_mode};
|
||||
#[cfg(feature = "layout_arc_from_file")]
|
||||
use crate::consts::LAYOUT_ARC_PATH;
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
use crate::training::frame_counter;
|
||||
|
||||
mod damage;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use skyline::nn::ui2d::ResColor;
|
||||
|
||||
use crate::sync::*;
|
||||
use training_mod_sync::*;
|
||||
|
||||
pub static NOTIFICATIONS_QUEUE: RwLock<Vec<Notification>> = RwLock::new(vec![]);
|
||||
|
||||
|
|
6
training_mod_sync/Cargo.toml
Normal file
6
training_mod_sync/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "training_mod_sync"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
|
@ -33,4 +33,4 @@ pub fn lock_write_rwlock<T>(rwlock: &RwLock<T>) -> RwLockWriteGuard<T> {
|
|||
/// Don't forget to drop the guard as soon as you're finished with it
|
||||
pub fn lock_read_rwlock<T>(rwlock: &RwLock<T>) -> RwLockReadGuard<T> {
|
||||
rwlock.read().unwrap()
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue