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.

Difference between revisions of "Build the client with MSVC 2008"

From OpenUru
Jump to navigation Jump to search
m (fix typo. compiled tools are copied into "tools" directory, not "test")
(VS2008 instructions are not needed. I will be requesting deletion of this page.)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
This document provides steps to build the CWE client with MSVC 2008 SP1 Express, with minimal changes from the current CWE-OU source as of 05-Dec-2018 [https://foundry.openuru.org/hg/CWE-ou/file/d991af4b4960].<BR>
 
This is an attempt to enhance the usability of the CWE-ou source tree by utilizing a freely available compiler and some updated libraries.
 
  
Please note that the client created using these instructions has not undergone extensive testing.<BR>
+
These instructions are not needed.  The "register" URL in the software itself is invalid, but you can get a VS2010 key from your Microsoft VS community account by scrolling down to the web installer download and selecting "get key".
  
These instructions need the project files from [https://bitbucket.org/OpenUru_org/cwe-ou/pull-requests/45 Pull request #45] on the CWE bitbucket.
+
A new set of VS2010 based instructions will be posted soon.
  
== Items needed to compile ==
+
Thank you.
* [http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso Microsoft Visual Studio 2008 SP1 Express]
 
* [http://www.microsoft.com/downloads/details.aspx?FamilyID=529f03be-1339-48c4-bd5a-8506e5acf571&DisplayLang=en DirectX 9.0c SDK (August 2007)]
 
* [https://www.openssl.org/source/openssl-1.0.2q.tar.gz OpenSSL 1.0.2q]
 
* [http://downloads.xiph.org/releases/ogg/libogg-1.3.2.zip libogg-1.3.2]
 
* [http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.zip libvorbis-1.3.6]
 
* [https://www.openal.org/downloads/OpenAL11CoreSDK.zip OpenAL v1.1 SDK]
 
* [http://developer.download.nvidia.com/PhysX/2.6.4/PhysX_2.6.4_SDK_Core.exe Ageia PhysX 2.6.4 Core SDK]
 
* [http://downloads.xiph.org/releases/speex/speex-1.2.0.tar.gz libspeex 1.2.0]
 
 
 
== Notes ==
 
 
 
* Libogg 1.3.2 was used because xiph removed the VS2008 projects from 1.3.3.
 
* 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.
 
* Some minor source changes are required in order to compile with VS 2008 SP1 Express version.  Those will be documented below.
 
* All libraries are compiled with "Whole Program Optimization" turned off.
 
* All release version libraries are compiled as "Multi-threaded DLL (/MD)"
 
* All debug version libraries are compiled as "Multi-threaded Debug DLL (/MDd)"
 
* It is understood that the specified DirectX SDK (Aug 2007) has expired messages for one of it's components.  The client does not use that particular component, and we are using that DirectX SDK version because it is the newest available SDK that does not require source changes to use.  The earlier October 2005 version is no longer available from Microsoft.
 
<BR>
 
* 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.<BR>
 
 
 
* Server hostnames, IP addresses, and ports are located in the following files:
 
<u>The status URL:  </u><BR>
 
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp"<BR>
 
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp"<BR><BR>
 
<u>The auth/gatekeeper address</u><BR>
 
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp"<BR><BR>
 
<u>The default client port</u><BR>
 
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/pnNbConstant.h"
 
 
 
== Build preparation steps ==
 
<ol>
 
<li> Obtain CWE-OU source</li>
 
<li> Install Visual Studio 2008 SP1 Express</li>
 
<li> Copy the include and lib directories from the SDK installed with VS2008 SP1 Express to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\PlatformSDK".  The directory where the SDK resides will most likely be "\Program Files\Microsoft SDKs\Windows\v6.0A".  As the SDK is in our path, this step is probably not necessary but we will do it for consistency.<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
StaticSDKs
 
  Win32
 
    PlatformSDK
 
      include
 
      lib</pre>
 
</li>
 
<li>Install the OpenAL SDK and copy the include and lib directories to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK"<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
  StaticSDKs
 
    win32
 
      OpenAL 1.1 with EFX SDK
 
        include
 
        libs
 
</pre>
 
</li>
 
<li>Install the DirectX 9.0c SDK (Say "OK" to the expired xaudio2 messages - we do not use that) and copy it to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\DX9.0c".<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
  StaticSDKs
 
    Win32
 
      DX9.0c
 
        include
 
        Lib
 
</pre>
 
</li>
 
<li>Copy PhysX subdirectories from "\Program Files\AGEIA Technologies\AGEIA PhysX SDK\v2.6.4\SDKs" and "\Program Files (x86)\AGEIA Technologies\AGEIA PhysX SDK\v2.6.4\Bin" to ""\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\PhysX<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
  StaticSDKs
 
    Win32
 
      PhysX
 
        Bin
 
        Cooking
 
        Docs
 
        Foundation
 
        Framework
 
        lib
 
        ...</pre>
 
</li>
 
<BR>
 
<li> Build Ogg and Vorbis</li>
 
<ol style="list-style-type:lower-latin">
 
<li> Create a directory and extract Ogg and Vorbis archives to it.
 
<pre>
 
oggvorbis
 
  libogg-1.3.2
 
  libvorbis-1.3.6</pre>
 
</li>
 
<li> Change directory to "\libvorbis-1.3.6\win32\vs2008" and edit the libogg.vsprops file.  Change the "LIBOGG_VERSION" value to match your version of Ogg (1.3.2 in this document).</li>
 
<li> Open "\libogg-1.3.2\win32\VS2008\libogg_static.sln" in the Visual Studio IDE.</li>
 
<li> Click on configuration drop-down on the upper left and select "Release"</li>
 
<li> Right click on project in the solution explorer and select properties.</li>
 
<li> 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.</li>
 
<li> Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded DLL (/MD)"</li>
 
<li> Click on "Apply"</li>
 
<li> Click on configuration drop-down on the upper left of the properties page and select "Debug"</li>
 
<li> 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.</li>
 
<li> Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded Debug DLL (/MDd)"</li>
 
<li> Click "Apply" and then "OK". </li>
 
<li> On the IDE toolbar, select "Release" from the drop down. then right click on the project in the solution explorer and select "Build". </li>
 
<li> On the IDE toolbar, select "Debug" from the drop down. then right click on the project in the solution explorer and select "Build". </li>
 
<li> Open "\libvorbis-1.3.6\win32\VS2008\vorbis_static.sln" in the Visual Studio IDE. </li>
 
<li> Repeat steps "d" through "n" for libvorbis_static and libvorbisfile. </li>
 
</ol>
 
<li> Copy Ogg and Vorbis files to CWE </li>
 
<ol style="list-style-type:lower-latin">
 
 
 
<li> Copy the ogg and vorbis include directories into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\oggvorbis\include".  It is okay to let it overwrite.
 
<li> Copy the "libogg-1.3.2\win32\VS2008\Win32\Release" and "Debug" directories into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\oggvorbis\lib"</li>
 
<li> Copy the "libvorbis-1.3.6\win32\VS2008\Win32\Release" and "Debug" directories to "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\oggvorbis\lib"</li>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
  StaticSDKs
 
    win32
 
      oggvorbis
 
        include
 
          ogg
 
          vorbis
 
        lib
 
          Debug
 
          Release</pre>
 
</li>
 
</ol>
 
<li> Build Speex 1.2.0 </li>
 
<ol style="list-style-type:lower-latin">
 
<li> Create a directory and extract the Speex 1.2.0 archive into it.</li>
 
<li> Unfortunately, the speex-1.2.0 release is missing the "fftwrap.c" file.  Obtain the missing file from the Speex github repository and copy it into "speex-1.2.0\libspeex" directory (the directory that also has "fftwrap.h" in it).  [https://github.com/xiph/speex/blob/master/libspeex/fftwrap.c fftwrap.c]</li>
 
<li> Open "\speex-1.2.0\win32\VS2008\libspeex.sln" in the VS2008 IDE.  Ignore "project missing" errors - we are only building libspeex. </li>
 
<li> Click on configuration drop-down on the upper left and select "Release_RTL_dll" </li>
 
<li> Right click on the "libspeex" project in the solution explorer and select properties.</li>
 
<li> 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.</li>
 
<li> Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded DLL (/MD)" </li>
 
<li> Click on "Apply" </li>
 
<li> Click on configuration drop-down on the upper left of the properties page and select "Debug_RTL_dll" </li>
 
<li> 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. </li>
 
<li> Select "C/C++ -> Code Generation" in the left pane, and select "Runtime Library" and verify it is set to "Multi-threaded Debug DLL (/MDd)"
 
<li> Click "Apply" and then "OK". </li>
 
<li> On the IDE toolbar, select "Release_RTL_dll" from the drop down. then right click on the "libspeex" project in the solution explorer and select "Build".</li>
 
<li> On the IDE toolbar, select "Debug_RTL_dll" from the drop down. then right click on project in the solution explorer and select "Build".</li>
 
</ol>
 
<li>Copy the "Speex-1.2.0" you just compiled into "MOULOpenSourceClientPlugin\StaticSDKs\Win32".
 
<pre>
 
  StaticSDKs
 
    win32
 
      speex-1.2.0
 
        doc
 
        include
 
        libspeex
 
        ...</pre>
 
</li>
 
 
 
 
 
<li>Compile and install OpenSSL (see [[Build OpenSSL with MS Visual C++]]).  As this is security software, it is best (in my opinion) to compile it yourself from source.  You can choose either static or dynamic linking.<BR>  '''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.<BR><BR>  Copy the installed stuff to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenSSL"  (created by "make install" - you do not want your development tree here).<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
  StaticSDKs
 
    Win32
 
      OpenSSL
 
        bin
 
        include
 
          openssl
 
        lib</pre>
 
</li>
 
<li>Open "Visual Studio 2008 Command Prompt" and change to the "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\jpeg-8c-rgba directory." Copy makefile.vc to makefile.nmake, and jconfig.vc to jconfig.h and then 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.</li>
 
<li>Install zlib and libpng<br />
 
<ol style="list-style-type:lower-latin"><li>Download ''zlib127.zip'' (or a newer version) from [http://www.zlib.net/ http://www.zlib.net/], extract the ''zlib-1.2.7'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib''.</li>
 
<li>Download ''lpng1511.zip'' (or a newer version) from [http://libpng.org/pub/png/libpng.html http://libpng.org/pub/png/libpng.html], extract the ''lpng1511'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png''.</li>
 
<li>Open ''png/projects/visualc71/libpng.sln'' in the Visual Studio 2008 IDE.</li>
 
<li>Right-click on the “libpng” project in the ''Solution Explorer'' and choose ''Properties''.</li>
 
<li>Select configuration “LIB Debug” in the popup menu at the top.</li>
 
<li>Select ''Configuration Properties'' > ''C/C++'' > ''Code Generation'' on the left.</li>
 
<li>Change the ''Runtime Library'' line to “Multi-threaded Debug DLL (/MDd)”. (This step avoids a warning in the final Plasma build. As far as I understand, leaving it out is harmless, but better do it to be sure.)</li>
 
<li>Choose the “LIB Release” configuration and set ''Runtime Library'' to “Multi-threaded DLL (/MD)”.</li>
 
<li>Repeat steps 4 to 8 for the other two projects “pngtest” and “zlib”.</li>
 
<li>Select “LIB Debug” from the ''Solution Configurations'' popup menu in the toolbar, then ''Build'' > ''Build Solution''.</li>
 
<li>Select the “LIB Release” configuration and build the solution.</li>
 
<li>Make a new folder ''png/lib'' and move ''png/projects/visualc71/Win32_LIB_Debug/libpngd.lib'' as well as ''png/projects/visualc71/Win32_LIB_Release/libpng.lib'' into it.</li>
 
<li>Make a new folder ''zlib/lib'' and move ''png/projects/visualc71/Win32_LIB_Debug/ZLib/zlibd.lib'' as well as ''png/projects/visualc71/Win32_LIB_Release/ZLib/zlib.lib'' into it.</li></ol>
 
</ol>
 
 
 
== Required source code changes ==
 
<ol>
 
<li>'''plFileUtils.cpp''' file located in directory "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\PubUtilLib\plFile"<BR>
 
Remove the "#include <errno.h>" line from the "#if HS_BUILD_FOR_UNIX" section and move it under "#include <sys/stat.h>"<BR>
 
'''Before'''<BR>
 
<pre>
 
#include <time.h>
 
#include <sys/types.h>
 
#include <sys/stat.h>
 
 
 
 
 
#if HS_BUILD_FOR_WIN32
 
#include <direct.h>
 
#include <io.h>
 
#endif
 
 
 
#if HS_BUILD_FOR_UNIX
 
#include <unistd.h>
 
#include <errno.h>
 
#include <utime.h>
 
#endif
 
</pre>
 
'''After'''<BR>
 
<pre>
 
#include <time.h>
 
#include <sys/types.h>
 
#include <sys/stat.h>
 
#include <errno.h>
 
 
 
#if HS_BUILD_FOR_WIN32
 
#include <direct.h>
 
#include <io.h>
 
#endif
 
 
 
#if HS_BUILD_FOR_UNIX
 
#include <unistd.h>
 
#include <utime.h>
 
#endif
 
</pre></li>
 
<li> '''hsWindows.h''' file located in directory "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\CoreLib"<BR>
 
Change the  _MSC_VER >=1600 to 1500.<BR>
 
'''Before'''<BR>
 
<pre>
 
#ifndef __AFX_H__  // MFC apps won't let us include windows from here. =(
 
 
 
#if defined(_MSC_VER) && _MSC_VER >= 1600
 
#define _WIN32_WINNT 0x0501
 
#else
 
#define _WIN32_WINNT 0x0400
 
#endif
 
</pre>
 
'''After'''<BR>
 
<pre>
 
#ifndef __AFX_H__  // MFC apps won't let us include windows from here. =(
 
 
 
#if defined(_MSC_VER) && _MSC_VER >= 1500
 
#define _WIN32_WINNT 0x0501
 
#else
 
#define _WIN32_WINNT 0x0400
 
#endif
 
</pre></li>
 
<li>'''plClient.rc''' file located in "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\Apps\plClient\res\"<BR>
 
We do not have MFC with VS2008 SP1 Express, so we need to replace the first reference to afxres.h.  The client portion of CWE does not use MFC (I believe the MAX plugin does), so we can make this replacement.<BR>
 
'''Before'''<BR>
 
<pre>
 
// Microsoft Visual C++ generated resource script.
 
//
 
#include "resource.h"
 
 
 
#define APSTUDIO_READONLY_SYMBOLS
 
/////////////////////////////////////////////////////////////////////////////
 
//
 
// Generated from the TEXTINCLUDE 2 resource.
 
//
 
#include "afxres.h"
 
</pre>
 
'''After'''<BR>
 
<pre>
 
// 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)
 
</pre></li>
 
<li>'''plUruLauncher.rc''' file located in "\CWE\MOULOpenSourceClientPlugin\Plasma20\Apps\plUruLauncher.rc"<BR>
 
This is the same change we just made in the previous file.<BR>
 
'''Before'''<BR>
 
<pre>
 
// Microsoft Visual C++ generated resource script.
 
//
 
#include "resource.h"
 
 
 
#define APSTUDIO_READONLY_SYMBOLS
 
/////////////////////////////////////////////////////////////////////////////
 
//
 
// Generated from the TEXTINCLUDE 2 resource.
 
//
 
#include "afxres.h"
 
</pre>
 
'''After'''<BR>
 
<pre>
 
// 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)
 
</pre></li>
 
</ol>
 
 
 
 
 
== Build the client ==
 
Now that the prep is done, you can actually build the client.
 
<ol>
 
<li> Open the "CWE\MOULOpenSourceClientPlugin\Plasma20\MSVC8Projects\Plasma\Apps\AllClient\AllClient-ou.sln" in the VS2008 IDE.</li>
 
<li> Select the type of build you want from the dropdown on the IDE toolbar.
 
* Release
 
* Release_Internal
 
* Debug
 
* Debug_Internal
 
</li>
 
<li> Right click on the "AllClient" project and select "Build".</li>
 
<BR>
 
Completed builds are copied into the "CWE\MOULOpenSourceClientPlugin\Plasma20\test" directory.
 
<BR>
 
'''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.
 
</ol>
 
 
 
If, after building the client, you require the server prep tools (plFileSecure, plFileEncrypt, plPythonPak), right click on those specific projects and click "Build".<BR>
 
The compiled files will be copied into the "CWE\MOULOpenSourceClientPlugin\Plasma20\tools" directory.
 
 
 
== DirectX notes ==
 
 
 
It is possible to use the [https://www.microsoft.com/en-us/download/details.aspx?id=6812 latest DirectX 9.0c SDK (June 2010)] with some more source changes.  The client compiles and runs with these changes, but it has not been extensively tested.  This basic documentation is here in case Microsoft decides to pull the link for the DX Aug 2007 SDK. <BR>
 
 
 
<li> In file "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\PubUtilLib\plPipeline\plDXPipeline.cpp"<BR>
 
Change "#include <dxerr9.h>" to "#include <dxerr9.h>"<BR>
 
Change "DXGetErrorString9" to "DXGetErrorString"<BR>
 
</li>
 
<li> In file "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\PubUtilLib\plAudio\plWavFile.cpp"<BR>
 
Change "#include <dxerr9.h>" to "#include <dxerr.h>"
 
</li>
 
 
 
<li> In file "\CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\PubUtilLib\plAudio\plEAXEffects.cpp"<BR>
 
Remove the "#include <dmusici.h>" line<BR>
 
Change "#include <dxerr9.h>" to "#include <dxerr.h>"
 
</li>
 
<li> In the "plPageOptimizer" project <BR>
 
Remove linker reference to "dplayx.lib" <BR>
 
Change linker reference "dxerr9.lib" to "dxerr.lib"
 
</li>
 
<li> In the "plClient" project <BR>
 
Remove linker reference to "dplayx.lib" <BR>
 
Change linker reference "dxerr9.lib" to "dxerr.lib"
 

Latest revision as of 16:35, 26 October 2019

Introduction

These instructions are not needed. The "register" URL in the software itself is invalid, but you can get a VS2010 key from your Microsoft VS community account by scrolling down to the web installer download and selecting "get key".

A new set of VS2010 based instructions will be posted soon.

Thank you.