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
d327053f
Commit
d327053f
authored
Oct 20, 2024
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hardcore commit))
parent
8695c884
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
25 deletions
+40
-25
functions_helper
data_from_portwine/scripts/functions_helper
+31
-24
start.sh
data_from_portwine/scripts/start.sh
+9
-1
No files found.
data_from_portwine/scripts/functions_helper
View file @
d327053f
...
...
@@ -786,7 +786,7 @@ debug_timer () {
# Поиск нужного .desktop файла по $portwine_exe
search_desktop_file
()
{
local
count desktop_file desktop_file_new EXEC_DESKTOP EXEC_DESKTOP_NEW TIME_TOTAL i j
local
count desktop_file desktop_file_new EXEC_DESKTOP
TIME_CURRENT_PROXY
EXEC_DESKTOP_NEW TIME_TOTAL i j
unset
TIME_CURRENT_ARRAY DESKTOP_FILES_ARRAY
count
=
0
for
desktop_file
in
"
$PORT_WINE_PATH
"
/
*
;
do
...
...
@@ -800,12 +800,36 @@ search_desktop_file () {
else
EXEC_DESKTOP
=
${
line
//Exec=env \
"
$PORT_SCRIPTS_PATH
\/
start.sh
\"
/}
fi
EXEC_DESKTOP_NEW=
${
EXEC_DESKTOP
//\
"/}
fi
if [[
$line
=~ ^#Time= ]] && [[
$portwine_exe
== "
$EXEC_DESKTOP_NEW
" ]] ; then
TIME_CURRENT=
${
line
//#Time=/
}
fi
[[
$line
=~ ^#Time= ]] && TIME_CURRENT_PROXY=
${
line
//#Time=/
}
done < "
$desktop_file
"
# Для конвертации существующих .desktop файлов flatpak в натив и наоборот
if [[
$EXEC_DESKTOP
=~ ^"
Exec
=flatpak run ru.linux_gaming.PortProton
" ]] ; then
sed -i "
s
|Exec=flatpak run ru.linux_gaming.PortProton|Exec=env \
"
$PORT_SCRIPTS_PATH
/start.sh
\"
|"
"
$desktop_file
"
elif [[
$EXEC_DESKTOP
=~ ^
"Exec=env
\"
$PORT_SCRIPTS_PATH
/start.sh
\"
"
]] ; then
sed -i
"s|Exec=env
\"
$PORT_SCRIPTS_PATH
/start.sh
\"
|Exec=flatpak run ru.linux_gaming.PortProton|"
"
$desktop_file
"
fi
EXEC_DESKTOP_NEW=
${
EXEC_DESKTOP
//\
"/}
if [[ -n
$TIME_CURRENT_PROXY
]] && [[
$portwine_exe
== "
$EXEC_DESKTOP_NEW
" ]] ; then
TIME_CURRENT=
$TIME_CURRENT_PROXY
TIME_CURRENT_ARRAY+=(
$TIME_CURRENT
)
# Если существует несколько .desktop файлов на один и тот же .exe файл,
# то среди них время берётся из того .desktop файла, в котором проведено дольше времени
# и данное время будет потом записываться во все .desktop файлы у которых общий .exe файл
if [[ -n
${
TIME_CURRENT_ARRAY
[1]
}
]] ; then
for i in "
${
!TIME_CURRENT_ARRAY[@]
}
" ; do
for j in "
${
!TIME_CURRENT_ARRAY[@]
}
" ; do
if ((
${
TIME_CURRENT_ARRAY
[
$i
]
}
>
${
TIME_CURRENT_ARRAY
[
$j
]
}
)) ; then
tmp=
${
TIME_CURRENT_ARRAY
[
$i
]
}
TIME_CURRENT_ARRAY[i]=
${
TIME_CURRENT_ARRAY
[
$j
]
}
TIME_CURRENT_ARRAY[j]=
$tmp
fi
done
done
fi
TIME_CURRENT="
${
TIME_CURRENT_ARRAY
[0]
}
"
fi
unset TIME_CURRENT_PROXY
if [[
$portwine_exe
== "
$EXEC_DESKTOP_NEW
" ]] ; then
# Когда новый .desktop файл
if [[
$TIME_CURRENT
== "" ]] ; then
...
...
@@ -814,12 +838,10 @@ search_desktop_file () {
# Для битых #Time=
else
if [[ !
$TIME_CURRENT
=~ [0-9]+ ]]
\
|| ((
$
TIME_CURRENT
>= 999999999 )) ; then
|| (( TIME_CURRENT >= 999999999 )) ; then
TIME_CURRENT="
0
"
fi
fi
TIME_CURRENT_ARRAY+=(
$TIME_CURRENT
)
unset TIME_CURRENT
DESKTOP_FILES_ARRAY["
$count
"]="
$desktop_file
"
(( count++ ))
fi
...
...
@@ -827,23 +849,8 @@ search_desktop_file () {
fi
done
IFS="
$orig_IFS
"
export TIME_CURRENT
# Если существуют .desktop файлы на один и тот же .exe файл, то среди них выбирается
# текущее время берётся из того .desktop файла, в котором проведено больше времени
# и запись этого большего времени будет потом записываться во все .desktop файлы
# у которых общий .exe файл, это нужно для того, чтобы в главном меню .desktop файлы
# упорядочивались нормально.
for i in "
${
!TIME_CURRENT_ARRAY[@]
}
" ; do
for j in "
${
!TIME_CURRENT_ARRAY[@]
}
" ; do
if ((
${
TIME_CURRENT_ARRAY
[
$i
]
}
>
${
TIME_CURRENT_ARRAY
[
$j
]
}
)) ; then
tmp=
${
TIME_CURRENT_ARRAY
[
$i
]
}
TIME_CURRENT_ARRAY[i]=
${
TIME_CURRENT_ARRAY
[
$j
]
}
TIME_CURRENT_ARRAY[j]=
$tmp
fi
done
done
TIME_CURRENT="
${
TIME_CURRENT_ARRAY
[0]
}
"
if [[ -n
$PW_TIME_IN_GAME
]] ; then
TIME_TOTAL=
$((
TIME_CURRENT
+
PW_TIME_IN_GAME
))
for df in "
${
DESKTOP_FILES_ARRAY
[@]
}
" ; do
...
...
data_from_portwine/scripts/start.sh
View file @
d327053f
...
...
@@ -643,6 +643,14 @@ else
else
PW_AMOUNT_OLD_DESKTOP+=(
$AMOUNT_GENERATE_BUTTONS
)
fi
# Для конвертация .desktop файлов flatpak в натив и наоборот
if [[
${
PW_NAME_D_ICON
[
"
$AMOUNT_GENERATE_BUTTONS
"
]
}
=~ ^"
Exec
=flatpak run ru.linux_gaming.PortProton
" ]] ; then
PW_NAME_D_ICON["
$AMOUNT_GENERATE_BUTTONS
"]=
${
PW_NAME_D_ICON
[
"
$AMOUNT_GENERATE_BUTTONS
"
]//Exec=flatpak run ru.linux_gaming.PortProton /
}
search_desktop_file
elif [[
${
PW_NAME_D_ICON
[
"
$AMOUNT_GENERATE_BUTTONS
"
]
}
=~ ^"
Exec
=env \
"
$PORT_SCRIPTS_PATH
/start.sh
\"
"
]] ; then
PW_NAME_D_ICON[
"
$AMOUNT_GENERATE_BUTTONS
"
]=
${
PW_NAME_D_ICON
[
"
$AMOUNT_GENERATE_BUTTONS
"
]//Exec=env \
"
$PORT_SCRIPTS_PATH
\/
start.sh
\"
/}
search_desktop_file
fi
# Для фикса битых #Time=
if [[ !
${
PW_GAME_TIME
[
"
$AMOUNT_GENERATE_BUTTONS
"
]
}
=~ [0-9]+ ]]
\
|| ((
${
PW_GAME_TIME
[
"
$AMOUNT_GENERATE_BUTTONS
"
]
}
>= 999999999 )) ; then
...
...
@@ -658,7 +666,7 @@ else
# Переопределение элементов в массивах в зависимости от PW_GAME_TIME, от большего значения к меньшему.
# 10 миллисекунд на 40 .desktop файлов, работает быстро
if [[
$SORT_WITH_TIME
== enabled ]] ; then
if [[
$SORT_WITH_TIME
== enabled ]]
&& [[ -n
${
PW_GAME_TIME
[1]
}
]]
; then
for i in "
${
!PW_GAME_TIME[@]
}
" ; do
for j in "
${
!PW_GAME_TIME[@]
}
" ; do
if ((
${
PW_GAME_TIME
[
$i
]
}
>
${
PW_GAME_TIME
[
$j
]
}
))
\
...
...
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