Winex/Linux

I realize Brad already got tied into one dead o/s but it would be great if Galciv ran on Linux through winex/wine. This may be as simple as writing an installer for Linux that puts all the files in the right place and creates the proper fake registry entries.

Why not just reboot? Because it would be far better to have galciv (a longterm game) running on some other desktop on the machine that can be dipped in to from time to time vs. sitting down to play days on end.
7,131 views 14 replies
Reply #1 Top
Wouldn't that be a problem, seeing as how GalCiv won't run with less than DirectX 8.1?


~SDC~
Reply #2 Top
Why not give it a try fusibou.
Let us know how you do.
I am sure others would be interested and willing to offer advice/help getting it set up under WINE.

~SDC~
Reply #3 Top
Laurina: winex was created to allow directx gaming. There are people running Ghost Recon and Civilization III on it.

Initial tests show winex crapping out with intallshield errors but plenty of other programs that others have got working do the same.
Reply #5 Top
I'd be delighted if GC would run under Winex in Linux!

After all, I am currently phasing out my Windows (no, let's not start a discussion on OS merits ;) ), because most games actually do run under it (have a look at the Transgaming company: http://www.transgaming.com).
Fast, too.

So far, nobody got GC to run under Winex. But if it actually worked...well, I'd never have to boot back into Windows 98SE. Joy! LOL
Reply #6 Top
I played a full game under Wine successfully last night. It requires a small fix to user32.dll.so. Get the newest Wine sources from CVS (I'd guess that the same fix also works for Transgaming's WineX) and edit dlls/user/painting.c. Insert this line in the beginning of both BeginPaint() and EndPaint() functions:

if (!lps) return 0;

This is only a quick bandaid-type fix. As another poster in comp.sys.ibm.pc.games.strategic pointed out, the correct solution would be to figure out what Windows does with a null lpstruct pointer and emulate that behaviour - if GalCiv really gives a null pointer and it's not caused by a bug in Wine, that is. Unfortunately my Wine-fu isn't strong enough for that. This patch also works for Corporate Machine, by the way.

Because I run Wine with a fake Windows installation and only copied the GalCiv directory over from the Win98SE machine, I had to import some registry keys for dart.dll and dartsock.dll. I also used the native version of quartz.dll.

Hope this helps.


~SDC~
Reply #7 Top
Topi: can't get it to work. In fact, not even notepad.exe works anymore. Notepad now results in the following in the terminal window:

**************8
FindWndPtr window 10021 belongs to other process
fixme:ttydrv:TTYDRV_DC_PatBlt (0x40395944, 0, 0, 2, 8, 15728673): stub
fixme:ttydrv:TTYDRV_DC_BitBlt (0x403931b4, 2, 0, 2, 8, 0x40395944, 0, 0, 6684742): stub
fixme:ttydrv:TTYDRV_DC_PatBlt (0x403952ac, 2, 2, 16, 1, 15728673): stub
fixme:ttydrv:TTYDRV_DC_PatBlt (0x403952ac, 2, 2, 1, 16, 15728673): stub
fixme:ttydrv:TTYDRV_DC_PatBlt (0x403952ac, 2, 2, 16,
1, 15728673): stub
fixme:ttydrv:TTYDRV_DC_PatBlt (0x403952ac, 2, 2, 1, 16, 15728673): stub
fixme:ttydrv:TTYDRV_DC_PatBlt (0x403931b4, -4, -97, 0, 0, 15728673): stub
fixme:ttydrv:TTYDRV_DC_BitBlt (0x403931b4, 2, 0, 2, 8, 0x40395be4, 0, 0, 6684742): stub
fixme:ttydrv:TTYDRV_DC_BitBlt (0x403931b4, 2, 0, 2, 8, 0x40395be4, 0, 0, 6684742): stub
fixme:ttydrv:TTYDRV_DC_BitBlt (0x403931b4, 2, 0, 2, 8, 0x40395be4, 0, 0, 6684742): stub
fixme:ttydrv:TTYDRV_DC_BitBlt (0x403931b4, 2, 0, 2, 8, 0x40395be4, 0, 0, 6684742): stub
******************************8

Here is what I did (I wanted to make a HOWTO):

****************************************
HOW-TO GET GALCIV RUNNING IN LINUX
(Using a Windows install)

WINDOWS 9x
Install Galciv on a Windows 9x machine

Use regedit and find the registry keys for dart.dll and dartsock.dll [[note: couldn't find dart.dll and found tons of dartsock.dlls, so not know what to do here]
Export each of these to files

LINUX
Get latest winex from CVS

execute: cvs -d:pserver:[email protected]:/cvsroot/winex login
Hit Enter when prompted for a password
execute: cvs -z3 -d:pserver:[email protected]:/cvsroot/winex co wine

Edit the wine/dlls/user/painting.c file in a text editor

Find the below section:

/***********************************************************************
* BeginPaint (USER32.@)
*/
HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
{
INT dcx_flags;
BOOL bIcon;
HRGN hrgnUpdate;
RECT clipRect, clientRect;
HWND full_handle;
WND *wndPtr;

Add the following line right below:

if (!lps) return 0;


Then find the below section:

/***********************************************************************
* EndPaint (USER32.@)
*/
BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
{


Add the following line right below:

if (!lps) return 0;

Save the painting.c file

cd to your ~/wine directory
execute: ./tools/wineinstall
to setup wine, execute: wine and choose fake windows install

cd ~/.transgaming
cd c_drive
mkdir windows
[[[copy regedit.exe from a win9x machine to your .transgaming/c_drive/windows directory
copy the exported registry keys from your Windows machine to your .transgaming/c_drive/windows directory]]]
[[[note I couldn't find a dart.dll in my win9x and there were tons of dartsock.dll's so i didn't do this step]]]
mkdir windows/fonts
mkdir windows/system
mkdir windows/system32
copy quartz.dll from a Win9x machine to your .transgaming/c_drive/windows/system32 directory
mkdir "Program Files"
mkdir "My Documents"
mkdir "Program Files"/galciv
change to your "Program Files"/galciv directory on your linux machine
copy your galciv directory from your windows machine into your new linux galciv directory
(note: in windows, galciv is probably located at: /Program Files/Strategy First/Galactic Civilizations)
eg. cp /mnt/win_c/"Program Files"/"Strategy First"/"Galactic Civilizations"/* . -r

edit your .wine/config to ensure quartz.dll is in there and marked "native" vs builtin
Find this header: [DllOverrides]
Add this right under: "quartz" = "native"
save and exit

change to your linux galciv directory

execute: wine galciv.exe

********
Reply #8 Top
Your instructions look pretty good. The notepad thing is strange - does it work if you recompile the user32 dll without those lines?

I used -debugmsg +ole to check which registry keys and dlls were needed. You should see something like this:

trace:ole:CoGetClassObject CLSID:{e436ebb3-524f-11ce-9f53-0020af0ba770},

Search for those keys in the registry, check which dll they belong to and copy both the keys and the dll.

You could also try the Wine CVS instead of WineX, just to be sure.
Reply #9 Top
Ok! Thanks Topi. Everyone who wants to run Galciv in Linux using Winex, see my HOW-TO below.

Topi, do you know how to (a) make galciv run at 1280x1024 instead of at a lower resolution? (b) make my cursor show up instead of a black box?

HOW-TO GET GALCIV RUNNING IN LINUX
(Using a Windows9x install)
by fusibou and Topi Paavola

WINDOWS 9x
Install Galciv on a Windows 9x machine


LINUX
Get latest winex from CVS

execute: cvs -d:pserver:[email protected]:/cvsroot/winex login
Hit Enter when prompted for a password
execute: cvs -z3 -d:pserver:[email protected]:/cvsroot/winex co wine

Edit the wine/dlls/user/painting.c file in a text editor

Find the below section:

/***********************************************************************
* BeginPaint (USER32.@)
*/
HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
{
INT dcx_flags;
BOOL bIcon;
HRGN hrgnUpdate;
RECT clipRect, clientRect;
HWND full_handle;
WND *wndPtr;

Add the following line right below:

if (!lps) return 0;


Then find the below section:

/***********************************************************************
* EndPaint (USER32.@)
*/
BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
{


Add the following line right below:

if (!lps) return 0;

Save the painting.c file

cd to your ~/wine directory
become superuser [this is so the wineinstall script can properly MAKE INSTALL and make the registry program]
execute: ./tools/wineinstall
to setup wine, execute: wine and choose fake windows install [you may need to ensure no partitions that ae mounted have windows on them] ensure that install with root compiles the registry program properly

then become regular user
mkdir ~/.transgaming
mkdir ~/.transgaming/c_drive
mkdir ~/.transgaming/c_drive/windows
mkdir ~/.transgaming/c_drive/windows/system
mkdir ~/.transgaming/c_drive/windows/system32
mkdir ~/.transgaming/c_drive/windows/fonts
mkdir ~/.transgaming/c_drive/windows/"Program Files"
mkdir ~/.transgaming/c_drive/windows/"My Documents"
execute: ~/wine/./tools/wineinstall
ensure it creates the registry entries ok

mkdir ~/.transgaming/c_drive/windows/"Program Files"/galciv
change to that directory
copy your galciv directory from your windows machine into your new linux galciv directory
(note: in windows, galciv is probably located at: /Program Files/Strategy First/Galactic Civilizations)
eg. after moving to your linux directory, you'd do something like: cp /mnt/win_c/"Program Files"/"Strategy First"/"Galactic Civilizations"/* . -r

FINDING THE REQUIRED DLLs!
There are three DLL's that Galciv needs. On my machine they were dartweb.dll, dartsock.dll, and quartz.dll. All three in a Windows 9x machine are in the Windows/system directory and should be copied to your ~/.transgaming/c_drive/windows/system directory.

You also need to grab the registry entries galciv made when installing on your windows computer for the above three DLL's. The CLSID and IID numbers I found are as follows:

for dartweb.dll:
CLSID: {c8b8bac2-9451-11d2-ba66-0040053687fe},
IID: {b196b28f-bab4-101a-b69c-00aa00341d07}

for dartsock.dll:
CLSID: {e9d55102-9683-11d2-ba68-0040053687fe},
IID: {00000001-0000-0000-c000-000000000046}

for quartz.dll:
CLSID: {e436ebb3-524f-11ce-9f53-0020af0ba770},
IID: {00000001-0000-0000-c000-000000000046}

On the Windows9x machine you installed galciv on, use regedit to search for all instances of the above numbers. For each key you find, export that key using the export function on the File menu to a separate .reg file.

Then boot into linux and copy all the .reg files to your ~/.transgaming/c_drive/windows/system directory.

Then run wine regedit .reg for each .reg file and click through the Windows dialogues that pop up to install the registry entries.

edit the ~/.wine/config file
Find this header:
[DllOverrides]
Add this right under:
"dartweb.dll" = "native"
"dartsock.dll" = "native"
"quartz.dll" = "native"
save and exit


FINISHED!
change to your ~/.transgaming/c_drive/windows/"Program Files"/galciv directory

execute: wine galciv.exe

enjoy!


TROUBLESHOOTING
If you followed the above and it doesn't work, you want to ensure you have the right CLSID numbers. You will need to go through a detection process three (3) times.

STEPS
A. In your linux galciv directory, execute: wine -debug +ole galciv.exe
B. In a long list of stuff test, you should see something like this:

trace:ole:CoGetClassObject
CLSID:{e436ebb3-524f-11ce-9f53-0020af0ba770},
IID: {blah blah blah numbers}

C. Copy and paste that output into a file and print it on your printer
D. Boot windows and go into regedit. Search for all instances of the number in the CLSID then the IID. At each instance, export the whole key to a .reg file from the File menu in regedit. For the CLSID if you click through the tabs, you will see a reference to a DLL file (ie dartweb.dll, dartsock.dll or quartz.dll)
E. Boot into Linux and go into your ~/.transgaming/c_drive/windows/system directory.
F. copy the .reg files and the DLL you identified to this system directory
copy regedit.exe from a win9x machine to your .transgaming/c_drive/windows/system
G. run wine regedit.exe on each of the .reg files
H. ensure your ~/.wine/config file has the DLL names under [DllOverrides] set to native as described above
I. Go through the Steps again until you have all the DLLs required as per the wine CLSID debugging messages
Reply #10 Top
Glad to know it works. If I understood correctly, galciv only runs in 1024x768. But Wine automatically switches to the correct resolution if the mode is defined in XF86Config. I have no idea about the cursor; it works for me. I'm using XFree 4.2.1.

Metaverse still doesn't work, and I don't get a dialog for submitting the score when the game ends. I think the dialogs are missing because of the same null pointer problem - actually, I haven't finished a game in Windows so I don't know how the process is supposed to go. :)
Reply #11 Top
The following changes to .wine/config file will create a 1024x768 window on your desktop containing galciv and will allow you to move the window around and your cursor outside of the window.

under the section: [x11drv] uncomment the following and change them to look like the following:

"ScreenDepth" = "24"
"Managed" = "N"
"Desktop" = "1024x768"
"DXGrab" = "N"
Reply #12 Top
Anyone tried getting it to run with WineX 3.0b from Transgaming?
I've yet to pick up the game, but have every intention of it...and would be far happier to be able to not have to reinstall Windows to play it...
Reply #13 Top
Thanks fusibou for posting the howto. Got mine working on a Mandrake 9.1 install.

Only problem I'm having now is that it runs dog slow. Anyone figure out how to speed it up to something closer to normal?

Reply #14 Top
thank you fusibou for the howto.

I managed to get it running with WineX and SUSE 8.2.
BTW: Those fixes on source code level are no longer needed. Tese have been integrated to the CVS code.

The only hassle remains with those dll's and the game upgrade process and submission to metaverse

Well ... and on my side there is no sound and movies only with lots of pauses. (:(
But speed (800MHz)is much much better than on my notebook (233MHz)

Question: does anybody know wether the official transgaming release makes things even easier?

So once again thank you for your work.:CONGRAT::D

Shaffer