Skip to content

Commit

Permalink
Add pseudo CD-ROM for fix old games CD-ROM check (Road Rash and others)
Browse files Browse the repository at this point in the history
  • Loading branch information
VHSgunzo committed Feb 21, 2024
1 parent 32064aa commit ec8a51e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.78.2.8

* Add pseudo CD-ROM for fix old games CD-ROM check (`Road Rash` and others)

# v0.78.2.7

* Add app and EXE names to all DB scripts
Expand Down
34 changes: 32 additions & 2 deletions lux-wine
Original file line number Diff line number Diff line change
Expand Up @@ -5089,8 +5089,32 @@ is_winepfx() {
|| -f "$1/user.reg" && -f "$1/.update-timestamp" ]]
}

try_add_reg_cdrom() {
local PFXSYSREG="$WINEPREFIX/system.reg"
if [ -f "$PFXSYSREG" ]
then
if [ "$1" ]
then
local drive="${1,,}:"
if ! grep -qo "\"$drive\"=\"cdrom\"" "$PFXSYSREG" 2>/dev/null
then
if grep -Fqo '[Software\\Wine\\Drives]' "$PFXSYSREG" 2>/dev/null
then
sed -i "/\[Software\\\\\\\\Wine\\\\\\\\Drives\]/{n;a\
\"$drive\"=\"cdrom\"
}" "$PFXSYSREG"
else
echo -e "\n[Software\\\\\\Wine\\\\\\Drives]\n\"$drive\"=\"cdrom\"" >> "$PFXSYSREG"
fi
fi
else print_error 'Specify the cdrom drive!'
fi
else print_error 'system.reg not found in prefix!'
fi
}

check_winepfx() {
is_wine_drive() { ls -l "$WINEPREFIX/dosdevices"/[a-z]: 2>/dev/null|grep -w "${1}$"|grep -o '[a-z]:' &>/dev/null ; }
is_wine_drive() { ls -l "$WINEPREFIX/dosdevices"/[a-z]: 2>/dev/null|grep -w "${1}$"|grep -qo '[a-z]:' ; }
[ -n "$1" ] && export WINEPREFIX="$1"
[ -n "$2" ] && export WINEARCH="$2"
WPFX_STEAMUSER_DIR="$WINEPREFIX/drive_c/users/steamuser"
Expand Down Expand Up @@ -5131,7 +5155,12 @@ check_winepfx() {
drive_h="$WINEPREFIX/dosdevices/h:"
is_wine_drive "$HOME"||(rm -f "$drive_h" && \
ln -sf "$HOME" "$drive_h")
(DRIVES=(a b d e f g i j k l m n o p q r s t u v w x y)
export PFX_CDROM="$WINEPREFIX/cdrom"
cdrom_r="$WINEPREFIX/dosdevices/r:"
try_mkdir "$PFX_CDROM"
is_wine_drive '../cdrom'||(rm -f "$cdrom_r" && \
ln -sfr "$PFX_CDROM" "$cdrom_r")
(DRIVES=(a b d e f g i j k l m n o p q s t u v w x y)
DEF_MP_DIRS=('/media' "/media/$USER" '/mnt' '/run/media' "/run/media/$USER")
IFS=$'\n' MP_DIRS=($(find "${DEF_MP_DIRS[@]}" -maxdepth 1 -type d 2>/dev/null|sort -u))
try_rm_broken_link "$WINEPREFIX/dosdevices" &>/dev/null
Expand Down Expand Up @@ -5173,6 +5202,7 @@ check_winepfx() {
fi
done
is_winepfx "$WINEPREFIX"||winepfx_init
try_add_reg_cdrom r
DEF_WDESK_DIR=("Desktop" "Documents" "Music" "Videos" "Pictures" "Downloads" "Templates")
(IFS=$'\n' ; for WINEDESK_DIR in "${DEF_WDESK_DIR[@]}"
do
Expand Down

0 comments on commit ec8a51e

Please sign in to comment.