Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PortWINE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikhail Tergoev
PortWINE
Commits
b58d7d8b
Commit
b58d7d8b
authored
Mar 31, 2025
by
Alex Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find local SteamAppId
parent
fd0fa7d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
39 deletions
+54
-39
add_in_steam.sh
data_from_portwine/scripts/add_in_steam.sh
+54
-39
No files found.
data_from_portwine/scripts/add_in_steam.sh
View file @
b58d7d8b
...
@@ -51,13 +51,7 @@ getAppExe() {
...
@@ -51,13 +51,7 @@ getAppExe() {
getAppTarget
()
{
getAppTarget
()
{
exe
=
$(
getAppExe
"
$1
"
)
exe
=
$(
getAppExe
"
$1
"
)
if
[[
-
n
"
${
exe
}
"
]]
;
then
[[
-
n
"
${
exe
}
"
]]
&&
parseSteamTargetExe
"
${
exe
}
"
if
[[
"
${
exe
}
"
=
~ .sh
$
]]
;
then
parseSteamTargetExe
"
${
exe
}
"
else
echo
"
${
exe
}
"
;
fi
fi
}
}
getSteamGameId
()
{
getSteamGameId
()
{
...
@@ -73,28 +67,46 @@ getSteamId() {
...
@@ -73,28 +67,46 @@ getSteamId() {
local cache_file="
${
PORT_WINE_TMP_PATH
:-
/tmp
}
/steamid_cache.json"
local cache_file="
${
PORT_WINE_TMP_PATH
:-
/tmp
}
/steamid_cache.json"
local applist_cache_file="
${
PORT_WINE_TMP_PATH
:-
/tmp
}
/steamapplist_cache.json"
local applist_cache_file="
${
PORT_WINE_TMP_PATH
:-
/tmp
}
/steamapplist_cache.json"
[[ -n "
${
1
:-}
" ]] && NOSTAPPNAME="
$1
"
[[ -n "
${
1
:-}
" ]] && NOSTAPPNAME="
$1
"
[[ -z "
${
NOSTAPPNAME
}
" ]] && return 1
if [[ -z "
${
SteamIds
:-}
" ]] && [[ -f "
${
cache_file
}
" ]]; then
if [[ -z "
${
SteamIds
:-}
" ]] && [[ -f "
${
cache_file
}
" ]]; then
SteamIds=
$(
<
"
${
cache_file
}
"
)
SteamIds=
$(
<
"
${
cache_file
}
"
)
fi
fi
if [[ -n "
${
SteamIds
:-}
" ]] && jq -e --arg key "
${
NOSTAPPNAME
}
" 'has(
$key
)' <<< "
${
SteamIds
}
" > /dev/null; then
if [[ -n "
${
1
:-}
" ]] && [[ -n "
${
SteamIds
:-}
" ]] && jq -e --arg key "
${
NOSTAPPNAME
}
" 'has(
$key
)' <<< "
${
SteamIds
}
" > /dev/null; then
SteamAppId=
$(
jq
-r
--arg
key
"
${
NOSTAPPNAME
}
"
'.[$key]'
<<<
"
${
SteamIds
}
"
)
SteamAppId=
$(
jq
-r
--arg
key
"
${
NOSTAPPNAME
}
"
'.[$key]'
<<<
"
${
SteamIds
}
"
)
else
else
if [[ -n "
${
1
:-}
" ]] && [[ "
${
USE_STEAMGRIDDB
:-
1
}
" == "1" ]]; then
if [[ -n "
${
2
:-}
" ]]; then
getSteamGridDBId "
${
NOSTAPPNAME
}
" > /dev/null
NOSTAPPPATH="
$2
"
[[ -f "
${
NOSTAPPPATH
}
.ppdb" ]] && source "
${
NOSTAPPPATH
}
.ppdb"
fi
fi
if [[
${
SteamGridDBTypeSteam
}
== true ]]; then
[[ -n "
${
STEAM_APP_ID
:-}
" ]] && SteamAppId="
${
STEAM_APP_ID
}
"
SRES=
$(
curl
-Ls
--connect-timeout
5
-m
10
-e
"https://www.steamgriddb.com/game/
${
SteamGridDBId
}
"
"https://www.steamgriddb.com/api/public/game/
${
SteamGridDBId
}
"
)
if [[ -z "
${
SteamAppId
:-}
" ]] && [[ -n "
${
NOSTAPPPATH
:-}
" ]]; then
if jq -e ".success == true" <<< "
${
SRES
}
" > /dev/null 2>&1; then
local paths=("steam_appid.txt" "steam_emu.ini" "steam_api.ini" "steam_api64.ini")
SteamAppId="
$(
jq
-r
'.data.platforms.steam.id'
<<<
"
${
SRES
}
"
)
"
local conditions=
$(
printf
" -o -name %q"
"
${
paths
[@]
}
"
)
local file=
$(
find
"
$(
dirname
"
${
NOSTAPPPATH
}
"
)
"
-type
f
\(
${
conditions
# -o
}
\)
-print
-quit
2>/dev/null
)
if [[ -n "
${
file
}
" ]]; then
if [[ "
${
file
}
" == *"steam_appid.txt" ]]; then
SteamAppId=
$(
cat
"
${
file
}
"
|
tr
-d
'\r\n'
)
else
SteamAppId=
$(
grep
-i
"^AppId="
"
${
file
}
"
|
cut
-d
'='
-f2
|
head
-1
|
tr
-d
'\r\n'
)
fi
fi
fi
elif [[ "
${
USE_STEAMGRIDDB
:-
1
}
" == "0" ]]; then
fi
if [[ ! -f "
${
applist_cache_file
}
" ]] || [[
$(
find
"
${
applist_cache_file
}
"
-mmin
+1440
)
]]; then
if [[ -z "
${
SteamAppId
:-}
" ]]; then
applist_data=
$(
curl
-s
--connect-timeout
5
"https://api.steampowered.com/ISteamApps/GetAppList/v2/"
)
[[ "
${
USE_STEAMGRIDDB
:-
1
}
" == "1" ]] && getSteamGridDBId "
${
NOSTAPPNAME
}
" > /dev/null
[[ -n "
${
applist_data
}
" ]] && echo "
${
applist_data
}
" > "
${
applist_cache_file
}
"
if [[
${
SteamGridDBTypeSteam
}
== true ]]; then
else
SRES=
$(
curl
-Ls
--connect-timeout
5
-m
10
-e
"https://www.steamgriddb.com/game/
${
SteamGridDBId
}
"
"https://www.steamgriddb.com/api/public/game/
${
SteamGridDBId
}
"
)
applist_data=
$(
<
"
${
applist_cache_file
}
"
)
if jq -e ".success == true" <<< "
${
SRES
}
" > /dev/null 2>&1; then
SteamAppId="
$(
jq
-r
'.data.platforms.steam.id'
<<<
"
${
SRES
}
"
)
"
fi
elif [[ "
${
USE_STEAMGRIDDB
:-
1
}
" == "0" ]]; then
if [[ ! -f "
${
applist_cache_file
}
" ]] || [[
$(
find
"
${
applist_cache_file
}
"
-mmin
+1440
)
]]; then
applist_data=
$(
curl
-s
--connect-timeout
5
"https://api.steampowered.com/ISteamApps/GetAppList/v2/"
)
[[ -n "
${
applist_data
}
" ]] && echo "
${
applist_data
}
" > "
${
applist_cache_file
}
"
else
applist_data=
$(
<
"
${
applist_cache_file
}
"
)
fi
[[ -n "
${
applist_data
}
" ]] && SteamAppId=
$(
jq
--arg
name
"
${
NOSTAPPNAME
,,
}
"
'.applist.apps[] | select(.name == $name) | .appid'
<<<
"
${
applist_data
,,
}
"
)
fi
fi
[[ -n "
${
applist_data
}
" ]] && SteamAppId=
$(
jq
--arg
name
"
${
NOSTAPPNAME
,,
}
"
'.applist.apps[] | select(.name == $name) | .appid'
<<<
"
${
applist_data
,,
}
"
)
fi
fi
SteamIds=
$(
jq
--arg
key
"
${
NOSTAPPNAME
}
"
--arg
value
"
${
SteamAppId
:-}
"
'. + {($key): $value}'
<<<
"
${
SteamIds
:-$(
jq
-n
'{}'
)}
"
)
SteamIds=
$(
jq
--arg
key
"
${
NOSTAPPNAME
}
"
--arg
value
"
${
SteamAppId
:-}
"
'. + {($key): $value}'
<<<
"
${
SteamIds
:-$(
jq
-n
'{}'
)}
"
)
echo "
${
SteamIds
}
" > "
${
cache_file
}
"
echo "
${
SteamIds
}
" > "
${
cache_file
}
"
...
@@ -178,11 +190,7 @@ getUserPath() {
...
@@ -178,11 +190,7 @@ getUserPath() {
}
}
getSteamPath() {
getSteamPath() {
local paths=(
local paths=("
${
HOME
}
/.steam/steam" "
${
HOME
}
/.local/share/Steam" "
${
HOME
}
/.var/app/com.valvesoftware.Steam/.steam/steam")
"
${
HOME
}
/.steam/steam"
"
${
HOME
}
/.local/share/Steam"
"
${
HOME
}
/.var/app/com.valvesoftware.Steam/.steam/steam"
)
for path in "
${
paths
[@]
}
"; do
for path in "
${
paths
[@]
}
"; do
if [[ -d "
${
path
}
" ]]; then
if [[ -d "
${
path
}
" ]]; then
STEAM_BASE_FOLDER="
${
path
}
"
STEAM_BASE_FOLDER="
${
path
}
"
...
@@ -237,7 +245,8 @@ listSteamGames() {
...
@@ -237,7 +245,8 @@ listSteamGames() {
appid="
${
name
}
"
appid="
${
name
}
"
name=
$(
basename
"
${
exe
}
"
.sh
)
name=
$(
basename
"
${
exe
}
"
.sh
)
else
else
appid="
$(
getSteamId
"
${
name
}
"
)
"
path="
$(
parseSteamTargetExe
"
${
exe
}
"
)
"
appid="
$(
getSteamId
"
${
name
}
"
"
${
path
}
"
)
"
[[ -z "
${
appid
}
" ]] && appid="0"
[[ -z "
${
appid
}
" ]] && appid="0"
fi
fi
gid="
$(
getSteamGameId
$id
)
"
gid="
$(
getSteamGameId
$id
)
"
...
@@ -302,7 +311,9 @@ parseSteamShortcutEntryLaunchOptions() {
...
@@ -302,7 +311,9 @@ parseSteamShortcutEntryLaunchOptions() {
}
}
parseSteamTargetExe
()
{
parseSteamTargetExe
()
{
grep
-
E
'^[^# ]*?(flatpak|start\.sh)'
"
$1
"
|
head
-
n
1
|
sed
's/ "\$@"//'
|
awk
-
F
'"'
'{print $(NF-1)}'
if
[[
"
$1
"
=
~ .sh
$
]]
;
then
grep
-
E
'^[^# ]*?(flatpak|start\.sh)'
"
$1
"
|
head
-
n
1
|
sed
's/ "\$@"//'
|
awk
-
F
'"'
'{print $(NF-1)}'
fi
}
}
restartSteam
()
{
restartSteam
()
{
...
@@ -333,9 +344,6 @@ downloadImage() {
...
@@ -333,9 +344,6 @@ downloadImage() {
}
}
downloadImageSteam
()
{
downloadImageSteam
()
{
if
[[
-
z
"
${
SteamAppId
}
"
]]
;
then
getSteamId
>
/
dev/null
fi
if
[[
-
n
"
${
SteamAppId
}
"
]]
;
then
if
[[
-
n
"
${
SteamAppId
}
"
]]
;
then
downloadImage
"https://cdn.cloudflare.steamstatic.com/steam/apps/
${
SteamAppId
}
/
$1
"
"
$2
"
downloadImage
"https://cdn.cloudflare.steamstatic.com/steam/apps/
${
SteamAppId
}
/
$1
"
"
$2
"
else
else
...
@@ -363,16 +371,22 @@ downloadImageSteamGridDB() {
...
@@ -363,16 +371,22 @@ downloadImageSteamGridDB() {
}
}
addGrids
()
{
addGrids
()
{
[[
-
z
"
${
SteamGridDBId
}
"
]]
&&
getSteamGridDBId
"
${
name_desktop
}
"
>
/
dev/null
local
AppId
=
"
${
NOSTAPPID
:-
0
}
"
if
[[
-
z
"
${
SteamAppId
}
"
]]
&&
[[
"
${
USE_STEAMGRIDDB
:-
1
}
"
==
"0"
]]
;
then
local
in
=(
"header.jpg"
"library_600x900_2x.jpg"
"library_hero.jpg"
"logo.png"
)
local
out
=(
"
${
AppId
}
.jpg"
"
${
AppId
}
"
p
".jpg"
"
${
AppId
}
"
_hero
".jpg"
"
${
AppId
}
"
_logo
".png"
)
local
gtype
=(
"grids"
"grids"
"heroes"
"logos"
)
local
mimes
=(
"image/jpeg"
"image/jpeg"
"image/jpeg"
"image/png"
)
local
dims
=(
"460x215,920x430"
"600x900,660x930"
""
""
)
if
[[
-
z
"
${
SteamGridDBId
}
"
]]
&&
[[
-
z
"
${
SteamAppId
}
"
]]
;
then
getSteamId
>
/
dev/null
getSteamId
>
/
dev/null
fi
fi
if
[[
-
n
"
${
SteamGridDBId
}
"
]]
||
[[
-
n
"
${
SteamAppId
}
"
]]
;
then
if
[[
-
n
"
${
SteamGridDBId
}
"
]]
||
[[
-
n
"
${
SteamAppId
}
"
]]
;
then
create_new_dir
"
${
STCFGPATH
}
/grid"
create_new_dir
"
${
STCFGPATH
}
/grid"
downloadImageSteamGridDB
"grids"
"
${
NOSTAPPID
:-
0
}
.jpg"
"mimes=image/jpeg"
"dimensions=460x215,920x430"
||
downloadImageSteam
"header.jpg"
"
${
NOSTAPPID
:-
0
}
.jpg"
||
echo
"Failed to load header.jpg"
for
i
in
{
0
..3
}
;
do
downloadImageSteamGridDB
"grids"
"
${
NOSTAPPID
:-
0
}
p.jpg"
"mimes=image/jpeg"
"dimensions=600x900,660x930"
||
downloadImageSteam
"library_600x900_2x.jpg"
"
${
NOSTAPPID
:-
0
}
p.jpg"
||
echo
"Failed to load library_600x900_2x.jpg"
downloadImageSteam
"
${
in
[
${
i
}
]
}
"
"
${
out
[
${
i
}
]
}
"
||
\
downloadImageSteamGridDB
"heroes"
"
${
NOSTAPPID
:-
0
}
_hero.jpg"
"mimes=image/jpeg"
||
downloadImageSteam
"library_hero.jpg"
"
${
NOSTAPPID
:-
0
}
_hero.jpg"
||
echo
"Failed to load library_hero.jpg"
downloadImageSteamGridDB
"
${
gtype
[
${
i
}
]
}
"
"
${
out
[
${
i
}
]
}
"
${
mimes
[
${
i
}
]
:+
"mimes=
${
mimes
[
${
i
}
]
}
"
}
${
dims
[
${
i
}
]
:+
"dimensions=
${
dims
[
${
i
}
]
}
"
}
||
\
downloadImageSteamGridDB
"logos"
"
${
NOSTAPPID
:-
0
}
_logo.png"
"mimes=image/png"
||
downloadImageSteam
"logo.png"
"
${
NOSTAPPID
:-
0
}
_logo.png"
||
echo
"Failed to load logo.png"
echo
"Failed to load
${
in
[
${
i
}
]
}
"
done
else
else
echo
"Game is not found"
echo
"Game is not found"
fi
fi
...
@@ -474,6 +488,7 @@ addNonSteamGame() {
...
@@ -474,6 +488,7 @@ addNonSteamGame() {
if
[[
-
n
"
${
SCPATH
}
"
]]
;
then
if
[[
-
n
"
${
SCPATH
}
"
]]
;
then
[[
-
z
"
${
NOSTSHPATH
}
"
]]
&&
NOSTSHPATH
=
"
${
STEAM_SCRIPTS
}
/
${
name_desktop
}
.sh"
[[
-
z
"
${
NOSTSHPATH
}
"
]]
&&
NOSTSHPATH
=
"
${
STEAM_SCRIPTS
}
/
${
name_desktop
}
.sh"
NOSTAPPNAME
=
"
${
name_desktop
}
"
NOSTAPPNAME
=
"
${
name_desktop
}
"
NOSTAPPPATH
=
"
${
portwine_exe
}
"
NOSTAPPID
=
$(
getAppId
"
${
NOSTSHPATH
}
"
)
NOSTAPPID
=
$(
getAppId
"
${
NOSTSHPATH
}
"
)
if
[[
!
-
f
"
${
NOSTSHPATH
}
"
]]
;
then
if
[[
!
-
f
"
${
NOSTSHPATH
}
"
]]
;
then
create_new_dir
"
${
STEAM_SCRIPTS
}
"
create_new_dir
"
${
STEAM_SCRIPTS
}
"
...
@@ -482,7 +497,7 @@ addNonSteamGame() {
...
@@ -482,7 +497,7 @@ addNonSteamGame() {
export LD_PRELOAD=
export LD_PRELOAD=
export START_FROM_STEAM=1
export START_FROM_STEAM=1
export START_FROM_FLATPAK=
$(
check_flatpak
&&
echo
1
||
echo
0
)
export START_FROM_FLATPAK=
$(
check_flatpak
&&
echo
1
||
echo
0
)
"
${
PORT_SCRIPTS_PATH
}
/start.sh" "
${
portwine_exe
}
" "\
$@
"
"
${
PORT_SCRIPTS_PATH
}
/start.sh" "
${
NOSTAPPPATH
}
" "\
$@
"
EOF
EOF
chmod
u+x
"
${
NOSTSHPATH
}
"
chmod
u+x
"
${
NOSTSHPATH
}
"
fi
fi
...
@@ -498,7 +513,7 @@ addNonSteamGame() {
...
@@ -498,7 +513,7 @@ addNonSteamGame() {
fi
fi
if
[[
"
${
USE_STEAMAPPID_AS_NAME
:-
0
}
"
==
"1"
]]
;
then
if
[[
"
${
USE_STEAMAPPID_AS_NAME
:-
0
}
"
==
"1"
]]
;
then
SteamAppId
=
$(
getSteamId
"
${
NOSTAPPNAME
}
"
)
getSteamId
>
/
dev/null
[[
-
n
"
${
SteamAppId
}
"
]]
&&
NOSTAPPNAME
=
"
${
SteamAppId
}
"
[[
-
n
"
${
SteamAppId
}
"
]]
&&
NOSTAPPNAME
=
"
${
SteamAppId
}
"
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment