Page 1 of 17 12311 ... LastLast
Results 1 to 10 of 164

Thread: Stuff I've learned about Wine

  1. #1
    Join Date
    Oct 2005
    Location
    U.S.A.
    Beans
    4,164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Stuff I've learned about Wine

    The currently updated version of this document is now part of the Ubuntu Gamers Arena and can be found here.

    I will continue to monitor this thread for suggestions, but rather than maintain two copies of the info, I'll only be updating the UGA version (unless someone convinces me otherwise).



    I've been spending a good chunk of the past few weeks working with the latest Wine and Windows games. I've had some pretty good success so far. Along the way, I picked up a few things that might not be so obvious to a new Wine user, but all Wine users should definitely be aware of. These pointers aren't in any particular order, but I did categorize them a bit. If this is useful to anyone, let me know. I'll try to keep the post updated with any new info as I encounter it.

    General stuff
    • Wine is not an emulator - In fact, the name "WINE" used to be an acronym: "Wine Is Not an Emulator". An emulator is a software program that creates a virtual environment for software to run in. That environment includes virtual representations of the hardware specifically required by the software and the operating system used to run it. That is not what Wine does. Wine is an alternate implementation of the Windows API. It is a compatibility layer that allows Linux to understand Windows executables and allows the Windows executable to understand Linux.
    • Use the latest Wine version... - but be aware that the latest version sometimes includes bugs that were not part of previous working versions. Ubuntu Feisty includes Wine 0.9.33 in the repositories, while the current Wine version is 0.9.40 (as of this writing). Wine 0.9.33 is pretty stable, but later versions of Wine include significant DirectX improvements. I have several games that won't work with 0.9.33, but work great with 0.9.40. However, somewhere between 0.9.37 and 0.9.40, sound in KotOR 2 broke on my system. That is the perfect example of the risk involved in using the latest version.
    • Don't compile Wine from source - Unless you absolutely have to or you are doing it for the challenge. Every time a new version is released, an Ubuntu .deb of that version is also released on Wine's own Ubuntu repository. See WineHQ's announcement page for download details. WineHQ also has a download page for previous versions of Wine, in case you need to downgrade your Wine version.
    • Use the terminal - If installed correctly, Wine does associate itself with the .exe file type, so in most cases you can double click on an executable to run it. This, however, is not the recommended way to use Wine. It is better to use Wine from the terminal so that the application paths can be set appropriately (see "Always cd to the game's install path" the the "Regular use stuff" below) otherwise applications will often complain that they can't find needed files. Additionally, running the application from the terminal allows any error messages from Wine to be output to the terminal, which is very useful for troubleshooting purposes.
    • Be prepared to work for it - Wine is not perfect. Heck, it's not even complete. Not everything will work correctly at first and you may need to spend some time figuring it out on your own. But you're a Linux user now, you should already be prepared to do that on occasion.


    Stuff in "winecfg"
    • Run "winecfg" - You have to run "winecfg" at least once to set up the base Wine directories and devices. Wine won't really work until you do that.
    • Emulate Virtual Desktop - using this option makes installations run so much smoother. I found instances where attempting to run an installation without this option checked caused some dialog boxes, such as CD key entry or disk swap confirmation, to not come to the front when activated. This led me to believe that the install had become "stuck" and I would end up killing the process. This can also help when troubleshooting a problem game as it won't lock up your desktop or alter your screen resolution to an unusable state when the game fails.
    • Use the Applications Settings - The Application Settings dialog on the winecfg Applications tab allows you to create some custom configurations for particular executables. At the moment, those configurations are limited to the OS version, some graphics settings and library settings (i.e. DLL overrides). Using the Application Settings allows you to do things like "override this DLL, but only when using blah.exe". This is very useful when a game requires a particular native DLL, but that DLL override is not required by or is bad for other games. I use this for every DLL override I do, just in case an override is potentially bad for Wine. Rather than screw up Wine as a whole, I just screw up that executable's profile. I can just delete that profile without hurting Wine.
    • Windows version - Try different Windows versions for different applications. Just because a game was made for Windows XP doesn't mean that Wine's Windows 98 support won't work better for the game. I once had an old Windows 3.1/Windows 95 game run best if I set the Windows version to Windows NT 4.0. When you find a Windows version that works, make sure you add an application entry in winecfg for the executable.
    • Use the ALSA driver - Some games do require OSS to work, but unless absolutely required, always use ALSA. The OSS driver is no longer being developed and Wine's Alsa support is currently under very active development. Each new release of Wine includes significant sound improvements for ALSA.
    • Don't allow the window manager to control the windows - Letting the Window manager control the windows will sometimes cause problems with running games in full screen, among other problems. I have found it best to leave it disabled.
      NOTE - Current Wine versions (0.9.39+) have corrected the full screen problems for most games and have introduced a new bug that prevents the keyboard from getting focus in the game when the window manager is not controlling the windows. This can be worked around by running the game in its own X session (see example in the "Regular use stuff" section).
    • Be careful with library overrides - winecfg gives you the ability to override Wine's built-in DLL files with Windows native DLL files. There are some DLLs that should never be overridden: kernel32.dll, gdi32.dll, user32.dll, and ntdll.dll. If you override those DLLs, Wine will not work at all. Some other DLLs, especially the DirectX DLLs, will not work with games, but they don't prevent Wine itself from working. Just be careful if you override a DLL and make sure you never over-write a Wine DLL, just in case you need to go back to it.


    Special configuration stuff
    • Create a symbolic link to CD drive - Wine creates a symbolic link to the mount directory for your CD drive, but it sometimes helps to also create a symbolic link to the actual /dev entry. I found that if I didn't do this, Wine would create its own symbolic device link and would use it for the E: drive, while my mount directory was linked to the D: drive. I believe this caused issues with some CD-based installs, since two different drives in Wine were now showing identical content. Change the /dev entry on the below code to match your system:
      Code:
      $ ln -s /dev/hdc ~/.wine/dosdevices/d\:\:
    • PERFORMANCE TWEAK Useful Registry Keys - Some features and/or configurations aren't accessible through winecfg, but they can be accessed through Wine's registry. The Wine Wiki maintains a list of those keys and updates it with every new Wine update. Two keys I have found very useful are the Alsa Driver "UseDirectHW" option, which can correct some sound stuttering problems; and the Direct3D "VideoMemorySize" key, which allows you to enter your video card's correct memory amount. Without this key, Wine will automatically report a video memory size of 64MB. Check through the other keys to see what you can use.
    • WINEPREFIXCREATE - When you first run "winecfg", it runs WINEPREFIXCREATE to create a default .wine directory, but you can use it to create a separate directory for running custom Wine configurations. I have found this useful for running games that require OSS for sound when I prefer to use ALSA. Having a separate directory for those games allows me to run them without having to run "winecfg" first to change my sound settings.
      Code:
      wineprefixcreate --prefix .ossgames
      When running games that are in this directory, I need to modify the launch parameters with the "env WINEPREFIX=" option:
      Code:
      env WINEPREFIX="/home/cogadh/.ossgames" wine "C:\Program Files\Game\Game.exe"
      This environment option needs to be applied when running anything, including "winecfg", on the custom directory.
    • Install the Wine Gecko IE engine - Some programs require Internet Explorer to be installed in order to run. However, installing Internet Explorer can severely break Wine. Instead, you should install the Wine Gecko IE engine. To install the Geko engine, do this:
      1. Run the following in the terminal:
        Code:
        wine iexplore http://www.winehq.org
      2. Answer yes to the install prompt
      3. Go to the Useful Registry Keys page and scroll down to the HKEY_LOCAL_MACHINE section.
      4. Add all of the Internet Explorer keys by using regedit.

        ALTERNATE INSTRUCTIONS
        Occasionally, the Gecko engine may fail to download or install properly. If this happens, do the following:
        1. Open a terminal and manually download/extract the Gecko package by running the following:
          NOTE - You will need to install the cabextract package from the repositories to do this
          Code:
          wget http://downloads.sourceforge.net/wine/wine_gecko-0.1.0.cab && cabextract wine_gecko-0.1.0.cab
        2. Next, run the following to create the directories needed for Gecko:
          Code:
          mkdir -p ~/.wine/drive_c/windows/gecko/0.1.0/
        3. Place the extracted Gecko files into the newly created directory:
          Code:
          mv wine_gecko ~/.wine/drive_c/windows/gecko/0.1.0/
        4. Run regedit in the terminal. Go to HKEY_Current_User/Software/Wine/MSHTML and create a new key labelled "0.1.0"
        5. In the new "0.1.0" key, create a new string value labelled "GeckoPath" and set the string value to "c:\windows\gecko\0.1.0\wine_gecko"
        6. Go to the Useful Registry Keys page and scroll down to the HKEY_LOCAL_MACHINE section. Add all of the Internet Explorer keys/strings to the registry.


        Gecko should now be installed properly. To test the Gecko installation, run the following in the terminal:
        Code:
        wine iexplore http://www.winehq.org


    Install stuff
    • Use Windows ini files for info - Every install CD has an autorun.ini files and will sometimes have a setup.ini file. Checking these files out can help you troubleshoot an installation problem. Sometimes the setup.ini will give you info on what executables are being launched during the install. Knowing this can help you determine where a problem is actually occurring. For example, when trying to install a Windows 95 game, the install kept nearly completing, but would crash before I got the chance to finish. I checked the setup.ini file and found that the setup finished by calling the DirectX install executable and that executable was actually causing the problem. I created a modified setup.ini and removed the DirectX setup entry and the install completed normally (the game ended up not running though).
    • Never run an install from the CD directory - Don't change directories to the CD drive in order to launch a setup executable. Doing so can sometimes prevent your CD drive from properly ejecting when you need to swap install CDs. Instead launch the install by running this from your home directory:
      Code:
      wine /media/cdrom0/setup.exe
    • "wine eject" is your friend - If an install needs you to switch CDs and the OS complains that you can't eject the CD, then open a new terminal window and run:
      Code:
      wine eject d:
      This will usually eject the current CD and allow the new CD to be automatically mounted. Sometimes the auto mount doesn't work, but the mount can still be performed manually.
    • Don't install DirectX - Wine has its own DirectX libraries, installing Microsoft's DX will screw up those libraries and Wine in general. Just don't do it.
    • Install the InstallShield bugfix - There is a bugfix for InstallShield that can correct some CD install problems. Use it, it will help you.
    • Always use the uninstaller - Use the terminal command "uninstaller" to launch the Wine uninstaller tool when you want to uninstall games. Don't try using the uninstall shortcuts that a game will sometimes place in the menu during the install. Those shortcuts often don't work right, but the Wine uninstaller tool usually will work.
    • .MSI files can be installed - Usually Windows applications use an .exe file to install the application. However, occasionally there are applications that use a Windows Installer File with an .msi extension instead (the current version of Steam, for example). There are two ways you can run this type of file in Wine:
      Code:
      wine msiexec /i install.msi
      OR
      Code:
      wine start install.msi


    Regular use stuff
    • Use the Wine documentation - By that I don't mean "RTFM". Wine has pretty good Wiki now. It is a very dry and boring read, but it does have plenty of useful info.
    • Use Wine's Application Database (AppDB) - Thousands of people are testing Wine on a daily basis and many of us add our experiences to the Wine Application Database in the hopes that it will benefit other users and assist with the further development of Wine. Often AppDB entries will include installation and configuration solutions that other users have come up with. Other times, it may help you identify which games are not worth trying (yet).
    • Always cd to the game's install path - If you have ever looked at the shortcut properties in Windows, you've probably noticed there are two path fields. One path is the path to actual executable. The other is a path labeled "Run in...". Most Windows executables want to "Run in" the directory they were installed in, changing directories to the executable's install path accomplishes that.
    • PERFORMANCE TWEAK Turn off WINEDEBUG - When run normally, Wine is constantly producing debug messages (all those "fixme" things). Most of that info is not really needed if you already have a functional game. So to free up those resources, launch the game using the "WINEDEBUG=-all" option. No messages will be generated at all. If you are troubleshooting a game, use the "WINEDEBUG=fixme-all" to remove only the "fixme" messages, which are just developer messages and mean nothing to the normal user.
    • Get used to cracks - Without completely functional copy protection support, sometimes the only way to get a game to work in Wine is to use a cracked executable. Either get over any apprehension you may have about using cracks, or dual boot Windows and use it for the games that won't work without a crack. Someday we will hopefully have functional copy protection support in Wine and cracks will no longer be an issue.
    • NEVER run Wine as root or with sudo - Wine is still beta software. Allowing it unrestricted access to the system through the use of a root account or the sudo command can and will cause problems. Just don't do it.
    • Other Wine commands - Wine has a few commands other than "wine", "winecfg", "wineprefixcreate" and "uninstaller". These commands can prove very useful:
      1. wineboot - Simulates a Windows reboot, useful for when an install requires a reboot before it can be used.
      2. wine control - Launches the Control Panel. If you install any Windows applications that make use of a Control Panel shortcut, then this is how you access it
      3. wineserver - wineserver is automatically launched by the wine command, but it can also be run from a terminal with different switches to different effect:
        • -d# - Sets the debug level in the terminal output. You might find a use for that, I never have
        • -h - Display the wineserver help file
        • -k - Kill the current wineserver. Useful if an application has locked up and you need to break out of it.
        • -p - Makes the wineserver persistent, meaning it will continue to run even after the application has closed. Useful if you intend to run several consecutive wine apps, as it can decrease wine load time
        • -w - Makes wineserver wait until the currently active wineserver exits. Again, you might find a use for that, I never have.
    • PERFORMANCE TWEAK Wine doesn't always like to play nice - If you are experiencing slow or choppy performance in a game, it can sometimes be fixed by giving the process a higher scheduling priority. This is done by using the "renice" command after launching a Wine game. The "renice" command allows you to change the priority of a currently running process, i.e. how "nice" a process is to other users on the system (higher priority = less nice, lower priority = more nice). The command has a range of -20 (highest priority) to 19 (lowest priority) and the default priority is 0. In order to use renice, you will need to open a separate terminal and run a command like this, after you have already launched your game/application:
      Code:
      sudo renice -10 -n game.exe
      I don't recommend jumping right to using -20 to run Wine games, start with -10 and if it doesn't improve performance enough, try working up in small increments. You will likely find that most games don't require more than -10 to get the best performance. Also, it goes without saying (I think), that you must be able to ALT-TAB out of the game to run the renice command.

      ALTERNATE INSTRUCTIONS
      For those of you that prefer the GUI method, you can do this instead to renice an app:
      1. Launch the game from a terminal, then ALT-TAB to get back to the desktop
      2. Launch System Monitor (System > Administration > System Monitor) and switch to the Processes tab
      3. Right-click on the running executable and select "Change Priority..."
      4. Move the slider to your desired prority and click "Change Priority"
      5. Enter your user password when prompted
      6. Close System Monitor and ALT-TAB back into the game


    Third party stuff
    • Wine-Doors - Wine-Doors is a graphical application that assists with the installation of many Windows applications, including games. It is currently in alpha development, but does have an initial release available for download. The application itself does look very promising.
      NOTE - Since Wine-Doors is alpha software, it should go without saying, use at your own risk.
    • Cedega - Cedega is technically a fork of Wine, with a specific focus on gaming. Cedega does include a GUI for running installations and launching games, plus it includes some support for copy protection software (you might not need to use a crack with Cedega). Cedega is not free, however. It has a $5 US monthly fee with a three month minimum. A small discount is offered for purchasing a full year in advance.
      NOTE - Cedega was originally called WineX and branched off of the Wine tree when Wine was still under the old MIT license and not the LGPL. Because of this, Cedega does not contribute back to the Wine source tree, as it would if it was covered by the LGPL. It also does not benefit from future updates to Wine. This combined with less than spectacular support leads many people away from Cedega as a Linux gaming solution.
    • CrossOver - Technically, CrossOver is not a third party product, as it is the primary financial backer for Wine. CrossOver originally started as a means of running Microsoft Office applications in Linux, but has recently begun adding support for games. CrossOver is based on older, more stable versions of Wine, but as Wine improves and updates, so does CrossOver. It costs $39.95 US to purchase the standard edition.
    • ReactOS - Also a Wine backer like CrossOver, ReactOS is an attempt to create a fully Windows compatible operating system based on much of the work already done in Wine. The ReactOS system, when complete, will be able to use the same drivers and applications that Windows uses, completely natively. The project is currently in alpha stages of development, but there are install CDs, live CDs, QEMU and VMware virtual machine images available for download.
      NOTE - Again, since ReactOS is alpha software, it goes without saying, use at your own risk


    Advanced stuff
    • PERFORMANCE TWEAK Use launch scripts - Wine games will often perform their best when they are launched in a separate X server. Wine doesn't require a window manager (Gnome or KDE) to run properly, so if you launch a game in a separate X server, you can get a significant performance boost. You can get an even bigger boost by stopping the GDM/KDM before you launch the game (only to be done from the console).
      1. First you need to create the script. From the terminal, do the following:
        Code:
        nano launcher.sh
      2. Copy the text below and paste it into the terminal with either the middle mouse button or by clicking on Edit->Paste. Take out the nVidia settings portion if you don't have an nVidia card and modify the application paths to match your game.
        Code:
        #!/bin/sh
        #uncomment if launching from console session
        #sudo /etc/init.d/gdm stop
        #KDE use this instead
        #sudo /etc/init.d/kdm stop
        
        # Launches a new X session on display 3. If you don't have an Nvidia card
        # take out the "& nvidia-settings --load-config-only" part
        X :3 -ac & nvidia-settings --load-config-only
        
        # Goto game dir (modify as needed)
        cd "$HOME/.wine/drive_c/Program Files/Game/Directory/"
        
        # Forces the system to have a break for 2 seconds, X doesn't launch instantly 
        sleep 2
        
        # Launches game (modify as needed)
        DISPLAY=:3 WINEDEBUG=-all wine "C:/Program Files/Game/Directory/game.exe"
      3. Save the file in your home directory by pressing CTRL-O, hit enter then CTRL-X to exit.
      4. Next, make your script executable with this command:
        Code:
        chmod +x ~/launcher.sh
      5. Launch the game by doing this from a terminal:
        Code:
        sh launcher.sh
        OR
        Code:
        ./ launcher.sh
      6. When you are done playing, do a CTRL-ALT-BACKSPACE to get back to the desktop.


      ALTERNATE INSTRUCTIONS
      If your game doesn't work, or if you want to try and squeeze some additional performance out of the game, follows these additional steps to try running it without your default X session still running:
      1. Uncomment the "sudo /etc/init.d/gdm stop" line (remove the "#") in the script and save it. If you use KDE, uncomment the "sudo /etc/init.d/kdm stop" and save the script.
      2. Close all open applications and switch to the console by pressing CTRL-ALT-F1.
      3. Log into the console and run the script:
        Code:
        sh launcher.sh
        OR
        Code:
        ./ launcher.sh
        You will be prompted for your password and your game will launch in its own X session, without the Gnome or KDE window manager getting in the way.
      4. If the script complains that you don't have permission to start the X session do this:
        Code:
        nano launcher.sh
        Then modify the X server launch line of the script to read:
        Code:
        sudo X :3 -ac & nvidia-settings --load-config-only
        NOTE - You can avoid having to modify the script by editing the Xwrapper.config file to allow normal users X access. Open the /etc/X11/Xwrapper.config file in a text editor using sudo, then change the "allowed_users=console" entry to "allowed_users=anybody".
      5. Once you are finished playing, either reboot or do a CTRL-ALT-BACKSPACE to get back to the console and restart your X server and desktop by doing this:
        Code:
        sudo /etc/init.d/gdm start
        If you use KDE, do this instead:
        Code:
        sudo /etc/init.d/kdm start
        The desktop should come right back up immediately, if it doesn't just type "startx".

      NOTES
      1. If you launch a game in it's own X session, make sure that Wine's virtual desktop has been disabled.
      2. Running a game in its own X server will often correct the problem with a non-functional keyboard in Wine games.
      3. There are additional command line switches that could be applied when launching the new X session see the Xserver manual and Xorg manual for details.
    Last edited by cogadh; December 22nd, 2007 at 05:39 PM. Reason: Corrected major error in the "nice" stuff

    Linux User #355330 | Ubuntu User #15618 | Last.FM

  2. #2
    Join Date
    Nov 2004
    Beans
    102

    Re: Stuff I've learned about Wine

    thanks for this - some very useful info

    cheers

    doc

  3. #3
    Join Date
    Aug 2006
    Location
    tuesday
    Beans
    6,502
    Distro
    Kubuntu Development Release

    Re: Stuff I've learned about Wine

    Stickied. ^_^

    Attention folks, keep replies on topic or they will be hidden.
    I don't want to have to lock cogadh's thread as this makes it a pain to update.

    Example (This post has no place here):

    Quote Originally Posted by *******
    all that has never work for me...
    Last edited by hikaricore; July 10th, 2007 at 04:24 PM.

  4. #4
    Join Date
    Apr 2005
    Location
    Brisbane, Qld. Australia
    Beans
    202
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Stuff I've learned about Wine

    Quote Originally Posted by hikaricore View Post
    Stickied. ^_^
    ^ Legendary move.
    "I'm just sittin' here watchin' the wheels go 'round and 'round"
    John Lennon

  5. #5
    Join Date
    May 2007
    Location
    New London, CT
    Beans
    12
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Stuff I've learned about Wine

    hey, this is great. this is much more helpful than the wine wiki, IMO.

    could you add some tips on what to do if your game runs too slow?
    i'm running Starcraft, in case you're wondering, and have seen all kinds of tips from "wine starcraft.exe -gl" to "wine nice -n 20 starcraft.exe" or editing the registry to use opengl instead of direct 3d or using winecfg to emulate hardware acceleration for audio and using winecfg to run it in a virtual desktop. i haven't got a clue what these things do, so i'll just try them all to find out which one works for me. some explanation of the options would be really helpful.
    Thanks!

  6. #6
    Join Date
    Oct 2005
    Location
    U.S.A.
    Beans
    4,164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Stuff I've learned about Wine

    Those kinds of tweaks are specific to Starcraft only and would not be useful for other games. They are beyond the intended scope of this doc. I wanted this to be a general Wine usage doc, which is why I put the "Use Wine's Application Database (AppDB)" statement in it. The info on AppDB covers most of the game-specific stuff you would need.

    However, I am not opposed to adding a game-specific section, if there is a demand for it. My only concern is that I would just be duplicating information that is already presented in a better fashion somewhere else. Perhaps adding links to good Wine How-Tos instead? Of course, AI has already done that with his "Looking for a game howto?" sticky post.

    As for performance tweaks, I did post a few mixed in there, such as turning off debug channels, running in a seperate X server, the useful registry keys. I have flagged those now and as I encounter more, I will add them. If you have any suggestions that aren't game-specific, I'd be happy to add them.

    Linux User #355330 | Ubuntu User #15618 | Last.FM

  7. #7
    Join Date
    Aug 2006
    Location
    tuesday
    Beans
    6,502
    Distro
    Kubuntu Development Release

    Re: Stuff I've learned about Wine

    If you havn't already (didn't have a chance to recheck) you may want to add a note about the info you discovered here for launching new X sessions without root to the part about launcher scripts. ^_^

  8. #8
    Join Date
    Oct 2005
    Location
    U.S.A.
    Beans
    4,164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Stuff I've learned about Wine

    Good call, just added it to the NOTES under the script section.

    Linux User #355330 | Ubuntu User #15618 | Last.FM

  9. #9
    Join Date
    Feb 2007
    Location
    In my chair
    Beans
    1,485

    Re: Stuff I've learned about Wine

    I have to use wineprefixcreate to make Ventrilo work properly for me.
    Last edited by Cappy; July 30th, 2007 at 06:26 PM. Reason: I recommended sidenet but wineprefixcreate works too
    Currently favorite songs:
    Miss Hyde, This Song Is About Monsters, Masagin, I Will Try to Blow it Out, La Resistance
    Visit www.cherrypeel.com for more free indie music =)

  10. #10
    Join Date
    Feb 2006
    Beans
    74

    Re: Stuff I've learned about Wine

    I'd love to get some of those launch scripts working, but I can never remember the command to make a script executable. Any chance you could add a couple extra steps along the lines of:
    -This KotOR launch script is saved as wine.kotor (or whatever)
    -[command that makes wine.kotor (or whatever) executable]

    I'm sure that I'm not the only one who'd appriciate it!

    Great work , cogadh

Page 1 of 17 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •