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

System.IndexOutOfRangeException at BSNESv115 graphics debugger #3399

Closed
getCursorsExe opened this issue Sep 27, 2022 · 4 comments
Closed

System.IndexOutOfRangeException at BSNESv115 graphics debugger #3399

getCursorsExe opened this issue Sep 27, 2022 · 4 comments
Labels
App: EmuHawk Relating to EmuHawk frontend Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core

Comments

@getCursorsExe
Copy link

This issue can be reproduced with World Class Service Super Nintendo Tester after reaching "Look for many Service Marios" screen in Character test. Opening the graphics debugger at that point might sometimes cause System.IndexOutOfRangeException when the output screen cuts to black. Visual Studio Breakpoints say that this is located at line 338 in BizHawk.Emulation.Cores.Nintendo.SNES.SNESGraphicsDecoder, which is just at the very end of RenderMode7TilesToScreen.

@YoshiRulz YoshiRulz added App: EmuHawk Relating to EmuHawk frontend Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core labels Sep 27, 2022
@YoshiRulz
Copy link
Member

Do you mean here?


If you could copy the stacktrace, that might be more helpful than a line number.

@getCursorsExe
Copy link
Author

getCursorsExe commented Sep 27, 2022

Yes. The stacktrace is not printed when debugging with Visual Studio, sorry.
I have no idea what prevents stacktrace from printing.

@Morilli
Copy link
Collaborator

Morilli commented Sep 27, 2022

Stacktrace I got:

System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs.
   bei BizHawk.Emulation.Cores.Nintendo.BSNES.SNESGraphicsDecoder.RenderMode7TilesToScreen(Int32* screen, Int32 stride, Boolean ext, Boolean directColor, Int32 tilesWide, Int32 startTile, Int32 numTiles) in D:\GitHub\BizHawk\src\BizHawk.Emulation.Cores\Consoles\Nintendo\BSNES\SNESGraphicsDecoder.cs:Zeile 330.
   bei BizHawk.Client.EmuHawk.SNESGraphicsDebugger.RenderTileView()
   bei BizHawk.Client.EmuHawk.SNESGraphicsDebugger.InternalUpdateValues()
   bei BizHawk.Client.EmuHawk.SNESGraphicsDebugger.UpdateAfter()

image
Can't investigate right now, but here it is for now.

@Morilli
Copy link
Collaborator

Morilli commented Oct 1, 2022

Okay so this happens when the game is running and the mouse has hovered a tile in the graphics debugger's tileview that is sufficiently low on the screen (to actually cause the IndexOutOfRangeException). The thing going wrong in this scenario is the currMapEntryState because that is only updated on MouseMove, but when a new frame comes in that changes the TileEntry map, the currMapEntryState isn't updated immediately and can cause this incorrect behavior.

The way to fix this would probably be to update the TileEntry map on every frame update by calling the MouseMove function (or extract its functionality and call that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App: EmuHawk Relating to EmuHawk frontend Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core
Projects
None yet
Development

No branches or pull requests

3 participants