Compare commits

..

7 Commits

Author SHA1 Message Date
Mikhail Tergoev
76e75b8dc9 Scripts version 2398 2025-03-05 21:55:22 +03:00
Mikhail Tergoev
85b370926f correction of unnecessary downloads Wine 2025-03-05 21:45:51 +03:00
Mikhail Tergoev
49567db2b0 force use WINE_LG for gamesvoice 2025-03-05 21:16:17 +03:00
Mikhail Tergoev
bf4ebe887d Merge branch 'alex2844-getSteamPath' into devel 2025-03-05 21:12:05 +03:00
Mikhail Tergoev
39c2095356 Merge branch 'getSteamPath' of github.com:alex2844/PortWINE into alex2844-getSteamPath 2025-03-05 21:11:54 +03:00
Alex Smith
57d48c9989 remove $NOSTAIDVDFHEX 2025-03-05 22:35:20 +05:00
Alex Smith
7698e6eb75 getSteamPath and flatpak steam 2025-03-05 01:29:45 +05:00
6 changed files with 54 additions and 59 deletions

@ -2,6 +2,10 @@ You can help us in the development of the project on the website: https://linux-
----------------------------------------
Changelog:
###Scripts version 2398### / Date: 05.03.2025 / Download update size: 4 megabytes
* fixed the error of extra downloading PROTON_LG from the download menu of other WINE versions
* fixed and improved the functions of PortProton integration with Steam (thanks to alex2844)
###Scripts version 2397### / Date: 05.03.2025 / Download update size: 4 megabytes
* fixed icons for autosearch shortcut after using setup.exe (thanks to Htylol)
* added display of time spent in the game in hours and minutes, can be switched or turned off in global settings (thanks to Htylol)

@ -2,6 +2,10 @@
-----------------------------------------
История изменений:
###Scripts version 2398### / Дата: 05.03.2025 / Размер скачиваемого обновления: 4 мегабайта
* исправлена ошибка лишнего скачивания PROTON_LG из меню скачивания других версий WINE
* исправлены и улучшены функции интеграции PortProton со Steam (спасибо alex2844)
###Scripts version 2397### / Дата: 05.03.2025 / Размер скачиваемого обновления: 4 мегабайта
* исправлены иконки для автопоиска ярлыка после использования setup.exe (спасибо Htylol)
* добавлено отображение проведенного времени в игре в часах и минутах, можно переключить, или выключить в глобальных настройках (спасибо Htylol)

@ -3,23 +3,6 @@
# based on https://github.com/sonic2kk/steamtinkerlaunch/blob/master/steamtinkerlaunch
PROGNAME="PortProton"
## How Non-Steam AppIDs work, because it took me almost a year to figure this out
## ----------------------
## Steam stores shortcuts in a binary 'shortcuts.vdf', at SROOT/userdata/<id>/config
##
## Non-Steam AppIDs are 32bit little-endian (reverse byte order) signed integers, stored as hexidecimal
## This is probably generated using a crc32 generated from AppName + Exe, but it can actually be anything
## Steam likely does this to ensure "uniqueness" among entries, tools like Steam-ROM-Manager do the same thing likely for similar reasons
##
## For simplicity we generate a random 32bit signed integer using an md5, which we'll then convert to hex to store in the AppID file
## Though we can write any AppID we want, Steam will reject invalid ones (i.e. big endian hex) it will overwrite our AppID
## We can also convert this to an unsigned 32bit integer to get the AppID used for grids and other things, the unsigned int is just what Steam stores
##
## We can later re-use these functions to do several things:
## - Check for and remove stray STL configs for no longer stored Non-Steam Game AppIDs (if we had Non-Steam Games we previously used with STL that we no longer use, we can remove these configs in case there is a conflict in future)
### BEGIN MAGIC APPID FUNCTIONS
## ----------
# Generate random signed 32bit integer which can be converted into hex, using the first argument (AppName and Exe fields) as seed (in an attempt to reduce the chances of the same AppID being generated twice)
generateShortcutVDFAppId() {
seed="$(echo -n "$1" | md5sum | cut -c1-8)"
@ -30,23 +13,11 @@ dec2hex() {
printf '%x\n' "$1" | cut -c 9- # cut removes the 'ffffffff' from the string (represents the sign) and starts from the 9th character
}
# Takes big-endian ("normal") hexidecimal number and converts to little-endian
bigToLittleEndian() {
echo -n "$1" | tac -rs .. | tr -d '\n'
}
# Takes an signed 32bit integer and converts it to a 4byte little-endian hex number
generateShortcutVDFHexAppId() {
bigToLittleEndian "$(dec2hex "$1")"
}
# Takes an signed 32bit integer and converts it to an unsigned 32bit integer
extractSteamId32() {
# STUID32=$((STUID64 - 76561197960265728))
echo $(($1 & 0xFFFFFFFF))
}
## ----------
### END MAGIC APPID FUNCTIONS
getSteamShortcutsVdfFileHex() {
if [[ -z "${STCFGPATH}" ]]; then
@ -153,7 +124,8 @@ getSteamGridDBId() {
}
getUserIds() {
SLUF="${HOME}/.local/share/Steam/config/loginusers.vdf"
[[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)"
SLUF="${STEAM_BASE_FOLDER}/config/loginusers.vdf"
if [[ -f "${SLUF}" ]]; then
STUIDS=()
while read -r line; do
@ -168,7 +140,8 @@ getUserIds() {
}
getUserId() {
SLUF="${HOME}/.local/share/Steam/config/loginusers.vdf"
[[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)"
SLUF="${STEAM_BASE_FOLDER}/config/loginusers.vdf"
if [[ -f "${SLUF}" ]]; then
SLUFUB=false
STUID=""
@ -196,17 +169,33 @@ getUserPath() {
STUID="$(getUserId)"
fi
if [ -n "${STUID}" ]; then
STUIDPATH="${HOME}/.local/share/Steam/userdata/${STUID}"
if [[ -d "${STUIDPATH}" ]]; then
if [[ -f "${STUIDPATH}/config/shortcuts.vdf" ]]; then
echo "${STUIDPATH}/config"
fi
[[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)"
STUIDPATH="${STEAM_BASE_FOLDER}/userdata/${STUID}"
if [[ -d "${STUIDPATH}/config/" ]]; then
echo "${STUIDPATH}/config"
fi
fi
}
getSteamPath() {
local paths=(
"${HOME}/.steam/steam"
"${HOME}/.local/share/Steam"
"${HOME}/.var/app/com.valvesoftware.Steam/.steam/steam"
)
for path in "${paths[@]}"; do
if [[ -d "${path}" ]]; then
STEAM_BASE_FOLDER="${path}"
echo "${STEAM_BASE_FOLDER}"
return 0
fi
done
return 1
}
listInstalledSteamGames() {
manifests=("${HOME}/.local/share/Steam/steamapps"/appmanifest_*.acf)
[[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)"
manifests=("${STEAM_BASE_FOLDER}/steamapps"/appmanifest_*.acf)
if [ ! -e "${manifests[0]}" ]; then
jq -n '[]'
else
@ -324,7 +313,11 @@ restartSteam() {
while pgrep -i steam &>/dev/null ; do
sleep 0.5
done
steam &
if command -v steam &>/dev/null; then
steam &
elif command -v flatpak >/dev/null 2>&1 && flatpak list | grep -q com.valvesoftware.Steam; then
flatpak run com.valvesoftware.Steam &
fi
sleep 5
pw_stop_progress_bar
exit 0
@ -395,8 +388,11 @@ addEntry() {
printf '\x00%s\x00' "shortcuts" > "${SCPATH}"
NEWSET=0
fi
NOSTAIDVDFHEXFMT="\x$(awk '{$1=$1}1' FPAT='.{2}' OFS="\\\x" <<< "$NOSTAIDVDFHEX")" # binary-formatted string hex of the above which we actually write out - ex: \xc1\xc2\x5a\xdc
NOSTAIDVDFHEXFMT=$(printf '\\x%02x\\x%02x\\x%02x\\x%02x' \
$((${NOSTAPPID} & 0xFF)) \
$(((${NOSTAPPID} >> 8) & 0xFF)) \
$(((${NOSTAPPID} >> 16) & 0xFF)) \
$(((${NOSTAPPID} >> 24) & 0xFF)))
{
printf '\x00%s\x00' "${NEWSET}"
printf '\x02%s\x00%b' "appid" "${NOSTAIDVDFHEXFMT}"
@ -406,18 +402,10 @@ addEntry() {
printf '\x01%s\x00%s\x00' "icon" "${NOSTICONPATH}"
printf '\x01%s\x00%s\x00' "ShortcutPath" ""
printf '\x01%s\x00%s\x00' "LaunchOptions" "${NOSTARGS:-}"
printf '\x02%s\x00%b\x00\x00\x00' "IsHidden" "\x00"
printf '\x02%s\x00%b\x00\x00\x00' "AllowDesktopConfig" "\x00"
# These values are now stored in localconfig.vdf under the "Apps" section,
# under a block using the Non-Steam Game Signed 32bit AppID. (i.e., -223056321)
# This is handled by `updateLocalConfigAppsValue` below
#
# Unsure if required, but still write these to the shortcuts.vdf file for consistency
printf '\x02%s\x00%b\x00\x00\x00' "AllowOverlay" "\x00"
printf '\x02%s\x00%b\x00\x00\x00' "OpenVR" "\x00"
printf '\x02%s\x00\x00\x00\x00\x00' "IsHidden"
printf '\x02%s\x00\x01\x00\x00\x00' "AllowDesktopConfig"
printf '\x02%s\x00\x01\x00\x00\x00' "AllowOverlay"
printf '\x02%s\x00\x00\x00\x00\x00' "OpenVR"
printf '\x02%s\x00\x00\x00\x00\x00' "Devkit"
printf '\x01%s\x00\x00' "DevkitGameID"
printf '\x02%s\x00\x00\x00\x00\x00' "DevkitOverrideAppID"
@ -434,6 +422,7 @@ removeNonSteamGame() {
[[ -n "$2" ]] && NOSTSHPATH="$2"
[[ -z "${STUID}" ]] && STUID=$(getUserId)
[[ -z "${STCFGPATH}" ]] && STCFGPATH="$(getUserPath ${STUID})"
[[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)"
if [[ -n "${STCFGPATH}" ]] && [[ -z "${SCPATH}" ]]; then
SCPATH="${STCFGPATH}/shortcuts.vdf"
fi
@ -449,12 +438,11 @@ removeNonSteamGame() {
NOSTSTDIR=$(jq -r '.dir' <<< "${game}")
NOSTICONPATH=$(jq -r '.icon' <<< "${game}")
NOSTARGS=$(jq -r '.args' <<< "${game}")
NOSTAIDVDFHEX=$(bigToLittleEndian $(printf '%08x' "${NOSTAPPID}"))
addEntry
done
rm -f "${STCFGPATH}/grid/${appid}.jpg" "${STCFGPATH}/grid/${appid}p.jpg" "${STCFGPATH}/grid/${appid}_hero.jpg" "${STCFGPATH}/grid/${appid}_logo.png"
rm -rf "${HOME}/.local/share/Steam/steamapps/compatdata/${appid}"
rm -rf "${HOME}/.local/share/Steam/steamapps/shadercache/${appid}"
rm -rf "${STEAM_BASE_FOLDER}/steamapps/compatdata/${appid}"
rm -rf "${STEAM_BASE_FOLDER}/steamapps/shadercache/${appid}"
if [[ -f "${NOSTSHPATH}" ]]; then
isInstallGame=false
for STUIDCUR in $(getUserIds); do
@ -494,7 +482,6 @@ addNonSteamGame() {
fi
NOSTICONPATH="${PORT_WINE_PATH}/data/img/${name_desktop_png}.png"
NOSTAIDVDF="$(generateShortcutVDFAppId "${NOSTAPPNAME}${NOSTEXEPATH}")" # signed integer AppID, stored in the VDF as hexidecimal - ex: -598031679
NOSTAIDVDFHEX="$(generateShortcutVDFHexAppId "${NOSTAIDVDF}")" # 4byte little-endian hexidecimal of above 32bit signed integer, which we write out to the binary VDF - ex: c1c25adc
NOSTAPPID="$(extractSteamId32 "${NOSTAIDVDF}")" # unsigned 32bit ingeger version of "$NOSTAIDVDF", which is used as the AppID for Steam artwork ("grids"), as well as for our shortcuts
create_new_dir "${STEAM_SCRIPTS}"

@ -4999,7 +4999,7 @@ gui_proton_downloader () {
if [[ "$1" != "silent" ]] ; then
for GIVE_ALL_WINE in ${VERSION_WINE_GIT} ; do
for GIVE_WINE_URL in "${WINE_GE_CUSTOM[@]}" "${PROTON_GE_GIT[@]}" "${WINE_KRON4EK[@]}" "${PROTON_PW_GIT[@]}" "${PROTON_CACHYOS_GIT[@]}" ; do
if [[ ${GIVE_WINE_URL^^} =~ ${GIVE_ALL_WINE^^} ]] ; then
if [[ ${GIVE_WINE_URL^^} =~ ${GIVE_ALL_WINE^^}.TAR ]] ; then
export URL_VERSION_PROTON_GIT=$GIVE_WINE_URL
fi
done

@ -13,4 +13,4 @@ export PW_USE_GAMEMODE="0"
export PW_PREFIX_NAME="DOTNET"
export PW_DLL_INSTALL=""
export PW_DISABLED_CREATE_DB="1"
export PW_WINE_USE="WINE_LG"

@ -1,6 +1,6 @@
#!/usr/bin/env bash
#Author: Castro-Fidel (linux-gaming.ru)
#SCRIPTS_NEXT_VERSION=2397
#SCRIPTS_NEXT_VERSION=2398
#SCRIPTS_STABLE_VERSION=2388
########################################################################
export AI_TOP_GAMES="PW_LGC PW_VKPLAY PW_EPIC PW_BATTLE_NET PW_WORLD_OF_SEA_BATTLE PW_RUSSIAN_FISHING PW_HO_YO_PLAY PW_FARLIGHT84 PW_WARFRAME PW_WGC PW_UBISOFT"