1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-23 06:46:11 +00:00

GC Digital Triggers Menu Fix (#497)

* Check for digital triggers

* Update menu.rs

* Special case digital triggers

* JK

* Update rust.yml

* Update menu.rs
This commit is contained in:
jugeeya 2023-02-26 23:44:12 -08:00 committed by GitHub
parent c3a36e78e5
commit 0395bbe8ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 167 additions and 152 deletions

View file

@ -1,149 +1,149 @@
name: Rust name: Rust
on: on:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main ]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
checker: checker:
name: Check, Clippy, Tests name: Check, Clippy, Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install minimal nightly rust - name: Install minimal nightly rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: nightly toolchain: nightly
components: rustfmt, clippy components: rustfmt, clippy
default: true default: true
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
name: Rust Cache name: Rust Cache
with: with:
prefix-key: "checker" prefix-key: "checker-2"
- name: Clippy - name: Clippy
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
continue-on-error: false continue-on-error: false
with: with:
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: actions-rs/cargo@v1
continue-on-error: false continue-on-error: false
with: with:
working-directory: training_mod_tui working-directory: training_mod_tui
plugin: plugin:
name: Plugin NRO name: Plugin NRO
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: jugeeya/cargo-skyline:3.2.0-no-dkp image: jugeeya/cargo-skyline:3.2.0-no-dkp
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
name: Rust Cache name: Rust Cache
with: with:
prefix-key: "plugin" prefix-key: "plugin"
- name: Build release NRO - name: Build release NRO
id: build_release id: build_release
run: cargo-skyline skyline build --release run: cargo-skyline skyline build --release
env: env:
HOME: /root HOME: /root
- name: Upload plugin artifact - name: Upload plugin artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: plugin name: plugin
path: target/aarch64-skyline-switch/release/libtraining_modpack.nro path: target/aarch64-skyline-switch/release/libtraining_modpack.nro
plugin_outside_training_mode: plugin_outside_training_mode:
name: Plugin NRO (Outside Training Mode) name: Plugin NRO (Outside Training Mode)
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: jugeeya/cargo-skyline:3.2.0-no-dkp image: jugeeya/cargo-skyline:3.2.0-no-dkp
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
name: Rust Cache name: Rust Cache
with: with:
prefix-key: "plugin" prefix-key: "plugin"
- name: Build outside_training_mode NRO - name: Build outside_training_mode NRO
run: | run: |
cargo-skyline skyline build --release --features outside_training_mode cargo-skyline skyline build --release --features outside_training_mode
env: env:
HOME: /root HOME: /root
- name: Upload plugin (outside training mode) artifact - name: Upload plugin (outside training mode) artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: plugin_outside_training_mode name: plugin_outside_training_mode
path: target/aarch64-skyline-switch/release/libtraining_modpack.nro path: target/aarch64-skyline-switch/release/libtraining_modpack.nro
upload: upload:
name: Upload Beta Release name: Upload Beta Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
needs: needs:
- plugin - plugin
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
- name: Prepare zip - name: Prepare zip
id: prepare_zip id: prepare_zip
env: env:
SMASH_PLUGIN_DIR: atmosphere/contents/01006A800016E000/romfs/skyline/plugins SMASH_PLUGIN_DIR: atmosphere/contents/01006A800016E000/romfs/skyline/plugins
run: | run: |
mkdir -p ${{env.SMASH_PLUGIN_DIR}} mkdir -p ${{env.SMASH_PLUGIN_DIR}}
cp plugin/libtraining_modpack.nro ${{env.SMASH_PLUGIN_DIR}}/libtraining_modpack.nro cp plugin/libtraining_modpack.nro ${{env.SMASH_PLUGIN_DIR}}/libtraining_modpack.nro
wget https://github.com/ultimate-research/params-hook-plugin/releases/download/v13.0.1/libparam_hook.nro wget https://github.com/ultimate-research/params-hook-plugin/releases/download/v13.0.1/libparam_hook.nro
wget https://github.com/ultimate-research/nro-hook-plugin/releases/download/v0.4.0/libnro_hook.nro wget https://github.com/ultimate-research/nro-hook-plugin/releases/download/v0.4.0/libnro_hook.nro
wget https://github.com/jugeeya/nn-hid-hook/releases/download/beta/libnn_hid_hook.nro wget https://github.com/jugeeya/nn-hid-hook/releases/download/beta/libnn_hid_hook.nro
cp libparam_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libparam_hook.nro cp libparam_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libparam_hook.nro
cp libnro_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnro_hook.nro cp libnro_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnro_hook.nro
cp libnn_hid_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnn_hid_hook.nro cp libnn_hid_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnn_hid_hook.nro
zip -r training_modpack_beta.zip atmosphere zip -r training_modpack_beta.zip atmosphere
- name: Delete Release - name: Delete Release
uses: dev-drprasad/delete-tag-and-release@v0.2.0 uses: dev-drprasad/delete-tag-and-release@v0.2.0
with: with:
tag_name: beta tag_name: beta
delete_release: true delete_release: true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Release - name: Update Release
uses: meeDamian/github-release@2.0 uses: meeDamian/github-release@2.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true prerelease: true
allow_override: true allow_override: true
gzip: false gzip: false
tag: beta tag: beta
commitish: main commitish: main
name: beta name: beta
body: > body: >
Beta built off of the latest code in the repository. Beta built off of the latest code in the repository.
# Changelog # Changelog
You can find the changelog here: https://github.com/jugeeya/UltimateTrainingModpack#beta-changelog You can find the changelog here: https://github.com/jugeeya/UltimateTrainingModpack#beta-changelog
## Installation ## Installation
*For fuller instructions, please join the [Discord](https://discord.gg/xUZWJ5BWe7) and visit the #setup-and-download channel.* *For fuller instructions, please join the [Discord](https://discord.gg/xUZWJ5BWe7) and visit the #setup-and-download channel.*
- (*Console only*) Install Atmosphere to your hacked Switch. One great guide can be found at https://switch.homebrew.guide/ - (*Console only*) Install Atmosphere to your hacked Switch. One great guide can be found at https://switch.homebrew.guide/
- Place the **contents** of the `training_modpack_beta.zip` on the root of your SD card. This means that you first unzip the file, then place its folder on the SD card root. The `atmosphere` folder should be **merged** onto the root of your SD card. - Place the **contents** of the `training_modpack_beta.zip` on the root of your SD card. This means that you first unzip the file, then place its folder on the SD card root. The `atmosphere` folder should be **merged** onto the root of your SD card.
- *For Ryujinx*: Paste the `contents` folder inside `atmosphere` into `%AppData%/Ryujinx/mods/` - *For Ryujinx*: Paste the `contents` folder inside `atmosphere` into `%AppData%/Ryujinx/mods/`
- Download Skyline: https://github.com/skyline-dev/skyline/releases. Place the `exefs` folder from the zip into `atmosphere/contents/01006A800016E000` on your SD card. - Download Skyline: https://github.com/skyline-dev/skyline/releases. Place the `exefs` folder from the zip into `atmosphere/contents/01006A800016E000` on your SD card.
- *For Ryujinx*: Paste these files in `%AppData%/Ryujinx/mods/contents/01006a800016e000` - *For Ryujinx*: Paste these files in `%AppData%/Ryujinx/mods/contents/01006a800016e000`
files: > files: >
training_modpack_beta.zip training_modpack_beta.zip
- name: Upload zip as artifact - name: Upload zip as artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: full_build name: full_build
path: training_modpack_beta.zip path: training_modpack_beta.zip

View file

@ -181,7 +181,7 @@ pub static mut BUTTON_PRESSES: ButtonPresses = ButtonPresses {
}, },
}; };
pub fn handle_get_npad_state(state: *mut NpadGcState, _controller_id: *const u32) { pub fn handle_get_npad_state(state: *mut NpadGcState, controller_id: *const u32) {
unsafe { unsafe {
let update_count = (*state).updateCount; let update_count = (*state).updateCount;
let flags = (*state).Flags; let flags = (*state).Flags;
@ -227,6 +227,17 @@ pub fn handle_get_npad_state(state: *mut NpadGcState, _controller_id: *const u32
BUTTON_PRESSES.up.is_pressed = true; BUTTON_PRESSES.up.is_pressed = true;
} }
// For digital triggers: these at TRIGGER_MAX means we should consider a press
if controller_is_gcc(*controller_id) {
if (*state).LTrigger == 0x7FFF {
BUTTON_PRESSES.l.is_pressed = true;
}
if (*state).RTrigger == 0x7FFF {
BUTTON_PRESSES.r.is_pressed = true;
}
}
// If we're here, remove all other Npad presses... // If we're here, remove all other Npad presses...
// Should we exclude the home button? // Should we exclude the home button?
(*state) = NpadGcState::default(); (*state) = NpadGcState::default();
@ -247,10 +258,14 @@ lazy_static! {
); );
} }
pub unsafe fn controller_is_gcc(controller_id: u32) -> bool {
let style_set = GetNpadStyleSet(&controller_id as *const _);
(style_set.flags & (1 << 5)) > 0
}
pub unsafe fn p1_controller_is_gcc() -> bool { pub unsafe fn p1_controller_is_gcc() -> bool {
let p1_controller_id = crate::training::input_delay::p1_controller_id(); let p1_controller_id = crate::training::input_delay::p1_controller_id();
let p1_style_set = GetNpadStyleSet(&p1_controller_id as *const _); controller_is_gcc(p1_controller_id)
(p1_style_set.flags & (1 << 5)) > 0
} }
pub unsafe fn quick_menu_loop() { pub unsafe fn quick_menu_loop() {