Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Modified 2026 by İlyas Akın for the macOS/Linux port; see NOTICE.md and the git history.
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: MiniLog.cpp ///////////////////////////////////////////////////////////
// Alternative logging
// Author: Matthew D. Campbell, January 2003
////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "zhio.h"
#include "Common/MiniLog.h"
#include "Common/ExecutableDirectory.h"
#ifdef DEBUG_LOGGING
LogClass::LogClass(const char *fname)
{
char buffer[ _MAX_PATH ];
#if defined(_WIN32)
getExecutableDirectory( buffer, sizeof( buffer ), FALSE );
#else
getLogDirectory( buffer, sizeof( buffer ), FALSE ); // outside an app bundle (P1)
#endif
AsciiString fullPath;
fullPath.format("%s\\%s", buffer, fname);
m_fp = zh_fopen(fullPath.str(), "wt");
}
LogClass::~LogClass()
{
if (m_fp)
{
fclose(m_fp);
}
}
void LogClass::log(const char *fmt, ...)
{
if (!m_fp)
return;
static char buf[1024];
static Int lastFrame = 0;
static Int lastIndex = 0;
if (lastFrame != TheGameLogic->getFrame())
{
lastFrame = TheGameLogic->getFrame();
lastIndex = 0;
}
va_list va;
va_start( va, fmt );
vsnprintf(buf, 1024, fmt, va );
buf[1023] = 0;
va_end( va );
char *tmp = buf;
while (tmp && *tmp)
{
if (*tmp == '\r' || *tmp == '\n')
{
*tmp = ' ';
}
++tmp;
}
fprintf(m_fp, "%d:%d %s\n", lastFrame, lastIndex++, buf);
fflush(m_fp);
}
#endif // DEBUG_LOGGING