robbert-vdh / yabridge

A modern and transparent way to use Windows VST2, VST3 and CLAP plugins on Linux
GNU General Public License v3.0
2.34k stars 61 forks source link

Superior Drummer 3 #12

Closed jupart closed 4 years ago

jupart commented 4 years ago

Hello! I'm trying to get Superior Drummer 3 to work using yabridge, but it crashes when loading into Bitwig.

What can I do to help figure out the needed overrides or missing dependencies for this plugin? Here is the crash log for wine.

Crash log ``` couldn't load main module (0) Unhandled exception: page fault on read access to 0x00000000, invalid program stack in 64-bit code (0x000000018088ecdd). Register dump: rip:000000018088ecdd rsp:000000000022e6f0 rbp:000000000022e7b9 eflags:00010246 ( R- -- I Z- -P- ) rax:0000000000000000 rbx:0000000002253878 rcx:0000000000000000 rdx:0000000000000000 rsi:0000000000b18d6b rdi:0000000002253878 r8:000000000022e5b0 r9:0000000000000009 r10:0000000000000008 r11:0000000000000246 r12:0000000002253740 r13:0000000000000000 r14:0000000002240ba0 r15:0000000000000000 Stack dump: 0x000000000022e6f0: 000000000022e7d0 0000000002253878 0x000000000022e700: 0000000000000000 0000000000000000 0x000000000022e710: 0000000000002d74 0000000004843652 0x000000000022e720: 0000000000000000 0000000000000001 0x000000000022e730: 0000000000b18d6b 0000000000000000 0x000000000022e740: 0000000000000000 0000000000000000 0x000000000022e750: 0000000000000000 0000000000000000 0x000000000022e760: fffffffffffffffe 0000000000000000 0x000000000022e770: 000000000045504d 0000000000000000 0x000000000022e780: 0000000000000000 0000000000000000 0x000000000022e790: 0000000000000000 0000000000000000 0x000000000022e7a0: 0000000000000000 0000000000000000 Backtrace: =>0 0x000000018088ecdd EntryPoint+0xff9d43f5() in superior drummer 3 (0x000000000022e7b9) 1 0x00000001801df6ef EntryPoint+0xff324e06() in superior drummer 3 (0x0000000181a7f1a0) 2 0x00000001801dda98 EntryPoint+0xff3231af() in superior drummer 3 (0x0000000000000000) 3 0x00007f095b140871 in user32 (+0xc0870) (0x000000000022eec8) 0x000000018088ecdd EntryPoint+0xff9d43f5 in superior drummer 3: movq (%rax),%rdx Modules: Module Address Debug info Name (48 modules) PE 7a850000- 7a854000 Deferred opengl32 PE 7b010000- 7b017000 Deferred kernelbase PE 7b420000- 7b5db000 Deferred kernel32 PE 7bc20000- 7bc24000 Deferred ntdll PE 180000000- 181f50000 Export superior drummer 3 PE 7f0948a70000- 7f0948a73000 Deferred combase PE 7f0948ab0000- 7f0948ab3000 Deferred api-ms-win-appmodel-runtime-l1-1-1 PE 7f0948ac0000- 7f0948ac3000 Deferred api-ms-win-core-sysinfo-l1-2-1 PE 7f094bcf0000- 7f094bcf3000 Deferred dwrite PE 7f094bda0000- 7f094bda4000 Deferred d3dcompiler_47 PE 7f094be10000- 7f094be14000 Deferred d3d10 PE 7f094be70000- 7f094be74000 Deferred wined3d PE 7f0958040000- 7f0958044000 Deferred dxgi PE 7f0958080000- 7f0958084000 Deferred d3d11 PE 7f09581a0000- 7f09581a4000 Deferred d3d10core PE 7f09581b0000- 7f09581b4000 Deferred d3d10_1 PE 7f09581d0000- 7f09581d4000 Deferred d2d1 PE 7f0958780000- 7f0958783000 Deferred api-ms-win-core-localization-l1-2-1 PE 7f0958790000- 7f0958793000 Deferred api-ms-win-core-fibers-l1-1-1 PE 7f09587b0000- 7f09587b3000 Deferred api-ms-win-core-synch-l1-2-0 PE 7f0958970000- 7f0958974000 Deferred winex11 PE 7f0959010000- 7f0959014000 Deferred uxtheme PE 7f0959050000- 7f0959054000 Deferred dbghelp PE 7f09590d0000- 7f09590d9000 Deferred msacm32 PE 7f0959100000- 7f095917d000 Deferred winmm PE 7f09591d0000- 7f09591d4000 Deferred ws2_32 PE 7f0959210000- 7f095921b000 Deferred mpr PE 7f0959240000- 7f095925f000 Deferred wininet PE 7f09592f0000- 7f09592f8000 Deferred oleaut32 PE 7f0959420000- 7f095942b000 Deferred winspool PE 7f0959480000- 7f0959483000 Deferred usp10 PE 7f09594d0000- 7f0959523000 Deferred comctl32 PE 7f0959640000- 7f0959668000 Deferred ole32 PE 7f0959790000- 7f0959793000 Deferred shcore PE 7f09597c0000- 7f09597c8000 Deferred shlwapi PE 7f0959830000- 7f095a106000 Deferred shell32 PE 7f095a270000- 7f095a31c000 Deferred comdlg32 PE 7f095a380000- 7f095a384000 Deferred bcrypt PE 7f095a3b0000- 7f095a3f4000 Deferred crypt32 PE 7f095a4b0000- 7f095a4b4000 Deferred iphlpapi PE 7f095a5e0000- 7f095a5e4000 Deferred imm32 PE 7f095abd0000- 7f095abd7000 Deferred gdi32 PE 7f095ad80000- 7f095ad84000 Deferred rpcrt4 PE 7f095ae10000- 7f095ae14000 Deferred advapi32 PE 7f095aec0000- 7f095aec4000 Deferred ucrtbase PE 7f095afe0000- 7f095afef000 Deferred setupapi PE 7f095b080000- 7f095b168000 Export user32 PE 7f095bd60000- 7f095bd64000 Deferred version Threads: process tid prio (all id:s are in hex) 0000000c services.exe 0000000e 0 0000000d 0 0000000f (D) Z:\usr\bin\yabridge-host.exe 00000021 0 0000001e 0 0000001d 0 0000001c 0 0000001b 0 0000001a 1 00000019 0 00000018 0 00000017 0 00000016 0 00000010 0 <== 00000011 explorer.exe 00000015 0 00000014 0 00000013 0 00000012 0 System information: Wine build: wine-5.7 Platform: x86_64 Version: Windows Server 2008 R2 Host system: Linux Host version: 5.6.11-arch1-1 ```
robbert-vdh commented 4 years ago

I'll track down a demo of Superior Drummer 3 so I can test for myself! Could you try the following for me in the meantime to get some debug output:

  1. First make sure that there are no left over Wine processes running using wineserver -k.
  2. Launch your host from a terminal using env YABRIDGE_DEBUG_FILE=/tmp/yabridge.log YABRIDGE_DEBUG_LEVEL=2 <host>, e.g. env YABRIDGE_DEBUG_FILE=/tmp/yabridge.log YABRIDGE_DEBUG_LEVEL=2 bitwig-studio.
  3. Try to rescan or load Superior Drummer 3.
  4. /tmp/yabridge.log should now contain at least some debug information. Could you upload that file for me? For instance as a file attachment to a comment, as a gist, or to hastebin.
jupart commented 4 years ago

Sure! yabridge.log

robbert-vdh commented 4 years ago

This looks like an issue of Wine failing to load a library that Superior Drummer uses for its GUI, either because Wine does current not implement it itself or because it needs to be installed separately (e.g. through winetricks). At line 9915 the VST host will ask the plugin the dimensions of its editor GUI and while Super Drummer 3 is initializing its GUI, Wine spews out these errors:

11:06:00 [Superior Drummer 3-AFVWZlpx] [Wine STDERR] 0010:err:ole:CoGetClassObject class {4ce576fa-83dc-4f88-951c-9d0782b4e376} not registered
11:06:00 [Superior Drummer 3-AFVWZlpx] [Wine STDERR] 0010:err:ole:create_server class {4ce576fa-83dc-4f88-951c-9d0782b4e376} not registered
11:06:00 [Superior Drummer 3-AFVWZlpx] [Wine STDERR] 0010:err:ole:CoGetClassObject no class object {4ce576fa-83dc-4f88-951c-9d0782b4e376} could be created for context 0x6

Then afterwards, when the host calls effEditOpen() to open the plugin GUI you'll see Wine crashing because it's trying to read from a null pointer, which very likely means that Superior Drummer 3 is trying trying to use the library that failed to load from the Wine errors above (4ce576fa-83dc-4f88-951c-9d0782b4e376). The way to fix this would be to somehow install that library. From a quick Google search I couldn't immediately find which package 4ce576fa-83dc-4f88-951c-9d0782b4e376 belongs to, but it could also be unrelated.

Did you ever manually install those vcrun201* packages using Winetricks? Those might be what you need.

jupart commented 4 years ago

I will check out those packages, there's a couple trails I'm going to hunt down about that package too. Should I be using a 32-bit wine prefix? I'm setting one up now to test.

robbert-vdh commented 4 years ago

There should be no reason to use a 32-bit Wine prefix, even if you're using a 32-bit version of Superior Drummer 3. You could of course always try, but as far as I'm aware the only reason to use 32-bit prefixes is when you need to install some packages through winetricks that outright fail to install on 64-bit Wine prefixes such as ancient versions of .NET Framework.

jupart commented 4 years ago

Back on the 64-bit prefix, I got gdiplus, vcrun2010, vcrun2013, vcrun2015 installed, still crashing in the same place. yabridge.log

robbert-vdh commented 4 years ago

It definitely is some kind of dependency error! I just downloaded a copy of Superior Drummer 3.1.7 and it opens without any issues:

afbeelding

The only problem left, of course, is finding out which specific dependency is missing from your system. Right now I'm using regular Wine Staging 5.6 with the GTK3 integration, but my main Wine prefix is so old that I have installed pretty much everything there is to be installed through winetricks. If I have some more time I will try figure out what I need to install in a clean prefix to get Superior Drummer to work.

EDIT: I just tried opening Superior Drummer in a completely clean Wine prefix without having changed any settings or installed any packages through Winetricks, and it still loads without any issues. Maybe the issue is with the version of Superior Drummer you're using?

jupart commented 4 years ago

Hmm maybe! I'm OK with closing this issue if you are, I'll try to figure out what's up on my end! Thanks for the help :)

EDIT: I am using v3.1.5

jupart commented 4 years ago

Is there anywhere I can support your work on yabridge?

robbert-vdh commented 4 years ago

I'll close the issue then, but please don't hesitate to post your solution if you do end up figuring out what was causing this!

robbert-vdh commented 4 years ago

And at the moment I don't really feel like I should be accepting donations for yabridge since I made this for the sole purpose of making music production on Linux a smoother and more pleasant experience. But please do not hesitate to spread the word about yabridge! :grin:

jupart commented 4 years ago

You wouldn't mind posting the output of winetricks list-installed would you?

jupart commented 4 years ago

I can get the standalone .exe to work, but not the linked .so I made via yabridge.

robbert-vdh commented 4 years ago

Hmmm so I've see this is this exact same problem before with the Roland Cloud synths. I attributed it to the bad DRM implementation there, but it looks like this does warrant some more experimentation. These plugins crash when their editor opens in Bitwig but they work find in Ardour, Carla, Reaper and Renoise. The only important difference in handling I can think of between those hosts is that the latter hosts all call effEditOpen() to open the editor GUI and then call effEditGetRect() to get its dimensions while Bitwig does this the other way around. My guess was that the plugin somehow expect those dimensions it has written before to still be available on effEditOpen(), but that turns out not to be the case. I'll have to investigate some more to see what could possibly be causing this.

robbert-vdh commented 4 years ago

So from what I've been able to find out this caused by a race condition within the plugin itself. It just never happens on Windows because of the way the VST hosts are implemented, because on Windows VST hosts those effEditGetRect and effEditOpen calls will immediately follow each other, and in our case we run the Win32 message handling loop inbetween. Because the plugin expects its GUI to already be open this will cause an infinite loop where the plugin is just waiting for the GUI to open (which will never happen because that's getting blocked by the infinite loop).

I've added a workaround for this specific problem in 0236eef591c973239d6729d1f96a04f77c98a4a7. If you'd like to give it a try, then you can grab a build here: https://github.com/robbert-vdh/yabridge/actions/runs/101948274

I'll have to come up with a more elegant fix if this works well.

jupart commented 4 years ago

I used 0236eef with the AUR package, it works! I'll dig in tomorrow a little deeper, but the plugin loads and makes sound. +1

Edit: So MIDI drag and drop is something I've been trying to figure out with Sonic Charge Microtonic plugin (it's the only direct way to move "grooves" into the DAW). I think this is a wine issue, but it affects this plugin as well. May not be yabridge's problem :)

robbert-vdh commented 4 years ago

Great! I've thought of a more proper solution to this (sadly not uncommon) plugin problem, so I'll implement that shortly on the master branch. And yes the inability to drag-and-drop from plugins sadly seems to be a Wine issue. I haven't had the time to really dig into how and if Wine supports XDND (the X11 drag-and-drop protocol) for dragging things from a Wine window onto regular X11 windows, but it also doesn't work either for standalone Wine windows (i.e. when not embedding into other windows like yabridge does).

EDIT: From a quick search it seems like they implemented a hack for native -> Wine drag and drop in Wine 5.0 (with this tracking issue) because I've used that before without any issues, but there's nothing similar for Wine -> native.

robbert-vdh commented 4 years ago

I've added a cleaner and better version of the fix above fix to the just released yabridge 1.1.3. It Works On My Machine (:tm:), but please let me know if there are still any issues.

jupart commented 4 years ago

I can confirm 1.1.3 continues to fix the issue for me :+1: Thank you!