FWGS / xash3d-fwgs

Xash3D FWGS engine
1.56k stars 235 forks source link

Host_InitError: can't initialize cl_dlls/client.dll #234

Closed Qiguang closed 3 years ago

Qiguang commented 3 years ago

Environment: Window10 Game: CS 1.6

I want to play CS1.6 using xash3d-fwgs.

Following is the log snippet about this error from engine.log printed by command "xash3d.exe -dev 2 -log":

[23:52:37] Sys_LoadLibrary: Loading avifil32.dll[2020:11:09|23:52:37] - ok [23:52:37] Sys_LoadLibrary: Loading msvfw32.dll[2020:11:09|23:52:37] - ok [23:52:37] Sys_LoadLibrary: Loading msacm32.dll[2020:11:09|23:52:37] - ok [2020:11:09|23:52:37] Using SDL audio driver: wasapi @ 44100 Hz [23:52:37] cl_dlls/client.dll it's not a valid executable file[2020:11:09|23:52:37] ^2Note:^7 cl_dlls/client.dll uses Windows API for mouse input [2020:11:09|23:52:37] LoadLibrary: Loading cl_dlls/client.dll - failed [2020:11:09|23:52:37] Host_InitError: can't initialize cl_dlls/client.dll:

I opened the valve/cl_dlls/client.dll as HEX, and these are the first serveral bytes of the file:

 00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................ 
 00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 00000030: 0000 0000 0000 0000 0000 0000 4000 0000  ............@...
 00000040: 7856 3412 fd5d b40b 60bb 1269 05b6 3eec  xV4..]..`..i..>.
 00000050: b8d3 7a99 ddfd c03e 9c82 715a b900 e75f  ..z....>..qZ..._
 00000060: b64d a100 b1a8 2283 42c9 2077 ce25 7cd3  .M....".B. w.%|.
 00000070: 2ad1 bd15 6c23 fb52 156c e23b ec5a fe57  *...l#.R.l.;.Z.W
 00000080: ae05 5cb3 0a51 7fd7 aea2 075e b5ac 035a  ..\..Q.....^...Z

And I checked the source code of xash3d, in file engine/common/filesystem.c

 3215 /* 
 3216 ==================
 3217 FS_CheckForCrypt
 3218
 3219 return true if library is crypted
 3220 ==================
 3221 */
 3222 qboolean FS_CheckForCrypt( const char *dllname )
 3223 {
 3224     file_t| *f;
 3225     int|key;
 3226
 3227     f = FS_Open( dllname, "rb", false );
 3228     if( !f ) return false;
 3229
 3230     FS_Seek( f, 64, SEEK_SET );|// skip first 64 bytes
 3231     FS_Read( f, &key, sizeof( key ));
 3232     FS_Close( f );
 3233
 3234     return ( key == 0x12345678 ) ? true : false;
 3235 }
 3236

It means the client.dll is encrypted.

How to fix this issue?

BTW: I find the open issue #188 maybe the same issue as this one. But it just provided very few info.

nekonomicon commented 3 years ago

It means the client.dll is encrypted.

  1. Currently, client.dll from the latest steam version of CS 1.6 is not encrypted.
  2. CS 1.6 uses vgui2 library which xash3d does not support.
a1batross commented 3 years ago

Original build of Counter-Strike 1.6 is unsupported.

We have reverse engineered client.dll of Counter-Strike but only legacy sources are available. I'm not giving any support on this pile of code and don't really want to see it again.