From Worms Knowledge Base
|Supported games:||WWP, W:A|
|License:||Open-source; MIT licence.|
NOTE: This works on Windows, but oddly enough, doesn't actually work on wine, as it turns out. I'm guessing there's some way in which madchook and wine don't get on that I'm not properly understanding.
I have made a WormKit module that enables WWP to work on wine without needing a wine patch (as well as older versions of WA if these should be needed for any reason, eg bug regression testing or just historical interest).
- Download WormKitDS. The vanilla plain-and-simple Wormkit doesn't work under wine so this is the one you'll need. It's probably easier to get the archive version since you're a Linux user. Extract madCHook.dll and dsound.dll into your WWP dir.
- Configure WormKitDS if you haven't done so already. In wine, it needs a little more configuration than in Windows - open winecfg and go into the libraries tab. Add a new "native then builtin" override for the dsound.dll library.
- Download my module, extract the DLL file into your WWP dir (the Source directory is only of interest to developers, you can delete it to save a few k if you aren't one).
- Launch WWP under wine - if it's anything like WA, it works best if you use a virtual desktop (and then you get window mode as a bonus!).
- I have not actually tested ANY of this under Linux. Ironically, I made this because I might not have access to a Windows machine for a few months; but I don't actually have access to a Linux one right now! However, it SHOULD work, or at least stop the main glitch of the black screen of death
- WWP seems to have a very strange bug not present in any version I dared try of WA, when used in conjunction with this app. Many of the menu screens are shifted up. Oddly, this seems to be resolved after starting and quitting a game, so there's a workaround for you. I'm not a DX programmer, so anyone who can help diagnose this would be much appreciated
This app has been tested (again, not under Linux but it should work there!) in Worms Armageddon versions as early as 18.104.22.168 (nothing special about that version aside from it being the one I clicked on ) and as late as the latest version (where it's unnecessary anyway due to the existing implementation), as well as in WWP (but it's hard to tell if it actually works there, I expect it does due to the aforementioned bugs!).
See above; this is a bug!
I get an error telling me it's a bad module!
You probably forgot madCHook.dll.
I can't minimise ingame!
That shows it's working! Also, you're obviously playing WA because WWP doesn't have a minimise option. Try not minimising ingame. No, seriously, use a wine virtual desktop to put the game in its own window, that way you can use your window manager to minimise it.
How the hell did you do this?
It's incredibly simple. WA/WWP use the SetCooperativeLevel DirectDraw call to tell DirectX to draw on their drawing window. However, in wine, this makes it draw behind the input window (which wine refuse to fix, apparently it will break other things due to the way wine and ddraw don't really mix very well), resulting in a black screen possibly with a few bits of weird. This module intercepts calls to SetCooperativeLevel and tell them to draw on the desktop window instead, which is DirectX speak for "DRAW ON EVERYTHING!!!11!1!1!1!", which (in theory) makes it work.
How long did it take?
Far too long. At first I tried to do it in Delphi because all the examples are in Delphi. But after much head-scratching and downloading of dodgy free trials of things, I worked out that the latest version of Delphi (the only one I could find) doesn't work with the old version of madCodeHook that is the free version. So, I rewrote the whole thing in C++, with no documentation and few examples, and as such, it also took me far longer than it should to get it working!
Note to developers: I have a feeling there might be a stack corruption bug somewhere (partially due to stupidity most likely, and perhaps to do with the lack of documentation and few, conflicting examples), as I was having a straight crash in WA when I was compiling it with -O2, but I can't seem to find one - if anyone does find one, let me know, or if you get a game to crash with it when it wouldn't normally in that situation, again let me know.
Copyright (C) 2012 Murray "Muzer" Colpman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.