Skip to content

Commit

Permalink
Merge pull request #36 from Naxdy/work/add-no-css-build
Browse files Browse the repository at this point in the history
feat: add "classic" version of the plugin
  • Loading branch information
Naxdy authored Oct 20, 2024
2 parents dcdf9f1 + 12211e8 commit 0330397
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 241 deletions.
17 changes: 17 additions & 0 deletions .github/release_notes/v0.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
> [!NOTE]
> This build is compatible with version 13.0.3 of SSBU ONLY!
This version introduces _no_ new functionality, but provides two versions of the plugin:

- The standard one, named `liblatency_slider_de.nro`, which is functionally identical to `v0.3.2`
- A "classic" version, named `liblatency_slider_de_classic.nro`

The "classic" version of the plugin is closer to the original latency slider in functionality:

- You can only see and adjust your desired latency in arenas, D-pad inputs on any CSS are ignored.
- The latency you select in arenas carries over to all gamemodes, including quickplay / elite.

The reason you'd pick classic over mainline is mod compatibility. Because it's much more barebones, it has a higher chance of being compatible with big, complex mods like the CSK collection. If you don't have any issues with mod compatibility however, there is no reason to use "classic" over the regular version.

> [!NOTE]
> If you're using the regular latency slider, and don't plan on switching to the classic version, there is no reason to upgrade from `v0.3.2` to `v0.4.0`.
26 changes: 26 additions & 0 deletions .github/workflows/check-flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Nix CI

on: pull_request

concurrency:
group: "${{ github.head_ref }}"
cancel-in-progress: true

jobs:
check:
name: "Check"
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Check
run: |
nix flake check --print-build-logs -j auto
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Nix CD

on:
push:
branches:
- "master"

concurrency:
group: "${{ github.head_ref }}"
cancel-in-progress: true

jobs:
check:
name: "Publish Stable Release"
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Check
run: |
nix flake check --print-build-logs -j auto
- name: "Determine release"
id: det-rel
run: |
version=$(nix flake eval .#packages.x86_64-linux.default.version --raw)
if [$(git tag -l "$version")]; then
echo "releasever=$version" >> $GITHUB_OUTPUT
else
echo "releasever=none" >> $GITHUB_OUTPUT
fi
- name: "Build Release"
if: steps.det-rel.outputs.releasever != 'none'
run: |
nix build .# --print-build-logs -j auto
nix build .#latency-slider-de-classic --print-build-logs -j auto -o result-classic
- name: "Publish Release"
if: steps.det-rel.outputs.releasever != 'none'
uses: ncipollo/release-action@v1.14.0
with:
artifacts: "result/lib/*.nro,result-classic/lib/*.nro"
bodyFile: ".github/release_notes/v${{ steps.det-rel.outputs.releasever }}.md"
name: "v${{ steps.det-rel.outputs.releasever }}"
commit: "${{ github.head_ref }}"
tag: "v${{ steps.det-rel.outputs.releasever }}"
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "latency-slider-de"
version = "0.3.2"
version = "0.4.0"
authors = []
edition = "2021"

Expand All @@ -14,7 +14,11 @@ crate-type = ["cdylib"]
ninput = { git = "https://github.com/blu-dev/ninput", version = "0.1.0" }
skyline_smash = { git = "https://github.com/jugeeya/skyline-smash.git", branch = "patch-2" }
skyline = { git = "https://github.com/ultimate-research/skyline-rs.git" }
once_cell = { version = "1.20.2" }
once_cell = { version = "1.20.2", default-features = true }

[features]
default = ["css_ui"]
css_ui = []

[profile.dev]
panic = "abort"
Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ You will need a moddable switch with atmosphere already installed on it. If you

Congratulations, Smash Ultimate online is now actually playable!

### What is `liblatency_slider_de_classic.nro`?

The "classic" version of the plugin is closer to the original latency slider in functionality:

- You can only see and adjust your desired latency in arenas, D-pad inputs on any CSS are ignored.
- The latency you select in arenas carries over to all gamemodes, including quickplay / elite.

The reason you'd pick classic over mainline is mod compatibility. Because it's much more barebones, it has a higher chance of being compatible with big, complex mods like the CSK collection. If you don't have any issues with mod compatibility however, there is no reason to use "classic" over the regular version.

## Building

The project can be reproducibly built using only the Nix package manager.
Expand Down Expand Up @@ -88,14 +97,22 @@ NO. These essentially do the same thing but differently, running multiple of the

#### Is this mod compatible with the VSync mod?

The VSync mod, aka "1 frame less delay", aka `less-delay` is compatible with this mod. I maintain a repo for that one as well, over here: https://github.com/xNaxdy/less-delay
The VSync mod, aka "1 frame less delay", aka `less-delay` is compatible with this mod. I maintain a repo for that one as well, over here: https://github.com/Naxdy/less-delay

#### Is this mod compatible with the Ultimate Training Modpack?

Yesn't. Both Latency Slider DE and the Ultimate Training Modpack attempt to hook the game's `draw` function, by trying to find its signature. The thing is, once one of the mods hooks that function, its signature changes, so whichever mod is loaded _second_ will fail to find that function. Therefore, if Latency Slider DE detects that you have Ultimate Training Modpack installed, it will display a warning message letting you know that it will run with reduced functionality in order to avoid crashing the game, making it so that it will not be able to display the input latency on the character select screen in Elite Smash.

It will, however, remain fully functional otherwise (including applying your selected latency in all online modes), and you will still be able to select your desired latency in arenas, as well as adjust it "blindly" on any CSS.

#### Is this mod compatible with [insert other mod here]?

Don't know, don't care. SSBU modding is kind of like chemistry, except you don't know the chemicals you're using. Any concoction has the chance to blow up in your face. The answer is: Try it. If it works, great. If not, you'll have to pick which mod you want enabled.

I _highly_ suggest using a mod manager of some sort to enable / disable mods as you need, to avoid potential complications.

There's also the `liblatency_slider_classic.nro` version of the plugin, which is a more barebones build, closer in functionality of the original latency slider (with the exception that it too works in all online modes). Because it is more barebones, there's a higher chance that it may work together with mods that present issues with the mainline latency slider.

Unfortunately I can't really invest any time into ensuring that latency-slider-de is compatible with each and every mod out there. However, if you submit a PR that improves compatibility with other mods, I will happily accept it!

#### Are you fine with people using this mod to cheat in online tournaments, or on qp?
Expand All @@ -108,6 +125,14 @@ Additionally, even without latency slider, there are mods (software and hardware

The bottom line here is that online tournaments have never been - and will never be - "fair", and if there's a will to cheat, there's a way (even without this mod). Unless you can ensure a 100% stable connection, equal and consistent input delay for both parties, and proctor all players to ensure they aren't using any special hardware to improve their play, this entire discussion is pointless to me.

#### Did you steal the source code of this plugin?

No. This project's source code has been licensed under the AGPL by the original authors, which is a license that grants everyone the right to view, modify, and redistribute the project's source code, so long as the original license is preserved. See [this project's license](./LICENSE), as well as [the license for HDR](https://github.com/HDR-Development/HewDraw-Remix/blob/pre-release/LICENSE) - the project this functionality was originally developed for.

I would also like to stress at this point that the AGPL regards "network interaction" as "distribution", meaning that if you download the source code for this plugin, modify it locally, and then use it to play online with others, you _have_ to publish your modifications to the source code, otherwise you are in violation of the license. According to section 13 of the [license](./LICENSE):

> Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
## Final Note

This fork is published under the original project's AGPL license. Though I pinky promise to never take this repo offline or privatize the source code in any way, I encourage you to fork it and re-share it as much as your heart desires.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 44 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,57 @@
{ self
, flake-utils
, nix-skyline-rs
, ...
}: (flake-utils.lib.eachDefaultSystem (system: {
, nixpkgs
}: (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
packages = {
default = self.packages.${system}.latency-slider-de;

latency-slider-de =
let
cargoTOML = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in
nix-skyline-rs.lib.${system}.mkNroPackage {
pname = cargoTOML.package.name;
version = cargoTOML.package.version;
src = self;
};
pkgs.callPackage
({ mode ? "build", copyLibs ? true, cargoBuildOptions ? old: old, overrideMain ? old: old }:
nix-skyline-rs.lib.${system}.mkNroPackage {
pname = cargoTOML.package.name;
version = cargoTOML.package.version;
src = self;

inherit cargoBuildOptions overrideMain mode copyLibs;
})
{ };

latency-slider-de-classic = pkgs.callPackage
({ mode ? "build", copyLibs ? true }: self.packages.${system}.latency-slider-de.override {
inherit mode copyLibs;

cargoBuildOptions = old: old ++ [
"--no-default-features"
];

overrideMain = old: {
postInstall = (if (old ? postInstall) && (old.postInstall != false) then old.postInstall else "") + (pkgs.lib.optionalString (mode == "build") ''
mv $out/lib/liblatency_slider_de.nro $out/lib/liblatency_slider_de_classic.nro
'');
};
})
{ };
};

checks = {
clippy = self.packages.${system}.latency-slider-de.override {
mode = "clippy";
};

clippy-classic = self.packages.${system}.latency-slider-de-classic.override {
mode = "clippy";
};
};

devShells.default = nix-skyline-rs.devShells.${system}.default;
Expand Down
Loading

0 comments on commit 0330397

Please sign in to comment.