bugfix: Remove superfluous CD checks and related code#2261
bugfix: Remove superfluous CD checks and related code#2261xezon merged 2 commits intoTheSuperHackers:mainfrom
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/Common/Audio/GameAudio.cpp | Removed CD-based music loading loop and m_musicPlayingFromCD flag initialization |
| Core/GameEngine/Include/Common/GameAudio.h | Removed isMusicPlayingFromCD() method and m_musicPlayingFromCD member variable |
| Core/GameEngine/Source/Common/System/FileSystem.cpp | Removed implementations of three CD-related methods (79 lines of dead code) |
| Generals/Code/GameEngine/Source/Common/GameEngine.cpp | Removed TheCDManager initialization and update calls |
| GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp | Removed TheCDManager initialization and update calls, fixed perf comment to reference TheGlobalLanguageData |
| Generals/Code/GameEngine/Source/Common/System/CDManager.cpp | Deleted entire CD manager implementation (294 lines) |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp | Removed CD check callbacks and replaced checkCDBeforeCampaign() calls with direct prepareCampaignGame() calls |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp | Removed IsFirstCDPresent() and CheckForCDAtGameStart() implementations, simplified game start flow |
| Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp | Deleted Win32-specific CD manager implementation (236 lines) |
| GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp | Deleted entire CD manager implementation (294 lines) |
Flowchart
flowchart TD
A[Game Initialization] --> B[FileSystem Init]
A --> C[AudioManager Init]
B -.->|REMOVED| D[CDManager Init]
D -.->|REMOVED| E[Scan CD Drives]
C --> F{Music Files<br/>Already Loaded?}
F -->|No - OLD BEHAVIOR| G[Enter CD Check Loop]
G -.->|REMOVED| H[Load Music from CD]
H -.->|REMOVED| I{Music Found?}
I -.->|No - REMOVED| J[Show Insert CD Dialog]
J -.->|OK - REMOVED| G
I -->|Yes - REMOVED| K[Create MusicManager]
F -->|Yes - NEW BEHAVIOR| K
F -->|No - NEW BEHAVIOR| L[setQuitting TRUE]
K --> M[Game Running]
M --> N[Game Update Loop]
N -.->|REMOVED| O[CDManager UPDATE]
P[Device Change Event] -.->|REMOVED| Q[unloadMusicFilesFromCD]
R[Campaign Start] -.->|REMOVED| S[checkCDBeforeCampaign]
S -.->|REMOVED| T{CD Present?}
T -.->|No - REMOVED| U[Show CD Prompt]
T -->|Yes - REMOVED| V[prepareCampaignGame]
R -->|NEW BEHAVIOR| V
style D fill:#f99,stroke:#f00
style E fill:#f99,stroke:#f00
style G fill:#f99,stroke:#f00
style H fill:#f99,stroke:#f00
style I fill:#f99,stroke:#f00
style J fill:#f99,stroke:#f00
style O fill:#f99,stroke:#f00
style Q fill:#f99,stroke:#f00
style S fill:#f99,stroke:#f00
style T fill:#f99,stroke:#f00
style U fill:#f99,stroke:#f00
Last reviewed commit: 3b0c6a8
|
I believe the maintainers should decide whether it’s better for the project to completely remove the CD logic (this PR) or to keep it behind a feature flag (my PR). IMHO, this PR might be better than mine, since CD is barely used nowadays. |
|
Ok I just realize this is the real pull... copying the texts: Removing all the CD Check code around Campaign and Skirmish is good and correct. As for Loading Music from CD, was that actually a supported Install option from CD? I cannot recall that the Music.big would have resided on the CD. It is copied to HDD, but perhaps there are exceptions when it detected very small HDD size?
|
|
Please also check MUSIC_BIG macro. I think that can also be removed. |
|
Please advance this Pull |
b771edf to
39954bd
Compare
|
ignore this commit i pushed the wrong button sorry |
f0980aa to
db30f41
Compare
|
changed the missing line: Thanks for the suggestion. I looked into MUSIC_BIG and while I agree it should be removed, it touches the audio system and core file closing logic which is outside the scope of my current changes. I'd prefer to handle that cleanup in a separate PR to ensure I can verify it properly without delaying this one. |
|
Please try to do the changes for Generals last, unless they're meaningfully different. This makes it easier to review, at least for me. |
|
Looks good to me, one line extra that could be removed diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt
index 9cf234c3a..c41ed211a 100644
--- a/Core/GameEngine/CMakeLists.txt
+++ b/Core/GameEngine/CMakeLists.txt
@@ -143,7 +143,6 @@ set(GAMEENGINE_SRC
# Include/GameClient/Anim2D.h
# Include/GameClient/AnimateWindowManager.h
# Include/GameClient/CampaignManager.h
-# Include/GameClient/CDCheck.h
Include/GameClient/ChallengeGenerals.h
# Include/GameClient/ClientInstance.h
Include/GameClient/ClientRandomValue.h |
The Pull Request TheSuperHackers#2203 made by @fbraz3 on the upstream repository inspired a deeper audit of the legacy CD requirements in the engine. Beyond merely skipping the startup prompt, it was discovered that large portions of the engine's CD-management infrastructure have become vestigial in modern execution environments. This commit implements a comprehensive modernization by pruning approximately 2,000 lines of dead code across the Core, Generals, and Zero Hour variants. Community investigations (thanks to tomsons26) revealed that the Music.big handling was primarily a copy protection mechanism (SafeDisc) rather than for streaming audio. The engine attempted to read a specific file (often generalsa.sec) from the archive to verify a hash. Failure to read this file would trigger copy protection. This mechanism has been non-functional from the start and is now removed. Tested all parts (init, singleplayer, skirmish) where this code was active, didn't find any problems.
db30f41 to
765c35e
Compare
|
added #2261 (comment) requesting review |
|
Curious why the commit shows xezon as author... |
Caball009
left a comment
There was a problem hiding this comment.
Good effort.
I'm going to nitpick here for a moment and point out a bunch of blank lines that can be removed.
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
Outdated
Show resolved
Hide resolved
|
There's also this one: EDIT, and these: |
|
why not merge this? |
|
There are outstanding comments. |
|
resolved outstanding comments |
The Pull Request #2203 made by @fbraz3 inspired a deeper audit of the legacy CD requirements in the engine. Beyond merely skipping the startup prompt, it was discovered that large portions of the engine's CD-management infrastructure have become vestigial in modern execution environments.
This commit implements a comprehensive modernization by pruning approximately 2,000 lines of dead code across the Core, Generals, and Zero Hour variants.
Investigations (thanks to tomsons26) revealed that the Music.big handling was primarily a copy protection mechanism (SafeDisc) rather than for streaming audio. The engine attempted to read a specific file (often generalsa.sec) from the archive to verify a hash. Failure to read this file would trigger copy protection. This mechanism has been non-functional from the start and is now removed.
Tested all parts (init, singleplayer, skirmish) where this code was active, didn't find any problems.