-
Notifications
You must be signed in to change notification settings - Fork 162
feat(screenshot): Add threaded JPEG/PNG screenshots without game stalls #1785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
13430b4
d53fafd
50ed01e
c8a27bc
c346f1b
aa9dd09
7fcbb01
0eb7821
1c45436
12858a9
7ac1a95
98ae29f
13108c2
1f46d55
8eb0036
f0e1a03
14ca7a0
df506b5
dd65a74
516acb2
7e3c765
65867f4
45c0339
a6f02b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| ** Command & Conquer Generals Zero Hour(tm) | ||
bobtista marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ** Copyright 2025 TheSuperHackers | ||
| ** | ||
| ** This program is free software: you can redistribute it and/or modify | ||
| ** it under the terms of the GNU General Public License as published by | ||
| ** the Free Software Foundation, either version 3 of the License, or | ||
| ** (at your option) any later version. | ||
| ** | ||
| ** This program is distributed in the hope that it will be useful, | ||
| ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ** GNU General Public License for more details. | ||
| ** | ||
| ** You should have received a copy of the GNU General Public License | ||
| ** along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "GameClient/Display.h" | ||
|
|
||
| void W3D_TakeCompressedScreenshot(ScreenshotFormat format, int quality = 0); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| ** Command & Conquer Generals(tm) | ||
| ** Copyright 2025 TheSuperHackers | ||
| ** | ||
| ** This program is free software: you can redistribute it and/or modify | ||
| ** it under the terms of the GNU General Public License as published by | ||
| ** the Free Software Foundation, either version 3 of the License, or | ||
| ** (at your option) any later version. | ||
| ** | ||
| ** This program is distributed in the hope that it will be useful, | ||
| ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ** GNU General Public License for more details. | ||
| ** | ||
| ** You should have received a copy of the GNU General Public License | ||
| ** along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #define STB_IMAGE_WRITE_IMPLEMENTATION | ||
| #include <stb_image_write.h> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,7 @@ class GlobalData : public SubsystemInterface | |
| Bool m_clientRetaliationModeEnabled; | ||
| Bool m_doubleClickAttackMove; | ||
| Bool m_rightMouseAlwaysScrolls; | ||
| Int m_jpegQuality; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Every neighboring member in this struct ( This means Add initialization in both m_jpegQuality = 80;Prompt To Fix With AIThis is a comment left during a code review.
Path: Generals/Code/GameEngine/Include/Common/GlobalData.h
Line: 145:145
Comment:
**`m_jpegQuality` is never initialized in the constructor**
Every neighboring member in this struct (`m_rightMouseAlwaysScrolls` at `GlobalData.cpp:647`, `m_useWaterPlane` at `GlobalData.cpp:648`, etc.) is explicitly initialized in the `GlobalData::GlobalData()` constructor, but `m_jpegQuality` is not. It only gets set later in `parseGameDataDefinition` via `optionPref.getJPEGQuality()`.
This means `m_jpegQuality` holds an indeterminate value between construction and the `parseGameDataDefinition` call. While screenshots are unlikely to be taken in that window during normal gameplay, this is still a correctness defect that should be fixed for consistency and safety. The same issue exists in the GeneralsMD mirror file.
Add initialization in both `GlobalData::GlobalData()` constructors, for example after `m_rightMouseAlwaysScrolls = FALSE;`:
```cpp
m_jpegQuality = 80;
```
How can I resolve this? If you propose a fix, please make it concise. |
||
| Bool m_useWaterPlane; | ||
| Bool m_useCloudPlane; | ||
| Bool m_useShadowVolumes; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.