Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. WalkthroughThe pull request extends shared path utilities and updates engine, library, and tool code to use them. The changes replace backslash-specific parsing in path operations and filename extraction. They also remove two file-transfer helpers and one library filename helper. ChangesShared path handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Suggested reviewers: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1a9d0ce7-d8fc-4873-a0c0-c8cd27bd0843
📥 Commits
Reviewing files that changed from the base of the PR and between 9176130 and 6700aad51d9f5e930cf4a9f306171a02352d2437.
📒 Files selected for processing (80)
Core/GameEngine/Include/GameNetwork/FileTransfer.hCore/GameEngine/Source/Common/Audio/AudioEventRTS.cppCore/GameEngine/Source/Common/CRCDebug.cppCore/GameEngine/Source/Common/INI/INIMapCache.cppCore/GameEngine/Source/Common/MiniLog.cppCore/GameEngine/Source/Common/System/Debug.cppCore/GameEngine/Source/Common/System/FileSystem.cppCore/GameEngine/Source/Common/System/GameMemoryInit.cppCore/GameEngine/Source/Common/WorkingDirectory.cppCore/GameEngine/Source/GameClient/MapUtil.cppCore/GameEngine/Source/GameLogic/Map/TerrainLogic.cppCore/GameEngine/Source/GameNetwork/FileTransfer.cppCore/GameEngine/Source/GameNetwork/GameInfo.cppCore/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cppCore/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppCore/Libraries/Include/Lib/PathUtil.hCore/Libraries/Source/WWVegas/WW3D2/agg_def.cppCore/Libraries/Source/WWVegas/WW3D2/ringobj.cppCore/Libraries/Source/WWVegas/WW3D2/sphereobj.cppCore/Libraries/Source/WWVegas/WW3D2/w3d_dep.cppCore/Libraries/Source/WWVegas/WWAudio/AudibleSound.cppCore/Libraries/Source/WWVegas/WWAudio/Utils.hCore/Libraries/Source/WWVegas/WWDownload/FTP.cppCore/Libraries/Source/WWVegas/WWLib/WWCommon.hCore/Libraries/Source/WWVegas/WWLib/ffactory.cppCore/Libraries/Source/debug/debug_debug.cppCore/Libraries/Source/debug/debug_io_flat.cppCore/Libraries/Source/debug/debug_stack.cppCore/Tools/Autorun/Utils.cppCore/Tools/Autorun/Wnd_file.cppCore/Tools/ImagePacker/Source/ImagePacker.cppCore/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cppCore/Tools/Launcher/DatGen/DatGen.cppCore/Tools/Launcher/findpatch.cppCore/Tools/Launcher/main.cppCore/Tools/Launcher/patch.cppCore/Tools/W3DView/GraphicView.cppCore/Tools/W3DView/MainFrm.cppCore/Tools/W3DView/SaveSettingsDialog.cppCore/Tools/W3DView/Utils.cppCore/Tools/W3DView/Utils.hCore/Tools/W3DView/W3DViewDoc.cppCore/Tools/WW3D/max2w3d/w3dutil.cppGenerals/Code/GameEngine/Source/Common/Recorder.cppGenerals/Code/GameEngine/Source/Common/StatsCollector.cppGenerals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cppGenerals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cppGenerals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cppGenerals/Code/Tools/GUIEdit/Source/GUIEdit.cppGenerals/Code/Tools/WorldBuilder/src/BuildList.cppGenerals/Code/Tools/WorldBuilder/src/SaveMap.cppGenerals/Code/Tools/WorldBuilder/src/ScriptDialog.cppGenerals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cppGenerals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cppGeneralsMD/Code/GameEngine/Source/Common/Recorder.cppGeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cppGeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cppGeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cppGeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cppGeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cppGeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cppGeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cppGeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cppGeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cppGeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cppGeneralsMD/Code/Tools/wdump/wdump.cpp
💤 Files with no reviewable changes (2)
- Core/GameEngine/Include/GameNetwork/FileTransfer.h
- Core/GameEngine/Source/Common/System/FileSystem.cpp
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
382efc8 to
63de2c4
Compare
962122f to
5ec1b8c
Compare
5ec1b8c to
641b280
Compare
641b280 to
9abcce4
Compare
9abcce4 to
7cdd6b3
Compare
[Medium impact] The reviewed changes appear safe to merge.
|
xezon
left a comment
There was a problem hiding this comment.
Are we certain this covers all call sites?
|
No, not all of them. Autorun/Utils.cpp:397 and :407 (Path_Add_Back_Slash) and W3DView/Utils.h:65 and :72 (Delimit_Path) still do it by hand, because they take a path with no buffer size. The Babylon and DatGen strcat calls have no existing-separator check, so I left them. If you want the unsized ones covered too, I'll add overloads for them. |
…atorInPath and return the path length
|
The title and description are outdated. |
|
Updated |
Upstream TheSuperHackers/GeneralsGameCode up to ee27e89 (19 commits, through TheSuperHackers#3691), with the DX9 side of their changes: - The embedded web browser removed (TheSuperHackers#3691): DX8WebBrowser's start-up, update, render and shutdown go, and with them dx8webbrowser.h, W3DWebBrowser.cpp in both trees and the core_browserengine link. Our edits there were d3d8 -> d3d9 includes only. Kept beside them: the RmlUi start-up in W3DDisplay::init, Begin_Scene's handling of an already-active scene (dx8wrapper.cpp), and WW3D2's d3d9 link. - Dynamic vertices written through VertexFormatXYZNDUV2 fields (TheSuperHackers#3671), our dynamic buffer's own layout: the streak renderer takes upstream's writes with its UVs still mapped into the particle atlas cell (6bae419); seglinerenderer merged as upstream wrote it. - max2w3d's libraries (TheSuperHackers#3679): upstream's list, d3d9 where it names d3d8lib - the fork has no d3d8lib target. The exporter is not built in this configuration. - Taken as they are: Targa header validation (TheSuperHackers#3572 - every loose, repo and archived TGA the game loads passes it), Convert_Color without a reinterpret (TheSuperHackers#3655), shore waves restored when a saved game loads (TheSuperHackers#3493), RawFileClass::Raw_Seek returning the position again (TheSuperHackers#3679), the special-power fixes (TheSuperHackers#3666 - in this retail-compatible build only MissileLauncherBuildingUpdate's crash fix changes anything), map cache and path helpers (TheSuperHackers#3107, TheSuperHackers#3444), the MinGW CI job (TheSuperHackers#3552). Checked before merging: the merged tree configured and built in a scratch worktree (z_generals Release, 0 errors); this commit's tree is that build's source. Six tools fail to build exactly as they do on main before the merge (ParticleEditor, DebugWindow, WorldBuilder, wdump, W3DView, the old tree's WW3D2). # Conflicts: # Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp # Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt # Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.h # Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp # Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp # Core/Tools/WW3D/max2w3d/CMakeLists.txt # Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp # GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp
…442) * fix(targa): Validate header sizes when loading Targa images (TheSuperHackers#3572) * fix(dx8wrapper): Prevent undefined behavior when converting Vector4 colors (TheSuperHackers#3655) * fix(ww3d2): Prevent undefined behavior when writing dynamic vertices and reading screenshot pixels (TheSuperHackers#3671) * refactor(pathutil): Add ensureTrailingSeparatorInPath helper (TheSuperHackers#3444) * bugfix(max2w3d): Let the timecoded animation compression drop keys of slow rotations (TheSuperHackers#3679) The compression tests whether a rotation key can be rebuilt from its neighbours with Slerp and measures the angle to the original. Slerp interpolated linearly without normalizing when the neighbours were less than about 5.1 degrees apart. The shortened quaternion read as an error of about half that span, so with the default tolerance of 0.05 degrees, keys of bones rotating between about 0.05 and 2.5 degrees per frame were never dropped, while faster bones compressed normally. Slerp now interpolates linearly only below the threshold that WWMath's Slerp and the game's Fast_Slerp use. Measured with VC6 on 61-frame test tracks, a constant rotation of 0.1 to 2.5 degrees per frame now keeps 2 keys instead of 61, and an ease in/out over 30 degrees keeps 15 instead of 59. Fast rotations are unchanged. The compression checks a removed key only against its neighbours at the time of removal, as it does for translations. Slow rotations now reach that limit too: on the test tracks, the largest error at removed frames is about 0.1 to 0.16 degrees. * refactor(maxsdk): Read max.h and maxscrpt.h through wrappers that restore the clashing macros (TheSuperHackers#3679) The force included max_undef.h removed the VC6 override shim and PI for the whole file, so no header read after the Max SDK could use the shim. max_sdk.h and maxscrpt_sdk.h now hide both macros only while the Max SDK headers are read, and restore them afterwards. max_undef.h keeps WIN32_LEAN_AND_MEAN, which must be undone before any header includes Windows.h. The wrappers have no include guard, because max.h has none: each time it is read, it redefines assert through assert1.h as an assert that also checks in release builds, and the plugin relies on that. Both PI values are the same float. * bugfix(rawfile): Return the file position from RawFileClass::Raw_Seek again (TheSuperHackers#3679) Since the switch of RawFileClass to the C stdio API, Raw_Seek returned the result of fseek, which is 0 on success, instead of the position that SetFilePointer returned. Seek and Tell of RawFileClass and of the classes derived from it returned 0 as well. ChunkSaveClass keeps these positions to go back to a chunk header and to continue writing behind the chunk, so files it wrote through these classes were overwritten from the start. This broke W3DView's saves of emitters, LODs, aggregates and animations. ChunkLoadClass::Seek always failed, and WWAudio passed 0 to the seek callback of Miles, which W3DView uses to play sounds. Raw_Seek now returns the position after the seek again, or -1 on failure. The game reads its files through GameFileClass, which already returns the position, and does not use the result when it writes files through RawFileClass. * refactor(max2w3d): Replace pluglib's copies of WWLib and WWMath with WWLib and WWMath (TheSuperHackers#3679) max2w3d and pluglib now include the WWLib and WWMath headers and link core_wwvegas, plus core_wwstub for the memory pool and operator new hooks that WWLib's always.h declares. pluglib keeps only its 3ds Max helpers and the Max matrix variant of EulerAnglesClass. The returning forms of Slerp and Vector3::Cross_Product only exist in WWMath with ALLOW_TEMPORARIES, so their callers use the forms with an output parameter. The AABTree builder no longer needs its own WWASSERT. WWMath normalizes vectors with Inv_Sqrt_Legacy instead of 1/sqrt. Measured with VC6 over a million random vectors, 87% of the exported normals stay bit-identical and the others differ by 1 or 2 ulp. Slerp computes with WWMath::Acos and Sinf_Legacy, which changes the components of its results by at most 2.4e-7, measured over a million random pairs. The abstract classes of the plugin now take _purecall from WWLib instead of the C library, as in the other tools that use WWLib. It pulls in the CPU detection and the system timer, so loading the plugin detects the CPU and calls timeBeginPeriod(1). * refactor(max2w3d): Use WWMath's EulerAnglesClass (TheSuperHackers#3679) pluglib's EulerAnglesClass was WWMath's adapted to take a Max matrix. The two callers now convert the Max matrix into a Matrix3D with the new Convert_Max_Matrix, which keeps the layout the adapted class used, and use WWMath's EulerAnglesClass. WWMath computes the angles in float instead of double. Measured with VC6 over a million random rotations, 98.7% of the exported pivot Euler angles stay bit-identical, and none differs by more than 5e-10 radians. The game does not read them. * refactor(max2w3d): Replace the Targa class with WWLib's (TheSuperHackers#3679) max2w3d's copy of TARGA differed from WWLib's only in writing through the C runtime file functions instead of WWLib's file factory, and in fixes that WWLib has since received. The exporter writes its 16x16 texture of material colors through WWLib's class now, with the same bytes. * refactor(max2w3d): Use w3d_file.h and w3d_obsolete.h from WW3D2 (TheSuperHackers#3679) max2w3d's copies of the W3D format headers were older versions of the WW3D2 ones. The newer w3d_file.h adds chunks, structs and enum values and swaps the values of SORT_LEVEL_BIN1 and SORT_LEVEL_BIN3, none of which max2w3d uses, apart from five surface types that the material dialog now also offers: Water Permeable, Tiberium Water, Tiberium Water Permeable, Underwater Dirt and Underwater Tiberium Dirt. * refactor(max2w3d): Move the remaining pluglib files into max2w3d (TheSuperHackers#3679) Only max2w3d used pluglib's 3ds Max helpers, so they move into max2w3d unchanged and the core_pluglib target is removed. * fix: Fix map cache path slashes for non-Windows (TheSuperHackers#3107) * bugfix(specialpower): Fix special powers never becoming ready on constructed structures (TheSuperHackers#3666) Non-retail builds started every special power of an object that is created under construction with a ready frame of 0xFFFFFFFF, so that it could not be used before the construction was finished. Only a SpecialPowerCreate module started the recharge on build completion, so the powers of structures without one, such as the Battle Plans and the CIA Intelligence of the America Strategy Center, never became ready. The ready frame now starts at 0 as in retail. The new SpecialPowerModule::canDoSpecialPower() tells whether the object can use its special power now, regardless of the timer. In non-retail builds it is false while the object is disabled, the power is paused, or the object is under construction, and isReady() requires it. This keeps shared powers unavailable on a structure that cannot use them, and stops the skirmish AI from firing a superweapon from a structure that is still being built. getPercentReady() now reports 1 only when isReady() is true, so that ActionManager no longer accepts a command that the special power then refuses. A power under construction reports 0, a paused power keeps the percent it was paused at, and any other power that is not ready stays below 1. * bugfix(specialpower): Prevent special powers from executing on structures under construction (TheSuperHackers#3666) Scripts and forced command button commands execute a special power without asking isReady(), so they could still use the special power of a structure under construction. In Zero Hour this dereferenced the special power module of MissileLauncherBuildingUpdate before its first update had looked it up. The special power entry points of SpecialPowerModule now refuse when canDoSpecialPower() is false. The powers that can sit on a structure and act after the base class call check it as well: OCLSpecialPower, SpyVisionSpecialPower, BaikonurLaunchPower, CashHackSpecialPower, DefectorSpecialPower and, in Zero Hour, FireWeaponPower. In non-retail builds this also stops these powers from creating their effect while the power is paused, for example the scan of a GLA Radar Van before its upgrade, which the base class already refused. MissileLauncherBuildingUpdate no longer crashes while it does not know its special power module yet. The retail escape path for an unready MissileLauncherBuildingUpdate now also stops OCLSpecialPower::doSpecialPower() from creating its object creation list, as it already did for doSpecialPowerAtLocation(). * bugfix(missilelauncherbuildingupdate): Look up the special power module when the object is created (TheSuperHackers#3666) MissileLauncherBuildingUpdate looked up its special power module only in its first update after construction. A special power fired before that, by a script on the frame the launcher is created or right after a save game is loaded, found no module. This no longer crashes, but in non-retail builds the missile was launched without the door sequence. In non-retail builds the module is now looked up in onObjectCreated(), once all modules of the object exist. Retail-compatible builds keep the lazy lookup in update() and the escape path that refuses the launch. * bugfix(watertracks): Restore shore waves when loading saved games (TheSuperHackers#3493) * refactor: Remove unused embedded web browser (TheSuperHackers#3691) * refactor(ww3d2): Route lights and fog via Renderer (TheSuperHackers#3420) * refactor(ww3d2): Remove the unused black and white shadow renderer (TheSuperHackers#3670) TexProjectClass only rendered with BWRenderClass inside an #if 0 block, so SpecialRenderInfoClass::BWRenderer was always null and MeshModelClass::Shadow_Render returned without drawing. * refactor(filesystem): Rename appendPathSeparator to ensureTrailingPathSeparatorInPath (TheSuperHackers#3694) * build(max2w3d): Fix the compile error from passing no image size to Targa::SetImage (TheSuperHackers#3696) * refactor: Replace _isnan and _finite with std::isnan and std::isfinite (TheSuperHackers#3686) _isnan and _finite are MSVC CRT functions from <float.h>. Use the standard functions instead. The new cmath_adapter.h gives VC6 std::isnan and std::isfinite built on _isnan and _finite, because neither VC6 nor STLport 4.5.3 has them. * ci(build): Keep precompiled headers when caching with ccache (TheSuperHackers#3701) * ci(build): Cache the MinGW-w64 toolchain packages (TheSuperHackers#3710) * feat(ww3d2): Implement texture atlas (TheSuperHackers#3562) * bugfix(worldheightmap): Restore Generals retail compatibility of the cliff state (TheSuperHackers#3634) Merging the Height Map code gave Generals the cliff state rows of Zero Hour, which have (width+7)/8 bytes. Retail Generals keeps them in rows of (width+1)/8 bytes, which are too short for the last cells of a row when the map width modulo 8 is 2 to 6. These cells share their bit with the first cells of the next row. Since the merge they read as no cliff instead, so the pathfinder classifies them differently and retail Generals replays on such maps mismatch. Retail Generals also reads the cliff bits of version 8 maps, which come from Zero Hour, in rows of (width+1)/8 bytes, while Zero Hour writes them in rows of (width+7)/8 bytes. When the map width modulo 8 is 1 to 6, each row in the file is one byte longer than the row retail reads, so retail reads each row one byte further off than the row before. A retail compatible Generals now restores the cliff state of retail after loading. For version 7 maps the last cells of a row take the stored bits of the first cells of the next row. For older maps, whose flags are computed from the heights column by column, the first cells of the next row take the flags of the last cells, which retail computes last. For version 8 maps the bits are regrouped into the rows that retail reads. Without retail compatibility, Generals and Zero Hour compute the flags of these cells from the heights for version 7 maps, because the file has no bits for them. Steep slopes in the last columns of such maps are no longer passable for ground units. Version 8 maps without retail compatibility and a retail compatible Zero Hour keep the cliff state as before. * bugfix(polygontrigger): Restore Generals retail compatibility of version 4 polygon triggers (TheSuperHackers#3634) Merging the map code gave Generals the layer name that Zero Hour stores in version 4 polygon triggers. Retail Generals does not know it and reads the following values of such triggers from the wrong bytes. With an empty layer name, the first trigger is never a water area, and reading its points runs past the end of the file, so no further triggers are read. Since the merge, Generals reads the water areas of Zero Hour maps correctly, so retail Generals replays on such maps mismatch. A retail compatible Generals now skips the layer name again and reads these triggers like retail. In debug builds this raises an assert for each value read past the end of the chunk. Without retail compatibility, and in Zero Hour, the layer name is read as before. * refactor: Replace Westwood function comment blocks with slim comments (TheSuperHackers#3697) The Westwood comment blocks above the functions are replaced by slim comments. Descriptions are kept where they add to the function name. INPUT and OUTPUT entries are dropped unless they say something the signature does not, such as units or valid ranges. History entries are dropped, except for notes on how a function behaves today and the TheSuperHackers entries, which keep their keyword. The Functions lists in the file headers are removed as well, since they repeat the function descriptions. * refactor: Remove the unused ATL includes (TheSuperHackers#3711) * ci(build): Remove the Wine and widl install step from MinGW-w64 jobs (TheSuperHackers#3675) * fix(worldbuilder): Prevent null dereferences and simplify name restore in object editing (TheSuperHackers#3383) * fix(build): restore winsock2 include in NetworkMesh and undef PAGE_SIZE in textureatlas * fix(build): use winsock2.h in udp.h for Windows compatibility * fix(build): include winsock2.h before windows.h in PreRTS.h * docs(worklog): remove leftover merge marker in 2026-11-DIARY.md --------- Co-authored-by: Bobby Battista <[email protected]> Co-authored-by: Jacob Lane Ledbetter <[email protected]> Co-authored-by: xezon <[email protected]> Co-authored-by: Omar Aglan <[email protected]> Co-authored-by: stm <[email protected]>
Adds ensureTrailingSeparatorInPath to PathUtil.h. It appends the native separator unless the path is empty or already ends with a separator, and fails when the buffer has no room for it. It returns the result in .ok and the new path length in .length.
Replaces the hand-written trailing separator checks in ImagePacker, W3DView, Autorun, WWLib, WW3D2 and WorldBuilder.
The
CStringoverload ofDelimit_Pathin W3DView now skips an empty path instead of reading before its start.