SCO wrote:I've been running morrowind in wine pretty flawlessly, except for one thing:
Morrowind Script Extender loads up the dll at the wrong adress apparently, provoking nasty errors, like duplicated keys on save-load in Keyring mod, hang when using a fire on touch spell with fleeing fletchers, hang/blackscreen on "New Game" with Protective Guards and many other problems i don't remember. The problem appears to be caused by this:
http://bugs.winehq.org/show_bug.cgi?id=13915(This is for oblivious, but i think that the problem is similar since it is from the same authors).
So here is my request:
incorporate MWSE into the morrowind code patch as a static alteration to the exe file. This would make it compatible with wine (and mac os x through it i think) and be one less thing you have to install/run to run a updated morrowind install.
Well, couple things with that:
First, it's difficult at best to push MWSE into the main engine. It takes injecting a bit of code into the virtual machine. Hrnchamd would have to weigh in on feasibility, but I know there's not a huge amount of space available in MW.exe. Even if you added an additional segment, there's the matter of linking it into the execution properly. Research would have to be done into how MWSE does that now and if it's possible to do statically. There is a huge conceptual difference between dynamic and static linkage, hence the relative similarity between Windows and POSIX executable code (all in a row, more or less) and shared libraries (PE vs ELF, virtual memory space, addressing differences, etc).
Second, if the comments here:
This appears to be a discrepancy between the Windows implementation of the DLL
dependency handler/loader and the Wine implementation. Unfortunately I don't
have a linux install to test this on, but my first guess would be that calling
CreateProcess with the CREATE_SUSPENDED flag set leaves the new process' loader
critical section locked until the main thread is resumed.
If that assumption is correct for MWSE as well (I'm not entirely sure if it is), it offers a very simple solution without any messy static binary mushing. Using loaders and suspended threads is a messy, at best, method of injecting custom code. It's also known to have problems with anti-virus programs, security checks, and all sorts of other things. A method I've used before (the one MGE uses, in fact) is far more reliable and far more stable.
Using the MGE method, there is a bit of code that is run whenever a shared object (DLL) is loaded. Both POSIX SOs and Windows DLLs have them, although only the latter matter here. The function is called from the main thread of the program
during launch, so long as the shared library is included in the PE's import table. It is easily and simply possible to inject any number of arbitrary DLLs into a process, especially if one were to use a basic loader to provide a single point of interface to the original engine (for example, replace binkw32.dll with a file that will load every DLL in a given directory). An even simpler solution would be to simply replace a select DLL with a specially-compiled one (a Wine version of MWSE/OBSE, for instance) that would load itself and dynamically link to the original. Doing so would effectively statically link the DLL in question, neatly sidestepping many of the issues.