CnC_Remastered_Collection icon indicating copy to clipboard operation
CnC_Remastered_Collection copied to clipboard

How do you build this?

Open notflip opened this issue 4 years ago • 15 comments

notflip avatar Jun 03 '20 12:06 notflip

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)

RudolfKurka avatar Jun 03 '20 13:06 RudolfKurka

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. :)

Hydra9268 avatar Jun 04 '20 01:06 Hydra9268

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

Hydra9268 avatar Jun 04 '20 01:06 Hydra9268

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...

RudolfKurka avatar Jun 04 '20 10:06 RudolfKurka

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.

Hydra9268 avatar Jun 04 '20 13:06 Hydra9268

Please give a compiler and sdk edition correctly for successful complie,thanks.

igofreely avatar Jun 05 '20 16:06 igofreely

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.

alexlk42 avatar Jun 06 '20 03:06 alexlk42

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 :)

RudolfKurka avatar Jun 06 '20 11:06 RudolfKurka

That's great! Glad the TD dll works as I hadn't tested that one yet.

alexlk42 avatar Jun 06 '20 15:06 alexlk42

Thanks, alex. That's was cool of you to share your fix. :)

Hydra9268 avatar Jun 07 '20 05:06 Hydra9268

Linux build would be nice as well.

melroy89 avatar Jun 07 '20 16:06 melroy89

You can likely run the remaster through Wine.

Hydra9268 avatar Jun 07 '20 18:06 Hydra9268

Yeah, properly. But now we have the source code! Yea!

melroy89 avatar Jun 07 '20 19:06 melroy89

Cool beans 😎

Hydra9268 avatar Jun 07 '20 21:06 Hydra9268

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.

icefog123 avatar Apr 23 '22 06:04 icefog123