I wanted to run an old computer game in Wine, that uses a 640x480 resolution on a touchscreen. This game wants to check the CD volume label, which regular loop mounting doesn't provide. But cdemu does!
I wrote a whole script to run the program after mounting the disc and setting the correct screen resolution.
|
#!/bin/sh
|
|
# File: run-game.sh
|
|
# Location:
|
|
# ~/bin/
|
|
# Author: bgstack15
|
|
# Startdate: 2021-10-30 19:11
|
|
# Title: Script that Runs 640x480 game in Wine with CD
|
|
# Purpose: get 640x480 screen and run wine game
|
|
# History:
|
|
# Usage:
|
|
# Reference:
|
|
# https://bgstack15.ddns.net/blog/posts/2021/10/01/convert-b6i-to-iso/
|
|
# Improve:
|
|
# Dependencies:
|
|
# wine32 from dpkg --add-architecture i386 && apt-get install wine32
|
|
# ISO format image of disc
|
|
# cdemu from https://build.opensuse.org/project/show/home:bgstack15:cdemu
|
|
# hand-crafted scripts in ~/.screenlayout/ from arandr
|
|
# rotate solution https://bgstack15.ddns.net/blog/posts/2021/10/29/menu-for-choosing-screen-orientation-on-a-tablet-computer/
|
|
# /usr/local/bin/set-touchscreen-resolution.sh
|
|
|
|
# change screensize
|
|
#exec 1>&/dev/pts/3 # useful for testing
|
|
~/.screenlayout/640x480_inverted.sh
|
|
/usr/local/bin/rotate.sh inverted
|
|
APPLY=1 sh -x /usr/local/bin/set-touchscreen-resolution.sh 640 480
|
|
#sleep 2 # just in case, for wine
|
|
|
|
# mount cd
|
|
echo "Mounting cdrom..."
|
|
sudo modprobe vhba 2>/dev/null
|
|
sudo chmod 0666 /dev/vhba_ctl 2>/dev/null
|
|
ps -ef | grep -q -E '[c]demu-daemon' || { cdemu-daemon 1>/dev/null 2>&1 & sleep 2 ; }
|
|
cdemu load 0 /opt/CDROMs/game.iso
|
|
thisdev="$( cdemu status 2>/dev/null | awk '/game.iso/{print $1}' )"
|
|
thisscsi="$( cdemu device-mapping | awk -v "dev=${thisdev:-NONE}" '$1 ~ dev {print $2}' )"
|
|
mount | grep -qE '\/dev\/cdrom' && sudo umount -lv /mnt/cdrom
|
|
sudo mkdir -p /mnt/cdrom
|
|
sudo mount -v "${thisscsi}" /mnt/cdrom
|
|
|
|
# run game
|
|
echo "Running game..."
|
|
cd ~"/.wine32/drive_c/Program Files/Game/"
|
|
WINEARCH=win32 WINEPREFIX=~/.wine32 wine game.exe
|
|
|
|
# restore resolution
|
|
echo "Restoring resolution"
|
|
~/.screenlayout/normal.sh
|
|
/usr/local/bin/rotate.sh normal
|
|
APPLY=1 /usr/local/bin/set-touchscreen-resolution.sh 1366 768
|
Screen resolution scripts
I used arandr
to make precanned selections for 640x480 and the default resolution of 1366x768.
Menu entry file
Dependencies
- Manually generated arandr scripts in ~/.screenlayout
- cdemu
- wine32
- My rotate screen solution
- Adjust touchscreen input for fullscreen aspect ratio
Comments