Skip to content

Commit

Permalink
Merge pull request #25 from loathingKernel/insteam
Browse files Browse the repository at this point in the history
Add files required for compatibility with Steam
  • Loading branch information
GloriousEggroll authored Feb 20, 2024
2 parents 8ed1f0f + 39b48b4 commit 65a9d88
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
13 changes: 13 additions & 0 deletions ULWGL-Runner/compatibilitytool.vdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"compatibilitytools"
{
"compat_tools"
{
"ULWGL-Runner" // Internal name of this tool
{
"install_path" "."
"display_name" "ULWGL-Runner"
"from_oslist" "windows"
"to_oslist" "linux"
}
}
}
8 changes: 8 additions & 0 deletions ULWGL-Runner/toolmanifest.vdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Generated file, do not edit
"manifest"
{
"commandline" "/ulwgl-run %verb%"
"version" "2"
"use_tool_subprocess_reaper" "1"
"compatmanager_layer_name" "ulwgl-runner"
}
1 change: 1 addition & 0 deletions ULWGL-Runner/ulwgl-run
9 changes: 0 additions & 9 deletions toolmanifest.vdf

This file was deleted.

27 changes: 16 additions & 11 deletions ulwgl_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
import subprocess
from ulwgl_dl_util import get_ulwgl_proton

verbs: Set[str] = {
"waitforexitandrun",
"run",
"runinprefix",
"destroyprefix",
"getcompatpath",
"getnativepath",
}


def parse_args() -> Union[Namespace, Tuple[str, List[str]]]: # noqa: D103
opt_args: Set[str] = {"--help", "-h", "--config"}
Expand Down Expand Up @@ -43,6 +52,11 @@ def parse_args() -> Union[Namespace, Tuple[str, List[str]]]: # noqa: D103
if sys.argv[1:][0] in opt_args:
return parser.parse_args(sys.argv[1:])

if sys.argv[1] in verbs:
if "PROTON_VERB" not in os.environ:
os.environ["PROTON_VERB"] = sys.argv[1]
sys.argv.pop(1)

return sys.argv[1], sys.argv[2:]


Expand Down Expand Up @@ -135,15 +149,15 @@ def check_env(
env["PROTONPATH"] = (
Path("~/.local/share/Steam/compatibilitytools.d/")
.expanduser()
.joinpath(os.environ["PROTONPATH"])
.joinpath(os.environ["PROTONPATH"]).as_posix()
)
elif not Path(os.environ["PROTONPATH"]).expanduser().is_dir():
os.environ["PROTONPATH"] = ""
get_ulwgl_proton(env)
else:
env["PROTONPATH"] = os.environ["PROTONPATH"]

print(env["PROTONPATH"])
print(env["PROTONPATH"], file=sys.stderr)

# If download fails/doesn't exist in the system, raise an error
if not os.environ["PROTONPATH"]:
Expand All @@ -160,15 +174,6 @@ def set_env(
Filesystem paths will be formatted and expanded as POSIX
"""
verbs: Set[str] = {
"waitforexitandrun",
"run",
"runinprefix",
"destroyprefix",
"getcompatpath",
"getnativepath",
}

# PROTON_VERB
# For invalid Proton verbs, just assign the waitforexitandrun
if "PROTON_VERB" in os.environ and os.environ["PROTON_VERB"] in verbs:
Expand Down

0 comments on commit 65a9d88

Please sign in to comment.