TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.08k stars 375 forks source link

While running Basic Bot, if you minimize EmuHawk, an unhandled Direct3D9Exception will occur. #3618

Open tommai78101 opened 1 year ago

tommai78101 commented 1 year ago

Summary

When EmuHawk is minimized while Basic Bot is running in the background, SlimDX will complain about an unhandled error (D3DERR_INVALIDCALL).

Repro

Both BizHawk v2.8 and BizHawk v2.9:

  1. Open BizHawk v2.8.
  2. Load any ROM.
  3. Open TAStudio.
  4. Open Basic Bot.
  5. Do whatever necessary to start running Basic Bot. Addresses, values, button weights, they all don't matter.
  6. While bot is running, minimize EmuHawk.
  7. Observe you get a pop-up dialog notifying you an error.

Output

I used Visual Studio 2022 attached to EmuHawk to reproduce this stack trace. I hoped it helps.

SlimDX.dll!SlimDX.Result.Throw<SlimDX.Direct3D9.Direct3D9Exception>(object dataKey, object dataValue)
SlimDX.dll!SlimDX.Result.Record<SlimDX.Direct3D9.Direct3D9Exception>(int hr, bool failed, object dataKey, object dataValue)
SlimDX.dll!SlimDX.Direct3D9.Texture.Texture(SlimDX.Direct3D9.Device device, int width, int height, int levelCount, SlimDX.Direct3D9.Usage usage, SlimDX.Direct3D9.Format format, SlimDX.Direct3D9.Pool pool)
BizHawk.Bizware.DirectX.dll!BizHawk.Bizware.DirectX.IGL_SlimDX9.CreateRenderTarget(int w, int h)
BizHawk.Client.Common.dll!BizHawk.Client.Common.RenderTargetFrugalizer.Get(int width, int height)
BizHawk.Client.Common.dll!BizHawk.Client.Common.DisplayManagerBase.RunFilterChainSteps(ref int rtCounter, out BizHawk.Bizware.BizwareGL.RenderTarget rtCurr, out bool inFinalTarget)
EmuHawk.exe!BizHawk.Client.EmuHawk.DisplayManager.UpdateSourceDrawingWork(BizHawk.Client.Common.DisplayManagerBase.JobInfo job)
BizHawk.Client.Common.dll!BizHawk.Client.Common.DisplayManagerBase.UpdateSourceInternal(BizHawk.Client.Common.DisplayManagerBase.JobInfo job)
BizHawk.Client.Common.dll!BizHawk.Client.Common.DisplayManagerBase.RenderOffscreen(BizHawk.Emulation.Common.IVideoProvider videoProvider, bool includeOSD)
EmuHawk.exe!BizHawk.Client.EmuHawk.MainForm.CaptureOSD()
EmuHawk.exe!BizHawk.Client.EmuHawk.BookmarksBranchesBox.CreateBranch()
EmuHawk.exe!BizHawk.Client.EmuHawk.BookmarksBranchesBox.PrepareHistoryAndLoadSelectedBranch()
EmuHawk.exe!BizHawk.Client.EmuHawk.MainForm.LoadQuickSave(int slot, bool suppressOSD)
EmuHawk.exe!BizHawk.Client.EmuHawk.Tools.BasicBot.BasicBot.Update()
EmuHawk.exe!BizHawk.Client.EmuHawk.ToolManager.UpdateToolsAfter()
EmuHawk.exe!BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(bool force)
EmuHawk.exe!BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
EmuHawk.exe!BizHawk.Client.EmuHawk.Program.SubMain(string[] args)
EmuHawk.exe!BizHawk.Client.EmuHawk.Program.Main(string[] args)
[Native to Managed Transition]
mscoreei.dll!00007ff87b23d6ea()
mscoree.dll!00007ff87b2db75b()
kernel32.dll!00007ff89b6026bd()
ntdll.dll!00007ff89d54a9f8()

Host env.

YoshiRulz commented 1 year ago

I suspect this would also happen with TAStudio or with Lua's screenshot-to-socket.

CasualPokePlayer commented 1 month ago

I believe this was "fixed" in https://github.com/TASEmulators/BizHawk/commit/3c168ed64cf28dce7da81ab39f3e43e5f4034658

Note of course this fix pretty much just makes it so if a client screenshot is attempted to be done, it will just return a 1x1 blank screenshot (keep in mind a minimized window is 0x0 resolution, so any kind of client screenshotting done at this point would be nonsense)