1
1
/*
2
- ** Command & Conquer Generals(tm)
2
+ ** Command & Conquer Generals Zero Hour (tm)
3
3
** Copyright 2025 Electronic Arts Inc.
4
4
**
5
5
** This program is free software: you can redistribute it and/or modify
34
34
#include " GameClient/GameText.h"
35
35
#include " GameNetwork/NetworkDefs.h"
36
36
37
+ #ifdef _INTERNAL
38
+ // for occasional debugging...
39
+ // #pragma optimize("", off)
40
+ // #pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
41
+ #endif
42
+
43
+
44
+
37
45
Bool TheDebugIgnoreSyncErrors = FALSE ;
38
46
extern Int DX8Wrapper_PreserveFPU;
39
47
@@ -644,7 +652,18 @@ Int parseBuildMapCache(char *args[], int)
644
652
return 1 ;
645
653
}
646
654
647
- #if defined(_DEBUG) || defined(_INTERNAL)
655
+
656
+ #if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
657
+ Int parsePreload ( char *args[], int num )
658
+ {
659
+ if ( TheWritableGlobalData )
660
+ TheWritableGlobalData->m_preloadAssets = TRUE ;
661
+ return 1 ;
662
+ }
663
+ #endif
664
+
665
+
666
+ #if defined(_DEBUG) || defined(_INTERNAL)
648
667
Int parseDisplayDebug (char *args[], int )
649
668
{
650
669
if (TheWritableGlobalData)
@@ -664,12 +683,6 @@ Int parseFile(char *args[], int num)
664
683
return 2 ;
665
684
}
666
685
667
- Int parsePreload ( char *args[], int num )
668
- {
669
- if ( TheWritableGlobalData )
670
- TheWritableGlobalData->m_preloadAssets = TRUE ;
671
- return 1 ;
672
- }
673
686
674
687
Int parsePreloadEverything ( char *args[], int num )
675
688
{
@@ -777,18 +790,37 @@ Int parseNoShellMap(char *args[], int)
777
790
return 1 ;
778
791
}
779
792
793
+ Int parseNoShaders (char *args[], int )
794
+ {
795
+ if (TheWritableGlobalData)
796
+ {
797
+ TheWritableGlobalData->m_chipSetType = 1 ; // force to a voodoo card which uses least amount of features.
798
+ }
799
+ return 1 ;
800
+ }
801
+
780
802
#if (defined(_DEBUG) || defined(_INTERNAL))
781
803
Int parseNoLogo (char *args[], int )
782
804
{
783
805
if (TheWritableGlobalData)
784
806
{
785
807
TheWritableGlobalData->m_playIntro = FALSE ;
786
808
TheWritableGlobalData->m_afterIntro = TRUE ;
809
+ TheWritableGlobalData->m_playSizzle = FALSE ;
787
810
}
788
811
return 1 ;
789
812
}
790
813
#endif
791
814
815
+ Int parseNoSizzle ( char *args[], int )
816
+ {
817
+ if (TheWritableGlobalData)
818
+ {
819
+ TheWritableGlobalData->m_playSizzle = FALSE ;
820
+ }
821
+ return 1 ;
822
+ }
823
+
792
824
Int parseShellMap (char *args[], int num)
793
825
{
794
826
if (TheWritableGlobalData && num > 1 )
@@ -820,6 +852,10 @@ Int parseQuickStart( char *args[], int num )
820
852
{
821
853
#if (defined(_DEBUG) || defined(_INTERNAL))
822
854
parseNoLogo ( args, num );
855
+ #else
856
+ // Kris: Patch 1.01 -- Allow release builds to skip the sizzle video, but still force the EA logo to show up.
857
+ // This is for legal reasons.
858
+ parseNoSizzle ( args, num );
823
859
#endif
824
860
parseNoShellMap ( args, num );
825
861
parseNoWindowAnimation ( args, num );
@@ -835,6 +871,29 @@ Int parseConstantDebug( char *args[], int num )
835
871
return 1 ;
836
872
}
837
873
874
+ #if (defined(_DEBUG) || defined(_INTERNAL))
875
+ Int parseExtraLogging ( char *args[], int num )
876
+ {
877
+ if (TheWritableGlobalData)
878
+ {
879
+ TheWritableGlobalData->m_extraLogging = TRUE ;
880
+ }
881
+ return 1 ;
882
+ }
883
+ #endif
884
+
885
+ // -allAdvice feature
886
+ /*
887
+ Int parseAllAdvice( char *args[], int num )
888
+ {
889
+ if( TheWritableGlobalData )
890
+ {
891
+ TheWritableGlobalData->m_allAdvice = TRUE;
892
+ }
893
+ return 1;
894
+ }
895
+ */
896
+
838
897
Int parseShowTeamDot ( char *args[], int num )
839
898
{
840
899
if ( TheWritableGlobalData )
@@ -973,6 +1032,20 @@ Int parseBenchmark(char *args[], int num)
973
1032
}
974
1033
#endif
975
1034
1035
+ #if defined(_DEBUG) || defined(_INTERNAL)
1036
+ #ifdef DUMP_PERF_STATS
1037
+ Int parseStats (char *args[], int num)
1038
+ {
1039
+ if (TheWritableGlobalData && num > 1 )
1040
+ {
1041
+ TheWritableGlobalData->m_dumpStatsAtInterval = TRUE ;
1042
+ TheWritableGlobalData->m_statsInterval = atoi (args[1 ]);
1043
+ }
1044
+ return 2 ;
1045
+ }
1046
+ #endif
1047
+ #endif
1048
+
976
1049
#ifdef DEBUG_CRASHING
977
1050
Int parseIgnoreAsserts (char *args[], int num)
978
1051
{
@@ -1056,14 +1129,14 @@ Int parseMod(char *args[], Int num)
1056
1129
}
1057
1130
1058
1131
// now check for dir-ness
1059
- struct stat statBuf;
1060
- if (stat (modPath.str (), &statBuf) != 0 )
1132
+ struct _stat statBuf;
1133
+ if (_stat (modPath.str (), &statBuf) != 0 )
1061
1134
{
1062
1135
DEBUG_LOG ((" Could not _stat() mod.\n " ));
1063
1136
return 2 ; // could not stat the file/dir.
1064
1137
}
1065
1138
1066
- if (statBuf.st_mode & S_IFDIR )
1139
+ if (statBuf.st_mode & _S_IFDIR )
1067
1140
{
1068
1141
if (!modPath.endsWith (" \\ " ) && !modPath.endsWith (" /" ))
1069
1142
modPath.concat (' \\ ' );
@@ -1129,6 +1202,9 @@ static CommandLineParam params[] =
1129
1202
{ " -scriptDebug" , parseScriptDebug },
1130
1203
{ " -playStats" , parsePlayStats },
1131
1204
{ " -mod" , parseMod },
1205
+ { " -noshaders" , parseNoShaders },
1206
+ { " -quickstart" , parseQuickStart },
1207
+
1132
1208
#if (defined(_DEBUG) || defined(_INTERNAL))
1133
1209
{ " -noaudio" , parseNoAudio },
1134
1210
{ " -map" , parseMapName },
@@ -1137,7 +1213,10 @@ static CommandLineParam params[] =
1137
1213
{ " -noLogOrCrash" , parseNoLogOrCrash },
1138
1214
{ " -FPUPreserve" , parseFPUPreserve },
1139
1215
{ " -benchmark" , parseBenchmark },
1140
- { " -saveStats" , parseSaveStats },
1216
+ #ifdef DUMP_PERF_STATS
1217
+ { " -stats" , parseStats },
1218
+ #endif
1219
+ { " -saveStats" , parseSaveStats },
1141
1220
{ " -localMOTD" , parseLocalMOTD },
1142
1221
{ " -UseCSF" , parseUseCSF },
1143
1222
{ " -NoInputDisable" , parseNoInputDisable },
@@ -1218,8 +1297,10 @@ static CommandLineParam params[] =
1218
1297
{ " -munkee" , parseMunkee },
1219
1298
{ " -displayDebug" , parseDisplayDebug },
1220
1299
{ " -file" , parseFile },
1221
- { " -preload" , parsePreload },
1222
- { " -preloadEverything" , parsePreloadEverything },
1300
+
1301
+ // { "-preload", parsePreload },
1302
+
1303
+ { " -preloadEverything" , parsePreloadEverything },
1223
1304
{ " -logAssets" , parseLogAssets },
1224
1305
{ " -netMinPlayers" , parseNetMinPlayers },
1225
1306
{ " -DemoLoadScreen" , parseDemoLoadScreen },
@@ -1239,14 +1320,15 @@ static CommandLineParam params[] =
1239
1320
{ " -noShellAnim" , parseNoWindowAnimation },
1240
1321
{ " -winCursors" , parseWinCursors },
1241
1322
{ " -constantDebug" , parseConstantDebug },
1242
- { " -quickstart" , parseQuickStart },
1243
1323
{ " -seed" , parseSeed },
1244
1324
{ " -noagpfix" , parseIncrAGPBuf },
1245
1325
{ " -noFPSLimit" , parseNoFPSLimit },
1246
1326
{ " -dumpAssetUsage" , parseDumpAssetUsage },
1247
1327
{ " -jumpToFrame" , parseJumpToFrame },
1248
1328
{ " -updateImages" , parseUpdateImages },
1249
1329
{ " -showTeamDot" , parseShowTeamDot },
1330
+ { " -extraLogging" , parseExtraLogging },
1331
+
1250
1332
#endif
1251
1333
1252
1334
#ifdef DEBUG_LOGGING
@@ -1261,6 +1343,15 @@ static CommandLineParam params[] =
1261
1343
#ifdef DEBUG_STACKTRACE
1262
1344
{ " -ignoreStackTrace" , parseIgnoreStackTrace },
1263
1345
#endif
1346
+
1347
+ // -allAdvice feature
1348
+ // { "-allAdvice", parseAllAdvice },
1349
+
1350
+ #if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
1351
+ { " -preload" , parsePreload },
1352
+ #endif
1353
+
1354
+
1264
1355
};
1265
1356
1266
1357
// parseCommandLine ===========================================================
0 commit comments