In Memoriam: Tai'lahr
OpenUru.org, along with the rest of the Mystonline community, is mourning the loss of Tai'lahr on October 16th, 2019.
Rest in Peace, friend.
Build the client with MSVC 2010 Express
Introduction
This document provides steps to build the CWE client with MSVC 2010 SP1 Express.
Items needed to compile
- Microsoft Visual Studio 2010 SP1 Express
- DirectX 9.0c SDK (June 2010)
- OpenSSL 1.0.2t
- libogg-1.3.2
- libvorbis-1.3.6
- OpenAL v1.1 SDK
- Ageia PhysX 2.6.4 Core SDK
Notes
- This guide assumes you are going to use the 7.0A SDK installed with Visual Studio 2010, and are using a 64 bit Windows install.
- You can upgrade to a newer version of Speex if you like, but you will need to fix the Speex VS2010 projects first.
- Libogg 1.3.2 was used because xiph removed the VS2010 projects from 1.3.3 and above.
- The client has physics bugs (cannot step off the Kadish elevator, and such) when compiled with PhysX 2.6.4 (the only available version). If you can obtain it, PhysX 2.6.0 is the version Cyan used, and clients compiled with it do not seem to have these physics bugs.
- You must use a 2.6.x version of PhysX for CWE, because the cooked mesh format was changed in PhysX 2.7.x and later.
- All libraries are compiled with "Whole Program Optimization" turned off.
- Release version libraries are compiled as "Multi-threaded DLL (/MD)"
- Debug version libraries are compiled as "Multi-threaded Debug DLL (/MDd)"
- Crypto keys are located in "CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\NucleusLib\pnNetBase". Edit the *.hpp files with a text editor to replace Cyan's keys with your own server's keys. Always clean your solution and rebuild when you change crypto keys, to make sure they are updated.
- Server hostnames, IP addresses, and ports are located in the following files:
The status URL:
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp"
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp"
The auth/gatekeeper address
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp"
The default client port
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/pnNbConstant.h"
Build preparation steps
Do this before you install VS2010 Express, or the DirectX SDK install will throw error S1023, due to a newer version of the C++ 2010 redistributables being installed.
Directory structure in the CWE tree will look like this:
StaticSDKs Win32 DX9.0c include Lib
Directory structure in the CWE tree will look like this:
StaticSDKs Win32 PlatformSDK include lib
Directory structure in the CWE tree will look like this:
StaticSDKs win32 OpenAL 1.1 with EFX SDK include libs
Directory structure in the CWE tree will look like this:
StaticSDKs Win32 PhysX Bin Cooking Docs Foundation Framework lib ...
- Create a directory and extract Ogg and Vorbis archives to it.
oggvorbis libogg-1.3.2 libvorbis-1.3.6
- Change directory to "libvorbis-1.3.6\win32\vs2010" and edit the libogg.vsprops file. Make sure the "LIBOGG_VERSION" value matches your version of Ogg (1.3.2 in this document).
- Open "libogg-1.3.2\win32\VS2010\libogg_static.sln" in the Visual Studio IDE.
- Click on configuration drop-down on the upper left and select "Release"
- Right click on project in the solution explorer and select properties.
- Select "Configuration Properties -> General " in the left pane, and then select "Whole Program Optimization" in the right pane, and select "No Whole Program Optimization" from the drop-down.
- Select "C/C++ -> Optimization" in the left pane, and set "Whole Program Optimization" in the right pane to "No".
- Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded DLL (/MD)"
- Click on "Apply"
- Click on configuration drop-down on the upper left of the properties page and select "Debug"
- Select "Configuration Properties -> General" in the left pane, and then select "Whole Program Optimization" in the right pane, and select "No Whole Program Optimization" from the drop-down.
- Select "C/C++ -> Optimization" in the left pane, and set "Whole Program Optimization" in the right pane to "No".
- Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded Debug DLL (/MDd)"
- Click "Apply" and then "OK".
- On the IDE toolbar, select "Release" from the drop down. then right click on the project in the solution explorer and select "Build".
- On the IDE toolbar, select "Debug" from the drop down. then right click on the project in the solution explorer and select "Build".
- Open "libvorbis-1.3.6\win32\VS2010\vorbis_static.sln" in the Visual Studio IDE.
- Repeat steps "d" through "n" for libvorbis_static and libvorbisfile.
- Copy the ogg and vorbis include directories into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\include". It is okay to let it overwrite.
- Copy the "libogg-1.3.2\win32\VS2010\Win32\Release" and "Debug" directories into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\lib"
- Copy the "libvorbis-1.3.6\win32\VS2010\Win32\Release" and "Debug" directories to "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\lib" Directory structure in the CWE tree will look like this:
StaticSDKs win32 xiph include ogg vorbis lib Debug Release
- Open CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\libspeex.sln in the Visual Studio 2010 IDE, and convert.
- Click on configuration drop-down on the upper left and select "Release"
- Right click on project in the solution explorer and select properties.
- Select "Configuration Properties -> General " in the left pane, and then select "Whole Program Optimization" in the right pane, and select "No Whole Program Optimization" from the drop-down.
- Select "C/C++ -> Optimization" in the left pane, and set "Whole Program Optimization" in the right pane to "No".
- Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded DLL (/MD)"
- Click on "Apply"
- Click on configuration drop-down on the upper left of the properties page and select "Debug"
- Select "Configuration Properties -> General" in the left pane, and then select "Whole Program Optimization" in the right pane, and select "No Whole Program Optimization" from the drop-down.
- Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded Debug DLL (/MDd)"
- Click "Apply" and then "OK".
- On the IDE toolbar, select "Release" from the drop down. then right click on the project in the solution explorer and select "Build".
- On the IDE toolbar, select "Debug" from the drop down. then right click on the project in the solution explorer and select "Build".
- Copy the headers (.h files) from CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\speex-1.0.1\libspeex to CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\include\speex
- Copy CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\Release\libspeex.lib to CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\lib\Release
- Copy CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\Debug\libspeex.lib to CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\xiph\lib\Debug
Note: If you link it dynamically, it will cause the Uru client to require the OpenSSL DLLs to be present in the client directory or in the system path.
Copy the installed OpenSSL files to "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenSSL".
Directory structure in the CWE tree will look like this:
StaticSDKs Win32 OpenSSL bin include openssl lib
- Open "Visual Studio 2010 Command Prompt" and change to the "CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\jpeg-8c-rgba directory."
- Copy makefile.vc to makefile.nmake
- Copy jconfig.vc to jconfig.h
- Run nmake nodebug=1 -f makefile.nmake. This will build the library in non-debug mode. If you use a debug library, the linker will complain when we link the client executable.
- Extract the files in the zlib archive to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib.
- Extract the files in the libpng archive to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png.
- Open png/projects/vstudio/vstudio.sln in the Visual Studio 2010 IDE.
- The VS2010 zlib project file distributed in the png archive is set to build for embedded environments. We need to reconfigure it.
- Right click on the zlib project tree in the solution explorer.
- Select Add -> Existing item
- Browse to the zlib source directory (CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\zlib) and select the gzlib.c file
- Do the same step above for gzclose.c, gzread.c, and gzwrite.c
- Right click on the zlib project and select Properties.
- Open 'Configuration Properties > C/C++ > Preprocessor
- Remove the Z_SOLO directive from Preprocessor Directives - Do this for both the LIB Release and LIB Debug configurations.
- Right-click on the “libpng” project in the Solution Explorer and choose Properties.
- Select configuration “LIB Debug” in the popup menu at the top.
- Select Configuration Properties > C/C++ and set Treat Warnings As Errors to No
- Select Configuration Properties > C/C++ > Code Generation on the left.
- Change the Runtime Library line to “Multi-threaded Debug DLL (/MDd)”.
- Select "C/C++ -> Optimization" in the left pane, and set "Whole Program Optimization" in the right pane to "No".
- Choose the “LIB Release” configuration and set Runtime Library to “Multi-threaded DLL (/MD)”.
- Repeat the above 7 steps for the other two projects “pngtest” and “zlib”.
- Select “LIB Debug” from the Solution Configurations popup menu in the toolbar, then Build > Build Solution.
- Select the “LIB Release” configuration and build the solution.
- Rename png/projects/vstudio/Debug Library/libpn16.lib to libpngd.lib and copy it to CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\png\lib
- Rename png/projects/vstudio/Release Library/libpn16.lib to libpng.lib and copy it to CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\png\lib
- Rename png/projects/vstudio/Debug Library/zlib.lib to zlibd.lib and copy it to CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\zlib\lib
- Copy png/projects/vstudio/Release Library/zlib.lib to CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\zlib\lib
Required source code changes for newer version of DirectX SDK
Since we are using a newer version of the DirectX SDK (which supports Visual Studio 2010 Express), we will need to change the source code slightly. We are not changing this in the source tree, since OpenUru is still using the original libraries and VS2003.
Change "#include <dxerr9.h>" to "#include <dxerr.h>"
Change "DXGetErrorString9" to "DXGetErrorString"
Change "#include <dxerr9.h>" to "#include <dxerr.h>"
Remove the "#include <dmusici.h>" line
Change "#include <dxerr9.h>" to "#include <dxerr.h>"
Required source changes for Visual Studio 2010 Express
Note: If you are compiling with VS2010 Professional or greater, you do *not* need to make these edits. Only the Express edition excludes MFC.
Before
// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h"
After
// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // //#include "afxres.h" #include <windows.h> #define IDC_STATIC (-1)
This is the same change we just made in the previous file.
Before
// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h"
After
// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // //#include "afxres.h" #include <windows.h> #define IDC_STATIC (-1)
Build the client
Now that the prep is done, you can actually build the client.
- Open the "CWE\MOULOpenSourceClientPlugin\Plasma20\MSVC10Projects\Plasma\Apps\AllClient\AllClient.sln" in the VS2010 IDE.
- Select the type of build you want from the dropdown on the IDE toolbar.
- Release
- Release_Internal
- Debug
- Debug_Internal
- Right click on the "AllClient" project and select "Build".
Completed builds are copied into the "CWE\MOULOpenSourceClientPlugin\Plasma20\test" directory.
Note: You *must* make sure your client is using the same versions of the PhysX DLLs that you built with. They are not compatible from version to version.
If, after building the client, you require the server prep tools (plFileSecure, plFileEncrypt, plPythonPak), right click on those specific projects and click "Build".
The compiled files will be copied into the "CWE\MOULOpenSourceClientPlugin\Plasma20\tools" directory.