farbrausch / fr_public

Farbrausch demo tools 2001-2011
3.38k stars 346 forks source link

altona_wz4 + Windows 10 + Visual Studio 2015 = win #95

Open kungfooman opened 6 years ago

kungfooman commented 6 years ago

Hi, just tried to build this, but I ran into a few problems. It took a bit to figure it out, so the next person will have it easier.

1) First generate the 2012 solution/project files normally 2) Drag&drop the generated G:\fr_public\altona_wz4\wz4\werkkzeug4\werkkzeug4.sln on Visual Studio 2015 3) Either Visual Studio retargets it automatically, or if not, simply right click on Solution 'werkkzeug4' and click on "Retarget" 4) Now open "base/types.hpp"

Rewrite this:

#define sCONFIG_NATIVEINT         __int64 _w64
#define sCONFIG_INT64             __int64 _w64

to this, because _w64 doesn't exist in Visual Studio 2015:

#define sCONFIG_NATIVEINT         __int64
#define sCONFIG_INT64             __int64

5) You need the DX9 or DX11 headers and libs, which can be installed by running this: https://www.microsoft.com/en-us/download/details.aspx?id=6812

The DirectX setup will error with some short error message, but all the .lib files and header includes are saved on disc.

6) Now we actually need to tell Visual Studio 2015 where to find the headers/libs:

Add to include search path:

C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared

Add the lib search path, only needed for werkkzeug4 project:

C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64

8)

First one was called, but fails, it needs "win32", not "Win32", case sensitive
1) yasm -Xvc -f Win32 -rnasm -pnasm      -o release_dx9_Win32\incbin.obj  incbin.asm
2) yasm -Xvc -f win32 -rnasm -pnasm      -o release_dx9_Win32\incbin.obj  incbin.asm

9) Add legacy_stdio_definitions.lib to werkkzeug4 project

10) The last problem is that Visual Studio doesn't allow overwriting the new operator "easily" anymore. But it works again by defining these two defines for every project (just select all, rightclick on options, C/C++ -> Preprocessor and set those two defines:

__PLACEMENT_NEW_INLINE
__PLACEMENT_VEC_NEW_INLINE

Otherwise the project will compile, but won't link, because two functions already have a body.

I guess this also works with Visual Studio 2017, but I didn't test it yet. Have fun xd

TRex22 commented 6 years ago

Thanks for this ... 👍

EGAMatsu commented 2 years ago

I get a error: "cannot convert argument 1 from 'sChar ' to 'const sChar &'.

kungfooman commented 2 years ago

I get a error: "cannot convert argument 1 from 'sChar ' to 'const sChar &'.

I think you can just remove the const from the function signature or do manual casting, which VS version do you use?