-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Added a warning before loading incompatible replays #7353
Added a warning before loading incompatible replays #7353
Conversation
else if (replayMeta.GameInfo.Version != Game.ModData.Manifest.Mod.Version) | ||
ConfirmationDialogs.PromptConfirmAction("Incompatible replay", "This replay was recorded with a different engine version {0}.".F(replayMeta.GameInfo.Version), onConfirm, onCancel); | ||
else if (replayMeta.GameInfo.MapPreview.Status != MapStatus.Available) | ||
ConfirmationDialogs.PromptConfirmAction("Incompatible replay", "This replay was recorded with an unavailable map {0}.".F(replayMeta.GameInfo.MapUid), onConfirm, onCancel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with what @obrakmann said with the addition of stating the replay's mod's version to indicate the correct version of OpenRA that can view the replay. |
Change confirm to continue? Might not hurt to add that continuing can result in abnormalities, desyncs, and crashes. So all up something like this: Incompatible Replay This replay was recorded with engine version Continue Cancel |
The dialog should also be displayed when the check in 2cdcd0f is triggered, or if this pr supersedes it then that should be reverted. That fix should have been sufficient to fix @obrakmann's issues, but I don't think he posted any stack traces to debug against so I don't know what is going wrong here. |
Actually, scratch that. Having these in the metadata block will make it easier to hook up file explorer / shell integration. |
b8e3836
to
8f9b815
Compare
Updated. You now can't start incompatible replays only cancel. Continue anyway made only sense when there was no replay meta block, but the replay is still compatible which is just useful now during development of this pull request, but not afterwards. The game will now also automatically switch to the correct mod at startup which is required for #4528. |
8f9b815
to
ac28c1e
Compare
Also cleaned the code a bit to avoid redundancy. |
{ | ||
static readonly Action DoNothing = () => { }; | ||
|
||
public static bool CheckReplayCompatibility(ReplayMetadata replayMeta, Action onCancel = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't IsReplayCompatible()
sound better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also thought about that. It does not only check that though, but also displays popup windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably split this so it does one thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already moved the UI fluff to IncompatibleReplayDialog
during the last set of requested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to request the namechange that @penev92 mentioned, Check
is just doing something while the Is
prefix is pretty universal for bools.
I tested this together with #4528, and I'm happy with it now. The game did the expected thing in all situations I tested (wrong version, missing mod, missing map). The only minor nit I have is that the cancel button isn't centered in ra (and d2k/ts, presumably). I suggest just adding a new dialog definition to 👍 with the fixed dialog. |
ac28c1e
to
8d5ea88
Compare
Added the |
8d5ea88
to
71f0339
Compare
Testing with relpays not-from-this-PR leads to:
I'd suggest switching the mod and version checks to avoid the WTF? they cause in that case. |
That is on purpose. Replays from old releases (different version) and from very old releases (not even a version stamp in the replay) will be incompatible. |
It will be a while before there is a difference between those two. |
I was already asked to remove the continue anyway button, because it is only useful on the development branch during a brief period. |
No, I get that the version is incompatible. But the game tells me the mod is unknown. That is my problem with it. |
I hit the following crash when trying to load an old replay file:
|
@@ -78,7 +80,14 @@ public void StartGame(Arguments args) | |||
var replay = args != null ? args.GetValue("Launch.Replay", null) : null; | |||
if (!string.IsNullOrEmpty(replay)) | |||
{ | |||
Game.JoinReplay(replay); | |||
var replayMeta = ReplayMetadata.Read(replay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the CheckReplayCompatibility
check immediately after this (and adding a null check inside it) should fix my crash and polish issue that @penev92 explained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will also need to reorder the checks inside CheckReplayCompatibility
to first check for replayMeta == null
, then version == null
, then mod == null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Which is exactly what it does. When you select an incompatible replay you will be brought back to the replay browser. |
71f0339
to
bc5f2d3
Compare
That isn't what happens when you launch from the OS file browser or commandline. |
I had a [Continue] button at first, but it was meant to load the replay anyway despite warnings which was removed on request. |
Needs a rebase. |
bc5f2d3
to
d7abfa0
Compare
Rebased. |
if (ReplayUtils.CheckReplayCompatibility(replayMeta, Game.LoadShellMap)) | ||
Game.JoinReplay(replay); | ||
|
||
var mod = replayMeta.GameInfo.Mod; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still throw when replayMeta
is null. You can fall back to the current mod if it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CheckReplayCompatibility
will catch that so it can never throw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code still runs and throws after CheckReplayCompatibility
displays its error dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, fixed.
d7abfa0
to
576594e
Compare
|
||
static bool IncompatibleReplayDialog(string type, string name, Action onCancel) | ||
{ | ||
var error = "It was recorded with " + type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty nit-picky of me but since you are really hardcoding the different reasons here this string may as well include the "an" that all of the reasons start with, instead of duplicating it.
After the two comments I made are addressed: 👍. |
576594e
to
e13447e
Compare
Tried to please all the nit-pickers. |
Thank you |
…eplay Added a warning before loading incompatible replays
This was demanded at #4528 (comment) by @pchote and is also useful to reduce the number of support requests https://github.com/OpenRA/OpenRA/wiki/FAQ#old-replays-crash-the-game.