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

Cross-platform patcher #388

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Cross-platform patcher #388

wants to merge 12 commits into from

Conversation

LennardF1989
Copy link
Member

@LennardF1989 LennardF1989 commented Feb 14, 2024

I've updated the patcher to .NET 8, as-is. I touched as little code as possible, I could even (barely) hold myself back from applying proper C# name conventions shivers.

I then split the logic into 3 components: UI, CLI and Core. UI is pretty much Windows-only (but could run under Proton), CLI is cross-platform and spits out a native executable for either Windows or Linux.

Workflow has been adjusted to spit out 6 files:

  • CLI: Windows/Linux Portable/Standalone
  • UI: Windows Portable/Standalone

CLI is pretty small when completely standalone (12MB-ish).
UI is humongous when standalone (125MB, 50MB compressed). Not sure how I feel about that, but WinForms can't be stripped (yet). UI could potentially be replaced with a different solution.

This will bring the patcher into "modern era", as well as add support for Steam Deck (test pending).

CLI also has additional logic applied so it will respect settings from the config, as well as waiting for a HITMAN process before applying and exiting.

Fixed wrong filenames for Linux artifacts
@RDIL RDIL added the major This will need to be in a semver-major release. label Feb 14, 2024
@RDIL
Copy link
Member

RDIL commented Feb 14, 2024

This is incredible! 🤩 Never thought I would see the day!

@RDIL
Copy link
Member

RDIL commented Feb 14, 2024

UI is humongous when standalone (125MB, 50MB compressed). Not sure how I feel about that, but WinForms can't be stripped (yet). UI could potentially be replaced with a different solution.

Probably controversial idea here - we might not even need a UI. If we have a script that starts the CLI in command prompt and then once the game is patched, it can just say something like "Done! You may now close this."

@alex73630
Copy link
Contributor

Thanks Lennard for this amazing work!
If you need help testing Linux/Steam Deck support, I'll gladly help you out

@alex73630
Copy link
Contributor

Probably controversial idea here - we might not even need a UI. If we have a script that starts the CLI in command prompt and then once the game is patched, it can just say something like "Done! You may now close this."

I don't think it's a good idea to completely remove the UI option, knowing some of our users, this will create more problems than shipping a 50MB binary

@LennardF1989
Copy link
Member Author

I gave this same more thought, and I might be able to turn the Core-lib into a .netstandard1 package, which would technically allow the UI to be run as good-ol' .net 4.6, but the CLI as .NET 8, while still sharing the same logic AND having the space benefit.

@LennardF1989
Copy link
Member Author

Above works. However, using a native Unix process to perform patching causes all kinds of issues, since Linux doesn't have the functions Windows has to apply the patches.

I'll rethink this but I see a few options: get the CLI in top shape for proton, fire and forget.

Or, use a hook dll to perform the patches natively. Benefit of this is also that you could use something like ImGui as a replacement for the UI. To be continued.

@LennardF1989
Copy link
Member Author

BOOM! Also appears to work without sudo, which is great.

image

@LennardF1989
Copy link
Member Author

Build now outputs a Windows-only .NET Framework 4.6 version, exactly like the original, just through a different build system.

The .NET 8 version is cross-compiled for Windows and Linux and comes in self-contained and portable versions.

Should be ready for testing.

@LennardF1989
Copy link
Member Author

Setup files for Steam Deck: PeacockSteamDeck.zip

Installation

  1. Switch to Desktop Mode
  2. Open a terminal
  3. Create a directory anywhere using mkdir Peacock and cd Peacock into it
  4. Execute the following command (use the "Copy to clipboard"-button):
wget https://github.com/thepeacockproject/Peacock/files/14323372/PeacockSteamDeck.zip && unzip PeacockSteamDeck.zip && chmod +x ./start.sh && rm PeacockSteamDeck.zip
  1. Run ./start.sh once to make sure everything is setup properly.
  2. Open a browser and go to http://localhost:3000 to confirm Peacock is running.
  3. Now open Steam, add a non-Steam game "Peacock" and choose the start.sh. Optionally assign the icon to be icon.png inside the Peacock-directory.

Running

  1. Switch back to Gaming Mode.
  2. Run the non-Steam game "Peacock". Leave it running like this, do not press B!
  3. Instead press the Steam-button on your Steam Deck to bring up your library. Either run Heroic and launch Hitman from there, or run the Steam version.

The game will be patched accordingly and connect to your own Peacock server.

Closing

Just close the game, switch back to Peacock and exit the application. This will take down both the server and the patcher.*

  • This is non-standard script behavior, but I guess Steam keeps track of the processes any process starts and kills all of them whenever you kill the parent process. Which is really nice for this situation!

@RDIL RDIL added the patcher Issues or pull requests targeting the patcher. label Mar 3, 2024
@RDIL RDIL added this to the v8 milestone Mar 31, 2024
@RDIL RDIL changed the base branch from v7 to master April 4, 2024 17:59
@crazytelli
Copy link

@LennardF1989 I was able to run the server and confirm in my browser that localhost:3000 is indeed running peacock.

I had to make a slight change in start.sh as follows:

FOLDER_NAME="Peacock-${LATEST_RELEASE}-linux" as the download file for linux is no longer named lite.

The one problem I'm running now is the Patcher is failing when launching hitman.

Here are some screenshots:

peacock-server-running

patcher-failed

@RDIL
Copy link
Member

RDIL commented Apr 5, 2024

@crazytelli thanks for the heads up, I changed it from lite -> linux in the linux setup repo. Will check on the error later.

@LennardF1989
Copy link
Member Author

Which version are you running @crazytelli? Steam, Epic? And if so, which version is reported in the main menu?

@crazytelli
Copy link

Which version are you running @crazytelli? Steam, Epic? And if so, which version is reported in the main menu?

I`m running the Steam version of Hitman III.

The game version (if I'm understanding what you're asking correctly) - in game -> Options:

  • game version: 3.180.0
  • server version: 8.15.0

@LennardF1989
Copy link
Member Author

And is it consistently failing to patch, or occasionally?

@crazytelli
Copy link

crazytelli commented Apr 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major This will need to be in a semver-major release. patcher Issues or pull requests targeting the patcher.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Peacock Patcher appears very blurry when using 125% scaling in Windows on a 1080p display
4 participants