Dolphin under Wine

Wine is a free (open source) way of running Windows programs under other operating systems like Mac OSX or Linux. With a few simple changes the Dolphin development environment can be run under Wine but, perhaps more importantly, so can the applications created with it. This article shows you how.

There are videos to go along with this post in the Video Library.

If you have a Mac you’re probably aware of emulators such as Parallels and VMWare that let you take your favourite Windows applications and run them as if they are part of the Mac OSX desktop. The effect is really quite seamless but does have a number of disadvantages:

  • Cost. In order to take the emulator route one needs not only a copy of the emulator software itself but also a full copy of Windows. This is not so bad if you have a number of Windows applications that you want to run on the Mac but if you are a Dolphin developer, for example, and you want Mac users to be able to run your software you can’t really assume that they will have this setup.

  • Time and Space. Although applications that run under Parallels and VMware will run at almost the full speed of the underlying computer they do take rather a long time to launch because one needs to boot an entire Windows system in order to be able to start a single program. Similarly, such solutions are memory hungry because of the need to support a full Windows OS running in parallel with the host operating system.

The Wine alternative creates a “fake” Windows API that lets your EXEs think they are running on top of a real copy of Windows when in fact they are just running on the host operating system. If you’re not familiar with the Wine project, you can read about it at WineHQ.

A problem, of course, is that “real” Windows is huge and, not only that, but it’s a moving target with new APIs being added seemingly every second. For this reason it’s unrealistic to expect Wine to be able to run all Windows applications perfectly. Indeed, several people have tried to run Dolphin under Wine in the past and come across various problems. However, recently, I thought I’d take a another look at what might be necessary to get a Dolphin installation up and running under Wine and I found it’s not all that hard.

Why now you ask? Well, it’s for two reasons. The first is that we’re putting together the 6.2 release of Dolphin and, if any changes are needed to get it working reasonably under Wine they can easily be included in the distribution at this stage. Secondly, I came across a version of Wine that I found to be rather exciting. It’s called WineSkin and is specifically targetted at Mac OSX.

You see, with the normal Wine distributions you still have to rely on your end users having it installed on their computers. This, coupled with the fact that new versions of Wine are released every few weeks, means that it is difficult to know whether a particular Windows application will be compatible with the version of Wine that your users have installed. With WineSkin, your application – in this case Dolphin Smalltalk or any executable created with it – can be wrapped with a particular target version of the Wine API and will appear on the desktop as a single standard Mac app. This means that a Dolphin application could be packaged and distributed as a Mac app and could be guaranteed to work on the end-users computer. To me this is quite enticing!

Before we go any further, if you haven’t seen the Dolphin Under Wine First Look video I posted last week, you might want to take a look at it now. This shows a beta version of Dolphin Professional 6.2 that has been installed as an application in the Mac OSX Applications folder and is being run from an icon in the Dock. Notice that it runs at pretty near full speed and that (within certain limitations) could be made to appear quite like a native Mac application. This should give you an idea of what WineSkin is all about. For those of you who don’t have Macs but are still interested in Dolphin running under Linux a lot of what follows should still be relevant although, I’m afraid, will not have been tested since I don’t have a Linux installation to hand.

So if you have a Mac and want to “go native” with Dolphin Smalltalk, just follow these steps:

Download and Install Wineskin Winery

First head over to WineSkin and download their Winery app. This is allows you to choose the version of Wine that you want to wrap with Dolphin. That’s the other great thing about WineSkin; you don’t need to manage Wine installations at all since it is all packaged for you. Run up the Winery and the first thing you need to do is to install a new Engine.

I chose the latest version at the time of writing, WS7Wine1.3.28. This uses the WineSkin 7 engine with Wine version 1.3.28.

Create a Dolphin Wrapper using the WineSkin Winery

Click the button to Create a New Blank Wrapper and the Winery will create a new app icon with the name you choose. I chose “Dolphin CE” for this test. You may get a message box about running the Wine Gecko Installer (which I believe is the Wine web browser component) but I just chose to ignore and cancel this to save space in my Dolphin application.

When complete you should be given the option of viewing the application package icon. This is stored in a folder called WineSkin within your User Applications folder (~Applications). Navigate to this and choose to show the package contents by right clicking and selecting the appropriate command:

This is important. In future you can come to this package view to add files manually into your application “disk drive” by opening the drive_c link. You can also set options for the WineSkin wrapper itself by double-clicking the Wineskin icon. The first time through, though, you should launch the Wineskin icon since this will give you the option of installing Dolphin using its standard installer.
Click Install Windows Software and then select the Dolphin Setup executable for your version of Dolphin. In this case I’m going to choose the standard setup file, DolphinSetupX6.exe. Just accept all of the defaults in the installer. The software will be installed in a Program Files directory within the psuedo C drive in your app package.

You will be given the choice of what EXE to launch for this App. Please make sure you choose the Dolphin.exe file that is in the Program Files sub-folder and NOT the one under Common Files. At this stage you don’t want to launch the Dolphin IDE right away since, although the unlock box will show, it won’t get much further after unlocking the image because there are a number of issues in the Dolphin image that need patching first.

Install Dolphin under Windows and patch an Image

In order to get you going, I have been through and debugged a number of glaring problems that occur when trying to run a standard Dolphin image under Wine. Most of these have been fairly trivial to debug and fix and the end result is a patch ST file that needs to be filed into an image before it will run.

On a genuine Windows machine, Download the patch file

You’ll notice that I’ve labelled each separate fix with a WFn number and I’ve placed a #wineFix symbol reference in each modified method to make them easy to find in a patched image. I’ve also added all fixed methods to a “wine fix” category. Simply browse for all references to #wineFix to see all the changed methods. I’m intending that this file should be maintained by the Dolphin community so, if you make changes to it, please follow the conventions already present in the file.

You’ll also see that in WF13 I have spent some time patching up the Dolphin Registry Editor sample application. This is not just for cosmetic reasons but because the Dolphin version can be quite useful for messing around with the registry under Wine when the standard REGEDIT.EXE is not present.

Follow these steps to prepare your image:

  1. Start a Fresh Install Dolphin image under Windows. Make sure it’s the same type as the one you want to use in your Mac app. In my case, I’m using Dolphin Community Edition.
  2. Once the image is up and running you need to make sure you have the Internal Bitmaps and Icons package installed. This was discussed (and a download link given) in a previous blog post. Certainly Dolphin 6.0x and 6.1x images will need this package to be installed but Dolphin 6.2 and later will come with this pre-loaded as standard.
  3. If you have not yet closed the image after Fresh Install, save it and do so now. Then relaunch. If you don’t do this you may find that the patching process may hang.
  4. Use File/File In to load in the file to patch the image. You will be prompted to perform a Panic, which will force all the IDE windows to be closed and a new System Folder opened.
  5. Save the image as “Dolphin.img” and copy this along with “Dolphin.sml” and “Dolphin.chg” to your Mac

Copy the Patched Image to your App

Now find the drive_c folder link inside your Dolphin App package and open it. Navigate to the C:\Program Files\Object Arts\Dolphin Smalltalk 6.x folder and copy the three files “Dolphin.img”, “Dolphin.sml” and “Dolphin.chg” into this folder. You may remember that if one opens Dolphin with no specific image file then it defaults to using a Dolphin.img, if present. Here we’ll rely on this behaviour to launch our newly patch image.

Set Options and Go

If you start Wineskin from the package folder you can now choose any options that you want. For the moment the default options should mostly be sufficient but just for a bit of fun you can set the application icon to the standard Dolphin image. To do this you’ll need a Dolphin.icns file that I’ve already pre-converted from the Windows format and made available here.

You can perform a trial run by clicking the Test Run (Debug Mode) button and, hopefully, you should get the Dolphin System Folder up and running pretty much as shown at the top of this article. You can also drag a link to your App package into the Dock and you are set to launch Dolphin as a “Native” Mac application.

More Stuff

I’ve gone through the entire process above in some videos that I’ve placing in the OA video library. There, I’ve also included some extra details on how to tailor your WineSkin app in various ways. In particular, there are some details on a crashing problem that can occur when you choose to decorate the window frames in the Mac style (see WineSkin Screen Options). There’s also some information about other bugs and “gotchas” that are currently present in the Dolphin Under Wine patched image.

At this juncture I have to point out that Dolphin Under Wine is not an officially supported Object Arts product. However, Wine itself is Open Source and the patch file is being made freely available in the hope that the Dolphin community will step up to the plate and fix the various bugs as they are discovered in future. We are more than happy to host revisions to the WineFix file so please discuss any changes you make on the Dolphin newsgroup and e-mail them through to me at the usual address.