-
Notifications
You must be signed in to change notification settings - Fork 167
Description
Prerequisites
- I have searched for similar issues and confirmed this is not a duplicate
Game Version
- Command & Conquer Generals
- Command & Conquer Generals: Zero Hour
- Other (please specify below)
Bug Description
The application currently fails to handle corruption or syntax errors within the MapCache.ini file. Instead of discarding the corrupted cache and regenerating it, the engine triggers a Release Crash during the initialization phase.
This occurs when the parser encounters a malformed entry in the .ini file. Rather than bypassing the invalid line or resetting the file, the application terminates, preventing the game from reaching the main menu until the user manually deletes the file.
Expected Behavior
The application should implement a robust fail-safe mechanism for cache handling:
Detection: If a parsing error is detected in MapCache.ini during startup, the application should catch the exception rather than terminating.
Recovery: The application should automatically delete or rename the corrupted MapCache.ini and attempt to regenerate a fresh cache file.
Fallback: If the regeneration process fails or a crash occurs a second time immediately after the file is wiped, only then should the "Release Crash" be triggered. This allows for a single automated recovery attempt before requiring manual user intervention.
Reproduction Steps
Navigate to the user data directory: \Documents\Command and Conquer Generals Zero Hour Data.
Open MapCache.ini and manually corrupt a line (e.g., a -nan instead of an expected number).
Launch the application.
Observe the "Release Crash" dialog referencing the parsing error.
Additional Context
This issue is architecturally related to #1180 (Improper Map.ini causes uncaught exception crash)
// Pseudo-code for the proposed fix in the initialization sequence
try {
LoadMapCache("MapCache.ini");
} catch (const IniParseException& e) {
Log("MapCache.ini corrupted, attempting silent recovery...");
DeleteFile("MapCache.ini");
// Retry initialization once
LoadMapCache("MapCache.ini");
}