CnC_Remastered_Collection
CnC_Remastered_Collection copied to clipboard
How do you build this?
I managed to build tibdawn dll with latest visual studio 2019 and tooling, only minimal changes, see my fork:
https://github.com/Capt-Nemo-/CnC_Remastered_Collection
ps: you need windows SDK, MFC and VC headers installed (available as a component inside VS installer)
1>Resource\TiberianDawn.rc(10): fatal error RC1015: cannot open include file 'afxres.h'.
If you don't want to install MFC, you can replace with #include<afxres.h> or #include "winres.h" in the TIBERIANDAWN\RESOURCE\TiberianDawn.rc and REDALERT\RESOURCE\RedAlert.rc files.
#include<afxres.h> didn't work for me, but #include "winres.h" did, so pick your poison. :)
error C2338: Windows headers require the default packing option. Changing this can lead to memory corruption. This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined. (compiling source file win32lib\#######.CPP)
How to fix: https://i.imgur.com/dP5JV59.jpg
I fixed those packing mismatch errors the same way but I was wondering if it's a good idea....why was it set for 1-byte boundary? Is this intentional or just some leftover from 1995? Theres asm code in the dll, could some manual offseting rely on this setting? Thing is (judging on quick google) if you flip that switch to default it means 8-byte alignment (x86 default) which sounds potentially code breaking...
The problem is two-fold. First, setting custom structs in the source code is better served with things like pragma pack instead of a universal compile switch that'll screw up other structs. Second, the recent versions of Visual Studio (specifically 2019) appear to be more strict with how solutions handle struct packaging. At least, that's my understanding based on the evidence. Feel free to correct me if I'm wrong.
Please give a compiler and sdk edition correctly for successful complie,thanks.
When building the source code I believe you should maintain the original data structure alignment/packing. I set up a repo that has this source configured for Visual Studio 2019. This repo preserves original data structure alignment/packing: https://github.com/alexlk42/CnC_Remastered_Collection. I tested the RedAlert.dll and it worked without crashing the game.
You are right, the dll's did not work and crashed upon loading. I changed my fork back to using 1-byte alignment and used your solution to suppress those packing errors and it's all good now. Tried the tib dawn dll as well and both seem working fine, nice :)
That's great! Glad the TD dll works as I hadn't tested that one yet.
Thanks, alex. That's was cool of you to share your fix. :)
Linux build would be nice as well.
You can likely run the remaster through Wine.
Yeah, properly. But now we have the source code! Yea!
Cool beans 😎
Can I build it with Visual Studio 2015, because VS2019 is ultra terrible awesome big,which i think is unnecessary,it takes a lot of time to download it.