Skip to content

Commit a62d6eb

Browse files
authored
Merge branch 'main' into vanilla_test
2 parents e2570a2 + 2e95fe2 commit a62d6eb

File tree

7,585 files changed

+561973
-1036328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,585 files changed

+561973
-1036328
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root=true
2+
3+
[*]
4+
insert_final_newline = true
5+
trim_trailing_whitespace = true
6+
7+
[{*.h,*.cpp,*.inl}]
8+
indent_style = unset
9+
indent_size = 2
10+
11+
[{CMakeLists.txt,*.cmake,*.py}]
12+
indent_style = spaces
13+
indent_size = 4
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Bug Report
2+
description: Report bugs or issues you've encountered while playing the game
3+
type: Bug
4+
labels: [ "Bug", "⚠️ Triage" ]
5+
6+
body:
7+
- type: checkboxes
8+
attributes:
9+
label: Prerequisites
10+
description: Please make sure you've completed the following steps before submitting an issue
11+
options:
12+
- label: I have searched for similar issues and confirmed this is not a duplicate
13+
required: true
14+
15+
- type: checkboxes
16+
attributes:
17+
label: Game Version
18+
description: Which version(s) of the game does this bug appear in?
19+
options:
20+
- label: "Command & Conquer Generals"
21+
required: false
22+
- label: "Command & Conquer Generals: Zero Hour"
23+
required: false
24+
- label: "Other (please specify below)"
25+
required: false
26+
27+
- type: textarea
28+
attributes:
29+
label: Bug Description
30+
description: |
31+
What is the bug? What happened versus what you expected to happen?
32+
Please provide a clear and detailed description.
33+
validations:
34+
required: true
35+
36+
- type: textarea
37+
attributes:
38+
label: Reproduction Steps
39+
description: How can we reproduce this bug?
40+
placeholder: |
41+
1. Start a new game with [specific settings]
42+
2. Build/Select [specific unit/building]
43+
3. Perform [specific action]
44+
4. Observe [the bug]
45+
validations:
46+
required: true
47+
48+
- type: textarea
49+
attributes:
50+
label: Additional Context
51+
description: Add any relevant screenshots, video recordings, or other files here
52+
validations:
53+
required: false

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
blank_issues_enabled: true
22
contact_links:
3-
- name: Ideas & Feature Requests
3+
- name: Feature Request
44
url: https://github.com/TheSuperHackers/GeneralsGameCode/discussions/categories/ideas
5-
about: Request an idea or feature request to be added to the game.
5+
about: Share your ideas or request new features to enhance the game
6+
67
- name: Community Outpost Discord Server
78
url: https://discord.gg/WzxQDZersE
8-
about: For help with miscelleneous things, join our discord server!
9+
about: For help with miscellaneous things, join our Discord community

.github/copilot-instructions.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# AI Coding Agent Instructions
2+
3+
## Project Overview
4+
5+
This is the **GeneralsGameCode** project - a community-driven effort to fix and improve the classic RTS games *Command & Conquer: Generals* and *Zero Hour*. The codebase has been modernized from Visual Studio 6/C++98 to Visual Studio 2022/C++20 while maintaining retail compatibility.
6+
7+
## Architecture
8+
9+
### Dual Game Structure
10+
- **Generals/**: Original C&C Generals (v1.08) codebase
11+
- **GeneralsMD/**: Zero Hour expansion (v1.04) codebase - **primary focus**
12+
- **Core/**: Shared game engine and libraries used by both games
13+
14+
### Key Components
15+
- **Core/GameEngine/**: Base game engine with GameClient/GameLogic separation
16+
- **Core/Libraries/**: Internal libraries including WWVegas graphics framework
17+
- **Core/GameEngineDevice/**: Platform-specific rendering (DirectX 8)
18+
- **Core/Tools/**: Development tools (W3DView, texture compression, etc.)
19+
- **Dependencies/**: External dependencies (MaxSDK for VC6, utilities)
20+
21+
## Build System
22+
23+
### CMake Presets (Critical)
24+
- **vc6**: Visual Studio 6 compatible build (retail compatibility required)
25+
- **win32**: Modern Visual Studio 2022 build
26+
- **vc6-debug/vc6-profile**: Debug/profiling variants
27+
- Use `cmake --preset <preset-name>` followed by `cmake --build build/<preset>`
28+
29+
### Build Commands
30+
```bash
31+
# Configure with specific preset
32+
cmake --preset vc6
33+
34+
# Build (from project root)
35+
cmake --build build/vc6
36+
37+
# Build with tools and extras
38+
cmake --build build/vc6 --target <game>_tools <game>_extras
39+
```
40+
41+
### Retail Compatibility
42+
- VC6 builds are required for replay compatibility testing
43+
- Debug builds break retail compatibility
44+
- Use RTS_BUILD_OPTION_DEBUG=OFF for compatibility testing
45+
46+
## Development Workflow
47+
48+
### Code Change Documentation
49+
**Every user-facing change requires TheSuperHackers comment format:**
50+
```cpp
51+
// TheSuperHackers @keyword author DD/MM/YYYY Description
52+
```
53+
54+
Common keywords: `@bugfix`, `@feature`, `@performance`, `@refactor`, `@tweak`, `@build`
55+
56+
### Pull Request Guidelines
57+
- Title format: `type: Description starting with action verb`
58+
- Types: `bugfix:`, `feat:`, `fix:`, `refactor:`, `perf:`, `build:`
59+
- Zero Hour changes take precedence over Generals
60+
- Changes must be identical between both games when applicable
61+
62+
### Code Style
63+
- Maintain consistency with surrounding legacy code
64+
- Prefer C++98 style unless modern features add significant value
65+
- No big refactors mixed with logical changes
66+
- Use present tense in documentation ("Fixes" not "Fixed")
67+
68+
## Testing
69+
70+
### Replay Compatibility Testing
71+
Located in `GeneralsReplays/` - critical for ensuring retail compatibility:
72+
```bash
73+
generalszh.exe -jobs 4 -headless -replay subfolder/*.rep
74+
```
75+
- Requires VC6 optimized build with RTS_BUILD_OPTION_DEBUG=OFF
76+
- Copies replays to `%USERPROFILE%/Documents/Command and Conquer Generals Zero Hour Data/Replays`
77+
- CI automatically tests GeneralsMD builds against known replays
78+
79+
### Build Validation
80+
- CI tests multiple presets: vc6, vc6-profile, vc6-debug, win32 variants
81+
- Path-based change detection triggers relevant builds
82+
- Tools and extras are built with `+t+e` flags
83+
84+
## Common Patterns
85+
86+
### Memory Management
87+
- Manual memory management (delete/delete[]) - this is legacy C++98 code
88+
- STLPort for VC6 compatibility (see `cmake/stlport.cmake`)
89+
90+
### Game Engine Separation
91+
- **GameLogic**: Game state, rules, simulation
92+
- **GameClient**: Rendering, UI, platform-specific code
93+
- Clean separation maintained for potential future networking
94+
95+
### Module Structure
96+
```
97+
Core/
98+
├── GameEngine/Include/Common/ # Shared interfaces
99+
├── GameEngine/Include/GameLogic/ # Game simulation
100+
├── GameEngine/Include/GameClient/ # Rendering/UI
101+
├── Libraries/Include/rts/ # RTS-specific utilities
102+
└── Libraries/Source/WWVegas/ # Graphics framework
103+
```
104+
105+
## External Dependencies
106+
107+
### Required for Building
108+
- **VC6 builds**: Requires MSVC 6.0 toolchain (automated in CI via itsmattkc/MSVC600)
109+
- **Modern builds**: Visual Studio 2022, Ninja generator
110+
- **vcpkg** (optional): zlib, ffmpeg for enhanced builds
111+
112+
### Platform-Specific
113+
- **Windows**: DirectX 8, Miles Sound System, Bink Video
114+
- **Registry detection**: Automatic game install path detection from EA registry keys
115+
116+
## Tools and Utilities
117+
118+
### Development Scripts (`scripts/cpp/`)
119+
- `fixInludesCase.sh`: Fix include case sensitivity
120+
- `refactor_*.py`: Code refactoring utilities
121+
- `remove_trailing_whitespace.py`: Code cleanup
122+
123+
### Build Tools
124+
- W3DView: 3D model viewer
125+
- TextureCompress: Asset optimization
126+
- MapCacheBuilder: Map preprocessing
127+
128+
## Key Files to Understand
129+
- `CMakePresets.json`: All build configurations
130+
- `cmake/config-build.cmake`: Build options and feature flags
131+
- `Core/GameEngine/Include/`: Core engine interfaces
132+
- `**/Code/Main/WinMain.cpp`: Application entry points
133+
- `GeneralsReplays/`: Compatibility test data

.github/workflows/build-toolchain.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ on:
2828

2929
jobs:
3030
build:
31-
name: Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
32-
runs-on: windows-latest
31+
name: ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
32+
runs-on: windows-2022
3333
timeout-minutes: 20
3434
steps:
3535
- name: Checkout Code
@@ -41,41 +41,38 @@ jobs:
4141
uses: actions/cache@v4
4242
with:
4343
path: C:\VC6
44-
key: vc6-permanent-cache-v1
44+
key: vc6-permanent-cache-v2
4545

4646
- name: Cache CMake Dependencies
4747
id: cache-cmake-deps
4848
uses: actions/cache@v4
4949
with:
5050
path: build\${{ inputs.preset }}\_deps
51-
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('cmake/**/*.cmake', '**/CMakeLists.txt') }}
52-
restore-keys: |
53-
cmake-deps-${{ inputs.preset }}-
51+
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
5452

55-
- name: Download VC6 Portable from Cloudflare R2
53+
- name: Download VC6 Portable from itsmattkc repo
5654
if: ${{ startsWith(inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
5755
env:
58-
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
59-
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
60-
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
61-
EXPECTED_HASH: "118D0F1ACBBD70C3F8B081CA4DBAF955FE0C6C359A76636E930AA89FDC551091"
56+
EXPECTED_HASH: "D0EE1F6DCEF7DB3AD703120D9FB4FAD49EBCA28F44372E40550348B1C00CA583"
57+
COMMIT: "001c4bafdcf2ef4b474d693acccd35a91e848f40"
6258
shell: pwsh
6359
run: |
6460
Write-Host "Downloading VC6 Portable Installation" -ForegroundColor Cyan
65-
aws s3 cp s3://github-ci/VS6_VisualStudio6.7z VS6_VisualStudio6.7z --endpoint-url $env:AWS_ENDPOINT_URL
61+
Invoke-WebRequest -Uri https://github.com/itsmattkc/MSVC600/archive/$env:COMMIT.zip -OutFile VS6_VisualStudio6.zip
6662
6763
Write-Host "Verifying File Integrity" -ForegroundColor Cyan
68-
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
64+
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.zip -Algorithm SHA256).Hash
6965
Write-Host "Downloaded file SHA256: $fileHash"
7066
Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
71-
if ($hash -ne $env:EXPECTED_HASH) {
67+
if ($fileHash -ne $env:EXPECTED_HASH) {
7268
Write-Error "Hash verification failed! File may be corrupted or tampered with."
7369
exit 1
7470
}
7571
7672
Write-Host "Extracting Archive" -ForegroundColor Cyan
77-
& 7z x VS6_VisualStudio6.7z -oC:\VC6
78-
Remove-Item VS6_VisualStudio6.7z -Verbose
73+
& Expand-Archive -Path VS6_VisualStudio6.zip -DestinationPath C:\VC6
74+
Move-Item -Path C:\VC6\MSVC600-$env:COMMIT -Destination C:\VC6\VC6SP6
75+
Remove-Item VS6_VisualStudio6.zip -Verbose
7976
8077
- name: Set Up VC6 Environment
8178
if: startsWith(inputs.preset, 'vc6')
@@ -102,19 +99,24 @@ jobs:
10299
with:
103100
arch: x86
104101

102+
- name: Setup vcpkg
103+
uses: lukka/run-vcpkg@v11
104+
105105
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
106106
shell: pwsh
107107
run: |
108108
$buildFlags = @(
109-
"-DGENZH_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
110-
"-DGENZH_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
109+
"-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
110+
"-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
111111
)
112112
113113
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
114-
$buildFlags += "-DGENZH_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
115-
$buildFlags += "-DGENZH_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
114+
$buildFlags += "-DRTS_BUILD_CORE_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
115+
$buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
116+
$buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
117+
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
116118
117-
Write-Host "Build flags: $buildFlags"
119+
Write-Host "Build flags: $($buildFlags -join ' | ')"
118120
119121
cmake --preset ${{ inputs.preset }} $buildFlags
120122
@@ -131,12 +133,12 @@ jobs:
131133
132134
if ("${{ inputs.preset }}" -like "win32*") {
133135
# For win32 preset, look in config-specific subdirectories
134-
$configToUse = if ("${{ inputs.preset }}" -eq "win32dbg") { "Debug" } else { "Release" }
135-
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
136+
$configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" }
137+
$files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
136138
} else {
137-
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
139+
$files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
138140
}
139-
$files | Move-Item -Destination $artifactsDir -Verbose
141+
$files | Move-Item -Destination $artifactsDir -Verbose -Force
140142
141143
- name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
142144
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)