diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 021daf76cb0..24f2d356c15 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -20,7 +20,7 @@ set(GAMEENGINE_SRC # Include/Common/BorderColors.h # Include/Common/BuildAssistant.h # Include/Common/ClientUpdateModule.h -# Include/Common/CommandLine.h + Include/Common/CommandLine.h Include/Common/crc.h Include/Common/CRCDebug.h # Include/Common/CriticalSection.h @@ -569,7 +569,7 @@ set(GAMEENGINE_SRC # Source/Common/Bezier/BezFwdIterator.cpp # Source/Common/Bezier/BezierSegment.cpp # Source/Common/BitFlags.cpp -# Source/Common/CommandLine.cpp + Source/Common/CommandLine.cpp Source/Common/crc.cpp Source/Common/CRCDebug.cpp Source/Common/DamageFX.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CommandLine.h b/Core/GameEngine/Include/Common/CommandLine.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/CommandLine.h rename to Core/GameEngine/Include/Common/CommandLine.h diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/Core/GameEngine/Source/Common/CommandLine.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp rename to Core/GameEngine/Source/Common/CommandLine.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 4d677083d8e..e9373cec104 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -17,7 +17,7 @@ set(GAMEENGINE_SRC Include/Common/BitFlagsIO.h Include/Common/BuildAssistant.h Include/Common/ClientUpdateModule.h - Include/Common/CommandLine.h +# Include/Common/CommandLine.h # Include/Common/crc.h # Include/Common/CRCDebug.h Include/Common/CriticalSection.h @@ -520,7 +520,7 @@ set(GAMEENGINE_SRC Source/Common/Bezier/BezFwdIterator.cpp Source/Common/Bezier/BezierSegment.cpp Source/Common/BitFlags.cpp - Source/Common/CommandLine.cpp +# Source/Common/CommandLine.cpp # Source/Common/crc.cpp # Source/Common/CRCDebug.cpp # Source/Common/DamageFX.cpp diff --git a/Generals/Code/GameEngine/Include/Common/CommandLine.h b/Generals/Code/GameEngine/Include/Common/CommandLine.h deleted file mode 100644 index 2ef28727c3c..00000000000 --- a/Generals/Code/GameEngine/Include/Common/CommandLine.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -** Command & Conquer Generals(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 . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// CommandLine.h -// The command-line interface -// Author: Matthew D. Campbell, September 2001 - -#pragma once - -class CommandLine -{ -public: - - static void parseCommandLineForStartup(); - static void parseCommandLineForEngineInit(); -}; diff --git a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp deleted file mode 100644 index ff670d4ee85..00000000000 --- a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp +++ /dev/null @@ -1,1452 +0,0 @@ -/* -** Command & Conquer Generals(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 . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/ArchiveFileSystem.h" -#include "Common/CommandLine.h" -#include "Common/CRCDebug.h" -#include "Common/LocalFileSystem.h" -#include "Common/Recorder.h" -#include "Common/version.h" -#include "GameClient/ClientInstance.h" -#include "GameClient/TerrainVisual.h" // for TERRAIN_LOD_MIN definition -#include "GameClient/GameText.h" -#include "GameNetwork/NetworkDefs.h" -#include "WWLib/trim.h" - - - - -Bool TheDebugIgnoreSyncErrors = FALSE; -extern Int DX8Wrapper_PreserveFPU; - -#ifdef DEBUG_CRC -Int TheCRCFirstFrameToLog = -1; -UnsignedInt TheCRCLastFrameToLog = 0xffffffff; -Bool g_keepCRCSaves = FALSE; -Bool g_saveDebugCRCPerFrame = FALSE; -AsciiString g_saveDebugCRCPerFrameDir; -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; -#endif - -#if defined(RTS_DEBUG) -extern Bool g_useStringFile; -#endif - -// Retval is number of cmd-line args eaten -typedef Int (*FuncPtr)( char *args[], int num ); - -static const UnsignedByte F_NOCASE = 1; // Case-insensitive - -struct CommandLineParam -{ - const char *name; - FuncPtr func; -}; - -static void ConvertShortMapPathToLongMapPath(AsciiString &mapName) -{ - AsciiString path = mapName; - AsciiString token; - AsciiString actualpath; - - if ((path.find('\\') == nullptr) && (path.find('/') == nullptr)) - { - DEBUG_CRASH(("Invalid map name %s", mapName.str())); - return; - } - path.nextToken(&token, "\\/"); - while (!token.endsWithNoCase(".map") && (!token.isEmpty())) - { - actualpath.concat(token); - actualpath.concat('\\'); - path.nextToken(&token, "\\/"); - } - - if (!token.endsWithNoCase(".map")) - { - DEBUG_CRASH(("Invalid map name %s", mapName.str())); - } - // remove the .map from the end. - token.truncateBy(4); - - actualpath.concat(token); - actualpath.concat('\\'); - actualpath.concat(token); - actualpath.concat(".map"); - - mapName = actualpath; -} - -//============================================================================= -//============================================================================= -Int parseNoLogOrCrash(char *args[], int) -{ - DEBUG_CRASH(("-NoLogOrCrash not supported in this build")); - return 1; -} - -//============================================================================= -//============================================================================= -Int parseWin(char *args[], int) -{ - TheWritableGlobalData->m_windowed = true; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoMusic(char *args[], int) -{ - TheWritableGlobalData->m_musicOn = false; - - return 1; -} - - -//============================================================================= -//============================================================================= -Int parseNoVideo(char *args[], int) -{ - TheWritableGlobalData->m_videoOn = false; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseFPUPreserve(char *args[], int argc) -{ - if (argc > 1) - { - DX8Wrapper_PreserveFPU = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parseUseWaveEditor(char *args[], int num) -{ - TheWritableGlobalData->m_usingWaterTrackEditor = TRUE; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseFullViewport(char *args[], int num) -{ - TheWritableGlobalData->m_viewportHeightScale = 1.0f; - - return 1; -} - -#if defined(RTS_DEBUG) - -//============================================================================= -//============================================================================= -Int parseUseCSF(char *args[], int) -{ - g_useStringFile = FALSE; - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoInputDisable(char *args[], int) -{ - TheWritableGlobalData->m_disableScriptedInputDisabling = true; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoFade(char *args[], int) -{ - TheWritableGlobalData->m_disableCameraFade = true; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoMilCap(char *args[], int) -{ - TheWritableGlobalData->m_disableMilitaryCaption = true; - - return 1; -} -#endif // RTS_DEBUG - -//============================================================================= -//============================================================================= -Int parseDebugCRCFromFrame(char *args[], int argc) -{ -#ifdef DEBUG_CRC - if (argc > 1) - { - TheCRCFirstFrameToLog = atoi(args[1]); - } -#endif - return 2; -} - -//============================================================================= -//============================================================================= -Int parseDebugCRCUntilFrame(char *args[], int argc) -{ -#ifdef DEBUG_CRC - if (argc > 1) - { - TheCRCLastFrameToLog = atoi(args[1]); - } -#endif - return 2; -} - -//============================================================================= -//============================================================================= -Int parseKeepCRCSave(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_keepCRCSaves = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseSaveDebugCRCPerFrame(char* args[], int argc) -{ -#ifdef DEBUG_CRC - if (argc > 1) - { - g_saveDebugCRCPerFrame = TRUE; - g_saveDebugCRCPerFrameDir = args[1]; - if (TheCRCFirstFrameToLog == -1) - TheCRCFirstFrameToLog = 0; - } -#endif - return 2; -} - -//============================================================================= -//============================================================================= -Int parseCRCLogicModuleData(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_crcModuleDataFromLogic = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseCRCClientModuleData(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_crcModuleDataFromClient = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseClientDeepCRC(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_clientDeepCRC = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseVerifyClientCRC(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_verifyClientCRC = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseLogObjectCRCs(char *args[], int argc) -{ -#ifdef DEBUG_CRC - g_logObjectCRCs = TRUE; -#endif - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNetCRCInterval(char *args[], int argc) -{ -#if defined(DEBUG_CRC) && !RETAIL_COMPATIBLE_NETWORKING - if (argc > 1) - { - NET_CRC_INTERVAL = atoi(args[1]); - } -#endif - return 2; -} - -//============================================================================= -//============================================================================= -Int parseReplayCRCInterval(char *args[], int argc) -{ -#ifdef DEBUG_CRC - if (argc > 1) - { - REPLAY_CRC_INTERVAL = atoi(args[1]); - } -#endif - return 2; -} - -//============================================================================= -//============================================================================= -Int parseNoDraw(char *args[], int argc) -{ -#ifdef DEBUG_CRC - TheWritableGlobalData->m_noDraw = TRUE; -#endif - return 1; -} - -#if defined(RTS_DEBUG) - -//============================================================================= -//============================================================================= -Int parseLogToConsole(char *args[], int) -{ -#ifdef ALLOW_DEBUG_UTILS - DebugSetFlags(DebugGetFlags() | DEBUG_FLAG_LOG_TO_CONSOLE); -#endif - return 1; -} - -#endif // RTS_DEBUG - -//============================================================================= -//============================================================================= -Int parseNoAudio(char *args[], int) -{ - TheWritableGlobalData->m_audioOn = false; - TheWritableGlobalData->m_speechOn = false; - TheWritableGlobalData->m_soundsOn = false; - TheWritableGlobalData->m_musicOn = false; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoWin(char *args[], int) -{ - TheWritableGlobalData->m_windowed = false; - - return 1; -} - -Int parseFullVersion(char *args[], int num) -{ - if (TheVersion && num > 1) - { - TheVersion->setShowFullVersion(atoi(args[1]) != 0); - } - return 1; -} - -Int parseNoShadows(char *args[], int) -{ - TheWritableGlobalData->m_useShadowVolumes = false; - TheWritableGlobalData->m_useShadowDecals = false; - - return 1; -} - -Int parseMapName(char *args[], int num) -{ - if (num == 2) - { - TheWritableGlobalData->m_mapName.set( args[ 1 ] ); - ConvertShortMapPathToLongMapPath(TheWritableGlobalData->m_mapName); - } - return 1; -} - -Int parseHeadless(char *args[], int num) -{ - TheWritableGlobalData->m_headless = TRUE; - TheWritableGlobalData->m_playIntro = FALSE; - TheWritableGlobalData->m_playSizzle = FALSE; - - // TheSuperHackers @fix bobtista 03/02/2026 Set DX8Wrapper_IsWindowed to false in headless - // mode so that ignoringAsserts() works correctly throughout the entire process lifetime, - // including during shutdown after TheGlobalData has been destroyed. - extern bool DX8Wrapper_IsWindowed; - DX8Wrapper_IsWindowed = false; - - return 1; -} - -Int parseReplay(char *args[], int num) -{ - if (num > 1) - { - AsciiString filename = args[1]; - if (!filename.endsWithNoCase(RecorderClass::getReplayExtention())) - { - printf("Invalid replay name \"%s\"\n", filename.str()); - exit(1); - } - TheWritableGlobalData->m_simulateReplays.push_back(filename); - - TheWritableGlobalData->m_playIntro = FALSE; - TheWritableGlobalData->m_playSizzle = FALSE; - TheWritableGlobalData->m_shellMapOn = FALSE; - - // Make replay playback possible while other clients (possible retail) are running - rts::ClientInstance::setMultiInstance(TRUE); - rts::ClientInstance::skipPrimaryInstance(); - - return 2; - } - return 1; -} - -Int parseJobs(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_simulateReplayJobs = atoi(args[1]); - if (TheGlobalData->m_simulateReplayJobs < SIMULATE_REPLAYS_SEQUENTIAL || TheGlobalData->m_simulateReplayJobs == 0) - { - printf("Invalid number of jobs: %d\n", TheGlobalData->m_simulateReplayJobs); - exit(1); - } - return 2; - } - return 1; -} - -Int parseXRes(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_xResolution = atoi(args[1]); - return 2; - } - return 1; -} - -Int parseYRes(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_yResolution = atoi(args[1]); - return 2; - } - return 1; -} - -#if defined(RTS_DEBUG) -//============================================================================= -//============================================================================= -Int parseLatencyAverage(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_latencyAverage = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parseLatencyAmplitude(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_latencyAmplitude = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parseLatencyPeriod(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_latencyPeriod = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parseLatencyNoise(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_latencyNoise = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parsePacketLoss(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_packetLoss = atoi(args[1]); - } - return 2; -} - -//============================================================================= -//============================================================================= -Int parseLowDetail(char *args[], int num) -{ - TheWritableGlobalData->m_terrainLOD = TERRAIN_LOD_MIN; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoDynamicLOD(char *args[], int num) -{ - TheWritableGlobalData->m_enableDynamicLOD = FALSE; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseNoStaticLOD(char *args[], int num) -{ - TheWritableGlobalData->m_enableStaticLOD = FALSE; - - return 1; -} - -//============================================================================= -//============================================================================= -Int parseFPSLimit(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_framesPerSecondLimit = atoi(args[1]); - } - return 2; -} - -//============================================================================= -Int parseNoViewLimit(char *args[], int) -{ - TheWritableGlobalData->m_useCameraConstraints = FALSE; - - return 1; -} - -Int parseWireframe(char *args[], int) -{ - TheWritableGlobalData->m_wireframe = TRUE; - - return 1; -} - -Int parseShowCollision(char *args[], int) -{ - TheWritableGlobalData->m_showCollisionExtents = TRUE; - - return 1; -} - -Int parseNoShowClientPhysics(char *args[], int) -{ - TheWritableGlobalData->m_showClientPhysics = FALSE; - - return 1; -} - -Int parseShowTerrainNormals(char *args[], int) -{ - TheWritableGlobalData->m_showTerrainNormals = TRUE; - - return 1; -} - -Int parseStateMachineDebug(char *args[], int) -{ - TheWritableGlobalData->m_stateMachineDebug = TRUE; - - return 1; -} - -Int parseJabber(char *args[], int) -{ - TheWritableGlobalData->m_jabberOn = TRUE; - - return 1; -} - -Int parseMunkee(char *args[], int) -{ - TheWritableGlobalData->m_munkeeOn = TRUE; - - return 1; -} -#endif // defined(RTS_DEBUG) - -Int parseScriptDebug(char *args[], int) -{ - TheWritableGlobalData->m_scriptDebug = TRUE; - TheWritableGlobalData->m_winCursors = TRUE; - - return 1; -} - -Int parseParticleEdit(char *args[], int) -{ - TheWritableGlobalData->m_particleEdit = TRUE; - TheWritableGlobalData->m_winCursors = TRUE; - TheWritableGlobalData->m_windowed = TRUE; - - return 1; -} - - -Int parseBuildMapCache(char *args[], int) -{ - TheWritableGlobalData->m_buildMapCache = true; - - return 1; -} - - -#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) -Int parsePreload( char *args[], int num ) -{ - TheWritableGlobalData->m_preloadAssets = TRUE; - - return 1; -} -#endif - - -#if defined(RTS_DEBUG) -Int parseDisplayDebug(char *args[], int) -{ - TheWritableGlobalData->m_displayDebug = TRUE; - - return 1; -} - -Int parseFile(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_initialFile = args[1]; - ConvertShortMapPathToLongMapPath(TheWritableGlobalData->m_initialFile); - } - return 2; -} - - -Int parsePreloadEverything( char *args[], int num ) -{ - TheWritableGlobalData->m_preloadAssets = TRUE; - TheWritableGlobalData->m_preloadEverything = TRUE; - - return 1; -} - -Int parseLogAssets( char *args[], int num ) -{ - FILE *logfile=fopen("PreloadedAssets.txt","w"); - if (logfile) //clear the file - fclose(logfile); - TheWritableGlobalData->m_preloadReport = TRUE; - - return 1; -} - -/// begin stuff for VTUNE -Int parseVTune ( char *args[], int num ) -{ - TheWritableGlobalData->m_vTune = TRUE; - - return 1; -} -/// end stuff for VTUNE - -#endif // defined(RTS_DEBUG) - -//============================================================================= -//============================================================================= - -Int parseNoFX(char *args[], int) -{ - TheWritableGlobalData->m_useFX = FALSE; - - return 1; -} - -#if defined(RTS_DEBUG) && ENABLE_CONFIGURABLE_SHROUD -Int parseNoShroud(char *args[], int) -{ - TheWritableGlobalData->m_shroudOn = FALSE; - - return 1; -} -#endif - -Int parseForceBenchmark(char *args[], int) -{ - TheWritableGlobalData->m_forceBenchmark = TRUE; - - return 1; -} - -Int parseNoMoveCamera(char *args[], int) -{ - TheWritableGlobalData->m_disableCameraMovement = true; - - return 1; -} - -#if defined(RTS_DEBUG) -Int parseNoCinematic(char *args[], int) -{ - TheWritableGlobalData->m_disableCameraMovement = true; - TheWritableGlobalData->m_disableMilitaryCaption = true; - TheWritableGlobalData->m_disableCameraFade = true; - TheWritableGlobalData->m_disableScriptedInputDisabling = true; - - return 1; -} -#endif - -Int parseSync(char *args[], int) -{ - TheDebugIgnoreSyncErrors = true; - - return 1; -} - -Int parseNoShellMap(char *args[], int) -{ - TheWritableGlobalData->m_shellMapOn = FALSE; - - return 1; -} - -Int parseNoShaders(char *args[], int) -{ - TheWritableGlobalData->m_chipSetType = 1; //force to a voodoo card which uses least amount of features. - - return 1; -} - -Int parseNoLogo(char *args[], int) -{ - TheWritableGlobalData->m_playIntro = FALSE; - TheWritableGlobalData->m_playSizzle = FALSE; - - return 1; -} - -Int parseShellMap(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_shellMapName = args[1]; - } - return 2; -} - -Int parseNoWindowAnimation(char *args[], int num) -{ - TheWritableGlobalData->m_animateWindows = FALSE; - - return 1; -} - -Int parseWinCursors(char *args[], int num) -{ - TheWritableGlobalData->m_winCursors = TRUE; - - return 1; -} - -Int parseQuickStart( char *args[], int num ) -{ - parseNoLogo( args, num ); - parseNoShellMap( args, num ); - parseNoWindowAnimation( args, num ); - return 1; -} - -Int parseConstantDebug( char *args[], int num ) -{ - TheWritableGlobalData->m_constantDebugUpdate = TRUE; - - return 1; -} - -#if defined(RTS_DEBUG) -Int parseExtraLogging( char *args[], int num ) -{ - TheWritableGlobalData->m_extraLogging = TRUE; - - return 1; -} -#endif - -//-allAdvice feature -/* -Int parseAllAdvice( char *args[], int num ) -{ - TheWritableGlobalData->m_allAdvice = TRUE; - - return 1; -} -*/ - -Int parseShowTeamDot( char *args[], int num ) -{ - TheWritableGlobalData->m_showTeamDot = TRUE; - - return 1; -} - - -#if defined(RTS_DEBUG) -Int parseSelectAll( char *args[], int num ) -{ - TheWritableGlobalData->m_allowUnselectableSelection = TRUE; - - return 1; -} -#endif - - -Int parseSeed(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_fixedSeed = atoi(args[1]); - } - return 2; -} - -Int parseIncrAGPBuf(char *args[], int num) -{ - TheWritableGlobalData->m_incrementalAGPBuf = TRUE; - - return 1; -} - -Int parseNetMinPlayers(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_netMinPlayers = atoi(args[1]); - } - return 2; -} - -Int parsePlayStats(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_playStats = atoi(args[1]); - } - return 2; -} - -Int parseDemoLoadScreen(char *args[], int num) -{ - TheWritableGlobalData->m_loadScreenDemo = TRUE; - - return 1; -} - -#if defined(RTS_DEBUG) -Int parseSaveStats(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_saveStats = TRUE; - TheWritableGlobalData->m_baseStatsDir = args[1]; - } - return 2; -} -#endif - -#if defined(RTS_DEBUG) -Int parseSaveAllStats(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_saveStats = TRUE; - TheWritableGlobalData->m_baseStatsDir = args[1]; - TheWritableGlobalData->m_saveAllStats = TRUE; - } - return 2; -} -#endif - -#if defined(RTS_DEBUG) -Int parseLocalMOTD(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_useLocalMOTD = TRUE; - TheWritableGlobalData->m_MOTDPath = args[1]; - } - return 2; -} -#endif - -#if defined(RTS_DEBUG) -Int parseCameraDebug(char *args[], int num) -{ - TheWritableGlobalData->m_debugCamera = TRUE; - - return 1; -} -#endif - -#if defined(RTS_DEBUG) -Int parseBenchmark(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_benchmarkTimer = atoi(args[1]); - TheWritableGlobalData->m_playStats = atoi(args[1]); - } - return 2; -} -#endif - -#if defined(RTS_DEBUG) -#ifdef DUMP_PERF_STATS -Int parseStats(char *args[], int num) -{ - if (num > 1) - { - TheWritableGlobalData->m_dumpStatsAtInterval = TRUE; - TheWritableGlobalData->m_statsInterval = atoi(args[1]); - } - return 2; -} -#endif -#endif - -#ifdef DEBUG_CRASHING -Int parseIgnoreAsserts(char *args[], int num) -{ - if (num > 0) - { - TheWritableGlobalData->m_debugIgnoreAsserts = true; - } - return 1; -} -#endif - -#ifdef DEBUG_STACKTRACE -Int parseIgnoreStackTrace(char *args[], int num) -{ - if (num > 0) - { - TheWritableGlobalData->m_debugIgnoreStackTrace = true; - } - return 1; -} -#endif - -Int parseNoFPSLimit(char *args[], int num) -{ - TheWritableGlobalData->m_useFpsLimit = false; - TheWritableGlobalData->m_framesPerSecondLimit = 30000; - - return 1; -} - -Int parseDumpAssetUsage(char *args[], int num) -{ - TheWritableGlobalData->m_dumpAssetUsage = true; - - return 1; -} - -Int parseJumpToFrame(char *args[], int num) -{ - if (num > 1) - { - parseNoFPSLimit(args, num); - TheWritableGlobalData->m_noDraw = atoi(args[1]); - return 2; - } - return 1; -} - -Int parseUpdateImages(char *args[], int num) -{ - TheWritableGlobalData->m_shouldUpdateTGAToDDS = TRUE; - - return 1; -} - -Int parseMod(char *args[], Int num) -{ - if (num > 1) - { - AsciiString modPath = args[1]; - if (strchr(modPath.str(), ':') || modPath.startsWith("/") || modPath.startsWith("\\")) - { - // full path passed in. Don't append base path. - } - else - { - modPath.format("%s%s", TheGlobalData->getPath_UserData().str(), args[1]); - } - DEBUG_LOG(("Looking for mod '%s'", modPath.str())); - - if (!TheLocalFileSystem->doesFileExist(modPath.str())) - { - DEBUG_LOG(("Mod does not exist.")); - return 2; // no such file/dir. - } - - // now check for dir-ness - struct _stat statBuf; - if (_stat(modPath.str(), &statBuf) != 0) - { - DEBUG_LOG(("Could not _stat() mod.")); - return 2; // could not stat the file/dir. - } - - if (statBuf.st_mode & _S_IFDIR) - { - if (!modPath.endsWith("\\") && !modPath.endsWith("/")) - modPath.concat('\\'); - DEBUG_LOG(("Mod dir is '%s'.", modPath.str())); - TheWritableGlobalData->m_modDir = modPath; - } - else - { - DEBUG_LOG(("Mod file is '%s'.", modPath.str())); - TheWritableGlobalData->m_modBIG = modPath; - } - - return 2; - } - return 1; -} - -#ifdef DEBUG_LOGGING -Int parseSetDebugLevel(char *args[], int num) -{ - if (num > 1) - { - AsciiString val = args[1]; - for (Int i=0; i 1) - { - AsciiString val = args[1]; - for (Int i=0; i argv; - - std::string cmdLine = GetCommandLineA(); - char *token = nextParam(&cmdLine[0], "\" "); - while (token != nullptr) - { - argv.push_back(strtrim(token)); - token = nextParam(nullptr, "\" "); - } - int argc = argv.size(); - - int arg = 1; - -#ifdef DEBUG_LOGGING - DEBUG_LOG(("Command-line args:")); - int debugFlags = DebugGetFlags(); - DebugSetFlags(debugFlags & ~DEBUG_FLAG_PREPEND_TIME); // turn off timestamps - for (arg=1; argm_commandLineData.m_hasParsedCommandLineForStartup) - return; - TheWritableGlobalData->m_commandLineData.m_hasParsedCommandLineForStartup = true; - - parseCommandLine(paramsForStartup, ARRAY_SIZE(paramsForStartup)); -} - -void CommandLine::parseCommandLineForEngineInit() -{ - createGlobalData(); - - DEBUG_ASSERTCRASH(TheGlobalData->m_commandLineData.m_hasParsedCommandLineForStartup, - ("parseCommandLineForStartup is expected to be called before parseCommandLineForEngineInit\n")); - DEBUG_ASSERTCRASH(!TheGlobalData->m_commandLineData.m_hasParsedCommandLineForEngineInit, - ("parseCommandLineForEngineInit is expected to be called once only\n")); - TheWritableGlobalData->m_commandLineData.m_hasParsedCommandLineForEngineInit = true; - - parseCommandLine(paramsForEngineInit, ARRAY_SIZE(paramsForEngineInit)); -} diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index a5d4d890705..694f7d267d8 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -19,7 +19,7 @@ set(GAMEENGINE_SRC Include/Common/BorderColors.h Include/Common/BuildAssistant.h Include/Common/ClientUpdateModule.h - Include/Common/CommandLine.h +# Include/Common/CommandLine.h # Include/Common/crc.h # Include/Common/CRCDebug.h Include/Common/CriticalSection.h @@ -559,7 +559,7 @@ set(GAMEENGINE_SRC Source/Common/Bezier/BezFwdIterator.cpp Source/Common/Bezier/BezierSegment.cpp Source/Common/BitFlags.cpp - Source/Common/CommandLine.cpp +# Source/Common/CommandLine.cpp # Source/Common/crc.cpp # Source/Common/CRCDebug.cpp # Source/Common/DamageFX.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 768aa1e5305..1bfb3539700 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -639,6 +639,9 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/TerrainTypes.cpp", Game.CORE, "GameEngine/Source/Common/TerrainTypes.cpp") #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/version.h", Game.CORE, "GameEngine/Include/Common/version.h") #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/version.cpp", Game.CORE, "GameEngine/Source/Common/version.cpp") + + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/CommandLine.h", Game.CORE, "GameEngine/Include/Common/CommandLine.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/CommandLine.cpp", Game.CORE, "GameEngine/Source/Common/CommandLine.cpp") return