Skip to content

[GEN][ZH] Implement REPLAY NOT FOUND and MAP NOT FOUND dialogs when attempting to load a Replay that was deleted or whose map is missing #992

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

Merged
merged 2 commits into from
Jun 7, 2025

Conversation

xezon
Copy link

@xezon xezon commented Jun 1, 2025

Merge with Rebase

This change implements a new MAP NOT FOUND dialog when the user attempts to load a Replay whose map is missing in the user data (or game install). Originally the game would crash when trying to start a new game with a missing map.

Additionally it implements a new REPLAY NOT FOUND dialog when the user attempts to load a Replay that was deleted after the Replay Menu was opened.

This change has 2 commits. The first commit is a refactor to help implement the fix efficiently. The second commit contains new code for GameText to allow looking up localization texts with substitute texts when those localizations are not found (which they currently are not because we do not touch game data). The substitution code can be compiled out cleanly when so desired (via GameDefines.h).

TODO

  • Replicate in Generals

Tip

Ignore whitespace in diff viewer to ease reviewing this change.

Dialog Image

shot_20250601_164828_1

@xezon xezon added this to the Stability fixes milestone Jun 1, 2025
@xezon xezon added Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Refactor Edits the code with insignificant behavior changes, is never user facing Crash This is a crash, very bad labels Jun 1, 2025
@xezon xezon requested a review from a team June 1, 2025 14:22
Copy link

@helmutbuhler helmutbuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I would have preferred out parameters instead of the ReplayMapInfo struct, which is a bit weird because it has methods as a struct, doesn't have m_ prefix for the members and makes callsite code more complicated.

@helmutbuhler
Copy link

Btw, can you also 'polish' PR #760? It's also split off of #398, and I don't know how to get your approval there.

Copy link

@roossienb roossienb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the subsitute in place, it would be great to have a follow up PR with:

  • add text for when the replay is paused/unpaused
  • Use substitute for Fast-forward message in Generals

@xezon
Copy link
Author

xezon commented Jun 2, 2025

With the subsitute in place, it would be great to have a follow up PR with:

  • add text for when the replay is paused/unpaused
  • Use substitute for Fast-forward message in Generals

Yes. Good idea.

@xezon xezon force-pushed the xezon/fix-replay-load-crash branch from f034d9f to 3f8abee Compare June 2, 2025 17:28
@xezon xezon changed the title [GEN][ZH] Implement new MAP NOT FOUND dialog when attempting to load a Replay whose map is missing [GEN][ZH] Implement new REPLAY NOT FOUND and MAP NOT FOUND dialogs when attempting to load a Replay that was deleted or whose map is missing Jun 2, 2025
@xezon
Copy link
Author

xezon commented Jun 2, 2025

I would have preferred out parameters instead of the ReplayMapInfo struct, which is a bit weird because it has methods as a struct, doesn't have m_ prefix for the members and makes callsite code more complicated.

Ok changed to function.

I also moved a bit more of the code into separate functions that could be reused elsewhere.

I also noticed that it is possible to attempt loading a Replay file that was deleted after the Replay Menu was opened. It then triggered the OLDER REPLAY VERSION dialog with the OK button. Pressing OK would get the game stuck loading nothing. So I added another new REPLAY NOT FOUND message to prevent that.

shot_20250602_191632_1

@aliendroid1
Copy link

What's with the title! It would better to have the title be something like "Inform when replay can't be loaded"

Also I think instead of waiting for the user to try click it and find out, maybe the titles for such replays should be made strikethrough or grayed out and the dialog information be displayed in a tooltip.

@xezon
Copy link
Author

xezon commented Jun 3, 2025

Also I think instead of waiting for the user to try click it and find out, maybe the titles for such replays should be made strikethrough or grayed out and the dialog information be displayed in a tooltip.

There will be a follow up change for making missing map texts dark red, created by helmut.

As for striking through replays, that is not worth it, because

  1. There currently is no strikethrough font in the game
  2. The Replay Menu list is populated on open. It is not refreshed when the user tinkers with his replay files while the game runs. And the chance that a user deletes his replays from outside the game after opening the Replay Menu are near 0%, because the Replay Menu has a DELETE REPLAY button. One notable feature for the Replay Menu could be a Refresh button. But that is well beyond the scope of this change and beyond what we currently aim to do: Stability fixes.

@xezon xezon requested a review from roossienb June 4, 2025 20:01
{
// TheSuperHackers @bugfix helmutbuhler 08/03/2025 Just use the filename.
// Displaying a long map path string would break the map list gui.
const char* filename = info.getMap().reverseFind('\\');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: I suspect this will still break the Replay list if the file name is very long then. So we perhaps need another change that caps the length of the Replay name here. Unrelated to this Pull Request.

@xezon xezon force-pushed the xezon/fix-replay-load-crash branch from 3f8abee to 4decb84 Compare June 6, 2025 21:35
@xezon xezon changed the title [GEN][ZH] Implement new REPLAY NOT FOUND and MAP NOT FOUND dialogs when attempting to load a Replay that was deleted or whose map is missing [GEN][ZH] Implement REPLAY NOT FOUND and MAP NOT FOUND dialogs when attempting to load a Replay that was deleted or whose map is missing Jun 6, 2025
@xezon
Copy link
Author

xezon commented Jun 6, 2025

Replicated to Generals without conflicts. Commit title improved.

@xezon xezon force-pushed the xezon/fix-replay-load-crash branch from 4decb84 to a8f2fa7 Compare June 6, 2025 21:41
xezon and others added 2 commits June 7, 2025 10:37
…stbox to new function (#992)

Co-authored-by: Helmut Buhler <buhler@8gadgetpack.net>
…eplay that was deleted or whose map is missing (#992)

Co-authored-by: Helmut Buhler <buhler@8gadgetpack.net>
@xezon xezon force-pushed the xezon/fix-replay-load-crash branch from a8f2fa7 to 0ddf70e Compare June 7, 2025 08:38
@xezon xezon merged commit 2c30516 into TheSuperHackers:main Jun 7, 2025
18 checks passed
xezon added a commit that referenced this pull request Jun 7, 2025
…stbox to new function (#992)

Co-authored-by: Helmut Buhler <buhler@8gadgetpack.net>
@xezon xezon deleted the xezon/fix-replay-load-crash branch June 7, 2025 09:15
@xezon xezon added the GUI For graphical user interface label Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing Crash This is a crash, very bad Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals GUI For graphical user interface Refactor Edits the code with insignificant behavior changes, is never user facing ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replay Menu looks broken when a replay with missing map file is listed
4 participants