Read this first
I am a fan of "less is more" and this is why I like RetroPie. No X-Window like for example on LXDE.
This is one of the reasons why I wanted to port my Box86 installation to RetroPie: less X-Window (although you will still need xserver and xinit), more performance.
Is it possible?
What is to be expected?
- You will only be able to change resolution or stretch to full screen thanks to the command tvservice. Example:
tvservice -e "DMT 35"
sleep 1fbset -g 1280 1024 1280 1024 32fbset -depth 8fbset -depth 32WINEPREFIX=... startx /your/game/binary --with-settingstvservice -e "DMT 58"sleep 1fbset -g 1680 1050 1680 1050 32fbset -depth 8fbset -depth 32
You will have to set hdmi_group=2 in /boot/config.txt and reboot to get tvservice to work.
- Otherwise you can run the game in 1 pixel = 1 pixel and use xdotool to center screen.
- The background will not be repainted, it means you have to make sure everything is black behind your game.
- Stretch while keeping aspect ratio is not easy, you will have to use an hybrid of stretching and xdotool
- GPU performance will be a problem since legacy driver does not support OpenGL well.
Setting up
sudo apt-get update
sudo apt-get install git cmake make
For X-Window
sudo apt-get install xserver-xorg xserver-xorg-video-fbturbo xinit xterm xdotool matchbox-window-manager
Explanation: you need
- xserver-xorg for server,
- xserver-xorg-video-fbturbo for using legacy driver with xserver,
- xinit to start sessions,
- xterm to run scripts inside sessions,
- xdotool to move windows,
- and matchbox-window-manager for window stability when running scripts.
Check your X-Window installation with xterm:
startx xterm
You should see a small white terminal in the top left of the screen. Inside it, exit:
exit
You will need to be more comfortable using xterm because you are going to be using it for testing at some point. This might seem secondary but if you spend a little time in xterm, you will most probably notice that the ugly small white screen does not fit your needs
cd ~
nano .Xdefaults
Let's make a big screen with the biggest possible font:
xterm*VT100*geometry:176x54 xdotool
# xterm*VT100*geometry:151x52 tvservice
xterm*VT100*foreground: lightblue
xterm*VT100*background: black
xterm*VT100*font: -misc-fixed-medium-r-normal-*-22-*-*-*-*-*-*-*
Try your screen to see if you are happy with it then exit:
startx xterm
exit
Now time to get your Wine binaries and Box86. I personally got them from another installation (in that case you don't need to unbzip2), you can use 3.20 from playonlinux.
The goal: Wine working category on RetroPie |
Wine:
wget https://www.playonlinux.com/wine/binaries/linux-x86/PlayOnLinux-wine-3.20-linux-x86.pol
sudo apt-get install bzip2
tar -jxf PlayOnLinux-wine-3.20-linux-x86.pol --strip-components=1
Box86:
cd ~
git clone https://github.com/ptitSeb/box86
cd box86;mkdir build;cd build; cmake .. -DRPI3=1;make;sudo make install
sudo systemctl restart systemd-binfmt
Kernel 3G/1G:
If you want to win time, you can always copy a wineprefix to retropie, otherwise
WINEPREFIX=/your/new/wineprefix/ startx /path/to/wine/x86/bin/wine winecfg
- Set virtual desktop to yes, its resolution to 1280x1024, desktop background color to black in "Desktop integration" and save and exit winecfg (so you avoid an ugly background)
- Performance-wise, you will lose direct OpenGL support. Setting ddr=gdi with winetricks will only partly answer the issue since gdi will bring screen repainting issues.
WINEPREFIX=/your/new/wineprefix WINE=/path/to/wine/x86/bin/wine winetricks ddr=gdi
WINEPREFIX=/your/new/wineprefix/ startx /path/to/wine/x86/bin/wine /path/to/some/windows/game.exe
The xdotool route
You will use xdotool and you will fork your xterm process. The strategy here is to make a script that:
- Launches the game and at the same time detaches a second terminal
- In the second terminal wait that the window is started (sleep 15 for example) and moves that window to center.
- That terminal quits itself afterwards
- Make sure that once you quit the game (the main script), you kill all the xinit windows, otherwise you will be in no man's land and can reboot your Pi.
xterm -hold -e `cd /home/pi/RetroPie/roms/wine/installed/HOMM4_eng;WINEPREFIX=/home/pi/winex86 /home/pi/wine-pol/bin/wine ./heroes4.exe;killall xinit;exit` &
sleep 15
xdotool search --onlyvisible --name heroes windowmove 320 14
matchbox-window-manager
exit
Text in red is your rom's path. Text in blue must be changed according to the binary name and Wine settings, text in purple depend on game resolution:
- 320 28 for 1280x1024
- 448 156 for 1024x768
- 560 240 for 800x600
- 640 300 for 640x480
- 800 440 for 320x200 (but most of these games should actually be playable and played in Dosbox)
- For exotic resolutions (640x350, 320x240...), just use the closest one. They won't be exactly centered in height but it should not prevent you from playing.
Save it with extension .sh, choose a directory where all your .sh will be (since the change directory command is in the script; your roms will be sorted that way)
First, start this script in console with:
startx somescript.sh
A started Heroes of Might and Magic IV binary on Retropie/startx automatically centered after 15 seconds with xdotool |
The tvservice route
- Do not forget to set hdmi_group = 2 in config.txt and reboot.
tvservice -m DMT
- will list you the availlable modes. you should take a screenshot/photo of that list or write it down.
- The example script is below. fbset will align your settings to tvservice so you will not have a black screen. it is mandatory. Old games will need a 16 bits depth but newer ports like VCMI will need a 32 bits depth to work.
tvservice -e "DMT 35"
sleep 1fbset -g 1280 1024 1280 1024 32fbset -depth 8fbset -depth 32WINEPREFIX=... startx /your/game/binary --with-settingstvservice -e "DMT 58"sleep 1fbset -g 1680 1050 1680 1050 32fbset -depth 8fbset -depth 32
Xrandr route [UPDATE October 14, 2021]
xrandr -s 1280x1024WINEPREFIX=... startx /your/game/binary --with-settingsxrandr -s 1920x1080
Emulationstation entry
Then you can start making a new emulator by editing /etc/emulationstation/es_systems.cfg
After the last </system> in the file, type in:
<system>
<name>Wine Box86</name>
<fullname>Wine Box86</fullname>
<path>/home/pi/RetroPie/roms/wine</path>
<extension>.sh</extension>
<command>startx %ROM%</command>
<platform>pc</platform>
<theme>wine</theme>
</system>
<system>
<name>Wine Box86</name>
<fullname>Wine Box86</fullname>
<path>/home/pi/RetroPie/roms/wine</path>
<extension>.sh</extension>
<command>bash %ROM%</command>
<platform>pc</platform>
<theme>wine</theme>
</system>
hello i'm following this guide but i have some problems. i installed winearm for diablo 2 with pikiss and it works. winearm is located in etc / alterntive and usr / bin and wineprefix in home / pi / .wine I created a folder in home / pi / wine86 with winei386 if I type wine in this folder it starts winearm and not wini386.
ReplyDeleteI created the sh script for xdotool by modifying it with my parameters. if I type startx xterm from the command line it works fine but if I launch the sh file I get this error. xinit: unexpect signal 15. I ran the script from an lxterminal window. File sh is in home/pi.
The script doesn't work well in RetroPie. When the 15 seconds are up, the game exits. xdotool doesn't seem to work.
DeleteWhat can be done?
Best regards:
sorry for the previous message. now i can run both winearm and winei386. my problem now is winetricks is connected to winearm and not awinei386. how can i connect winetricks to winei386?
ReplyDeleteHello,
DeleteGood to know you finally succeeded.
People often report trouble when trying to make winearm and winex86 run together on a RetroPie as a system starting point.
To answer your winetricks question, see "Winetricks" section nearly at the end of my other post:
https://thepigamer.blogspot.com/2021/01/performance-topic-running-x86-games-on.html
Make sure to disable box86 banner while running Winetricks on your winex86.
Have fun
The pi gamer
I think this script also has problems.
ReplyDeletexterm -hold -e `cd / home / pi / RetroPie / roms / wine / installed / HOMM4_eng; WINEPREFIX = / home / pi / winex86 / home / pi / wine-pol / bin / wine ./heroes4.exe;killall xinit ; exit` &
sleep 15
xdotool search --onlyvisible --name heroes windowmove 320 14
matchbox-window-manager
exit
if I start I get:
line 1 $ '\ r' command not found sleep invalid time interval 15 \ r
line 4 matchbox-window-manager \ r command not found
line 5 exit \ r command not found
matchbox-window- manager is installed
to start the script on the console maybe the command is xinit and not startx?
For some reasons it seems that spaces were strangely added to your copy/paste. Did you have these spaces in your script in the first time?
DeleteEG: cd / home / pi / RetroPie / --> cd /home/pi/RetroPie/
exit should not be a "command not found", exit is builtin.
no... spaces are not in my script.
Deletethis is my script:
xterm -hold -e `cd
/home/pi/RetroPie/roms/wine/model1; WINEPREFIX=/home/pi/wine86/wine2 /home/pi/wine86/bin/wine ./Modeler.exe;killall xinit;exit` &
sleep 15
xdotool search --onlyvisible --name segamodel1 windowmove 560 240
matchbox-window-manager
exit
Send me a PM. I'll try to troubleshoot that with you on Google chat.
DeleteAt first view it shouldn't be a script errors, you would have a syntax error or something like that.
After it works for you, I'll delete the history of comments and change the guide if necessary.
TPG