Run Game In Separate X Server?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
JeZ-l-Lee
Level 4
Level 4
Posts: 122
Joined: Mon Jun 29, 2009 7:12 pm

Run Game In Separate X Server?

Post by JeZ-l-Lee »

Run Game In Separate X Server?

Hi,

I posted before about STEAM games
not working too well with current Wine.

I've done some more research
and I think I found a good solution
but do not know how to implement it.

I'm on Ubuntu 10.10 64bit Linux
using current Wine 1.3.13 32bit
with an nVidia graphic card(GTS 450)
and current proprietary display drivers installed.

How would I run a STEAM game in a separate X Server?
I think doing this would solve my problems.

Any help would be appreciated.
Thanks!

Jesse
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Run Game In Separate X Server?

Post by vitamin »

JeZ-l-Lee wrote:Run Game In Separate X Server?
Start X for a separate display then run games there. The simplest way to do both at the same time is:

Code: Select all

xinit /usr/bin/wine game.exe -- :1
drunk_sob
Newbie
Newbie
Posts: 1
Joined: Sun Jun 05, 2011 11:23 pm

Re: Run Game In Separate X Server?

Post by drunk_sob »

vitamin wrote:
JeZ-l-Lee wrote:Run Game In Separate X Server?
Start X for a separate display then run games there. The simplest way to do both at the same time is:

Code: Select all

xinit /usr/bin/wine game.exe -- :1
thats great ty...but where do u put the code in the terminal? geting sick of all linux forums being so rtfm I WOULD GLADLY READ THE MANUAL IF SOME 1 COULD POINT ME TO IT.in the mean time ill just sick this code where the sun dont shine :x
jjmckenzie
Moderator
Moderator
Posts: 1153
Joined: Wed Apr 27, 2011 11:01 pm

Run Game In Separate X Server?

Post by jjmckenzie »

On 6/5/11 9:27 PM, drunk_sob wrote:
vitamin wrote:
JeZ-l-Lee wrote:
Run Game In Separate X Server?
Start X for a separate display then run games there. The simplest way to do both at the same time is:

Code:
xinit /usr/bin/wine game.exe -- :1

thats great ty...but where do u put the code in the terminal? geting sick of all linux forums being so rtfm I WOULD GLADLY READ THE MANUAL IF SOME 1 COULD POINT ME TO IT.in the mean time ill just sick this code where the sun dont shine :x
Linux does come with a whole bunch of manuals. If you are told "Go read
the manuals" that is because you really should. Forum support is mostly
volunteer and folks do have other things to do. Take time to read
through what you are being told. Also, learn to use the copy + paste
function. That is what you are being told. Not everything can nor
should be done through a GUI.

James McKenzie
figure002
Newbie
Newbie
Posts: 4
Joined: Thu Jul 21, 2011 2:48 pm

Post by figure002 »

The solution provided does not work for me. I use a patched wine-1.3.18 (WinePulse).

I try to run Call of Duty 4 in a separate xserver. Running games in a separate xserver works great for native Linux games, but I can't get it to work for a game that needs to start with Wine.

For example, if I run:

Code: Select all

xinit /usr/bin/env WINEPREFIX="/home/serrano/.wine" /usr/bin/wine "/home/serrano/.wine/drive_c/Program Files/Activision/Call of Duty 4 - Modern Warfare/iw3sp.exe" -- :1
or

Code: Select all

xinit /usr/bin/wine "/home/serrano/.wine/drive_c/Program Files/Activision/Call of Duty 4 - Modern Warfare/iw3sp.exe" -- :1
The screen switches to a new xserver, and in that xserver I'm presented with a graphical error message:
WIN_IMPROPER_QUIT_BODY
[Yes] [No] [Cancel]
If I answer Yes or No, it gives me the following error,
Error during initialization:
Couldn't load fileSysCheck.cnf. Make sure Call of Duty is run from the correct folder.
[OK]
Anyone know how to fix this?
Cloudef
Level 4
Level 4
Posts: 138
Joined: Wed Mar 18, 2009 3:10 pm

Post by Cloudef »

I assume you use nvidia, it opens it in :2
change :2 to something else if you want it somewhere else,
or heck make it even a command line option

Code: Select all

#!/bin/sh
# cd to dir && run in wine in another X Display

if [ ! "$1" ]; then
	echo "Usage : xwine [gameDir] [exe]"
	exit
fi
if [ ! "$2" ]; then
	echo "Usage : xwine [gameDir] [exe]"
	exit
fi

X :2 -ac -terminate & nvidia-settings --load-config-only
sleep 10
DISPLAY=:2
cd "$1"
wine "$2" $3
1. create new file, name it xwine
2. copy that to that file
3. chmod +x
4. sudo mv xwine /usr/bin/
5. xwine "/path/to/game/dir" "executable"

Not tested, but should work.
figure002
Newbie
Newbie
Posts: 4
Joined: Thu Jul 21, 2011 2:48 pm

Post by figure002 »

Cloudef,

Thanks, it works! I use NVIDIA indeed. It seems the key lies in moving to the game directory first (weird, I'm pretty sure I already tested this). The following works as well,

Code: Select all

cd ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/
xinit /usr/bin/wine iw3sp.exe -- :1
I'm wondering what the options -ac and -terminate mean. I can't find them in the man page for X.

There's still on problem though. When the game runs in the separate X server, I don't hear any sound. I do hear the sound when I switch back to the desktop (Ctrl+Alt+F7) while the game is running, so sound is working. This might have something to do with the patched Wine version I use which uses PulseAudio. Is there a way to get sound working in the separate X server as well?
Cloudef
Level 4
Level 4
Posts: 138
Joined: Wed Mar 18, 2009 3:10 pm

Post by Cloudef »

-terminate switch terminates the X Display when there are no applications running anymore. I don't remember what -ac does anymore but it's in man page.

About the sound issue. You are probably using distro that has sound configured wrongly, or it's pulse audio issue. I'm using Arch Linux and Alsa, and stuff works fine.

eg. In old linux mint I once had, you have to be root to play any sound when switching to TTY terminal, which is bad.
figure002
Newbie
Newbie
Posts: 4
Joined: Thu Jul 21, 2011 2:48 pm

Post by figure002 »

I don't think it's a distro (Ubuntu) problem because I don't have this sound problem with non-wine stuff. I can launch any native Linux game and even XBMC in a separate xserver and switch xservers or terminal (logged in as regular user) without losing the sound. Good chance this is a WinePulse problem. In that case I should wait until the new audio system for Wine is finished - hopefully that's not a long wait - I really miss the sniping...
figure002
Newbie
Newbie
Posts: 4
Joined: Thu Jul 21, 2011 2:48 pm

Post by figure002 »

I found the solution to the PulseAudio + separate xserver sound issue! Google is again my best friend. I found the solution here.

One needs to execute wine with 'ck-launch-session' which was already installed on my Ubuntu machine (I have no idea what it's for; there's no man page and I don't know what package it's from). So the command for running a WinePulse game in a separate xserver:

Code: Select all

cd ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/
xinit /usr/bin/ck-launch-session /usr/bin/wine iw3sp.exe -- :1
Sound should work fine now, even when switching xservers. :D
Cloudef
Level 4
Level 4
Posts: 138
Joined: Wed Mar 18, 2009 3:10 pm

Post by Cloudef »

ck-launch-session is part of consolekit, (and maybe policykit) Maybe it's used to grant permissions for sound or something. But most likely sounds that ubuntu is configured that way.
Locked