Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PortProton
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
PortProton
Commits
e9b8b66e
Commit
e9b8b66e
authored
Aug 22, 2023
by
Mikhail Tergoev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parents
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
257 additions
and
0 deletions
+257
-0
portproton-cmd
portproton-cmd
+257
-0
No files found.
portproton-cmd
0 → 100755
View file @
e9b8b66e
#!/usr/bin/env bash
# Author: Tergoev Mikhail
##### CHECK ROOT #####
if
[[
$(
id
-u
)
==
0
]]
;
then
echo
"Do not run the script from the superuser!"
exit
1
fi
##### CHECK VARIABLES #####
check_variables
()
{
[[
-z
${
!1
}
]]
&&
export
$1
=
"
$2
"
;
}
##### DEFAULT VARIABLES #####
check_variables PP_DEFAULT_PATH
"
$HOME
/.local/share/PortProton"
check_variables WINEESYNC
"1"
check_variables WINEFSYNC
"1"
check_variables WINEARCH
"win64"
check_variables WINEDLLOVERRIDES
"winemenubuilder.exe=d"
check_variables STAGING_SHARED_MEMORY
"1"
check_variables WINE_LARGE_ADDRESS_AWARE
"1"
check_variables WINE_FULLSCREEN_FSR
"1"
check_variables PROTON_DISABLE_LSTEAMCLIENT
"1"
check_variables DEBUG 0
if
[[
$DEBUG
!=
1
]]
;
then
check_variables WINEDEBUG
"-all"
check_variables DXVK_LOG_LEVEL
"none"
check_variables VKD3D_SHADER_DEBUG
"none"
check_variables VKD3D_DEBUG
"none"
check_variables DXVK_LOG_PATH
"none"
check_variables VKBASALT_LOG_LEVEL
"none"
check_variables DXVK_NVAPI_LOG_LEVEL
"none"
else
check_variables WINEDEBUG
"fixme-all,err+loaddll,err+dll,err+file,err+reg"
check_variables DXVK_LOG_LEVEL
"warn"
check_variables VKD3D_DEBUG
"warn"
check_variables WINE_MONO_TRACE
"E:System.NotImplementedException"
check_variables VK_LOADER_DEBUG
"warn"
check_variables VKBASALT_LOG_LEVEL
"warn"
check_variables DXVK_NVAPI_LOG_LEVEL
"warn"
fi
check_variables PP_WINDOWS_VER
"10"
check_variables PP_USE_GSTREAMER
"1"
check_variables PP_USE_D3D_EXTRAS
"1"
check_variables WINE_WIN_START
"start /wait /high /unix"
check_variables WINE_ALLOW_XIM
"0"
check_variables PP_USE_SHADER_CACHE
"1"
check_variables PP_USE_EAC_AND_BE
"1"
if
[[
-z
$WINE_CPU_TOPOLOGY
]]
;
then
check_variables PP_WINE_CPU_TOPOLOGY
"disabled"
else
export
PP_WINE_CPU_TOPOLOGY
=
$WINE_CPU_TOPOLOGY
""
fi
check_variables D8VK_VER
"1.0"
check_variables DXVK_STABLE_VER
"1.10.3-28"
check_variables DXVK_GIT_VER
"2.2-137"
# check_variables DXVK_CONFIG_FILE "path/to/dxvk.conf"
check_variables VKD3D_STABLE_VER
"1.1-2602"
check_variables VKD3D_GIT_VER
"1.1-3516"
# check_variables VKD3D_FEATURE_LEVEL "12_0"
check_variables MANGOHUD 0
check_variables MANGOHUD_CONFIG
"cpu_stats,cpu_temp,cpu_mhz,cpu_color=2e97cb,cpu_text=CPU,gpu_stats,gpu_temp,gpu_core_clock,gpu_mem_clock,vulkan_driver,gpu_name,gpu_color=2e9762,gpu_text=GPU,vram,vram_color=ad64c1,ram,ram_color=c26693,io_color=a491d3,frame_timing=1,frametime_color=00ff00,time,arch,wine,wine_color=eb5b5b,engine_color=eb5b5b,background_alpha=0.2,font_size=24,background_color=020202,text_color=ffffff,toggle_hud=Shift_R+F12,resolution,vkbasalt"
##### MESSAGES FUNCTIONS #####
print_error
()
{
printf
"
\E
[31m%s Error:
$@
%s
\e
[0m
\n
"
;
}
print_warning
()
{
printf
"
\E
[33m%s Warning:
$@
%s
\e
[0m
\n
"
;
}
print_info
()
{
printf
"
\E
[36m%s Info:
$@
%s
\e
[0m
\n
"
;
}
print_debug
()
{
printf
"
\E
[35m%s Debug:
$@
%s
\e
[0m
\n
"
;
}
print_var
()
{
for
vp
in
$@
;
do
print_info
"
${
vp
}
=
${
!vp
}
"
;
done
;
}
##### HELPER FUNCTIONS #####
try_copy_file
()
{
if
[
!
-f
"
$1
"
]
;
then
print_info
"file
$1
not found for copy"
&&
return
1
elif
[
-z
"
$2
"
]
;
then
print_error
"no way to copy file
$1
"
&&
return
1
else
cp
-f
"
$1
"
"
$2
"
if
[
"
$?
"
!=
0
]
then
print_error
"failed to copy file
$1
to
$2
"
&&
return
1
else return
0
fi
fi
}
try_copy_dir
()
{
if
[
!
-d
"
$1
"
]
;
then
print_info
"directory
$1
not found for copy"
elif
[
-z
"
$2
"
]
;
then
print_error
"no way to copy directory
$1
"
else
cp
-fr
"
$1
"
"
$2
"
[
"
$?
"
!=
0
]
&&
print_error
"failed to copy directory
$1
to
$2
"
||
return
0
fi
return
1
}
try_remove_file
()
{
if
[
-f
"
$1
"
]
||
[
!
-e
"
$1
"
]
;
then
rm
-f
"
$1
"
&&
return
0
||
return
1
fi
}
try_remove_dir
()
{
if
[
-d
"
$1
"
]
;
then
rm
-fr
"
$1
"
&&
return
0
||
return
1
fi
}
try_force_link_file
()
{
if
[
!
-f
"
$1
"
]
;
then
:
elif
[
-z
"
$2
"
]
;
then
print_error
"no way to link file
$1
"
else
ln
-sf
"
$1
"
"
$2
"
[
"
$?
"
!=
0
]
&&
print_error
"failed to link file
$1
to
$2
"
||
return
0
fi
return
1
}
check_symlink
()
{
CHK_SYMLINK_FILE
=
"
$(
file
"
$1
"
)
"
if
[[
!
-z
"
$(
echo
"
$CHK_SYMLINK_FILE
"
|
grep
-v
"broken"
|
grep
"symbolic link to"
|
awk
'{print $1}'
)
"
]]
;
then return
0
elif
[[
!
-z
"
$(
echo
"
$CHK_SYMLINK_FILE
"
|
grep
"broken symbolic link to"
|
awk
'{print $1}'
)
"
]]
;
then
print_error
"remove broken symlink:
$CHK_SYMLINK_FILE
"
rm
-fr
"
$CHK_SYMLINK_FILE
"
return
1
else return
1
fi
}
try_force_link_dir
()
{
if
[
!
-d
"
$1
"
]
;
then
print_info
"directory
$1
not found for link"
elif
[
-z
"
$2
"
]
;
then
print_error
"no way to link directory
$1
"
else
ln
-sf
"
$1
"
"
$2
"
[
"
$?
"
!=
0
]
&&
print_error
"failed to link directory
$1
to
$2
"
||
return
0
fi
return
1
}
create_new_dir
()
{
if
[
!
-d
"
$1
"
]
;
then
mkdir
-p
"
$1
"
fi
return
0
}
try_unpack_file
()
{
if
[
-f
"
$1
"
]
&&
[
-n
"
$2
"
]
;
then
create_new_dir
"
$2
"
case
"
$1
"
in
*
.tar.zst
)
pv
"
$1
"
|
tar
-I
zstd
-xf
-
-C
"
$2
"
&&
UNPACK_STATUS
=
0
||
UNPACK_STATUS
=
1
;;
*
.tar.xz
)
pv
"
$1
"
|
tar
-Jxf
-
-C
"
$2
"
&&
UNPACK_STATUS
=
0
||
UNPACK_STATUS
=
1
;;
*
.tar.gz
)
pv
"
$1
"
|
tar
-xzf
-
-C
"
$2
"
&&
UNPACK_STATUS
=
0
||
UNPACK_STATUS
=
1
;;
*
.tar
)
pv
"
$1
"
|
tar
-xhf
-
-C
"
$2
"
&&
UNPACK_STATUS
=
0
||
UNPACK_STATUS
=
1
;;
esac
if
[[
${
UNPACK_STATUS
}
==
0
]]
;
then
print_info
"unpacked
$1
- OK!"
return
0
else
print_error
"unpacking
$1
- failed!"
return
1
fi
fi
}
try_download
()
{
DOWNLOAD_FILE_NAME
=
"
$(
basename
$1
)
"
print_info
"Try download
$DOWNLOAD_FILE_NAME
from
$1
"
if
curl
--progress-bar
-A
"Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)"
-L
"
$1
"
-o
"
$2
"
;
then
print_info
"Download
$DOWNLOAD_FILE_NAME
successful."
return
0
else
print_error
"Download
$DOWNLOAD_FILE_NAME
failed."
return
1
fi
}
##### OVERRIDE VARIABLES FUNCTIONS #####
var_winedlloverride_update
()
{
if
[
!
-z
"
${
WINEDLLOVERRIDES
}
"
]
then
export
WINEDLLOVERRIDES
=
"
${
1
}
;
${
WINEDLLOVERRIDES
}
"
else
export
WINEDLLOVERRIDES
=
"
${
1
}
"
fi
}
var_vkd3d_config_update
()
{
if
[
!
-z
"
${
DXVK_CONFIG
}
"
]
then
export
DXVK_CONFIG
=
"
${
1
}
;
${
DXVK_CONFIG
}
"
else
export
DXVK_CONFIG
=
"
${
1
}
"
fi
}
var_vkd3d_config_update
()
{
if
[
!
-z
"
${
VKD3D_CONFIG
}
"
]
then
export
VKD3D_CONFIG
=
"
${
1
}
;
${
VKD3D_CONFIG
}
"
else
export
VKD3D_CONFIG
=
"
${
1
}
"
fi
}
var_radv_perftest_config_update
()
{
if
[
!
-z
"
${
RADV_PERFTEST
}
"
]
then
export
RADV_PERFTEST
=
"
${
1
}
;
${
RADV_PERFTEST
}
"
else
export
RADV_PERFTEST
=
"
${
1
}
"
fi
}
var_vk_istance_layers_config_update
()
{
if
[
!
-z
"
${
PW_VK_INSTANCE_LAYERS
}
"
]
then
export
PW_VK_INSTANCE_LAYERS
=
"
${
1
}
:
${
PW_VK_INSTANCE_LAYERS
}
"
else
export
PW_VK_INSTANCE_LAYERS
=
"
${
1
}
"
fi
}
##### CHECK WINDOWS FILE #####
check_win_file
()
{
if
[[
-f
"
$1
"
]]
;
then
WIN_FILE_EXEC
=
"
$(
readlink
-f
"
$1
"
)
"
if
basename
"
$WIN_FILE_EXEC
"
|
grep
-e
".exe$"
&>/dev/null
;
then
WIN_FILE_TYPE
=
exe
elif
basename
"
$WIN_FILE_EXEC
"
|
grep
-e
".msi$"
&>/dev/null
;
then
WIN_FILE_TYPE
=
msi
elif
basename
"
$WIN_FILE_EXEC
"
|
grep
-e
".bat$"
&>/dev/null
;
then
WIN_FILE_TYPE
=
bat
else
print_error
"Unknown file extension."
return
1
fi
WIN_FILE_PATH
=
"
$(
dirname
"
$WIN_FILE_EXEC
"
)
"
return
0
else
print_error
"File not found:
\n
$1
"
return
1
fi
}
##### CHECK CONFIG FILE #####
PP_CONFIG_FILE
=
"
$HOME
/.config/PortProton.conf"
if
[[
!
-f
"
$PP_CONFIG_FILE
"
]]
;
then
if
[[
-z
"
$PORTPROTON_PATH
"
]]
;
then
echo
"export PORTPROTON_PATH=
\"
$PP_DEFAULT_PATH
\"
"
>
"
$PP_CONFIG_FILE
"
else
echo
"export PORTPROTON_PATH=
\"
$PORTPROTON_PATH
\"
"
>
"
$PP_CONFIG_FILE
"
fi
fi
.
"
$PP_CONFIG_FILE
"
check_win_file
"
$1
"
print_var WIN_FILE_EXEC WIN_FILE_TYPE WIN_FILE_PATH PP_DEFAULT_PATH PORTPROTON_PATH
exit
0
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