32bit plugins freeze FL Studio 12.x - 2X.x
I'm taking a workaround posted on wine and linking it here. This is not my own findings. I'm just spreading the word to people who don't use bugzilla on WINE. Link is here.. https://bugs.winehq.org/show_bug.cgi?id=44827 This has been an issue for many versions. I tried debugging it, (Im armonius in the bugzilla post)but I don't understand WINE enough to patch it. But I'll be working through that when I get the time at some point. But anyways, the cleanest workaround(don't use Jbridge if u don't want to be messing with parameters and settings) is to use the registry.(type wine regedit in the terminal) Go to Here HK_USERS > S-1-5-21-0-0-0-1000 > Software > Image-Line > Shared > Plugins > Fruity Wrapper > Plugins Look for the vendor of the 32bit plugin you're trying to use. If it's not there, create a new folder(key i think) Make sure it matches directly(it's case sensitive). Then go into that key and add a new value called 'BridgedExternalWindow' and set it to 1... Now if you want to open saved projects and have it automatically open them up as bridged, it's a different folder in the registry. But I don't remember it off the top of my head. I'll try to get back to it the next time I get my hands on my bros laptop.
I would like to add that I managed to load a 32bit plugin following this workaround, with the difference that under the vendor key (folder) I added a new 'dword value' with the name 'BridgedExternalWindow', having the value 1. (Commenting this just so people won't go crazy finding out which value type to put)
@OmniWarp Yeah that's totally fine. Thats better for the community... . I'm a total noob at this, but I have been trying to properly debug this and the constant flickering issue. I think I found a lead on what's causing the freeze. (FL uses delphi, and one of delphi's classes called Tapplication may be passing incorrect window properties.) But I need to write some more traces in wine, recompile it and see what properties it's passing to be sure... I tried posting some of my findings inside of the FL studio forum, but even after creating an account, I still can't post for some reason..
I'm having some mixed results with this workaround when reopening projects which I have not yet been able to identify the cause. To be on the safe side with old 32-bit projects, I will also be using the other workarounds suggested in the winehq post which is to enable the "External window" setting on the processing tab for each plugin and also to then try and remember to continue to save these projects with the processing tab left as default (or anything else other than the GUI) for each plugin just in case I need to trouble shoot in future. Hopefully this is the year to wave goodbye to Windows!!!
I'm having some mixed results with this workaround when reopening projects which I have not yet been able to identify the cause. To be on the safe side with old 32-bit projects, I will also be using the other workarounds suggested in the winehq post which is to enable the "External window" setting on the processing tab for each plugin and also to then try and remember to continue to save these projects with the processing tab left as default (or anything else other than the GUI) for each plugin just in case I need to trouble shoot in future. Hopefully this is the year to wave goodbye to Windows!!!
Yes i had issues with that too... Fl studio uses a different folder within the registry to store the folder of saved plugin states.... I dont remember the folder. but there iss a seperate folder inside of the same Fruity Wrapper folder in the registry That you have to add 'BridgedExternalWIndow' to.
Im going to post my findings here.. I have been working on a lot and Im going to try to explain in as much detail I can without having to source too much pieces of information(I dont have the time right now, but i need to do something) The first thing I did when troubleshooting complex issues like this is to run the program with
WINEDEBUG=+class,+win,+relay and see if i can find anything suspicious in the behavior. I ran two logs.one of them with some custom patches to look at what class it is registering each time it loads a window. I truly detest consistently looking through log files. It puts me to sleep and its hard conceptualizing fixing the issue with them. But i did see weird behavior. First of all, running Fl studio with any +relay channel and trying to reproduce the bug, create a situation where FL no longer freezes, it catches itself and prints something like "xPlugin_namex has encountered a serious error opeining. Please reinstall the plugin" or something. So i couldnt exactly run it and it reproduce completely the same issue.... But what i did see as weird behavior in my log files looked a little like this
01ac:Ret KERNEL32.Sleep() retval=00000000 ret=101e06f56
025c:Call ntdll.NtProtectVirtualMemory(ffffffffffffffff,1001ff3d8,1001ff3d0,00000002,0088eac4) ret=6ffff62c2c5c
025c:Ret ntdll.NtProtectVirtualMemory() retval=00000000 ret=6ffff62c2c5c
025c:Call ntdll.RtlIsCurrentProcess(ffffffffffffffff) ret=6ffff62c2c1b
025c:Ret ntdll.RtlIsCurrentProcess() retval=6fffffd64801 ret=6ffff62c2c1b
025c:Call ntdll.NtProtectVirtualMemory(ffffffffffffffff,1001ff3d8,1001ff3d0,00000004,0088eac4) ret=6ffff62c2c5c
025c:Ret ntdll.NtProtectVirtualMemory() retval=00000000 ret=6ffff62c2c5c
025c:Call ntdll.RtlIsCurrentProcess(ffffffffffffffff) ret=6ffff62c2c1b
025c:Ret ntdll.RtlIsCurrentProcess() retval=6fffffd64801 ret=6ffff62c2c1b
025c:Call ntdll.NtProtectVirtualMemory(ffffffffffffffff,1001ff3d8,1001ff3d0,00000002,0088eac4) ret=6ffff62c2c5c
01ac:Call KERNEL32.Sleep(00000001) ret=101e06f56
025c:Ret ntdll.NtProtectVirtualMemory() retval=00000000 ret=6ffff62c2c5c
01ac:Call ntdll.NtDelayExecution(00000000,0709cd00) ret=6fffff7473b8
025c:Call ntdll.RtlIsCurrentProcess(ffffffffffffffff) ret=6ffff62c2c1b
025c:Ret ntdll.RtlIsCurrentProcess() retval=6fffffd64801 ret=6ffff62c2c1b
025c:Call ntdll.NtProtectVirtualMemory(ffffffffffffffff,1001ff3d8,1001ff3d0,00000004,0088eac4) ret=6ffff62c2c5c
025c:Ret ntdll.NtProtectVirtualMemory() retval=00000000 ret=6ffff62c2c5c
Now, thats okay if it happens once or so. But MANY lines were like this in the relay log. It sleeping so often waiting for something sorta lines up with the freeze. When i didnt add +relay to log, I saw many HEAPFree calls after it registered TPUtilWindow. but that could or couldnt be the issue. This is why i hate reading through logs. It is literally FAR from something interactive. And unless i have a wealth of knowledge on Windows and Wine's operating system infrastructure, its so hard to find concrete evidence of what caused the issue.
So me being tired of logs and frustrated, i used x64dbg (well, x32dbg and found this)
The EIP(the instruction pointer. essentially where the program is right now) is inside of win32u.dll. that memory address is the location of the NtUserSetParent function) NTUserSetParent basically tries to make one window and another window have a parent-child relationship, so basically it opening up and rendering the new plugin window) Now this is a solid lead.... This showed me something that is locking up the program. I checked wine source code and found this
`HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
{
RECT window_rect = {0}, old_screen_rect = {0}, new_screen_rect = {0};
UINT context;
WINDOWPOS winpos;
HWND full_handle, new_toplevel, old_toplevel;
HWND old_parent = 0;
BOOL was_visible;
WND *win;
BOOL ret;
TRACE("(%p %p)\n", hwnd, parent);
if (is_broadcast(hwnd) || is_broadcast(parent))
{
RtlSetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
}
if (!parent) parent = get_desktop_window();
else if (parent == HWND_MESSAGE) parent = get_hwnd_message_parent();
else parent = get_full_window_handle( parent );
if (!is_window( parent ))
{
RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
now, as you can see here... It returns 0 and immediately closes the function. but since the main thread of FL is waiting for that function to create the parent-child relationship and then move forward, Fl gets locked up (Literally. in a Critical Section), it returning 0 keeps FLwaiting on a message it never gets. If i saw the handle ilbridge its trying to pair it to inside of the FL Studio's handles tab in x64dbg, this would have been an easy fix. but i dont see it there Now to me, there's two credible hypothesis. (maybe there is more, i dont know)
- ILbridge is passing an invalid/stale handle. I dont necessarily think this is the case completely. but it is what it said. I looked for the parameters when i used x32dbg by basically sourcing the memory dump, and the handle is okay in terms of syntax and memory value. It could be invalid, but its the context that would make it invalid here?
- Wine's Wow64 thunking is eradicating/messing up the cycle that Fl uses to go through window creation... This sounds more like the truth but im not sure.... I think gemini told me about Delphi (which is what FL is coded in) having something they call VCL. Which is a Visual Component Library . This would basically be what would manage the handle construction/destruction process that FL is done under... I have used WINspy++ and Fl defintiely transfers handles between Fruity_Wrapper and the plugin manager ilbridge.... I thought it was highly likely that ilbridge is inferring a parent handle from the 32it address space the Wow64 "thunked" it into instead of using FL64.exe space. But I need to patch the memory address with a handle from FL studio to see if that fixes the issue. Now unfortunately, I dont know a way I can set a breakpoint in FL studio the moment it opens up ilbridge... Every method i have tried so far doesnt work. I tried using the Image File Execution Options inside of the registry to immediately open up x32dbg the moment Fl opens FL64 and it didn't work. I tried using winedbg with g flags. but that didnt work either. I was thinking i could maybe catch FL the moment it creates the process for ILbridge, but theres some anti-tampering protection stuff FL uses in their code that is stopping me from setting breakpoints around these important functions... so im not necessarily sure how i can tackle this anymore....
I'm having some mixed results with this workaround when reopening projects which I have not yet been able to identify the cause. To be on the safe side with old 32-bit projects, I will also be using the other workarounds suggested in the winehq post which is to enable the "External window" setting on the processing tab for each plugin and also to then try and remember to continue to save these projects with the processing tab left as default (or anything else other than the GUI) for each plugin just in case I need to trouble shoot in future. Hopefully this is the year to wave goodbye to Windows!!!
Yes i had issues with that too... Fl studio uses a different folder within the registry to store the folder of saved plugin states.... I dont remember the folder. but there iss a seperate folder inside of the same Fruity Wrapper folder in the registry That you have to add 'BridgedExternalWIndow' to.
I'm back in Windows and yes there do appear to be multiple entries, one per plugin vendor and potentially multiple per plugin type. I assume there is a specific order that they are checked and this may mean an unspecified value takes precedent over another specified value as on my Linux build I do not have any items with BridgedExternalWIndow set to 0 but I have addition items on Windows. In this case, the setting in the project file appears to overrule the others if external is enabled there.
I had started testing a larger number of plugins but I'm currently down to trying to nail just 2 at the moments, so for reference, here are my Windows entries for those with any references to BridgedExternalWIndow for those 2 plugins:
TAL-Bassline
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\TAL - Togu Audio Line
- (Default) only
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\TAL-Togu Audio Line
- (Default) only
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\TAL-BassLine
- BridgedExternalWIndow = 0
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\TAL-BassLine
- BridgedExternalWIndow = 0
For info - there is a 64-bit version of TAL-Bassline available however there are other TAL plugins that have not been updated so I'm testing with this as I have used it in a completed project but hopefully lessons learnt will also apply to all other TAL plugins.
GenesisCM
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\Ummet Ozcan
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\Ummet Ozcan\Genesis
- numerous items but not BridgedExternalWIndow
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\Genesis
- BridgedExternalWIndow = 0
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\GenesisCM1.02
- BridgedExternalWIndow = 0
The solutions to populate the registry in the winehq post do not cater for potential multiple entries, nor for entries that have not yet been created so I think I will use my existing Windows registry as a starting point and export+edit that to create something to import into wine to create those multiple BridgedExternalWindow entries.
Just posting this here which I found last night which may be of use to somebody - There is a difference in the ilbridge.exe that shipped with FL 20.9 and FL 21 which was forced onto Image-Line with a move to a newer version of Delphi. They are aware of 2 plugins affected, ICECREAM and Farbrausch V, but there may be others.
https://forum.image-line.com/viewtopic.php?t=330646#p1985973
I am currently testing FL 20.8 on Linux so that I can easily switch between 32 and 64 versions, but this means there is no guarantee that anything I get working will work on later versions.
Just posting this here which I found last night which may be of use to somebody - There is a difference in the ilbridge.exe that shipped with FL 20.9 and FL 21 which was forced onto Image-Line with a move to a newer version of Delphi. They are aware of 2 plugins affected, ICECREAM and Farbrausch V, but there may be others.
https://forum.image-line.com/viewtopic.php?t=330646#p1985973
I am currently testing FL 20.8 on Linux so that I can easily switch between 32 and 64 versions, but this means there is no guarantee that anything I get working will work on later versions.
Can you give me more information on this? What do you mean they are aware of 2 plugins affected? How are those plugins affected?
I'm having some mixed results with this workaround when reopening projects which I have not yet been able to identify the cause. To be on the safe side with old 32-bit projects, I will also be using the other workarounds suggested in the winehq post which is to enable the "External window" setting on the processing tab for each plugin and also to then try and remember to continue to save these projects with the processing tab left as default (or anything else other than the GUI) for each plugin just in case I need to trouble shoot in future. Hopefully this is the year to wave goodbye to Windows!!!
Yes i had issues with that too... Fl studio uses a different folder within the registry to store the folder of saved plugin states.... I dont remember the folder. but there iss a seperate folder inside of the same Fruity Wrapper folder in the registry That you have to add 'BridgedExternalWIndow' to.
I'm back in Windows and yes there do appear to be multiple entries, one per plugin vendor and potentially multiple per plugin type. I assume there is a specific order that they are checked and this may mean an unspecified value takes precedent over another specified value as on my Linux build I do not have any items with BridgedExternalWIndow set to 0 but I have addition items on Windows. In this case, the setting in the project file appears to overrule the others if external is enabled there.
I had started testing a larger number of plugins but I'm currently down to trying to nail just 2 at the moments, so for reference, here are my Windows entries for those with any references to BridgedExternalWIndow for those 2 plugins:
TAL-Bassline
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\TAL - Togu Audio Line - (Default) only HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\TAL-Togu Audio Line - (Default) only HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\TAL-BassLine - BridgedExternalWIndow = 0 HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\TAL-BassLine - BridgedExternalWIndow = 0For info - there is a 64-bit version of TAL-Bassline available however there are other TAL plugins that have not been updated so I'm testing with this as I have used it in a completed project but hopefully lessons learnt will also apply to all other TAL plugins.
GenesisCM
HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\Ummet Ozcan HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\Ummet Ozcan\Genesis - numerous items but not BridgedExternalWIndow HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\Genesis - BridgedExternalWIndow = 0 HKEY_CURRENT_USER\SOFTWARE\Image-Line\Shared\Plugins\Fruity wrapper\Plugins\VST\GenesisCM1.02 - BridgedExternalWIndow = 0The solutions to populate the registry in the winehq post do not cater for potential multiple entries, nor for entries that have not yet been created so I think I will use my existing Windows registry as a starting point and export+edit that to create something to import into wine to create those multiple BridgedExternalWindow entries.
I'm not sure if I'm understanding correctly. But your assumption was right as far as some checking system giving some values more priority over others.... but there should be a new folder generated the moment you actually open up a project on your Linux build.... . Also, you don't need to export+edit your windows one to do it. You can just open up a project with no 32bit plugins in linux, look at the registry changes, then use regedit to add a new key to WINE registry... is that not suitable for you?