Box86 and Wine on RPi4
-
Hello,
Recently I've been experimenting with Box86 and Wine on RetroPie. I've got to say it's a pretty cool experience being able to run some x86 based and Windows based games directly on my Raspberry Pi, launched through Emulation Station.
I've written a couple of script modules to facilitate installation. It's still a little raw, but many things work. For example, I've been able to play the old favorite, Windows Space Cadet Pinball. It would be great to release this and add this capability to RetroPie, but I believe there are some caveats that may need to be addressed first. I'll list them out to prompt some discussion. I appreciate the feedback!
Box86:
- Box86 is still very early on in its development. That being said, it's still VERY impressive. Still, I'd think that Box86 would remain in the "Experimental" group for quite some time.
- Box86 is not the typical type of emulator that you see on RetroPie. It can't be run as a standalone app, it has no menu system, and there are no "roms". In some ways, it's more like a driver than an emulator (at least in the sense of the emulators that you see in RetroPie). Should a ROM directory even be created? Should it exist in Ports, Experimental, or something else?
- Box86 requires a newer version of the Mesa OpenGL (libgl1) drivers that has not yet been updated in the RaspberryPi OS/Raspbian repositories. In fact, the RaspberryPi OS/Raspbian version of libgl1 is NVidia's Vender Neutral Dispatch (libglvnd) version and not Mesa's version. NVidia's version does use code from Mesa though, and I've seen evidence that the drivers may be updated in the future, especially now that Vulkan compatibility is coming. In the mean time I've created a separate script module that will compile the latest OpenGL from Mesa and install it in a separate location. So far I haven't seen any conflicts occur, but once the OpenGL drivers are updated, launch scripts would have to be updated, which could be a pain. It would be great to get feedback on that.
- The author is tagging releases on GitHub, but no release has yet been tagged as official. Thus there doesn't seem to be a way to automatically detect new releases. In this experimental phase, that might be ok. We don't really know if new releases will introduce unforseen issues.
- X11 is required for Box86/Wine. In my testing, I found that OpenGL on X11 ran extremely slowly. After a bit of investigation with glxinfo, I found that X11 was using a VMWare LLVM Pipe drivercalled xserver-xorg-video-fbturbo, which is CPU based and not GPU based. After removing it, things run very smoothly and I haven't experienced any issues yet. I asked about this in a different thread and it seems this should be fine.
- As a sub-point to installation, any app that you want to run on RetroPie through Box86 would require its own script. I'll go into a little more detail with Wine installation, but I think one of the top considerations will be how apps get installed if they are typically installed through APT. Installing Multi-Arch Libs seems to be overkill. For at least some apps, it seems that this is unnecessary. But without Multi-Arch, I don't think one would be able to install an app through APT as it will attempt to install all the dependencies, including all the x86 libraries, which Box86 actually proxies to corresponding ARM libraries.
Wine:
- First and foremost, it doesn't really make a ton of sense to try to compile Wine on a Raspberry Pi. It's an x86 based app and we're looking to run x86 Windows apps with it. Compiling Wine on Pi would require a qemu/chroot environment and would take a long time. Alternatively, Wine is distributed for Debian via APT, but as I mentioned before, attempting to install via APT would attempt to install all the x86 multiarch libs, which are not necessary.
- I should note that there is an ARM version of Wine, but that seems to be strictly for running Windows apps that have been compiled for ARM.
- The version of Wine that I have working is a devel version and not the latest official release. Some versions in the 5.x series don't seem to work reliably, so I've been working with the one that I've found to work the most consistently.
- What my Wine script module is doing is downloading the .deb files from WineHQ and extracting the required files to /opt/retropie/ports/wine/. Amazingly, no other dependencies are needed. It also creates Emulation Station menu items under Ports for Wine Desktop, Wine Config, and Wine File Manager. I'd love to hear if there might be a better way of performing the installation.
- Again, as Wine through Box86 opens up a ton of possibilities for new games to play, each one would need its own installation script module/launch script to be able to run directly from Emulation Station. I don't have a solution for this at this moment.
- Most Windows apps/games use some kind of GUI based installer and this is probably not scriptable. It should also be noted that as Box86 is still early in development (especially with Wine support), not all installers and apps will work out of the box. Unless an installation can be fully scripted (like just by copying files), I don't know of a way to automatically install a Windows app. The only other option I could see would be to copy all the installed files from an existing installation into a Zip file and then store the Zip file somewhere. Keep in mind that many Windows games are paid products.
- Wine uses the directory ~/.wine as the location for configuration files and the "C Drive", where programs are stored. Emulation Station typically expects two different folders for configuration and "roms". A script module usually performs a movconfigdir and mkromdir to create these directories. I'd like to hear some thoughts on what should be done in Wine's case.
So this is a lot of food for thought and discussion. I'd like to get through at least some of these points before I start messing with a pull request. I look forward to the discussion.
Thanks everyone!
- George
-
Your research is impressive !
A few moths ago I tried to install that bos86.
I could only get the steam installer running.
But I'm not really into steam.
Combined with wine, thats another story, indeed.
This brings nice possibilities.Are you going to share your script in this thread ?
-
@george very cool. i cant wait to start diving into this more once i get working on my pi4.
look forward to more info on how to go about doing it. sometimes the GitHub instructions are not the best to follow for someone who is not a master at Linux. lol
im still learning
-
Thanks!
The ultimate goal will be to have my script modules added to RetroPie, so that people will be able to use them easily on their own. This may take a while though as there are several iterations that might be needed in order to get them up to a good enough standard of quality. I'd like to see if I can get some feedback on some points above before I submit a pull request. Once a pull request has started, people can take the scripts and play around with them to test it out.
I just have to stress that Box86 is early on in its development and Wine compatibility is REALLY new. Not everything is going to work out of the box immediately. You may have to temper your expectations.
The good news is that it looks like there is interest! I appreciate the input @ExarKunIv and @Folly!
- George
-
@george Yes this is very interesting! Unfortunately I am not knowledgeable enough to help, I would only be a user. But a very happy one ;)
-
So theoretically, would this open up the possibility of playing the Taito Type X (Windows based) arcade games? The Taito Type X and X2 hardware specs seem comparable to Pi 4.
-
@dodonpachi theoretically yes. i have not messed with it yet but what i have seen on youtube. the performance is really good
-
@exarkuniv That's nuts. The prospect of playing the arcade version of Blazblue off a Pi 4 sounds insanely awesome. Definitely keeping an eye on this project.
-
A quick update. One of the drawbacks to this is that there are multiple projects that are in constant development. MESA has been updated to 20.3, Box86 has been updated to v0.16, and Wine is getting ready to release v6.0. So I'm testing out variations of configuration to make sure the latest works. The more recent versions of Wine seem to have a compatibility issue with some software, which I'm trying to track down. The last version of Wine I was able to use fully is 5.16 (v5.17-5.22 have the same issue). If I'm able to track down the issue, I'll submit a pull request. There will likely be several iterations of the scripts after that.
@dodonpachi I've never tried "Taito Type X" but I'll see if I can check it out. From what I've found, it seems to be from 2004 and I've played games similar to that time frame and they work pretty well. I'll let you know what I find out.
I should note that there are others out there who have gotten Box86 and Wine to work on Raspberry Pi OS. You can check out Novaspirit Tech and Twister OS if you're interested in experimentation.
- George
-
@george thanks for the update.
-
@george Yes, they're essentially Windows games that were played on arcade cabinets. They're a little finicky and can't be run directly without some modification; a program like TypeXtra is helpful to add the additional files needed to get it running.
EDIT: If you're willing to test games though, could you try the freeware version of Vanguard Princess?
-
Wow I just discovered this thread, and I'm so excited about this ! I own some Windows game that I really want to play on my pi4-based arcade cabinet. Like Super Meat Boy, Peggle, TrialsHD, Worms World Party, Feeding Frenzy, Mashed.
Can't wait to see this happen. I'm not good enough to help releasing it, but I could do some testing stuff. -
@george Do you have a GitHub page? I'm wrestling myself with Box86/Wine ... this would be a great addition ... Any other way to test your work?
-
Just a quick update. I'm testing the latest Wine (v6.0~rc5) and Mesa drivers (v20.3.2) and doing a bit of clean up on my install scripts. I'll be doing a pull request soon to the main RetroPie-Setup repository and will post a note here when that happens.
- George
-
@george said in Box86 and Wine on RPi4:
Just a quick update. I'm testing the latest Wine (v6.0~rc5) and Mesa drivers (v20.3.2) and doing a bit of clean up on my install scripts. I'll be doing a pull request soon to the main RetroPie-Setup repository and will post a note here when that happens.
- George
I can’t wait ... I’m very curious about the scripts and the chosen solutions.
-
I've submitted a pull request. See here:
https://github.com/RetroPie/RetroPie-Setup/pull/3285
Specifically, you'll want to look at the files committed in:
The best way to know something is going to work in Wine is to try it out on an x86 Linux box with Wine. Wine also has an App DB for users interested in learning how to play a particular game with Wine.
For Box86, there's a compatibility list that might help as well.
https://github.com/ptitSeb/box86-compatibility-list/issues
Enjoy!
- George
-
@george Great work mate. I wil start testing tonight. In the meantime I made some wine prefixes on a Raspbian OS installation (Comandos 1, Age of Empires 2, Settlers 3 etc).
Question, why wouldn't you chose to install Box86/Wine as a separate system, much like for example DosBox/PC.
Second question, does your script support wine_prefixes (bottles so to speak?). When I look in the scripts I believe it does?
I do hope you keep developing! Thx
-
Quite amazing.
You nailed it, Nice job !I tested your scripts and pinball is working.
I had a few problems installing it all, but I think it's not because of your scripts.
I had these problems :- the source of mesa wasn't downloaded at first. (perhaps a bad internet connection, I don't know) ( I updated and upgraded my system manually, then the second time it worked but it took quite some time)
- Box86 installed very fast !
- Wine installed, but got stuck in configuring for an hour. So I terminated it, and then installed pinball. ( perhaps I had too little space on my sd card) (For others, make sure you have at least 3GB of free space available)
- Pinball installed very fast. It works very good, but the sound is not optimal yet.
-
Awesome @Folly and @mth75, hope you enjoy it!
I forgot to mention that you need to make sure your system is using RetroPie 4.7.1 and is up to date before you attempt to run installation. Either from RetroPie Setup or the command line:
sudo apt update sudo apt upgrade
This is probably why it didn't run successfully the first time.
@Folly some responses:
- Mesa will take a decent amount of to compile, but should be done in under an hour. Maybe even 20 minutes.
- Box86 should compile pretty quickly. Amazing since it is so powerful and yet quite small.
- The configuration of Wine basically runs winecfg from the command line. I haven't seen it getting stuck for an hour, so if it does, I would just terminate it and run Wine Config from EmulationStation.
- I've noticed the audio issue with Pinball as well. I'm not sure how to fix it yet though. The music will not play due to a bug that has been filed with Wine (but may actually be a bug with Space Cadet). The fact that the sound effects are strange is either to do with Alsa or WaveMix in Windows. Not sure yet. Space Cadet is kind of notorious for having a sloppy code base though.
- Make sure you use Alt-F4 to quit Space Cadet. Hitting Escape will hang the app for some reason with a blank screen.
@mth75 to answer your questions:
- I chose to place Box86 and Wine as a Port instead of its own system mostly because Box86 can be used for Linux x86 games and I think it's up for discussion on how to deal with their installation. For Wine, it's not an emulator by definition, as DosBox is. Further, both Linux and Windows executables are not as neatly packaged as ROMs are for most other emulators.
- I should also note that I've just used the default Wine Prefix location (~/.wine/) and not a special location in the ROMs directory like other emulators.
- You should be able to use other Wine Prefixes with a command line option in your own scripts without a problem, though I haven't tested it out myself.
Let me know if you have any other questions! Thanks again!
- George
-
Looks like I was able to improve the sound output for Space Cadet 3D Pinball with some configuration changes. This was a good resource for information https://www.compuphase.com/wavemix.htm. I'll see how to add this to my script, but in the mean time, you can check out the configuration file:
wavemix.inf
which is in the Space Paranoids directory.You may need to change the permissions on the file as for some reason it's being set as non-writable. You can do this with the following commands:
cd "/home/pi/.wine/drive_c/Program Files/SpaceCadet3DPinball" chmod u+w wavemix.inf
Here's the configuration file I'm using. Let me know if you have any suggestions.
[general] ; if ShowDevices exists and is non-zero then will display wave out devices and other stuff ; ; ShowDevices=0 : default ; ShowDevices=1 : show output from waveOutGetDevCaps ShowDevices=0 ; if WaveOutDevice exists it should be between zero and one less num devices ; the default is WAVE_MAPPER ; ; WaveOutDevice=0 : use the first device (default) ; WaveOutDevice=1 : use the second device ; WaveOutDevice=-1: use WAVE_MAPPER (will use [Unknow Device] setttings) ; ; WaveOutDevice=0 ; Wavemix will detect if it is running on a 286 and not use any 386 instructions ; you can force it to use the 286 only code on a 386 by setting cmixit=1 ; cmixit=0 (default) ; cmixit=1 uses only 286 code (even on a 386 or >) [default] ; Remix=1 = ResetRemix() ; Remix=2 = NoResetRemix() ; default=1 Remix=2 ; GoodWavePos=0 = uses timeGetTime() (default) ; GoodWavePos=1 = uses waveOutGetPosition() GoodWavePos=1 ; WaveBlocks=# (2<=#<=6) the number of ping pong buffers to use ; default=3 WaveBlocks=6 ; WaveBlockLen=# min = 512 max = 4096 ; if a number is not specified Wavemix.dll will try to determine a size ; WaveBlockLen=688 ; SamplesPerSec=11 (11.025 Khz) (default) ; =22 (22.04 KHz) ; =44 (44.1 KHz) SamplesPerSec=44
The biggest change was changing [WinNT:default] to just [default]. For some strange reasons, it wasn't detecting the WinNT part.
Enjoy!
- George
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.