From cd8755012c20636288d804605003f47c8d036c1e Mon Sep 17 00:00:00 2001 From: asimon-1 <40246417+asimon-1@users.noreply.github.com> Date: Tue, 22 Jun 2021 16:47:29 -0400 Subject: [PATCH] Fix GH Actions Workflow (#208) * Add workflow_dispatch * Add specific lock_api version * Update to latest cargo-skyline version * Update workflow with skyline-rs toolchain * Separate cargo-skyline install and toolchain update * Use Rust docker container * Try rustocker/rustup container * Revert "Try rustocker/rustup container" This reverts commit 26fff6a44fee4ff992a5041f885e349a10ae168a. * Try fork of cargo-skyline * Revert "Try fork of cargo-skyline" This reverts commit 0465c39e94d164e2e87299beadd5f19612e95a02. * Try installing own Rust * Fix syntax error Co-authored-by: asimon-1 --- .github/workflows/rust.yml | 19 +++++++++++----- Cargo.toml | 4 +++- Xargo.toml | 22 ------------------ aarch64-skyline-switch.json | 45 ------------------------------------- rust-toolchain | 2 +- src/common/menu.rs | 16 ++++++------- src/common/mod.rs | 4 +--- src/lib.rs | 2 +- 8 files changed, 28 insertions(+), 86 deletions(-) delete mode 100644 Xargo.toml delete mode 100644 aarch64-skyline-switch.json diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8fd6414..c081817 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,18 +3,27 @@ name: Rust on: push: branches: [ master ] + workflow_dispatch: jobs: plugin: runs-on: ubuntu-latest - container: jugeeya/cargo-skyline:latest - steps: - uses: actions/checkout@v2 - - name: Link rust-std-skyline src - run: mkdir ../rust-std-skyline-squashed && ln -s $XARGO_RUST_SRC ../rust-std-skyline-squashed/src + - name: Install minimal stable rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Install cargo-skyline + run: | + cargo install cargo-skyline + - name: Update skyline-rs toolchain + run: | + cargo skyline update-std - name: Build release NRO - run: cargo skyline build --release + run: | + cargo skyline build --release - name: Upload plugin artifact uses: actions/upload-artifact@v2 with: diff --git a/Cargo.toml b/Cargo.toml index 91b803b..b8a57a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,9 @@ crate-type = ["cdylib"] [dependencies] skyline = { git = "https://github.com/ultimate-research/skyline-rs.git" } -skyline_smash = { git = "https://github.com/ultimate-research/skyline-smash.git" } +# TODO: Update from commit 95ea66a to latest +# skyline_smash = { git = "https://github.com/ultimate-research/skyline-smash.git", features=["weak_l2cvalue"]} +skyline_smash = {git = "https://github.com/ultimate-research/skyline-smash.git", rev = "95ea66a"} skyline-web = { git = "https://github.com/skyline-rs/skyline-web.git" } bitflags = "1.2.1" parking_lot = { version = "0.11.1", features = ["nightly"] } diff --git a/Xargo.toml b/Xargo.toml deleted file mode 100644 index 4651919..0000000 --- a/Xargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -rust-src = "../rust-std-skyline-squashed/src" - -[dependencies.core] -path = "../rust-std-skyline-squashed/src/libcore" -#git = "https://github.com/jam1garner/rust-std-skyline-squashed.git" -stage = 0 - -[dependencies.alloc] -path = "../rust-std-skyline-squashed/src/liballoc" -#git = "https://github.com/jam1garner/rust-std-skyline-squashed.git" -stage = 0 - -[dependencies.std] -path = "../rust-std-skyline-squashed/src/libstd" -#git = "https://github.com/jam1garner/rust-std-skyline-squashed.git" -stage = 1 - -#[patch.crates-io] -#rustc-std-workspace-core = { git = 'https://github.com/jam1garner/rust-std-skyline-squashed.git', branch = 'master' } -#rustc-std-workspace-alloc = { git = 'https://github.com/jam1garner/rust-std-skyline-squashed.git', branch = 'master' } -#rustc-std-workspace-std = { git = 'https://github.com/jam1garner/rust-std-skyline-squashed.git', branch = 'master' } diff --git a/aarch64-skyline-switch.json b/aarch64-skyline-switch.json deleted file mode 100644 index b8cb884..0000000 --- a/aarch64-skyline-switch.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "abi-blacklist": [ - "stdcall", - "fastcall", - "vectorcall", - "thiscall", - "win64", - "sysv64" - ], - "arch": "aarch64", - "crt-static-default": false, - "crt-static-respected": false, - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", - "dynamic-linking": true, - "dynamic-linking-available": true, - "executables": true, - "has-elf-tls": false, - "has-rpath": false, - "linker": "rust-lld", - "linker-flavor": "ld.lld", - "llvm-target": "aarch64-unknown-none", - "max-atomic-width": 128, - "os": "switch", - "panic-strategy": "abort", - "position-independent-executables": true, - "pre-link-args": { - "ld.lld": [ - "-Tlink.ld", - "-init=__custom_init", - "-fini=__custom_fini", - "--export-dynamic" - ] - }, - "post-link-args": { - "ld.lld": [ - "--no-gc-sections", - "--eh-frame-hdr" - ] - }, - "relro-level": "off", - "target-c-int-width": "32", - "target-endian": "little", - "target-pointer-width": "64", - "vendor": "roblabla" -} diff --git a/rust-toolchain b/rust-toolchain index 66822d4..870bbe4 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-04-10 +stable \ No newline at end of file diff --git a/src/common/menu.rs b/src/common/menu.rs index 0ce4c38..7f28f02 100644 --- a/src/common/menu.rs +++ b/src/common/menu.rs @@ -136,7 +136,7 @@ macro_rules! add_bitflag_submenu { $menu.add_sub_menu_sep( $title, stringify!($id), - MENU_STRUCT.$id.bits() as usize, + MENU.$id.bits() as usize, [<$id _strs>].iter().map(|i| i.as_str()).collect(), [<$id _vals>] ); @@ -167,7 +167,7 @@ pub fn set_menu_from_url(s: &str) { unsafe { - MENU_STRUCT.set(toggle, bits); + MENU.set(toggle, bits); } } } @@ -212,7 +212,7 @@ pub unsafe fn render_menu() -> String { overall_menu.add_sub_menu( "Shield Toggles", "shield_state", - MENU_STRUCT.shield_state as usize, + MENU.shield_state as usize, [ ("None", Shield::None as usize), ("Hold", Shield::Hold as usize), @@ -226,10 +226,10 @@ pub unsafe fn render_menu() -> String { "Input Delay", "input_delay", // unnecessary for slider? - MENU_STRUCT.input_delay as usize, + MENU.input_delay as usize, [].to_vec(), [ - (0, 10, MENU_STRUCT.input_delay as usize) + (0, 10, MENU.input_delay as usize) ].to_vec() ); @@ -240,7 +240,7 @@ pub unsafe fn render_menu() -> String { overall_menu.add_sub_menu( "Hitbox Visualization", "hitbox_vis", - MENU_STRUCT.hitbox_vis as usize, + MENU.hitbox_vis as usize, [ ("Off", OnOff::Off as usize), ("On", OnOff::On as usize), @@ -250,7 +250,7 @@ pub unsafe fn render_menu() -> String { overall_menu.add_sub_menu( "Stage Hazards", "stage_hazards", - MENU_STRUCT.stage_hazards as usize, + MENU.stage_hazards as usize, [ ("Off", OnOff::Off as usize), ("On", OnOff::On as usize), @@ -260,7 +260,7 @@ pub unsafe fn render_menu() -> String { overall_menu.add_sub_menu( "Mash In Neutral", "mash_in_neutral", - MENU_STRUCT.mash_in_neutral as usize, + MENU.mash_in_neutral as usize, [ ("Off", OnOff::Off as usize), ("On", OnOff::On as usize), diff --git a/src/common/mod.rs b/src/common/mod.rs index 1bdfccd..45daff7 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -6,7 +6,7 @@ use smash::app::{self, lua_bind::*}; use smash::hash40; use smash::lib::lua_const::*; -pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu { +pub static mut MENU: consts::TrainingModpackMenu = consts::TrainingModpackMenu { hitbox_vis: OnOff::On, stage_hazards: OnOff::Off, di_state: Direction::empty(), @@ -35,8 +35,6 @@ pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpac save_damage: OnOff::On, }; -pub static mut MENU: &consts::TrainingModpackMenu = unsafe { &mut MENU_STRUCT }; - pub static mut FIGHTER_MANAGER_ADDR: usize = 0; pub static mut STAGE_MANAGER_ADDR: usize = 0; diff --git a/src/lib.rs b/src/lib.rs index aac4cc9..9436752 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,7 +62,7 @@ pub fn main() { nro::add_hook(nro_main).unwrap(); unsafe { - let mut buffer = format!("{:x}", MENU as *const _ as u64); + let mut buffer = format!("{:x}", &MENU as *const _ as u64); log!( "Writing training_modpack.log with {}...", buffer