electronicarts / CnC_Remastered_Collection

Other
18.36k stars 4.74k forks source link

Linux compilation #31

Open abergmeier opened 4 years ago

abergmeier commented 4 years ago

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

alexlk42 commented 4 years ago

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

abergmeier commented 4 years ago

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

antdude commented 4 years ago

Please make this Linux port happen! :D

cybik commented 4 years ago

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

abergmeier commented 4 years ago

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

horvatic commented 4 years ago

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

abergmeier commented 4 years ago

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 commented 4 years ago

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

diegoiast commented 4 years ago

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

tsilcher commented 4 years ago

@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). 
antdude commented 4 years ago

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

abergmeier commented 4 years ago

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 commented 4 years ago

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?

OmniBlade commented 4 years ago

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.

hifi commented 4 years ago

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.