Giter Site home page Giter Site logo

theassemblyarmada / vanilla-conquer Goto Github PK

View Code? Open in Web Editor NEW
331.0 18.0 51.0 21.66 MB

Vanilla Conquer provides clean, cross-platform builds of the C&C Remastered Collection and the standalone legacy games.

License: Other

C++ 96.72% C 2.95% CMake 0.30% Python 0.03%
games game-engine command-and-conquer redalert red-alert rts real-time-strategy open-game openredalert c-plus-plus

vanilla-conquer's Introduction

Vanilla Conquer

Vanilla Conquer is a fully portable version of the first generation C&C engine and is capable of running both Tiberian Dawn and Red Alert on multiple platforms. It can also be used for mod development for the Remastered Collection.

The main focus of Vanilla Conquer is to keep the default out-of-box experience faithful to what the games were back when they were released and work as a drop-in replacement for the original executables while also providing bug fixes, compatiblity and quality of life improvements.

Current project goals are tracked as GitHub issues with the goal label.

Chat with us

There are rooms on multiple platforms for discussion:

All of these rooms are bridged together so people can choose their preferred service. Please be nice to each other.

Building

We support wide variety of compilers and platforms to target. Vanilla Conquer is known to compile with recent enough gcc, MSVC, mingw-w64 or clang and known to run on Windows, Linux, macOS and BSDs.

Presets

A CMakePresets.json file is provided that contains presets for common build configurations and is used by our CI scripts to build the release builds. These presets require the Ninja build tool to be available in the system PATH in order to be used.

We also provide an example CMakeUserPresets.json that can be copied to the root source directory and renamed. You can edit this file to create your own development presets that won't be included in git commits. A few example presets are provided which override the release presets to build a "debug" configuration.

To build using a preset, add --preset preset_name to the CMake command line examples below.

Windows

Requirements

The following components are needed to build Vanilla Conquer executables:

Extract SDL2 and OpenAL somewhere you know. If you are building only Remastered dlls you can skip installing SDL2 and OpenAL.

Building

In a VS command line window in the Vanilla Conquer source directory:

cmake -DSDL2_ROOT_DIR=C:\path\to\SDL2 -DOPENAL_ROOT=C:\path\to\OpenAL -B build .
cmake --build build

This will build Vanilla Conquer executables in the build directory. If you are building Remastered dlls you need to configure cmake with -A win32 and ensure your VS command line is x86.

Linux / macOS / BSD

Requirements

  • GNU C++ Compiler (g++) or Clang
  • CMake
  • SDL1 or SDL2
  • OpenAL

On Debian/Ubuntu you can install the build requirements as follows:

sudo apt update
sudo apt install g++ cmake libsdl2-dev libopenal-dev
or
sudo apt install g++ cmake libsdl1.2-dev libopenal-dev

On Fedora/RedHat based system you can install the build requirements as follows:

sudo dnf install gcc-c++ cmake SDL2-devel openal-soft-devel
or
sudo dnf install gcc-c++ cmake SDL-devel openal-soft-devel

Building

cmake -B build .
cmake --build build

This will build Vanilla Conquer executables in the build directory.

macOS considerations

To create a portable bundle for macOS we run macdylibbundler in our CI builds as an extra step to add the SDL2 and OpenAL libraries to the bundle. If you wish to create a portable bundle yourself, you will need to do this step manually as CMake will not currently do it for you.

Icons

CMake will attempt to generate icons in an appropriate format for Windows and macOS if ImageMagick is found in the system PATH. Otherwise you will end up with generic "program" icons.

Releases

Binary releases of the latest commit are available from here, which is updated whenever new code is merged into the main branch.

Running

VanillaTD and VanillaRA

Copy the Vanilla executable (vanillatd.exe or vanillara.exe) to your legacy game directory, on Windows also copy SDL2.dll and OpenAL32.dll.

For Tiberian Dawn the final freeware Gold CD release (GDI, NOD) works fine.

For Red Alert the freeware CD release works fine as well. The official Red Alert demo is also fully playable. The demo supports custom skirmish maps (except interior) and includes one campaign mission for both Allied and Soviet from the retail game.

While it is possible to use the game data from the Remastered Collection, The Ultimate Collection or The First Decade they are currently not supported. Any repackaged version that you may already have from any unofficial source is not supported. If you encounter a bug that may be data related like invisible things or crashing when using a certain unit please retest with the retail data first before submitting a bug report.

Remastered

The build process will produce Vanilla_TD and Vanilla_RA directories in your build directory if you enable them with -DBUILD_REMASTERTD=ON and -DBUILD_REMASTERRA=ON. These work as mods for the Remastered Collection.

To manually install a local Remastered mod, launch both games once then head to My Documents/CnCRemastered/CnCRemastered/Mods. You should see Tiberian_Dawn and Red_Alert directories.

Tiberian Dawn

Copy the Vanilla_TD directory to the Tiberian_Dawn directory.

The directory structure should look like this:

My Documents/CnCRemastered/CnCRemastered/Mods/Tiberian_Dawn/Vanilla_TD/Data/TiberianDawn.dll
My Documents/CnCRemastered/CnCRemastered/Mods/Tiberian_Dawn/Vanilla_TD/ccmod.json
My Documents/CnCRemastered/CnCRemastered/Mods/Tiberian_Dawn/Vanilla_TD/GameConstants_Mod.xml

You should now see the new mod in the mods list of Tiberian Dawn Remastered.

Red Alert

Copy the Vanilla_RA directory to the Red_Alert directory.

The directory structure should look like this:

My Documents/CnCRemastered/CnCRemastered/Mods/Red_Alert/Vanilla_RA/Data/RedAlert.dll
My Documents/CnCRemastered/CnCRemastered/Mods/Red_Alert/Vanilla_RA/ccmod.json

You should now see the new mod in the mods list of Red Alert Remastered.

vanilla-conquer's People

Contributors

anpage avatar bmattea avatar capsterx avatar ccawley2011 avatar cg9999 avatar chthonvii avatar danfe avatar giulianobelinassi avatar hazelnot avatar hifi avatar isojalka avatar johnsterid avatar lasdesu avatar martinpalko avatar mlipfert1 avatar northfear avatar nyerguds avatar omniblade avatar pg-stevet avatar rparolin avatar test12376 avatar th-otto avatar tobiaskarnat avatar tomsons26 avatar tore29 avatar walterbarrett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vanilla-conquer's Issues

MSVC built RedAlert.dll freezes during gameplay

To reproduce the freeze, RedAlert.dll needs to be build with MSVC (I used 19.27.29112 with default flags) and you need to run over a nuclear crates like in the map Siberia: Fresh Tracks.

grafik

I can't get any backtrace as it only freezes.
Doesn't happen without mod and doesn't if vanilla conquer was built with mingw-w64-gcc (all run with wine).

Cppcheck analysis

https://github.com/danmar/cppcheck

Cppcheck on Vanilla-Conquer XML

cppcheck -j 2 --max-ctu-depth=99 --cppcheck-build-dir=C:\Users\user\Downloads\Vanilla-Conquer-vanilla-cppcheck-build-dir --enable=warning,performance,portability,missingInclude --force --std=c++11 --verbose --xml C:\Users\user\Downloads\Vanilla-Conquer-vanilla 2> cppcheck-Vanilla-Conquer-master.xml.txt

182 errors
2798 warnings
346 performance issues
45 portability issues

Note: unusedFunction check can't be used with '-j' option.

Sidebar credits tick in next session.

A well known issue in RA and TD.
If you start a mission with a lot of credits, then start skirmish the credits will tick down to the expected amount. If you had A LOT of credits this will take a long time for the credits bar to return to normal.
Reason for this is the game doesn't clear some class members between sessions.

VanillaTD Skirmish mode

The Remaster build supports a skirmish mode for TD via the glyphx frontend, but the vanilla menu system currently has no way of going into skirmish mode. In RA the Serial menu pulled double duty and also acted as the skirmish menu which is now its sole role. The TD menu could perhaps be refactored in a similar fashion.

Network play

To get network play further we can start by testing the IPX winsock implementation in RA and refine it until it works with an IPX emulation dll like CnCNet 4. We can test that over the internet as well with it.

Once IPX works we can switch it over to real UDP and remove all legacy IPX code and update TD to use the same networking classes internally over the legacy thipx16/32 thing.

Finally the networking code can be cleaned up to work cross platform.

-fpack-struct=1 causes problems

It seems -fpack-struct=1 defined in the CXX_FLAGS causes problems with external system calls on linux.

I get stack smashing at file_posix.cpp Find_File_Data_Posix::FindNextWithFilter()
during the stat call
if (stat(DirEntry->d_name, &buf) != 0) {

when stepping through the code in gdb, the stack canary get overwritten during this call.

when investigating this issue, I found out the size of the stat buffer is 84 when -fpack-struct=1 is used, otherwise it is 88.

I made a small reproducer which causes stack smashing when compiled with -m32 -fpack-struct=1

#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>

DIR* Directory;
struct dirent* DirEntry;
 
int blah() {
        DirEntry = readdir(Directory);

        struct stat buf = {0};
        printf("Size of stat buffer: %d @ %x  filename: %s\n", sizeof(buf), &buf, DirEntry->d_name);
        stat(DirEntry->d_name, &buf);
        return 0;
}


int main() {
        char cwd[PATH_MAX] = {0};
        getcwd(cwd, PATH_MAX);
        Directory = opendir(cwd);
        blah();
}

There may be other places where this is happening, but it does not happen to overwrite the stack canary and causes silent corruption

SDL2 port (Linux)

Replace all winapi stuff after #19 is done so we can build a native Linux executable.

Palette fade issues in Red Alert.

Palette fade on the main menu and in some transitions with the score screen appears to be faulty and causes incorrect colors to be displayed during the fade.

MSVC Build with enabled Whole Program Optimization doesn't link

MSVC Building with /GL and linking with /LTCG does not link.

conquer.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""bool ModemService" (?ModemService@@3_NA)". [E:\Vanilla
-Conquer\build\tiberiandawn\TiberianDawn.vcxproj]
E:\Vanilla-Conquer\build\Debug\TiberianDawn.dll : fatal error LNK1120: 1 nicht aufgelöste Externe [E:\Vanilla-Conquer\b
uild\tiberiandawn\TiberianDawn.vcxproj]

Changes to CMake

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL /Zp1")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GL /Zp1")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
    set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG")
    set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG")

This patch will make it link.

--- a/tiberiandawn/conquer.cpp	2020-10-20 21:48:32.873354908 +0200
+++ b/tiberiandawn/conquer.cpp	2020-10-20 17:39:13.337823675 +0200
@@ -1205,12 +1203,12 @@
     /*
     **	Modem and Null Modem maintenance
     */
-    if (GameToPlay == GAME_NULL_MODEM || ((GameToPlay == GAME_MODEM) && ModemService)) {
+    //if (GameToPlay == GAME_NULL_MODEM || ((GameToPlay == GAME_MODEM) && ModemService)) {
         //|| GameToPlay == GAME_INTERNET) {
 
         // PG_TO_FIX
         // NullModem.Service();
-    }
+    //}
 #endif
 }

Undefined reference to Net_Reconnect_Dialog

Mostly successful build, but in the end:

[ 98%] Linking CXX shared library ../RedAlert.dll
[ 98%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/visudlg.cpp.obj
[ 98%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/vortex.cpp.obj
[ 98%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/w95trace.cpp.obj
[ 98%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/warhead.cpp.obj
[ 98%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/weapon.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/iconset.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/winstub.cpp.obj
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: CMakeFiles/RedAlert.dir/objects.a(queue.cpp.obj): in function `ZNK15BasicTimerClassI16SystemTimerClassE5ValueEv':
/home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `Net_Reconnect_Dialog(int, int, int, unsigned long)'
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: /home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `Reconnect_Modem()'
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: /home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `ConnectionLost'
collect2: error: ld returned 1 exit status
make[2]: *** [redalert/CMakeFiles/RedAlert.dir/build.make:3578: RedAlert.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:769: redalert/CMakeFiles/RedAlert.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wolapiob.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/woledit.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wolstrng.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_cgam.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_chat.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_dnld.cpp.obj
[ 99%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_gsup.cpp.obj
[100%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_logn.cpp.obj
[100%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_main.cpp.obj
[100%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wol_opt.cpp.obj
[100%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wsproto.cpp.obj
[100%] Building CXX object redalert/CMakeFiles/VanillaRA.dir/wspudp.cpp.obj
[100%] Building RC object redalert/CMakeFiles/VanillaRA.dir/VanillaRAResource.rc.res
/home/sa/Vanilla-Conquer/redalert/wolstrng.cpp:26:49: note: ‘#pragma message: ...Building English version...’
   26 | #pragma message("...Building English version...")
      |                                                 ^
[100%] Linking CXX executable ../vanillara.exe
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: CMakeFiles/VanillaRA.dir/objects.a(queue.cpp.obj): in function `ZNK15BasicTimerClassI16SystemTimerClassE5ValueEv':
/home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `Net_Reconnect_Dialog(int, int, int, unsigned long)'
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: /home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `Reconnect_Modem()'
/usr/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: /home/sa/Vanilla-Conquer/redalert/ftimer.h:174: undefined reference to `ConnectionLost'
collect2: error: ld returned 1 exit status
make[2]: *** [redalert/CMakeFiles/VanillaRA.dir/build.make:3530: vanillara.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:741: redalert/CMakeFiles/VanillaRA.dir/all] Error 2
make: *** [Makefile:114: all] Error 2

OS: Manjaro Recent (20.1.1 Mikah)
Kernel: 5.8.11-1-MANJARO

Reimplement timers in a portable manner

Later games used to poll the system time on request and calculate the ticks based on frequency. We should probably do the same.

This is up for grabs and should be rather simple to implement. @OmniBlade noted that the C++ chrono could be used for this.

Sound crash after playing around with TD mission startups

Glad I run both games in a debugger all the time. I got a somewhat useful backtrace. This is with August 12th hotfix on top of vanilla:

Unhandled exception: page fault on read access to 0x06f200a4 in 32-bit code (0xf7c568f6).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:006b GS:0063
 EIP:f7c568f6 ESP:0244f488 EBP:0244f4a8 EFLAGS:00210202(  R- --  I   - - - )
 EAX:06f200a4 EBX:030ee048 ECX:00000002 EDX:0244f536
 ESI:0057422e EDI:0057422a
Stack dump:
0x0244f488:  030ee048 7f3a220f 0244f536 06f200a4
0x0244f498:  00000002 7bca0026 0266f634 0244f4c0
0x0244f4a8:  0244f4f8 004304c3 0266f634 003f8000
0x0244f4b8:  0244f4c8 004304c3 0244f536 06f200a4
0x0244f4c8:  00000002 c0000001 0244f4f0 0244f550
0x0244f4d8:  0244f538 7f2e78a0 0244f500 00004216
Backtrace:
=>0 0xf7c568f6 (0x0244f4a8)
  1 0x004304c3 _Z11Simple_CopyPPvPiS0_S1_S0_i+0x8a(source=0x5741c9, ssize=0x5741cd, alternate=0x57422a, altsize=0x57422e, dest=0x244f52c, size=0x2) [\\?\unix\home\hifi\work\Vanilla-Conquer\common\soundio.cpp:1481] in vanillatd (0x0244f4f8)
  2 0x0042e82c _Z11Sample_CopyP17SampleTrackerTypePPvPiS2_S3_S1_i13SCompressTypeS1_Ps+0xa7(st=0x574197, source=0x5741c9, ssize=0x5741cd, alternate=0x57422a, altsize=0x57422e, dest=0x30ee048, size=0x2000, scomp=SCOMP_SOS, trailer=0x5741fd, trailersize=0x5741fb) [\\?\unix\home\hifi\work\Vanilla-Conquer\common\soundio.cpp:1531] in vanillatd (0x0244f548)
  3 0x00446afe _Z20Maintenance_Callbackv+0x1e9() [\\?\unix\home\hifi\work\Vanilla-Conquer\common\soundio.cpp:149] in vanillatd (0x0244f5d8)
  4 0x004476f2 _Z20Sound_Timer_Callbackjjmmm@20+0x29(uID=0, uMsg=0, dwUser=0, dw1=0, dw2=0) [\\?\unix\home\hifi\work\Vanilla-Conquer\common\soundio.cpp:648] in vanillatd (0x0244f5f8)
  5 0x004387c8 _Z14Sound_Callbackv+0x5f() [\\?\unix\home\hifi\work\Vanilla-Conquer\common\soundio.cpp:528] in vanillatd (0x0244f638)
  6 0x00496a28 _ZN10ThemeClass2AIEv+0xb7() [\\?\unix\home\hifi\work\Vanilla-Conquer\tiberiandawn\theme.cpp:201] in vanillatd (0x0244f668)
  7 0x0046663e _Z9Call_Backv+0x1d() [\\?\unix\home\hifi\work\Vanilla-Conquer\tiberiandawn\conquer.cpp:1113] in vanillatd (0x0244f708)
  8 0x0043a504 _Z15Fade_Palette_ToPvjPFvvE+0xa7(palette1=0x2550940, delay=0xf, callback=0x466620) [\\?\unix\home\hifi\work\Vanilla-Conquer\common\palette.cpp:187] in vanillatd (0x0244f738)
  9 0x00430118 _Z11Select_Gameb+0x1667(fade=0x1) [\\?\unix\home\hifi\work\Vanilla-Conquer\tiberiandawn\init.cpp:1529] in vanillatd (0x0244fa58)
  10 0x00468f06 _Z9Main_GameiPPc+0x41(argc=0x2, argv=0x244fdd8) [\\?\unix\home\hifi\work\Vanilla-Conquer\tiberiandawn\conquer.cpp:152] in vanillatd (0x0244fb28)
  11 0x00427e7d WinMain@16+0xc9c(instance=0x400000, command_line="-CD.", command_show=0xa) [\\?\unix\home\hifi\work\Vanilla-Conquer\tiberiandawn\startup.cpp:577] in vanillatd (0x0244fe68)
  12 0x0052174d strtrim+0x304(str="ï Uï∞] %ädK{ÉÉÉÉÉÉÉÉï Uï∞] %êdK{ÉÉÉÉÉÉÉÉï Uï∞] %îdK{ÉÉÉÉÉÉÉÉï Uï∞] %ÉdK{ÉÉÉÉÉÉÉÉï Uï∞] %ödK{ÉÉÉÉÉÉÉÉï Uï∞] %ÿdK{ÉÉÉÉÉÉÉÉï Uï∞] %£dK{ÉÉÉÉÉÉÉÉï Uï∞] %ádK{ÉÉÉÉÉÉÉÉï Uï∞] %ñdK{ÉÉÉÉÉÉÉÉï Uï∞] %¿dK{ÉÉÉÉÉÉÉÉï Uï∞] %¼dK{ÉÉÉÉÉÉÉÉ
ï Uï∞] %░dK{ÉÉÉÉÉÉÉÉï Uï∞] %░dK{ÉÉÉÉÉÉÉÉï Uï∞] %┤dK{ÉÉÉÉÉÉÉÉï Uï∞] %┤dK{ÉÉÉÉÉÉÉÉï Uï∞] %╕dK{ÉÉÉÉÉÉÉÉï Uï∞] %╝dK{ÉÉÉÉÉÉÉÉï Uï∞] %└dK{ÉÉÉÉÉÉÉÉï Uï∞] %─dK{ÉÉÉÉÉÉÉÉï Uï∞] %╚dK{ÉÉÉÉÉÉÉÉï Uï∞] %╠dK{ÉÉÉÉÉÉÉÉï Uï∞] %╨dK{ÉÉÉÉÉÉÉÉï Uï∞] %╘dK{ÉÉÉÉÉÉÉÉï Uï∞] %╪dK{ÉÉÉ
ÉÉÉÉÉï Uï∞] %▄dK{ÉÉÉÉÉÉÉÉï Uï∞] %αdK{ÉÉÉÉÉÉÉÉï Uï∞] %ΣdK{ÉÉÉÉÉÉÉÉï Uï∞] %ΦdK{ÉÉÉÉÉÉÉÉï Uï∞] %∞dK{ÉÉÉÉÉÉÉÉï Uï∞] %≡dK{ÉÉÉÉÉÉÉÉï Uï∞] %⌠dK{ÉÉÉÉÉÉÉÉï Uï∞] %°dK{ÉÉÉÉÉÉÉÉï Uï∞] %ⁿdK{ÉÉÉÉÉÉÉÉï Uï∞] %") [\\?\unix\home\hifi\work\Vanilla-Conquer\common\misc.c:167] in vanillatd (0x0244fe88)
  13 0x00401386 _Z5UnionRK4RectS1_+0x401385(rect1=0x7b454882, rect2=0x3ff000) [\\?\unix\home\hifi\work\Vanilla-Conquer\common\rect.cpp:197] in vanillatd (0x0244ff28)
  14 0x7b454882 in kernel32 (+0x34881) (0x0244ff48)
  15 0x7b454cfc in kernel32 (+0x34cfb) (0x0244ffd8)
  16 0x7b45488e in kernel32 (+0x3488d) (0x0244ffec)
0xf7c568f6: movzbl      0x0(%eax),%ebx

I first started the GDI mission, played a few seconds, abort, NOD mission, few seconds, abort, GDI mission, boom before the first rendered map frame.

High CPU usage.

Both games at least standalone consume close to 100% of a CPU core at pretty much all times by refreshing menus as fast as possible and by busy waiting between logic ticks. Needs some judicious use of at least Sleep(1) or equivalents to force the game to give up its time slice for most menu loops in the game and Sync_Delay().

[Linux] "Command & Conquer is unable to detect your CD ROM drive"

I built the Linux executable, installed the game from the ISOs, kept them mounted and tried to run vanillaconquer, but all I get is an error message saying "Command & Conquer is unable to detect your CD ROM drive" in the game window, and the terminal log ends with

C&C95 - About to search for CD drives
Prog_End()C&C95 - About to call Sound_End.
C&C95 - Returned from Sound_End.
C&C95 - Deleting mouse object.
C&C95 - Deleting palette object.

Clicking the save button crashes the game (in Linux at least)

Just that, clicking Save Mission in the menu causes a crash. Here's the gdb log:

C&C95 - Scenario read OK.
C&C95 - About to call Options.Set.
C&C95 - About to return from Start_Scenario.
C&C95 - Scenario started OK.
C&C95 - Initialising message system.
C&C95 - About to call Call_Back.
*** stack smashing detected ***: terminated

Thread 1 "vanillatd" received signal SIGABRT, Aborted.
0xf7fce549 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fce549 in __kernel_vsyscall ()
#1  0xf7a0a1ea in raise () from /usr/lib32/libc.so.6
#2  0xf79f240e in abort () from /usr/lib32/libc.so.6
#3  0xf7a4eaac in __libc_message () from /usr/lib32/libc.so.6
#4  0xf7aee8cc in __fortify_fail () from /usr/lib32/libc.so.6
#5  0xf7aee89d in __stack_chk_fail () from /usr/lib32/libc.so.6
#6  0x5666c048 in __stack_chk_fail_local ()
#7  0x56659fa4 in Find_File_Data_Posix::FindNextWithFilter (this=0x56bc13c0) at /home/hazelnot/git/Vanilla-Conquer/common/file_posix.cpp:81
#8  0x5665a07b in Find_File_Data_Posix::FindFirst (this=0x56bc13c0, fname=0x56673dba "SAVEGAME.*")
    at /home/hazelnot/git/Vanilla-Conquer/common/file_posix.cpp:93
#9  0x5664f07e in Find_First (fname=0x56673dba "SAVEGAME.*", mode=0, ffblk=0xffffcc3c) at /home/hazelnot/git/Vanilla-Conquer/common/file.cpp:11
#10 0x565df6b3 in LoadOptionsClass::Fill_List (this=0xffffcf98, list=0xffffcde9) at /home/hazelnot/git/Vanilla-Conquer/tiberiandawn/loaddlg.cpp:587
#11 0x565deaf9 in LoadOptionsClass::Process (this=0xffffcf98) at /home/hazelnot/git/Vanilla-Conquer/tiberiandawn/loaddlg.cpp:250
#12 0x565b91e8 in GameOptionsClass::Process (this=0x566c4ce0 <Options>) at /home/hazelnot/git/Vanilla-Conquer/tiberiandawn/goptions.cpp:420
#13 0x5658d657 in Main_Game (argc=2, argv=0xffffd2d4) at /home/hazelnot/git/Vanilla-Conquer/tiberiandawn/conquer.cpp:279
#14 0x5661faa1 in main (argc=2, argv=0xffffd2d4) at /home/hazelnot/git/Vanilla-Conquer/tiberiandawn/startup.cpp:482

Replace x86 assembly with C

This is a blocker for 64-bit builds and overall portability. This also removes the dependency on JWasm from non-MSVC builds which is nice.

This should be a CMake option that is on by default while keeping the assembly versions around.

common

  • drawmisca.asm
  • irandoma.asm
  • keyfbuff.asm
  • lcwcomp.asm
  • miscasm.asm
  • tobuff.asm
  • txtprnt.asm
  • xordelta.asm

tiberiandawn

  • miscasma.asm
  • stamp.asm

redalert

  • stamp.asm

[RA] Game crashes when removing (destroying or selling) a building with a bib

I think the explosion of the oil derrick might be causing it, cause that's about when the crash happens, but I can't get in there to properly test it without getting zapped by the Tesla Coils or getting a grenade thrown by an enemy onto the barrels.

image

This is the gdb log:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff737d640 (LWP 19756)]
[Thread 0x7ffff737d640 (LWP 19756) exited]
[New Thread 0x7ffff6cbb640 (LWP 19757)]
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
[New Thread 0x7ffff64ba640 (LWP 19758)]
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
[New Thread 0x7ffff5cb9640 (LWP 19759)]
[New Thread 0x7fffd3362640 (LWP 19760)]
[New Thread 0x7fffd2b61640 (LWP 19761)]
[New Thread 0x7fffd2360640 (LWP 19762)]
[New Thread 0x7fffd1b5f640 (LWP 19763)]
[New Thread 0x7fffd135e640 (LWP 19764)]
[New Thread 0x7fffd0b5d640 (LWP 19765)]
[New Thread 0x7fffbbfff640 (LWP 19766)]
[New Thread 0x7fffbb7fe640 (LWP 19767)]
[New Thread 0x7fffbaffd640 (LWP 19768)]
[New Thread 0x7fffba7fc640 (LWP 19769)]
[New Thread 0x7fffb9ffb640 (LWP 19770)]
[New Thread 0x7fffb97fa640 (LWP 19771)]
[New Thread 0x7fffb8ff9640 (LWP 19772)]
[New Thread 0x7fff97fff640 (LWP 19773)]
[New Thread 0x7fff977fe640 (LWP 19774)]
[New Thread 0x7fff96ffd640 (LWP 19775)]
[New Thread 0x7fff967fc640 (LWP 19776)]
[New Thread 0x7fff95ffb640 (LWP 19777)]
[New Thread 0x7fff957fa640 (LWP 19778)]
[New Thread 0x7fff94ff9640 (LWP 19779)]
[New Thread 0x7fff77fff640 (LWP 19780)]
[New Thread 0x7fff777fe640 (LWP 19781)]
[New Thread 0x7fff76ffd640 (LWP 19782)]
[Thread 0x7fff76ffd640 (LWP 19782) exited]
[New Thread 0x7fff76ffd640 (LWP 19783)]
[Thread 0x7fff76ffd640 (LWP 19783) exited]
[New Thread 0x7fff76ffd640 (LWP 19785)]
[Thread 0x7fff76ffd640 (LWP 19785) exited]
[New Thread 0x7fff76ffd640 (LWP 19786)]
Loaded scenario fileSCG01EA.INIassert 'IsActive' failed at line 249 in module /home/hazelnot/git/Vanilla-Conquer/redalert/smudge.cpp.
Prog_End()assert 'IsActive' failed at line 249 in module /home/hazelnot/git/Vanilla-Conquer/redalert/smudge.cpp.
[Thread 0x7ffff5cb9640 (LWP 19759) exited]
[Thread 0x7ffff64ba640 (LWP 19758) exited]

Thread 1 "vanillara" received signal SIGSEGV, Segmentation fault.
SmudgeClass::Disown (this=0x5555569a4a40, cell=7485) at /home/hazelnot/git/Vanilla-Conquer/redalert/smudge.cpp:251
--Type <RET> for more, q to quit, c to continue without paging--
251	   if (Class->IsBib) {
(gdb) bt
#0  SmudgeClass::Disown (this=0x5555569a4a40, cell=7485) at /home/hazelnot/git/Vanilla-Conquer/redalert/smudge.cpp:251
#1  0x000055555559eebd in BuildingClass::Mark (this=0x55555772dad0, mark=MARK_UP) at /home/hazelnot/git/Vanilla-Conquer/redalert/building.cpp:761
#2  0x00005555556411f4 in ObjectClass::Limbo (this=0x55555772dad0) at /home/hazelnot/git/Vanilla-Conquer/redalert/object.cpp:1429
#3  0x00005555556536d5 in RadioClass::Limbo (this=0x55555772dad0) at /home/hazelnot/git/Vanilla-Conquer/redalert/radio.cpp:260
#4  0x00005555555a3e38 in BuildingClass::Limbo (this=0x55555772dad0) at /home/hazelnot/git/Vanilla-Conquer/redalert/building.cpp:2506
#5  0x000055555559f742 in BuildingClass::AI (this=0x55555772dad0) at /home/hazelnot/git/Vanilla-Conquer/redalert/building.cpp:966
#6  0x000055555562eeb3 in LogicClass::AI (this=0x55555579d780 <Logic>) at /home/hazelnot/git/Vanilla-Conquer/redalert/logic.cpp:350
#7  0x00005555555c890e in Main_Loop () at /home/hazelnot/git/Vanilla-Conquer/redalert/conquer.cpp:1958
#8  0x00005555555c5557 in Main_Game (argc=2, argv=0x7fffffffe0a8) at /home/hazelnot/git/Vanilla-Conquer/redalert/conquer.cpp:323
#9  0x0000555555677923 in main (argc=2, argv=0x7fffffffe0a8) at /home/hazelnot/git/Vanilla-Conquer/redalert/startup.cpp:578

VanillaRA SDL2 port

The game currently crashes on Linux with fortify enabled due to stack smashing so I haven't yet got around to clean up the code other than what was done before to get the game linking.

SDL2 port (Windows)

Keep winapi stuff around, change rendering and event engine from DirectDraw to SDL2.

Remove ADVAPI32.dll dependency from Red Alert remaster dll

To remove the dependency to ADVAPI32.dll.

diff -urN a/redalert/init.cpp b/redalert/init.cpp
--- a/redalert/init.cpp	2020-08-10 18:34:52.240247730 +0200
+++ b/redalert/init.cpp	2020-08-10 18:36:42.375571959 +0200
@@ -3371,6 +3371,8 @@
 
 bool bUsingDVD = false;
 
+#ifndef REMASTER_BUILD
+
 const char* Game_Registry_Key();
 
 //***********************************************************************************************
@@ -3411,6 +3413,8 @@
     return bUsingDVD;
 }
 
+#endif
+
 //***********************************************************************************************
 bool Using_DVD()
 {

Portable audio engine

Initial audio engine implementation (#17) will be dsound. We need a portable one for non-Windows targets.

Suggestions include OpenAL and SDL_mixer at least.

Program icons

Project could do with some cleanly license icons that can be included in a GPL3 project.

[TD] Crash in LCW_Uncompress when loading click maps.

Didn't catch this when testing the replacment LCW code. The C code that RA uses does not do bounds checking to make sure it writes within the buffer which is normally fine because LCW comressed data is supposed to end with a terminating command. It looks like the clickmaps were written with an older version of the compressor that didn't terminate it and relied on the decoder checking the end of the buffer to know when to stop.

Add x86 assembly porting testing system

To verify the C ports are correct it would be best to have a CMake target which builds a test suite that runs data against both versions - original MASM and C.

Run under Wine RedAlert.dll crashes during gameplay

To reproduce the crash, RedAlert.dll needs to be build with mingw-w64-gcc and you need to destroy the barrels on the upper right side on soviet 1.

wine-stable 5.0.1

Unhandled exception: page fault on write access to 0x00000000 in 32-bit code (0x100ef17b).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:100ef17b ESP:04b0f44c EBP:04b0f454 EFLAGS:00010212(  R- --  I   -A- - )
 EAX:00000000 EBX:35403ac0 ECX:00000000 EDX:1046b594
 ESI:00000002 EDI:35403ac0
Stack dump:
0x04b0f44c:  00000003 00000000 04b0f4c4 100c4a53
0x04b0f45c:  00000003 ffffffff 00000001 ffffffff
0x04b0f46c:  00000000 04b0f4e8 04b0f4b4 05c56b6f
0x04b0f47c:  35403ac0 05c56b30 04b0f401 10197a40
0x04b0f48c:  1019d178 04b0f4c4 100c4b0f 04b0f45c
0x04b0f49c:  00000000 04b0f4e8 04b0f403 00000000
Backtrace:
=>0 0x100ef17b AbstractClass::AI+0x23() [\\?\unix\tmp\Vanilla-Conquer\redalert\abstract.h:94] in redalert (0x04b0f454)
  1 0x100c4a53 ObjectClass+0x52() [\\?\unix\tmp\Vanilla-Conquer\redalert\object.cpp:140] in redalert (0x04b0f4c4)
  2 0x1014b1ea AnimClass+0x79() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:558] in redalert (0x04b0f554)
  3 0x1014ad74 AnimClass::Middle+0x4eb() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:1110] in redalert (0x04b0f5f4)
  4 0x1014a76b AnimClass::Start+0xe6() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:1154] in redalert (0x04b0f624)
  5 0x1014b59f AnimClass+0x42e() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:604] in redalert (0x04b0f6b4)
  6 0x1014acfd AnimClass::Middle+0x474() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:1104] in redalert (0x04b0f754)
  7 0x1014a196 AnimClass::AI+0x5c9() [\\?\unix\tmp\Vanilla-Conquer\redalert\anim.cpp:838] in redalert (0x04b0f7a4)
  8 0x100b284e LogicClass::AI+0x769() [\\?\unix\tmp\Vanilla-Conquer\redalert\logic.cpp:349] in redalert (0x04b0f884)
  9 0x10053966 CNC_Advance_Instance+0x1c1() [\\?\unix\tmp\Vanilla-Conquer\redalert\dllinterface.cpp:1816] in redalert (0x04b0f8f4)
  10 0x0054c401 EntryPoint+0xffffffff() in instanceserverg (0x04b0f9b4)
  11 0x005fc7bf EntryPoint+0xffffffff() in instanceserverg (0x04b0fa84)
  12 0x006380c3 EntryPoint+0xffffffff() in instanceserverg (0x04b0fac4)
  13 0x00488f3e EntryPoint+0xffffffff() in instanceserverg (0x04b0fad4)
  14 0x008d2ca1 EntryPoint+0xffffffff() in instanceserverg (0x04b0fb2c)
  15 0x00651ae8 EntryPoint+0xffffffff() in instanceserverg (0x04b0fee0)
  16 0x008d4113 EntryPoint+0xffffffff() in instanceserverg (0x04b0ff10)
  17 0x018362a4 _CItan+0x44513() in ucrtbase (0x04b0ff4c)
  18 0x7bcb015c call_thread_func_wrapper+0xb() in ntdll (0x04b0ff5c)
  19 0x7bcb3766 RtlCaptureStackBackTrace+0x195() in ntdll (0x04b0ffdc)
  20 0x7bcb014e call_thread_exit_func+0x31() in ntdll (0x04b0ffec)
0x100ef17b AbstractClass::AI+0x23 [\\?\unix\tmp\Vanilla-Conquer\redalert\abstract.h:94] in redalert: movl	%edx,0x0(%eax)
94	        , Height(0){};

Release Build with enabled LTO cause crash

Building a release with LTO enabled causes crashes, to reproduce in sowjet 1 directly after level start.

Changes to CMake

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG -w -fpermissive -fpack-struct=1 -fdata-sections -ffunction-sections -Wl,--gc-sections -DNOMINMAX")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -DNDEBUG -w -fpermissive -fpack-struct=1 -fdata-sections -ffunction-sections -Wl,--gc-sections -DNOMINMAX")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)

This patch will fix the crash, yet I don't understand why the call to an empty Assert_Failure() is required.

diff -urN a/redalert/function.h b/redalert/function.h
--- a/redalert/function.h	2020-08-05 18:58:05.827350761 +0200
+++ b/redalert/function.h	2020-08-05 18:59:24.812297196 +0200
@@ -401,11 +401,7 @@
 #endif // assert
 void Assert_Failure(char* expression, int line, char* file);
 
-#ifdef NDEBUG
-#define assert(__ignore) ((void)0)
-#else
 #define assert(expr) ((expr) ? (void)0 : Assert_Failure(#expr, __LINE__, __FILE__))
-#endif // NDEBUG
 
 #endif //__BORLANDC__
 
diff -urN a/redalert/winstub.cpp b/redalert/winstub.cpp
--- a/redalert/winstub.cpp	2020-08-05 18:58:05.839350904 +0200
+++ b/redalert/winstub.cpp	2020-08-05 19:00:34.598141531 +0200
@@ -652,7 +652,6 @@
     Set_Palette(palette);
 }
 
-#ifndef NDEBUG
 /***********************************************************************************************
  * Assert_Failure -- display the line and source file where a failed assert occurred           *
  *                                                                                             *
@@ -670,6 +669,7 @@
 
 void Assert_Failure(char* expression, int line, char* file)
 {
+    #ifndef NDEBUG
     char assertbuf[256];
     char timebuff[512];
     SYSTEMTIME time;
@@ -716,8 +716,8 @@
     Prog_End(assertbuf, false);
     // PostQuitMessage( 0 );
     // ExitProcess(0);
+    #endif
 }
-#endif
 
 /***********************************************************************************************
  * Memory_Error_Handler -- Handle a possibly fatal failure to allocate memory                  *

Without this patch -fno-ipa-icf was required as a workaround.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.