Skip to content
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

TAStudio hash mismatch message error on "Yes" to discard greenzone #4079

Open
RetroEdit opened this issue Oct 6, 2024 · 5 comments
Open

Comments

@RetroEdit
Copy link
Contributor

RetroEdit commented Oct 6, 2024

So in essence, currently even the "safer" option has issues. (I'm skeptical that it would work sensibly anyway, but at the moment it's completely broken.)

var result = _dialogParent.ModalMessageBox2(
caption: "Discard GreenZone?",
text: $"The TAStudio project {movie.Filename.MakeRelativeTo(pathEntries.MovieAbsolutePath())} appears to be for a different game than the one that's loaded.\n"
+ "Choose \"No\" to continue anyway, which may lead to an invalid savestate being loaded.\n"
+ "Choose \"Yes\" to discard the GreenZone (savestate history). This is safer, and at worst you'll only need to watch through the whole movie.");
//TODO add abort option

Repro

  1. Open game, File > Movie > Record movie... and then Tools > TAStudio to open TAStudio so it gets saved as a .tasproj. Close BizHawk
  2. Open another different game of the same platform.
  3. Use File > Movie > Recent to open the previously created .tasproj
  4. Press 'Yes' on the dialog that appears.

Output

System.NullReferenceException: Object reference not set to an instance of an object.
   at BizHawk.Client.Common.TasMovie.InvalidateAfter(Int32 frame) in C:\Emu\_repo\BizHawk\src\BizHawk.Client.Common\movie\tasproj\TasMovie.cs:line 125
   at BizHawk.Client.Common.TasMovie.InvalidateEntireGreenzone() in C:\Emu\_repo\BizHawk\src\BizHawk.Client.Common\movie\tasproj\TasMovie.cs:line 140
   at BizHawk.Client.Common.MovieSession.QueueNewMovie(IMovie movie, String systemId, String loadedRomHash, PathEntryCollection pathEntries, IDictionary`2 preferredCores) in C:\Emu\_repo\BizHawk\src\BizHawk.Client.Common\movie\MovieSession.cs:line 207
   at BizHawk.Client.EmuHawk.MainForm.StartNewMovie(IMovie movie, Boolean newMovie) in C:\Emu\_repo\BizHawk\src\BizHawk.Client.EmuHawk\MainForm.Movie.cs:line 42
   at BizHawk.Client.EmuHawk.MainForm.LoadMoviesFromRecent(String path) in C:\Emu\_repo\BizHawk\src\BizHawk.Client.EmuHawk\MainForm.cs:line 2111
   at BizHawk.Client.EmuHawk.ToolExtensions.ToolExtensions.<>c__DisplayClass0_1.<RecentMenu>b__3(Object o, EventArgs ev) in C:\Emu\_repo\BizHawk\src\BizHawk.Client.EmuHawk\Extensions\ToolExtensions.cs:line 65
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Host env.

  • BizHawk dev build at fedd2db
    • (So it wasn't caused by the recent zwinder changes in 2d229be and f28fa49 )
  • BizHawk dev build at 97785b2; Win11
@RetroEdit RetroEdit changed the title TAStudio hash mismatch message crashes on "Yes" to discard greenzone TAStudio hash mismatch message error on "Yes" to discard greenzone Oct 6, 2024
@Morilli
Copy link
Collaborator

Morilli commented Oct 6, 2024

This issue seems to go back to 84fd85c where this feature was first introduced. GreenzoneInvalidated is only set when starting a movie via TAStudio, but you're opening the .tasproj via recent movies outside of TAStudio.

@Morilli
Copy link
Collaborator

Morilli commented Oct 6, 2024

And yes you're right, state 0 is never invalidated, so trying to seek to frame 1 will crash, even if yes was selected.

@RetroEdit
Copy link
Contributor Author

RetroEdit commented Oct 6, 2024

My comment about work sensibly was more about a repeated workflow where it will prompt you every time you open the movie since the hash itself doesn't seem to be adjusted.

But mostly, in an ideal world it's not even desirable to have the movie open in hash mismatch cases in my opinion. Since autoload makes mistakes like this easy, and reopening with the correct game is what the user wants in those cases, not altering their movie.

I personally would have no issue with the movie open operation being rejected by default like system mismatch, but judging by #2328 and my rejected PR #2335 (which I'd forgotten about till now), this would probably be harmful to certain emulated systems and movie configurations like multi-disk bundler.

@Morilli
Copy link
Collaborator

Morilli commented Oct 13, 2024

Perhaps this feature should be reworked to instead of prompting for deleting greenzone, prompt whether to load the project in the first place and not touch the greenzone.

Even clearing greenzone would not invalidate branches, so trying to load a branch would also result in a crash assuming savestates are not valid. The best way is probably to warn the user that bizhawk might outright crash and let them proceed if they choose to.

@RetroEdit
Copy link
Contributor Author

Branches could technically be repaired by playing back the branch input log from the start and re-creating the savestate.

But I agree: prompting whether to load the project would probably be best. Using a tasproj with a different game is not really supported behavior and probably not worth the effort to implement right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants