freezy / dmd-extensions

A toolbox for virtual pinball dot matrix displays.
GNU General Public License v2.0
127 stars 54 forks source link

Unhandled Exception ZeDMD win10 #460

Closed AussieMakerGeek closed 5 months ago

AussieMakerGeek commented 8 months ago

Hi, First time using ZeDMD on a new build and trying to get it working and I am getting an error. The DMD boots and displays it's logo etc but I can't interact with it.

ZeDMD 3.4.1 dmd extensions 2.2.1 Windows 10 fresh build (x64)

PS C:\VisualPinball\VPinMAME> .\dmdext.exe test -d auto

Unhandled Exception: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.Media.Imaging.BitmapSource.get_PixelWidth()
   at LibDmd.Common.ImageUtil.ConvertToRgb24(BitmapSource bmp, Int32 offset, Double lum)
   at LibDmd.Frame.BmpFrame.ConvertToRgb24()
   at LibDmd.RenderGraph.<>c__DisplayClass62_0.<Connect>b__14(BmpFrame frame)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Reactive.Stubs.<.cctor>b__1(Exception ex)
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.ScheduledObserver`1.Dispatch(ICancelable cancel)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
PS C:\VisualPinball\VPinMAME>

The same happens if I use '--use-ini' but if I just run the test, the app displays ok.

zesinger commented 8 months ago

Hello, could you try with these versions (made by mkalkbrenner) DmdDevice.zip and DmdDevice64.zip ?

AussieMakerGeek commented 8 months ago

Thanks for the response - That has not made much difference. I still get the same error when running the test command but now with those DLLs in place, VPX just crashes when I try to load a table. Swapping the DLLs back at least allows the table to load.

I see that when it did go to do the test, the ZeDMD version disappears from the DMD as if it initialises, but it never displays anything.

AussieMakerGeek commented 8 months ago

So I just tried some older x86 versions on a different PC (Win11) and from 2.1.1 up to 2.2.0-Beta2 all pass the test ok. However, releases of 2.2.0 and newer do not work. It produces the same error.

I tested with a different computer just in case there was something going on with the PC

However, i observed unusual behavior in that the first time I ran 2.2.1, the virtual DMD came up and it seemed to reset the DMD but then never displayed anything. No Error like initially reported. But I did get some 'access denied' messages so I tried running it from administrator prompt and then I got the app crash. Then after that, every time it would crash, regardless of admin access or not.

image

Edit:

TLDR: The exe is broken past 2.2.0 Beta 2, DLLs are fine. Install Visual C++ Redistributable regardless of doing MSI or manual install...

Ok, after a BUNCH more testing, I can confirm that the issue is not in the DLL(s), it's in the actual dmdext.exe file.

I can use the latest 2.2.1 DLLs with the exe from 2.2.0 Beta 2 and it works.

I did come across another weird issue in my travels that I think it's also worth mentioning here though.

When I was testing on this alternative windows 11 machine, it worked with no issue at all, but when plugging it back into the cabinet PC, the app would now load fine, the screen would clear but no display still.

I originally used the MSI installer so glanced past the 'manual install' part, but this contains a significant importance that the MSI does not handle, and that is that the 'Visual C++ Redistributable' must be installed manually REGARDLESS of MSI or manual install. This had me chasing my tail for hours trying to work out why it worked fine on my test machine and not in the cab because it does not generate any errors. As soon as i installed it, the DMD started working.

zesinger commented 8 months ago

@mkalkbrenner : could you check this, please?

mkalkbrenner commented 8 months ago

There's nothing to check. @freezy needs to merge the pending MR for newer ZeDMD Versions: https://github.com/freezy/dmd-extensions/pull/450

I assume, we need a new exe file to test with, not just the DLLs

mkalkbrenner commented 7 months ago

@AussieMakerGeek could you test the snapshot build? https://ci.appveyor.com/project/freezy/dmd-extensions/builds/49117433

freezy commented 5 months ago

This should be fixed now, re-open if that's not the case.