1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-28 04:44:06 +00:00

Keep Mii hats and Luma on save state load; Fix Github Actions (#532)

* Exclude Mii hats and Luma

* Use allowlist to fix clippy

* More clippy

* More clippy

* Unnecessary cast

* Unnecessary vec!

* Spacing

* Import ordering

* Use a different action for test

---------

Co-authored-by: GradualSyrup <68757075+GradualSyrup@users.noreply.github.com>
This commit is contained in:
jugeeya 2023-07-11 09:10:56 -07:00 committed by GitHub
parent b34fc6b4a9
commit e0ef313297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 9 deletions

View file

@ -50,10 +50,10 @@ jobs:
command: clippy command: clippy
args: --all-targets --all-features --target=x86_64-unknown-linux-gnu -- -D warnings args: --all-targets --all-features --target=x86_64-unknown-linux-gnu -- -D warnings
- name: TUI Test - name: TUI Test
uses: actions-rs/cargo@v1 uses: ClementTsang/cargo-action@v0.0.3
continue-on-error: false
with: with:
working-directory: training_mod_tui command: test
directory: training_mod_tui
plugin: plugin:
name: Plugin NRO name: Plugin NRO
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -70,8 +70,7 @@ pub fn is_operation_cpu(module_accessor: &mut app::BattleObjectModuleAccessor) -
let entry_id = app::FighterEntryID(entry_id_int); let entry_id = app::FighterEntryID(entry_id_int);
let mgr = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager); let mgr = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
let fighter_information = let fighter_information = FighterManager::get_fighter_information(mgr, entry_id);
FighterManager::get_fighter_information(mgr, entry_id) as *mut app::FighterInformation;
FighterInformation::is_operation_cpu(fighter_information) FighterInformation::is_operation_cpu(fighter_information)
} }

View file

@ -32,7 +32,7 @@ unsafe fn was_in_shieldstun(module_accessor: *mut app::BattleObjectModuleAccesso
macro_rules! actionable_statuses { macro_rules! actionable_statuses {
() => { () => {
vec![ [
FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE_AIR, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE_AIR,
FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ATTACK_AIR, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ATTACK_AIR,
FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON,

View file

@ -4,6 +4,7 @@ use log::info;
use parking_lot::Mutex; use parking_lot::Mutex;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smash::app::{self, lua_bind::*, Item}; use smash::app::{self, lua_bind::*, Item};
use smash::cpp::l2c_value::LuaConst;
use smash::hash40; use smash::hash40;
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use smash::phx::{Hash40, Vector3f}; use smash::phx::{Hash40, Vector3f};
@ -29,6 +30,24 @@ use crate::training::reset;
use crate::training::ui::notifications; use crate::training::ui::notifications;
use crate::{is_ptrainer, ITEM_MANAGER_ADDR}; use crate::{is_ptrainer, ITEM_MANAGER_ADDR};
// Don't remove Mii hats, or Luma, or crafting table
const ARTICLE_ALLOWLIST: [(LuaConst, LuaConst); 5] = [
(
FIGHTER_KIND_MIIFIGHTER,
FIGHTER_MIIFIGHTER_GENERATE_ARTICLE_HAT,
),
(
FIGHTER_KIND_MIISWORDSMAN,
FIGHTER_MIISWORDSMAN_GENERATE_ARTICLE_HAT,
),
(
FIGHTER_KIND_MIIGUNNER,
FIGHTER_MIIGUNNER_GENERATE_ARTICLE_HAT,
),
(FIGHTER_KIND_ROSETTA, FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO),
(FIGHTER_KIND_PICKEL, FIGHTER_PICKEL_GENERATE_ARTICLE_TABLE),
];
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN3app14sv_information8stage_idEv"] #[link_name = "\u{1}_ZN3app14sv_information8stage_idEv"]
pub fn stage_id() -> i32; pub fn stage_id() -> i32;
@ -296,10 +315,10 @@ unsafe fn on_death(fighter_kind: i32, module_accessor: &mut app::BattleObjectMod
// All articles have ID <= 0x25 // All articles have ID <= 0x25
(0..=0x25) (0..=0x25)
// Don't remove crafting table
.filter(|article_idx| { .filter(|article_idx| {
!(fighter_kind == *FIGHTER_KIND_PICKEL !ARTICLE_ALLOWLIST.iter().any(|article_allowed| {
&& *article_idx == *FIGHTER_PICKEL_GENERATE_ARTICLE_TABLE) article_allowed.0 == fighter_kind && article_allowed.1 == *article_idx
})
}) })
.for_each(|article_idx| { .for_each(|article_idx| {
if ArticleModule::is_exist(module_accessor, article_idx) { if ArticleModule::is_exist(module_accessor, article_idx) {