Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadps4: init at 0.3.0-unstable-2024-10-13 #340215

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

ryand56
Copy link
Member

@ryand56 ryand56 commented Sep 6, 2024

Description of changes

Adds shadPS4, an in-early development PS4 emulator.
Closes #339617

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Sep 7, 2024
@ryand56 ryand56 requested a review from OPNA2608 September 7, 2024 19:12
@ryand56 ryand56 marked this pull request as ready for review September 7, 2024 19:13
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4554

@OPNA2608
Copy link
Contributor

Have you been able to launch anything with this? For me the GUI launches and I can adjust settings & install homebrew pkgs, but it just freezes & eventually segfaults on everything eboot I try to launch.

@ryand56
Copy link
Member Author

ryand56 commented Sep 13, 2024

Have you been able to launch anything with this? For me the GUI launches and I can adjust settings & install homebrew pkgs, but it just freezes & eventually segfaults on everything eboot I try to launch.

I haven't got around to it yet, but this might just be an issue with shadPS4 itself.

@ryand56 ryand56 marked this pull request as draft September 13, 2024 18:16
@OPNA2608
Copy link
Contributor

I've got a later commit building & working on some OpenOrbis samples, though there are some leftover warnings at configure time - unpackaged dependencies, and outdated/borked provided dependencies. I think we should resolve those issues first before getting this in.

Bildschirmfoto_2024-09-13_20-18-00
0001-shadps4-Get-it-working.patch.txt

@ryand56
Copy link
Member Author

ryand56 commented Sep 14, 2024

Seems like #331649 exists for toml11, but zydis v5.0.0 doesn't exist 🤔 and not sure about vulkan memory allocator

@ryand56 ryand56 changed the title shadps4: init at 0.2.0 shadps4: init at 0.2.0-unstable-2024-09-01 Sep 14, 2024
@OPNA2608
Copy link
Contributor

zydis: shadps4-emu/shadPS4#546

the zydis commit in externals is from an unreleased dev branch (with an incompatible change) which will ultimately be v5, so v4 library need to be rejected

Our zydis package has no dependencies aside from cmake, so prolly fine to drop it from buildInputs and use the vendored one for now.

vulkan-memory-allocator: AFAICT the CMake config module doesn't expose its version, so it fails to determine if it satisfies the version constraint. Need to apply GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@257138b to our package.

sdl3: #326699

@luochen1990
Copy link
Contributor

Just syncing some info: 0.3.0 is released :)

@ryand56 ryand56 changed the title shadps4: init at 0.2.0-unstable-2024-09-01 shadps4: init at 0.3.0 Sep 24, 2024
@henkery
Copy link
Contributor

henkery commented Sep 27, 2024

Tested this by building it myself, it seems to crash and exit without explanation unexpectedly when attempting to load a game which runs on the official build (CUSA01113)

@ryand56
Copy link
Member Author

ryand56 commented Sep 27, 2024

Tested this by building it myself, it seems to crash and exit without explanation unexpectedly when attempting to load a game which runs on the official build (CUSA01113)

Could you send the logs here? I'm still waiting on SDL3 to be added

@henkery
Copy link
Contributor

henkery commented Sep 27, 2024

Could you send the logs here? I'm still waiting on SDL3 to be added

The logs don't say very much as it's a segfault

[Loader] <Info> emulator.cpp:Emulator:56: Starting shadps4 emulator v0.3.0 
[Loader] <Info> emulator.cpp:Emulator:57: Revision GITDIR-NOTFOUND
[Loader] <Info> emulator.cpp:Emulator:58: Branch GIT-NOTFOUND
[Loader] <Info> emulator.cpp:Emulator:59: Description GIT-NOTFOUND
[Config] <Info> emulator.cpp:Emulator:61: General isNeo: false
[Config] <Info> emulator.cpp:Emulator:62: GPU isNullGpu: false
[Config] <Info> emulator.cpp:Emulator:63: GPU shouldDumpShaders: false
[Config] <Info> emulator.cpp:Emulator:64: GPU shouldDumpPM4: false
[Config] <Info> emulator.cpp:Emulator:65: GPU vblankDivider: 1
[Config] <Info> emulator.cpp:Emulator:66: Vulkan gpuId: -1
[Config] <Info> emulator.cpp:Emulator:67: Vulkan vkValidation: false
[Config] <Info> emulator.cpp:Emulator:68: Vulkan vkValidationSync: false
[Config] <Info> emulator.cpp:Emulator:69: Vulkan vkValidationGpu: false
[Config] <Info> emulator.cpp:Emulator:70: Vulkan rdocEnable: false
[Config] <Info> emulator.cpp:Emulator:71: Vulkan rdocMarkersEnable: false
[Config] <Info> emulator.cpp:Emulator:72: Vulkan crashDiagnostics: false
[Kernel.Vmm] <Info> address_space.cpp:Impl:352: System managed virtual memory region: 0x400000 - 0x7ffffbfff
[Kernel.Vmm] <Info> address_space.cpp:Impl:355: System reserved virtual memory region: 0x7ffffc000 - 0xfffffffff
[Kernel.Vmm] <Info> address_space.cpp:Impl:358: User virtual memory region: 0x1000000000 - 0x10fffffffff
[Kernel.Vmm] <Info> memory.cpp:SetupMemoryRegions:50: Configured memory regions: flexible size = 0x1c000000, direct size = 0x120000000
[Kernel.Vmm] <Info> memory.cpp:MemoryManager:35: Usable memory address space: 1087_GB
[Loader] <Info> emulator.cpp:Run:126: Game id: CUSA01113 Title: Gravity Rush™ Remastered
[Loader] <Info> emulator.cpp:Run:129: Fw: 0x4500000 App Version: 01.00
Segmentation fault (core dumped)

@expenses
Copy link
Contributor

expenses commented Oct 1, 2024

shadps4-emu/shadPS4#1042 has been merged so that first patch can be removed. For Bloodborne specifically you probably want to include shadps4-emu/shadPS4#1146, but shadps4 development is happening so quickly that it might make more sense not to include any patches with this derivation and let people use overrideAttrs to point to their own sources.

(at least until things get more stable)

@ryand56 ryand56 changed the title shadps4: init at 0.3.0 shadps4: init at 0.3.1-unstable-2024-09-30 Oct 1, 2024
@OPNA2608
Copy link
Contributor

OPNA2608 commented Oct 1, 2024

Prolly needs smth like this:

postFixup =
let
rpath = lib.makeLibraryPath (
finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs
);
in
lib.optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") ''
for lib in $out/lib/*.so* ; do
if ! [[ -L "$lib" ]]; then
patchelf --set-rpath "$(patchelf --print-rpath $lib):${rpath}" "$lib"
fi
done
'';

...but for $out/bin & just whatever X11/wayland libs it wants to dlopen().

@expenses
Copy link
Contributor

expenses commented Oct 1, 2024

Prolly needs smth like this:

Yep, I was just testing using a wrapper script as it didn't require recompilation, but you can just patch the rpaty in the binary. See my edited comment.

@expenses
Copy link
Contributor

expenses commented Oct 1, 2024

I've uploaded my changes at master...expenses:nixpkgs:shadps4. I'm using a local path for the shadps4 source but that's only because I'm on a bad internet connection and it cuts off before I can clone the repo in nix. I'm using the latest head (shadps4-emu/shadPS4@bf3e43b).

@ryand56 ryand56 marked this pull request as draft October 2, 2024 00:38
@ryand56 ryand56 changed the title shadps4: init at 0.3.1-unstable-2024-09-30 shadps4: init at 0.3.1-unstable-2024-10-01 Oct 2, 2024
@expenses
Copy link
Contributor

expenses commented Oct 2, 2024

Things look good now :)

@ryand56 ryand56 marked this pull request as ready for review October 2, 2024 17:23
@urioTV
Copy link

urioTV commented Oct 8, 2024

I just want to say that it seems working.

@ghost
Copy link

ghost commented Oct 9, 2024

The emulator crashed when clicking play, but it may not be due to the PR since the appimage also crashes. The errors show that the emulator doesn't support certain thread settings, has some missing functions, and can't fully access the game files. shadps4-emu/shadPS4#1311

@ryand56 ryand56 changed the title shadps4: init at 0.3.1-unstable-2024-10-01 shadps4: init at 0.3.1-unstable-2024-10-10 Oct 10, 2024
Copy link
Contributor

@henkery henkery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working well and as expected
perhaps we wish to discuss the release/update cadence here as well
I see we've now switched to unstable versions but how will we maintain which version we track, is it just the maintainer who updates the tracked commit whenever they feel like it?

@ryand56
Copy link
Member Author

ryand56 commented Oct 10, 2024

It's working well and as expected perhaps we wish to discuss the release/update cadence here as well I see we've now switched to unstable versions but how will we maintain which version we track, is it just the maintainer who updates the tracked commit whenever they feel like it?

I'm depending on the unstable releases for now, until stable 0.3.1 is released.

@urioTV
Copy link

urioTV commented Oct 10, 2024

We can always depend on latest release. For bleeding edge there is always https://github.com/chaotic-cx/nyx repo where bot automatically updates to the latest git commit.

@OPNA2608
Copy link
Contributor

If you want, you can add an update script.

passthru.updateScript = unstableGitUpdater {
  tagPrefix = "v";
};

Should make it trivial for anyone to make a bump (nix-shell maintainers/scripts/update.nix --argstr package shadps4), and @r-ryantm will automatically generate bump PRs whenever it runs the update script and the bumped build passes (which can happen abit too frequently on unstable packages with active upstreams like this, so should maybe opt out of the auto-updates in case the spam bothers you).

(I'll give this another review later today, not on an x86_64 machine right now)

@ryand56 ryand56 changed the title shadps4: init at 0.3.1-unstable-2024-10-10 shadps4: init at 0.3.1-unstable-2024-10-13 Oct 13, 2024
@OPNA2608
Copy link
Contributor

New auto-updater doesn't make sense for our purposes & might confuse users with it non-functionality on NixOS: shadps4-emu/shadPS4#1368

Patch to neutralise it for now:

0001-Disable-update-checking.patch.txt

image

(didn't wanna dig deeper into how to make Qt not get stuck on weirdly initiated windows on app shutdown, otherwise I'd make it throw a warning & immediately exit here instead of hijacking that dialogue)

@ryand56 ryand56 changed the title shadps4: init at 0.3.1-unstable-2024-10-13 shadps4: init at 0.3.0-unstable-2024-10-13 Oct 13, 2024
Copy link
Contributor

@OPNA2608 OPNA2608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing I've spotted, otherwise LGTM.

Copy link
Contributor

@OPNA2608 OPNA2608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result of nixpkgs-review pr 340215 run on x86_64-linux 1

1 package built:
  • shadps4

Builds on OfBorg, OpenOrbis sample package still works, can't spot anything immediately wrong with it anymore. LGTM!

@OPNA2608 OPNA2608 added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Oct 14, 2024
@OPNA2608 OPNA2608 merged commit 4c62505 into NixOS:master Oct 14, 2024
28 of 29 checks passed
@ryand56 ryand56 deleted the init/shadps4 branch October 14, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: shadps4
7 participants