|
I have seen a few people asking in CD IRC channel how to get CD working in WINE so they can play on linux. Here's how to do it:
You are going to create a linux library that will hook a function HL uses and load cd.dll from within hl itself, since WINE does not support the external dll loading API's that CD uses
First, create a file "cdlinux.c" with the following contents:
CODE
#include<dlfcn.h>
char* (*p_GetCommandLineA)()=0;
int times=0;
char *GetCommandLineA() {
if(!p_GetCommandLineA)
p_GetCommandLineA=dlsym((void*)-1,"GetCommandLineA");
times++;
if(times==6)
LoadLibraryA("C:\\Program Files\\Cheating-Death\\cd.dll");
return (*p_GetCommandLineA)();
}
You may need to change the path in the LoadLibraryA line to wherever you installed your CD. Make sure you use \\ to seperate directories, NOT / or \
Now you compile this by doing
$ gcc -shared cdlinux.c -o cdlinux.so
Next go into your Half-Life directory, and create a file called "cdlinux.sh" with the following contents:
CODE
#!/bin/sh
export LD_PRELOAD="/lib/libdl.so.2 /usr/lib/transgaming/winex/lib/libkernel32.so /path/to/your/cdlinux.so"
export LD_LIBRARY_PATH="/usr/lib/transgaming/winex/lib"
winex hl.exe -- $*
note these paths are for winex binary. If you are using wine or winex source you may need to change them to whatever they are for those(search for libkernel32.so and thats the directory to use)
Change the /path/to/your/cdlinux.so to where the cdlinux.so you created is
You will NOT use cdeath.exe AT ALL. Now when you want to use cd, simply run "sh cdlinux.sh", and CD will be loaded, and you can play on CD servers! |
|