Skip to content

-ignoreAsserts is parsed too late to suppress GameData INI assertions #3031

Description

@bobtista

Prerequisites

  • I have searched for similar issues and confirmed this is not a duplicate

Game Version

  • Command & Conquer Generals
  • Command & Conquer Generals: Zero Hour

Bug Description

In builds with DEBUG_CRASHING, the -ignoreAsserts command-line option is parsed only after the global GameData INIs have been loaded.

-ignoreAsserts currently belongs to paramsForEngineInit. However, GameEngine::init() loads:

  • Data\INI\Default\GameData
  • Data\INI\GameData
  • Data\INI\GameDataDebug in Debug builds

before calling CommandLine::parseCommandLineForEngineInit().

Consequently, a malformed GameData INI can display assertion dialogs even when the game was explicitly launched with -ignoreAsserts.

The same ordering problem affects -ignoreStackTrace: stack traces generated while loading these INIs cannot be suppressed because that option has not yet been parsed.

Reproduction Steps

  1. Build Zero Hour with DEBUG_CRASHING.
  2. Put an invalid value in a loose Data\INI\GameData.ini, for example:
    UseTrees = Maybe
  3. Run the game in non-headless mode with:
    -ignoreAsserts -ignoreStackTrace
    
  4. Observe assertion handling and stack-trace generation while GameData.ini is parsed, before the command-line options take effect.

Expected Behavior

-ignoreAsserts and -ignoreStackTrace should take effect before any GameData INIs are loaded.

This only concerns DEBUG_CRASH assertion handling. A later fatal ReleaseCrash dialog caused by the propagated INI exception is separate and is not expected to be suppressed by these options.

Suggested Fix

Move the following guarded entries from paramsForEngineInit to paramsForStartup:

#ifdef DEBUG_CRASHING
	{ "-ignoreAsserts", parseIgnoreAsserts },
#endif

#ifdef DEBUG_STACKTRACE
	{ "-ignoreStackTrace", parseIgnoreStackTrace },
#endif

Startup parsing already creates TheWritableGlobalData, and both handlers only set boolean members. GlobalData::init() does not reset these flags, and they are not overwritten by GameData INI fields.

The comment describing paramsForEngineInit should also be corrected: these parameters are parsed after the global GameData INIs, not before all INI data is loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions