Skip to content

Commit 5afee38

Browse files
authored
Merge branch 'TheSuperHackers:main' into end_return_refactor
2 parents 8d25367 + e404977 commit 5afee38

File tree

86 files changed

+1136
-946
lines changed

Some content is hidden

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

86 files changed

+1136
-946
lines changed

.github/workflows/weekly-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
strategy:
9191
matrix:
9292
include:
93-
- preset: "vc6"
93+
- preset: "vc6-weekly"
9494
tools: true
9595
extras: false
9696
release: true
@@ -110,7 +110,7 @@ jobs:
110110
strategy:
111111
matrix:
112112
include:
113-
- preset: "vc6"
113+
- preset: "vc6-weekly"
114114
tools: true
115115
extras: false
116116
release: true
@@ -156,7 +156,7 @@ jobs:
156156
- name: Download Generals VC6 Artifacts
157157
uses: actions/download-artifact@v4
158158
with:
159-
name: Generals-vc6+t
159+
name: Generals-vc6-weekly+t
160160
path: generals-vc6-artifacts
161161

162162
- name: Prepare and Zip Generals VC6
@@ -167,7 +167,7 @@ jobs:
167167
- name: Download GeneralsMD VC6 Artifacts
168168
uses: actions/download-artifact@v4
169169
with:
170-
name: GeneralsMD-vc6+t
170+
name: GeneralsMD-vc6-weekly+t
171171
path: generalsmd-vc6-artifacts
172172

173173
- name: Prepare and Zip GeneralsMD VC6

CMakePresets.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@
5353
"RTS_DEBUG_CRASHING": "ON"
5454
}
5555
},
56+
{
57+
"name": "vc6-weekly",
58+
"displayName": "Windows 32bit VC6 Weekly Release",
59+
"inherits": "vc6",
60+
"cacheVariables": {
61+
"RTS_BUILD_OPTION_VC6_FULL_DEBUG": "ON"
62+
}
63+
},
5664
{
5765
"name": "default",
5866
"displayName": "Default Config (don't use directly!)",
@@ -178,6 +186,12 @@
178186
"displayName": "Build Windows 32bit VC6 Release Logging",
179187
"description": "Build Windows 32bit VC6 Release Logging"
180188
},
189+
{
190+
"name": "vc6-weekly",
191+
"configurePreset": "vc6-weekly",
192+
"displayName": "Build Windows 32bit VC6 Weekly Release",
193+
"description": "Build Windows 32bit VC6 Weekly Release"
194+
},
181195
{
182196
"name": "win32",
183197
"configurePreset": "win32",
@@ -281,6 +295,19 @@
281295
}
282296
]
283297
},
298+
{
299+
"name": "vc6-weekly",
300+
"steps": [
301+
{
302+
"type": "configure",
303+
"name": "vc6-weekly"
304+
},
305+
{
306+
"type": "build",
307+
"name": "vc6-weekly"
308+
}
309+
]
310+
},
284311
{
285312
"name": "win32",
286313
"steps": [

Core/GameEngine/Include/Common/FramePacer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class FramePacer
4949

5050
Real getUpdateTime() const; ///< Get the last update delta time in seconds.
5151
Real getUpdateFps() const; ///< Get the last update fps.
52+
Real getBaseOverUpdateFpsRatio(Real minUpdateFps = 5.0f); ///< Get the last engine base over update fps ratio. Used to scale user inputs to a frame rate independent speed.
5253

5354
void setTimeFrozen(Bool frozen); ///< Set time frozen. Allows scripted camera movement.
5455
void setGameHalted(Bool halted); ///< Set game halted. Does not allow scripted camera movement.

Core/GameEngine/Source/Common/FramePacer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ Real FramePacer::getUpdateFps() const
118118
return 1.0f / m_updateTime;
119119
}
120120

121+
Real FramePacer::getBaseOverUpdateFpsRatio(Real minUpdateFps)
122+
{
123+
// Update fps is floored to default 5 fps, 200 ms.
124+
// Useful to prevent insane ratios on frame spikes/stalls.
125+
return (Real)BaseFps / std::max(getUpdateFps(), minUpdateFps);
126+
}
127+
121128
void FramePacer::setTimeFrozen(Bool frozen)
122129
{
123130
m_isTimeFrozen = frozen;

Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ const char * RingRenderObjClass::Get_Name(void) const
500500
void RingRenderObjClass::Set_Name(const char * name)
501501
{
502502
WWASSERT(name != NULL);
503-
WWASSERT(strlen(name) < 2*W3D_NAME_LEN);
504-
strcpy(Name,name);
503+
const size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name));
504+
(void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name));
505505
}
506506

507507
/***********************************************************************************************

Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ const char * SphereRenderObjClass::Get_Name(void) const
435435
void SphereRenderObjClass::Set_Name(const char * name)
436436
{
437437
WWASSERT(name != NULL);
438-
WWASSERT(strlen(name) < 2*W3D_NAME_LEN);
439-
strcpy(Name,name);
438+
const size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name));
439+
(void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name));
440440
}
441441

442442

Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void Scan_Emitter (ChunkLoadClass &cload, StringList &files, const char *
8383
static void Scan_Aggregate (ChunkLoadClass &cload, StringList &files, const char *w3d_name);
8484
static void Scan_HLOD (ChunkLoadClass &cload, StringList &files, const char *w3d_name);
8585

86-
static void Get_W3D_Name (const char *filename, char *w3d_name);
86+
static void Get_W3D_Name (const char *filename, char *w3d_name, size_t w3d_name_size);
8787
static const char * Make_W3D_Filename (const char *w3d_name);
8888

8989

@@ -118,7 +118,7 @@ bool Get_W3D_Dependencies (const char *w3d_filename, StringList &files)
118118

119119
// Get the W3D name from the filename.
120120
char w3d_name[W3D_NAME_LEN];
121-
Get_W3D_Name(w3d_filename, w3d_name);
121+
Get_W3D_Name(w3d_filename, w3d_name, ARRAY_SIZE(w3d_name));
122122

123123
// Create a chunk loader for this file, and scan the file.
124124
ChunkLoadClass cload(file);
@@ -511,7 +511,7 @@ static void Scan_HLOD (ChunkLoadClass &cload, StringList &files, const char *w3d
511511
* HISTORY: *
512512
* 4/3/00 AJA : Created. *
513513
*=============================================================================================*/
514-
static void Get_W3D_Name (const char *filename, char *w3d_name)
514+
static void Get_W3D_Name(const char* filename, char* w3d_name, size_t w3d_name_size)
515515
{
516516
assert(filename);
517517
assert(w3d_name);
@@ -532,9 +532,9 @@ static void Get_W3D_Name (const char *filename, char *w3d_name)
532532

533533
// Copy all characters from start to end (excluding 'end')
534534
// into the w3d_name buffer. Then capitalize the string.
535-
int num_chars = end - start;
536-
WWASSERT(num_chars <= W3D_NAME_LEN);
537-
strlcpy(w3d_name, start, min(W3D_NAME_LEN, num_chars));
535+
size_t num_chars = end - start;
536+
WWASSERT(num_chars < w3d_name_size);
537+
strlcpy(w3d_name, start, min(w3d_name_size, num_chars));
538538
strupr(w3d_name);
539539
}
540540

@@ -554,7 +554,6 @@ static void Get_W3D_Name (const char *filename, char *w3d_name)
554554
static const char * Make_W3D_Filename (const char *w3d_name)
555555
{
556556
assert(w3d_name);
557-
assert(strlen(w3d_name) < W3D_NAME_LEN);
558557

559558
// Copy the w3d name into a static buffer, turn it into lowercase
560559
// letters, and append a ".w3d" file extension. That's the filename.
@@ -565,7 +564,8 @@ static const char * Make_W3D_Filename (const char *w3d_name)
565564
buffer[0] = 0;
566565
return buffer;
567566
}
568-
strcpy(buffer, w3d_name);
567+
const size_t bufferLen = strlcpy(buffer, w3d_name, ARRAY_SIZE(buffer));
568+
(void)bufferLen; WWASSERT(bufferLen < W3D_NAME_LEN);
569569
char *dot = strchr(buffer, '.');
570570
if (dot)
571571
*dot = 0;

Core/Libraries/Source/WWVegas/WWLib/DbgHelpGuard.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
DbgHelpGuard::DbgHelpGuard()
25-
: m_hasLoaded(false)
25+
: m_needsUnload(false)
2626
{
2727
activate();
2828
}
@@ -34,26 +34,16 @@ DbgHelpGuard::~DbgHelpGuard()
3434

3535
void DbgHelpGuard::activate()
3636
{
37-
if (DbgHelpLoader::isLoadedFromSystem())
38-
{
39-
// This is ok. Do nothing.
40-
}
41-
else if (DbgHelpLoader::isLoaded())
42-
{
43-
// This is maybe not ok. But do nothing until this becomes a user facing problem.
44-
}
45-
else
46-
{
47-
// Front load the DLL now to prevent other code from loading the potentially wrong DLL.
48-
m_hasLoaded = DbgHelpLoader::load();
49-
}
37+
// Front load the DLL now to prevent other code from loading the potentially wrong DLL.
38+
DbgHelpLoader::load();
39+
m_needsUnload = true;
5040
}
5141

5242
void DbgHelpGuard::deactivate()
5343
{
54-
if (m_hasLoaded)
44+
if (m_needsUnload)
5545
{
5646
DbgHelpLoader::unload();
57-
m_hasLoaded = false;
47+
m_needsUnload = false;
5848
}
5949
}

Core/Libraries/Source/WWVegas/WWLib/DbgHelpGuard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ class DbgHelpGuard
4040

4141
private:
4242

43-
bool m_hasLoaded;
43+
bool m_needsUnload;
4444
};

0 commit comments

Comments
 (0)