check header in OpenReplay #2807
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors replay file handling by removing the redundant CheckReplay function and enhancing header validation in OpenReplay while also improving version information reporting for old replays.
- Removed Replay::CheckReplay functionality
- Added additional header and version flag checks in OpenReplay
- Updated replay file filtering and version info logging in menu handling and refresh logic
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| gframe/replay.h | Removed declaration of Replay::CheckReplay to simplify header checking. |
| gframe/replay.cpp | Added header validations in OpenReplay and removed CheckReplay implementation. |
| gframe/menu_handler.cpp | Updated replay selection logic and added version info logging. |
| gframe/game.cpp | Removed explicit CheckReplay call in RefreshReplay to rely on OpenReplay. |
Comments suppressed due to low confidence (2)
gframe/menu_handler.cpp:545
- Verify that myswprintf is safe from potential buffer overflow issues when formatting version information; consider using a formatting function that guarantees buffer safety if available.
myswprintf(version_info, L"version 0x%X", temp_replay.pheader.version);
gframe/game.cpp:1259
- Without using Replay::CheckReplay, ensure that OpenReplay robustly validates replay files, so that invalid or corrupted files are properly handled later in the process.
if (!isdir && IsExtension(name, L".yrp"))
Collaborator
|
lgtm |
purerosefallen
approved these changes
May 26, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors replay validation by removing the old CheckReplay helper, consolidating header checks into OpenReplay, skips individual file reads in RefreshReplay, and surfaces version details for legacy replays.
- Remove
CheckReplaydeclaration and implementation - Add inline header validation in
OpenReplayand show version info for old replays - Update replay listing to rely solely on extension check and defer validation to
OpenReplay
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| gframe/replay.h | Drop CheckReplay declaration |
| gframe/replay.cpp | Inline header checks in OpenReplay, remove CheckReplay implementation |
| gframe/menu_handler.cpp | Use selected filename variable, append version info for old replay |
| gframe/game.cpp | Simplify RefreshReplay to only filter by extension |
Comments suppressed due to low confidence (1)
gframe/menu_handler.cpp:528
- [nitpick] Consider renaming
filenameto something more descriptive likeselectedReplayNameto clarify its purpose and improve readability.
auto filename = mainGame->lstReplayList->getListItem(sel);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
check header in OpenReplay
remove Replay::CheckReplay
CheckReplaycannot check the detail of yrp file.Now we can check the yrp file by
OpenReplay.does not read yrp file in RefreshReplay
Opening and reading every files takes too much time and has very limited effects.
OpenReplaywill check the file anyway.add version_info for old replay
yrp file of version before 0x1353 has many problems in PRNG, and these file need additional attention.
@mercury233
@Wind2009-Louse