Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/System/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extern const char *gAppPrefix; /// So WB can have a different log file name.
// TheSuperHackers @info Must not use static RAII types when set in DebugInit,
// because DebugInit can be called during static module initialization before the main function is called.
#ifdef DEBUG_LOGGING
static FILE *theLogFile = NULL;
FILE *theLogFile = NULL;
static char theLogFileName[ _MAX_PATH ];
static char theLogFileNamePrev[ _MAX_PATH ];
#endif
Expand Down
4 changes: 2 additions & 2 deletions GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Bool TheDebugIgnoreSyncErrors = FALSE;
extern Int DX8Wrapper_PreserveFPU;

#ifdef DEBUG_CRC
Int TheCRCFirstFrameToLog = -1;
Int TheCRCFirstFrameToLog = 0;//-1;
UnsignedInt TheCRCLastFrameToLog = 0xffffffff;
Bool g_keepCRCSaves = FALSE;
Bool g_saveDebugCRCPerFrame = FALSE;
Expand All @@ -53,7 +53,7 @@ Bool g_crcModuleDataFromLogic = FALSE;
Bool g_crcModuleDataFromClient = FALSE;
Bool g_verifyClientCRC = FALSE; // verify that GameLogic CRC doesn't change from client
Bool g_clientDeepCRC = FALSE;
Bool g_logObjectCRCs = FALSE;
Bool g_logObjectCRCs = TRUE;//FALSE;
#endif

#if defined(RTS_DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ GlobalData::GlobalData()
#endif

#ifdef DEBUG_CRASHING
m_debugIgnoreAsserts = FALSE;
m_debugIgnoreAsserts = TRUE;
#endif

#ifdef DEBUG_STACKTRACE
Expand Down
22 changes: 21 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ void RecorderClass::logCRCMismatch( void )
m_file->seek(fileSize, File::seekMode::START);
DEBUG_ASSERTCRASH(res == fileSize, ("Could not seek to end of file!"));

m_wasDesync = TRUE;
#if defined(RTS_DEBUG)
if (TheGlobalData->m_saveStats)
{
m_wasDesync = TRUE;
unsigned long bufSize = MAX_COMPUTERNAME_LENGTH + 1;
char computerName[MAX_COMPUTERNAME_LENGTH + 1];
if (!GetComputerName(computerName, &bufSize))
Expand Down Expand Up @@ -350,6 +350,18 @@ void RecorderClass::cleanUpReplayFile( void )
#endif // DEBUG_LOGGING
}
#endif
#ifdef DEBUG_LOGGING
const char* logFileName = DebugGetLogFileName();
if (logFileName[0] == '\0')
return;

AsciiString targetFilepath = getReplayDir();
targetFilepath.concat(getLastReplayFileName());
targetFilepath.concat(".txt");

DEBUG_LOG(("Copy log to replayfolder to %s", targetFilepath.str()));
CopyFile(logFileName, targetFilepath.str(), FALSE);
#endif // DEBUG_LOGGING
}

/**
Expand Down Expand Up @@ -553,6 +565,14 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In
// We have to make sure the replay dir exists.
TheFileSystem->createDirectory(filepath);

#ifdef DEBUG_LOGGING
// Delete old logfile next to replay
m_fileName = getReplayDir();
m_fileName.concat(getLastReplayFileName());
m_fileName.concat(".txt");
DeleteFileA(m_fileName.str());
#endif

m_fileName = getLastReplayFileName();
m_fileName.concat(getReplayExtention());
filepath.concat(m_fileName);
Expand Down
27 changes: 27 additions & 0 deletions GeneralsMD/Code/Main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "Common/GameEngine.h"
#include "Common/GameSounds.h"
#include "Common/Debug.h"
#include "Common/CRCDebug.h"
#include "Common/GameMemory.h"
#include "Common/StackDump.h"
#include "Common/MessageStream.h"
Expand Down Expand Up @@ -854,6 +855,32 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,

CommandLine::parseCommandLineForStartup();

if(!TheGlobalData->m_headless)
{
#if defined(DEBUG_LOGGING) && defined(DEBUG_CRC) && (defined(_MSC_VER) && _MSC_VER < 1300) && RETAIL_COMPATIBLE_CRC
extern FILE *theLogFile;
if (theLogFile == NULL || NET_CRC_INTERVAL != 1)
{
MessageBoxW(NULL, L"This is a special build of the game that helps debugging mismatches.\n"
L"This version requires write permission on the game folder. To fix this, you can start the game as admin or copy the game folder into a user folder and run the game from there.",
L"Super Hackers Build", MB_ICONERROR);
return 1;
}

MessageBoxW(NULL, L"This is a special build of the game that helps debugging mismatches.\n\n"
L"Some info about this:\n"
L" - This version might run a bit slower.\n"
L" - If a mismatch occurs, a log file 00000000.txt appears next to the replay. The devs will need both the replay and the log file.\n"
L" - This version is still compatible with the 1.04 retail game. But to debug mismatches with this, the devs will need the replays and log files of two players who got a mismatch with each other.\n"
L"\nThanks for testing!",
L"Super Hackers Build", 0);
#else
MessageBoxW(NULL, L"You downloaded the wrong exe!",
L"Super Hackers Build", MB_ICONERROR);
return 1;
#endif
}

// register windows class and create application window
if(!TheGlobalData->m_headless && initializeAppWindows(hInstance, nCmdShow, TheGlobalData->m_windowed) == false)
return exitcode;
Expand Down
Loading