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
protontricks: init at 1.2.3 #64705
protontricks: init at 1.2.3 #64705
Conversation
@aanderse I see that this was already assigned to you, but I wasn't sure of your progress. Does this seem like the right approach? |
@MetaDark Thanks for doing this! I assigned the issue to myself because I eventually have a need for it so eventually I would have got around to it... but you did first! I will review and test this tonight. |
eaaf54c
to
85b870c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nuff said @aanderse 😄 , reviewed the python bit.
4ebac50
to
5fe341e
Compare
@MetaDark I built & installed
I have never used Any thoughts? |
Hmm I haven't run into that issue before. It looks like it's failing to find the proton app for the given app id. It first looks in ~/.local/share/Steam/config/config.vdf and then tries to read from ~/.local/share/Steam/appcache/appinfo.vdf. It seems to be failing there because a regex on appinfo returns no results. What is the output if you try to run the following? #!/usr/bin/env nix-shell
#!nix-shell -i python '<nixpkgs>' -A protontricks
import vdf
import os
from pathlib import Path
from pprint import pprint
config_file = os.path.join(Path.home(), '.local/share/Steam/config/config.vdf')
with open(config_file) as f:
vdf_data = vdf.load(f)
pprint(vdf_data["InstallConfigStore"]["Software"]["Valve"]["Steam"].get("ToolMapping"))
pprint(vdf_data["InstallConfigStore"]["Software"]["Valve"]["Steam"].get("CompatToolMapping")) |
@MetaDark Thanks for looking into this. I should note that I have a second 'steam library' setup so all my games are installed into Output of your script:
|
@aanderse No problem 😊. If you run strings on ~/.local/share/Steam/appcache/appinfo.vdf, do you see proton_316_beta in there at all? If you do, I'm thinking that the magic number protontricks uses in the regex might be different on your install. This script should pull out the magic number, if that's the case: #!/usr/bin/env nix-shell
#!nix-shell -i python '<nixpkgs>' -A protontricks
import binascii
import os
import re
import struct
import vdf
from pathlib import Path
tool_mapping_name = 'proton_316_beta'
steam_path = os.path.join(Path.home(), '.local/share/Steam/')
appinfo_path = os.path.join(steam_path, 'appcache/appinfo.vdf')
with open(appinfo_path, 'rb') as f:
vdf_data = f.read().hex()
appid_regex = '({0})(.{{16}})(.{{8}})'.format(bytes(tool_mapping_name, 'utf-8').hex())
magic = None
for match in re.finditer(appid_regex, vdf_data):
magic = match.group(2)
app_id = struct.unpack('<I', binascii.unhexlify(match.group(3)))[0]
print('name: {}, app_id: {}, magic: {}'.format(tool_mapping_name, app_id, magic))
if magic is None:
print("Failed to find '{}' in appinfo".format(tool_mapping_name)) The magic number used in the regex is: 0002617070696400 |
@MetaDark
And the results of script: |
@aanderse Hmm yep, it looks like protontricks needs to be fixed upstream then. It really should be using the binary api for vdf rather than using regex's to find this information. |
@aanderse If you still want to try it out, you can use this patch in the nix expression: From 0bf70a56b6a8597a6e30e9dbf7ef061f4bc17936 Mon Sep 17 00:00:00 2001
From: MetaDark <kira.bruneau@gmail.com>
Date: Sun, 14 Jul 2019 13:52:48 -0400
Subject: [PATCH] custom magic number
---
src/protontricks/steam.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/protontricks/steam.py b/src/protontricks/steam.py
index d70c416..eabcb96 100644
--- a/src/protontricks/steam.py
+++ b/src/protontricks/steam.py
@@ -310,7 +310,7 @@ def find_steam_proton_app(steam_path, steam_apps, appid=None):
# ```
# proton_316_beta..appid.
# ```
- appid_regex = "({name_ascii}0002617070696400)([a-z0-9]{{8}})".format(
+ appid_regex = "({name_ascii}00080070726f746f)([a-z0-9]{{8}})".format(
name_ascii=str(binascii.hexlify(bytes(name, "utf-8")), "utf-8")
)
# The second group contains the App ID as a 32-bit integer in little-endian
--
2.22.0 |
@MetaDark Well one step closer. When I apply the patch you said I select a game and now get this:
I appreciate all the help so far. Hopefully I'll find some time to dig into this... |
I've pushed a fix to protontricks' repo in the appinfo_parse branch. The fix should parse the appinfo.vdf file properly based on the vdf Python library developer's comment here. The fix is working for me, but I'd like to hear if it's working on other environments besides my own first. If that's the case, I'll look into merging it into master soon. :) |
@Matoking Thanks for taking a look at this. I just built
Any ideas? |
I pushed another update to the appinfo_parse branch at Matoking/protontricks@e58b094. With some luck, it should work. And if that doesn't work, another option is to upload the appinfo.vdf file somewhere and see what's wrong with it. It seems to contain information about all the games affiliated with the currently logged in Steam user, including the SteamPlay manifests which contain the "compat tool name to app ID" mapping Protontricks needs. |
@Matoking Unfortunately this did not work. I have sent you an e-mail including my |
Hi, I received your appinfo.vdf and made another commit to the branch at Matoking/protontricks@1f25ec0. Third time's hopefully the charm, but if that still doesn't work, could you check your Steam configuration file at
|
@MetaDark and @Matoking I can't express how much I appreciate your help on this. Your latest revision solves the problem entirely and allows me to successfully run the command My son and I are about to finish our most recent LEGO game so this fix couldn't have come at a better time! |
@aanderse Thanks for your help in solving this bug. 👍 I've pushed out a new release 1.2.3 with this bug fix. If this gets accepted into NixOS' package repository, I'd be happy to add the package under the list of unofficial packages in the main repo. |
@MetaDark When you get a chance to bump this to version 1.2.3 please also squash all but the first commits into one. Thanks again to everyone! |
5fe341e
to
9ec12db
Compare
@GrahamcOfBorg build protontricks |
@aanderse I don't think the build will succeed if it's running it directly from master. I had to set |
9ec12db
to
5d053d8
Compare
@aanderse I managed to work around the build issue by ensuring that winetricks depends on the same minimal build of wine that protontricks depends on. This has the added benefit of reducing the closure size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Motivation for this change
This adds the protontricks package with required dependencies: #61193.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)