Page 2 of 2

Re: Win: Deadlock 1 Partial Audio Fix

Posted: Sun Feb 17, 2013 7:27 am
by Ubergeneral Grunt
I just ticked "Disable Visual Themes" in the compatibility settings and the save and load dialog boxes came back.

MacSoft may still have the source code for the Mac version of Deadlock, I already asked them but they told me to contact Atari. Maybe if I was able to contact one of the Mac version's programmers directly, I'd have more luck (even just knowing whether they have it).

Re: Win: Deadlock 1 Partial Audio Fix

Posted: Sun Feb 17, 2013 7:33 am
by Belix
Ubergeneral Grunt wrote:I just ticked "Disable Visual Themes" in the compatibility settings and the save and load dialog boxes came back.
This works. Oh man! I thought that it was working at one point and found it strange that it suddenly didn't, but I dismissed it as a mix-up with running the game normally. But I would of tried this and other check boxes at one point. I'm going to edit this into my first post as a note for anyone else that reads this and scratch my last comment out about it. Nice catch!

For the source, I don't suppose you tried Cyberlore Studios? It seems quite likely they had access to the source code of Deadlock 1 or a lot of information that went straight into the engine. Of course, they'll probably give you the same response since it is a potential legal matter. It would be nice if anyone who had the source code could make an unofficial patch. I doubt it would be very time consuming.

Re: Win: Deadlock 1 Partial Audio Fix

Posted: Sun Feb 17, 2013 7:44 am
by Ubergeneral Grunt
I have only contacted Cyberlore once and that was on the subject of why Deadlock II wasn't ported to the Mac, I got Lester Humphreys (Deadlock II's executive producer), though! I haven't asked them about the source code.

Re: Win: Deadlock 1 Partial Audio Fix

Posted: Sun Mar 03, 2013 5:36 am
by Ubergeneral Grunt
I've had a bit more of a play with the new WAIL32.DLL and it seems all crashes are tied to the loading and playing of territory sound effects (industry, people, possibly birds). I have played through a few long games with the DLL and I haven't had any crashes while it's just music and/or battle sounds playing. While battle sounds and music seem to play as they should all the time without glitches or crashes, a lot of the time: industry, traffic, etc. just cuts in, not fading in like they're supposed to.

So it seems all sound-related crashes are caused by territory sounds. After turning sound effects off, while leaving BGM on, stability seems to noticeably improve to the point where crashes seem to disappear (even after changing territories quickly). I haven't tried playing for any long lengths of time with sounds off, so it might still crash in the long run, even so it looks promising.

I tried moving the territory sound effects out of the WAV folder in Deadlock's directory, but Deadlock ended up looking for the files on the CD instead. It might be possible to create a copy of the CD with the territory sounds removed, so music and battle sounds can be used with a lower risk of crashing (I'm not sure how kindly Deadlock will react to not being able to find a sound file though, it might crash).

I tried seeing if turning sound effects off (not music) solved the problems with the original WAIL32.DLL: the territory view didn't crash (I wasn't there for long, through), a battle sequence loaded up fine, but the game crashed while trying to load the second combat theme (the first one loaded fine).

At least we seem to have found the likely culprit for the sound related crashes, but whether we can fix it is the question.

Re: Win: Deadlock 1 Partial Audio Fix

Posted: Sun Mar 03, 2013 8:13 pm
by Belix
I had the same thought earlier and experimented with creating a Deadlock CD image with only the bare required essentials to satisfy the CD check, and then adding only the desired assets to the game folder; as you noticed, the game first checks for assets locally - not just sounds, but even all the Smacker videos and music too. So with an 'empty' CD it only uses the assets in the game directory. I left the files ACCOLADE.URL, DEADLOCK.TXT and README.TXT on my blank Deadlock image just for good measure, but they may not be necessary.

This worked fine, the game was really well designed in calling on its assets. If the game can't find the files in neither its own folder nor the CD, it simply doesn't play them, no crashing to worry about. So you could create an image of the CD and remove particular things with no ill effects. So with such a blank CD you can control exactly what assets the game will ever use by adding and removing them in the game folder.

You might be on to something, Ubergeneral. I did not consider testing which assets might be responsible for the freezes AFTER replacing WAIL32.DLL, as I assumed when I saw it still happening that the reasons would be the same. Before replacing it, I tested both music and sounds, and they all seemed to lead to crashes without the other playing at all. It is possible there is a difference though, since they are different file formats (wav vs raw).

For those of you with a hex editor, an alternative for testing this might be to make a backup copy of DEADLOCK.EXE in your game folder, and then open it up and search for the file names of assets you want to disable, and replace a character in said file names so that they point at files that don't exist, effectively removing them from the game. Same result, opposite approach; make the game overlook the asset.

As an aside to anyone reading this, Deadlock's "check my folder first" behavior means if you use your physical CD but would like to reduce wear or read times on the CD, you can eliminate most of it by copying all the following folders from the CD straight into your Deadlock game directory:

CH
CY
HU
MA
MISC (most of this folder's files are on the drive already, but some files were left on the CD)
MUSIC
NA
RE
SK
TA
UV


I have noticed the quirky skipping behavior you mentioned in the audio with the first WAIL32.DLL I posted (not sure if the second one does that also), and what really puzzles me is that it also affects Smacker playback, cutting off the very tail end of the videos. I have no idea why it would have any impact on Smacker videos which, as far as I know, don't use WAIL32.DLL at all as evidenced by the fact they play and are heard perfectly fine without compatibility mode, a circumstance in which WAIL32.DLL doesn't even get loaded by the game at all.

I have recently considered writing a DLL wrapper to catch Deadlock's audio calls through WAIL and reroute them away from it entirely, instead playing them directly through whatever means modern applications use now (and maybe even properly check file headers so we can get the high quality music and sounds in there!), but I have quite a bit of learning to do to achieve such a thing, and I fear it wouldn't resolve Deadlock's audio problems without compatibility mode enabled as I haven't the faintest clue why the DLL fails to load without it... in which case the wrapper likely wouldn't work either. Unfortunately it might be years until I've gained enough programming experience tinkering on the side to do such a thing. If I recall correctly Deadlock still tries to open the files even if WAIL32.DLL isn't loaded, so it might be easier for me to write a companion program that watches the audio files Deadlock is trying to access, and play them in the background at the same time (and this one would play the high quality stuff too), but that's a rather unkempt solution and still a distance outside the boundries of my current knowledge.

Both of those efforts, however, work towards a perfect solution with no freezing or audio cut offs. The DLL already offers a huge improvement, and if we can improve upon that with a few other minor adjustments, all the better. It doesn't have to be perfect... just good enough. :)


p.s. If you want, either now or after you do some more experimentation, I could upload a modified DEADLOCK.EXE that doesn't play the ambient territory/settlement sound effects to help test your theory with. It would only take a few minutes of my time. While it'd be even easier to upload the blank CD image for the purposes of testing this, I don't want to inadvertently be providing people with a no CD crack for the game, which isn't its intended application.