CnC_Remastered_Collection icon indicating copy to clipboard operation
CnC_Remastered_Collection copied to clipboard

Linux compilation

Open abergmeier opened this issue 4 years ago • 15 comments

Will you be accepting changes to compile on Linux, too?

abergmeier avatar Jun 06 '20 13:06 abergmeier

So far it seems they won't be accepting any changes as this appears to be a code drop. Although, the modding community will be interested in changes. Makes me wonder what a good way to make our changes known to each other is...

alexlk42 avatar Jun 06 '20 15:06 alexlk42

That is a good point. I am currently starting to put together a linuxlib but am somewhat wondering whether I am the first one to do so...

abergmeier avatar Jun 06 '20 20:06 abergmeier

Please make this Linux port happen! :D

antdude avatar Jun 07 '20 04:06 antdude

If enough is done to get a working binary set, EA could put it as a beta-branch.

cybik avatar Jun 07 '20 13:06 cybik

Ok, I now have the first CompileUnit linking on Linux.

abergmeier avatar Jun 07 '20 15:06 abergmeier

@abergmeier how? I am using cmake to convert the sln to CMakeList, but I am having issues with this....

horvatic avatar Jun 08 '20 04:06 horvatic

I am using cmake to convert the sln to CMakeList, but I am having issues with this....

I can try to (quickly) describe my process.

Here a (uncomplete) list of things I encountered:

Problem Solution
DOS file encoding Reencode all files with UTF-8
Case insensitive paths Change all relevant includes to uppercase
Non-standard (VisualStudio) C++ extensions Change part of code to comply with C++17
Compile error in GCC Change part of code to comply with C++17
Monoheaders Change includes in files to be self sufficient
Referencing Windows symbols Create compat mapping to C++17 types

My process with this is to create CMake from scratch and pull one CU in after the other. If you guys are interested, I can try to clean up the code today and publish my fork tomorrow.

abergmeier avatar Jun 08 '20 05:06 abergmeier

So my repo is here: https://github.com/abergmeier/CnC_Remastered_Multiplatform

abergmeier avatar Jun 08 '20 06:06 abergmeier

I started porting to GCC/Linux. I converted all files into lowercase, and added a CMakeLists.txt.

However, code for https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/LZWOTRAW.CPP is still not compiling. All code is VERY dependent on win32 (for example https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/BMP8.H) I also found several definitions of "true"/"false" in the code. (code seems very broken when compiling in GCC).

IMHO - this can be ported to SDL. However - this is only a DLL, I am unsure what main() loads this DLL and where is the start point of this app. Also - I am unsure how to create free assets for this "engine".

Is anyone else interested in a port for linux/mac? (modern C++ on windows as well?)

elcuco avatar Jun 08 '20 08:06 elcuco

@elcuco Yes we are interested too (#50). I was also wondering what the next steps were once we get this compiled on linux & unix.

Afaik we need a game engine to "run" this as well as the assets. For your own local testing purposes I believe you could use the official assets if you own the game (without distributing them). Am I right?

As for the entry point it's in both cases CONQUER.CPP. You can look the the commented code in there:

Main_Game -- Main game startup routine.
Main_Loop -- This is the main game loop (as a single loop). 

tsilcher avatar Jun 08 '20 08:06 tsilcher

EA did release the original C&C (Gold -- Windows port) game for free to the public last decade: https://www.google.com/search?safe=active&q=EA+release+C%26C+game+%22ISO%22+free. We just need Linux client to use and play them. ;)

antdude avatar Jun 08 '20 08:06 antdude

I converted all files into lowercase

My reasoning was to have as little changes to the code as possible. So I would rather change the includes to uppercase to not be forced to use rename detection.

However, code for https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/LZWOTRAW.CPP is still not compiling

I for now limit anything to TD. Enough work already :)

abergmeier avatar Jun 08 '20 08:06 abergmeier

So I created now a few PRs for some basic changes: https://github.com/abergmeier/CnC_Remastered_Multiplatform/pulls

If you want to code as well just ping me. Not sure yet, how to setup review process. Maybe create a team RemasteredPorters?

abergmeier avatar Jun 08 '20 10:06 abergmeier

You might want to check out https://github.com/hifi/Vanilla-Conquer which has the same goals but already has a working cmake build system and progess towards windows based standalone builds and mingw GCC builds. Linux compatibility is very much part of the purpose for this as it was for https://github.com/TheAssemblyArmada/Chronoshift before the code drop kind of made it moot. More code is required than this drop provides for working standalone and some of the changes required to revert the remaster changes for standalone are obscure.

OmniBlade avatar Jun 09 '20 22:06 OmniBlade

Indeed, it's a lot of work to get a fully functioning Linux version.

In Vanilla Conquer we are going the long route of roughly:

  1. CMake
  2. Inline MASM to external MASM files (JWASM compat)
  3. Source fixes for MinGW/gcc compatibility
  4. Standalone builds
  5. Assembly to C
  6. SDL2/Linux port
  7. 64 bit support

We are currently working points 3 and 4 where 3 is almost mergeble and 4 is drawing the menu.

Our goal is to keep "everyone" happy by keeping remaster modding, MSVC building and portability all in the same code base while also cleaning up and avoid breaking any of these simultaneously supported builds within every commit.

It's slow work compared to many other projects that can work with the VS solution directly and stick with either remaster modding or to a single game. We are combining as much of the sources together to ease maintainability and refactors.

Anyone are free to contribute and we all hang around in The Assembly Armada discord server.

Good luck to everyone else working on Linux support as well! Every solved issue in any fork will benefit everyone.

hifi avatar Jun 20 '20 11:06 hifi