HOW TO: Fix issues with crashing and freezing

Ask here for technical assistance with installing, running, etc. Forum related issues should be reported here, too.
MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

Hello all,

This is my first post here although I've checked out the forums from time to time. I apologize in advance for the lengthy post, but I think this will be a huge help to many people.

Like many other people, I had trouble with the game crashing on newer versions of windows(I'm on 64 bit Windows 10), and I've been trying to reverse engineer this game for over a year now because I wanted to make a working version and to figure out how the game actually works. I've figured out that there are 2 things that cause the problems.

The first problem is that the game uses a dead api that was made for windows 3.1 called WinG (see link below).

https://en.m.wikipedia.org/wiki/WinG

This api had functions that were similar to those in the gdi32 api that is still updated by Microsoft. I'm pretty sure WinG used some 16 bit stuff that doesn't play well with 64 bit windows. I found something online that gave me gdi32 code that was practically equivalent to what the WinG api did, so I was able to make a fake WinG dll that can be placed into the deadlock folder, and deadlock will load it instead of the real WinG dll. It uses the equivalent gdi32 code when the game calls it.

That fixed the crashing problem when trying to zoom into a territory, and the only graphical issue that I have now is when I press the spacebar button to hide the resource/minimap window. The backgrounds look a little wonky in that view (possibly due to my screen resolution), but it's better than not being able to play at all.

After I got the graphics crashing worked out, I was still having issues with the game randomly freezing if I had music, sound, or videos on. This problem comes from the WAIL32 dll that came included with the game. The AIL sound library was renamed to MSS32.dll later on by the company that makes it (RAD).

I found a copy of the mss32.dll that was included with Warcraft 3 from what I understand. I tried renaming this to WAIL32.DLL, but they renamed a few of the functions in mss32, so it didn't work just doing that unfortunately.

To work around this problem, I made a fake WAIL32.DLL that would be called from the game but would basically forward the calls to the real MSS32 dll instead just like my fake WinG dll does with gdi32.

This worked like a charm, and the game now runs as smooth as butter with all sounds and videos.

I have currently only tested these with the original CD version 1.20, so I will have to see if they work with version 1.31 and possibly make some adjustments if not. I will post the DLLs later today when I have a chance to test them on 1.31.

MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

Re: HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

Ok I tested the DLLs with version 1.31, and everything still seems to work fine. The DLLs can be found at the link below.

https://github.com/MildewMan1/DeadlockFixes

Note: It's never a good idea to just download random DLLs off the internet and let them be loaded as they can have malicious code inside. I have also included the source code for the fake WinG and WAIL32 dlls in case anyone wants to compile them on their own. I obviously don't have the source code for the MSS32.dll, so I don't know what to tell you about that one.

For those of you willing to test this out, please let me know how it works for you!

User avatar
Tggtt
Mighty Colony Leader
Mighty Colony Leader
Posts: 224
Joined: Sun Oct 06, 2013 8:08 pm

Re: HOW TO: Fix issues with crashing and freezing

Post by Tggtt »

Hello MildewMan1,

Welcome and many thanks for your contributions!

I will let more people know once they have similar questions.

In the past we would simply share the required DLLs.
Fortunately, Deadlock 1 runs fine with older Windows versions and it also runs fine under WINE (for Linuxes and MacOSX), so that is somewhat unusual that most users complain about crashing.

if you are positive about redistributing your solution, we might even contact the current DL1 retailers (e.g. GOG and Steam) about it.

Out of curiosity, once I challenged myself to run Deadlock 1 on IBM OS/2 4 Warp with Win32 runtime support. It crashes when it attempts to render the territories. It is possibly related to the same WinG problem.
Best 20x20 Map is elected.
Follow @OpenDeadlock.
Please help Deadlock Wikis by documenting buildings.
Note: OpenDeadlock Knowledge Gathering has been updated. Translation and Build Tools might fail. Send me a PM if you need help.

MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

Re: HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

Hi Tggtt,

I don't know everything that GOG changed in their version, but I don't believe that it has the crashing problems. This is more for the original 1996 CD version of the game. I own both, and I only have issues with the original version.

User avatar
Tggtt
Mighty Colony Leader
Mighty Colony Leader
Posts: 224
Joined: Sun Oct 06, 2013 8:08 pm

Re: HOW TO: Fix issues with crashing and freezing

Post by Tggtt »

MildewMan1 wrote:
Thu Jul 02, 2020 11:32 pm
I don't know everything that GOG changed in their version, but I don't believe that it has the crashing problems. This is more for the original 1996 CD version of the game. I own both, and I only have issues with the original version.
That's great MildewMan1, since you have the GOG version as well, once you have some free time, please try to test if you solved the remaining issue with the MP patch. This would allow GOG owners to play online once again without the CD.

Thanks in advance.
Best 20x20 Map is elected.
Follow @OpenDeadlock.
Please help Deadlock Wikis by documenting buildings.
Note: OpenDeadlock Knowledge Gathering has been updated. Translation and Build Tools might fail. Send me a PM if you need help.

MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

Re: HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

I'll give it a shot when I have a chance to today.

I am working on another WinG dll that implements new cheat codes as well that you would input into the normal Ctrl F1 command box. As of right now, it only works on version 1.20, but it allows you to get 1879048191 credits instantly, research all of the technologies instantly, make insanely huge resource bonuses on all of the tiles in your owned territories, make all of your units elite always, and get rid of any wet/useless tiles in your territory.

Right now I'm working on deciphering how the racial traits work. I can currently give myself all of the best abilities even if abilities are off, but I'm trying to see if I can modify the values to make supercharged abilities. I have figured out some of them and I can supercharge some of the traits to give massive resource output, trade credit output, production output, and research output.

I also am planning on making a cheat code that allows you to force AI to declare war on any other player or make peace with them.

Last I am going to make a modification to allow players to disable the City Center win criteria to make the game be a domination style win. I've always wanted to make the map as big as possible and the territories as small as possible and just have an all out war with the AI, but they always go for the city center win. :(

User avatar
Tggtt
Mighty Colony Leader
Mighty Colony Leader
Posts: 224
Joined: Sun Oct 06, 2013 8:08 pm

Re: HOW TO: Fix issues with crashing and freezing

Post by Tggtt »

Best of Luck!
MildewMan1 wrote:
Fri Jul 03, 2020 12:42 pm
Right now I'm working on deciphering how the racial traits work.
if you wish some help about that, check this thread.
Once the game is created, a column from that bidimensional array is copied to the abilities array of the player. You could edit any of them if you wish.
MildewMan1 wrote:
Fri Jul 03, 2020 12:42 pm
I also am planning on making a cheat code that allows you to force AI to declare war on any other player or make peace with them.
The AI has another bidimensional array on relations to other players, but I don't know exactly how it works, I know where it is. I could check later if you need help.
MildewMan1 wrote:
Fri Jul 03, 2020 12:42 pm
Last I am going to make a modification to allow players to disable the City Center win criteria to make the game be a domination style win.
Well, Deadlock 2 supports that. In any case, I think there is a counter on the number of turns after all the city centers are built that can be zeroed.
Best 20x20 Map is elected.
Follow @OpenDeadlock.
Please help Deadlock Wikis by documenting buildings.
Note: OpenDeadlock Knowledge Gathering has been updated. Translation and Build Tools might fail. Send me a PM if you need help.

MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

Re: HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

Ok I tried using the patched version with my DLLs, and I couldn't get the music to work at first (on the main menu or in a single player game). After a lot of banging my head on the wall, I figured out that the patched version didn't retain the compatibility settings. After I changed that back to Windows 98 compat, the music started working fine on the main menu and in single player with the patched version.

I tried to make a multiplayer game with myself using a Windows XP virtual box. I could find the game I made, but I could never get them to connect, so I could start the game, so I don't know if the music works in multiplayer. Got any ideas on how I could test it?

User avatar
Tggtt
Mighty Colony Leader
Mighty Colony Leader
Posts: 224
Joined: Sun Oct 06, 2013 8:08 pm

Re: HOW TO: Fix issues with crashing and freezing

Post by Tggtt »

Thanks for your testing, it seems good enough already!
MildewMan1 wrote:
Sat Jul 04, 2020 4:31 am
I figured out that the patched version didn't retain the compatibility settings.
Please forgive me! it has been discovered before, I guess I should have told you about compatibility settings.
MildewMan1 wrote:
Sat Jul 04, 2020 4:31 am
I tried to make a multiplayer game with myself using a Windows XP virtual box. I could find the game I made, but I could never get them to connect, so I could start the game, so I don't know if the music works in multiplayer. Got any ideas on how I could test it?
VirtualBox's VM with HOST networking probably does not work for multiplayer because Deadlock 1 does not use IP (protocol). It uses NETBIOS instead and newer Windows versions are probably unable to tunnel Netbios over IP.

Firstly, I recommend you to be ensure that your Windows XP VM can really play multiplayer games.

If you have enough disk space (and virtual memory) you can CLONE your VM and then start both the original and the clone using INTERNAL NETWORKING MODE.

Remember to set the same internal network name for both. And then they will work like a LAN.
But the advantage is that this mode does not need IP routing.

You might need to disable the audio of some of these VMs to be able to test the audio.
It looks something like this:
Image

There might be a way to start two instances of Deadlock on your host machine and play a multiplayer game... given that your Windows can handle Netbios for the loopback adapter.
Best 20x20 Map is elected.
Follow @OpenDeadlock.
Please help Deadlock Wikis by documenting buildings.
Note: OpenDeadlock Knowledge Gathering has been updated. Translation and Build Tools might fail. Send me a PM if you need help.

MildewMan1
Colonist
Colonist
Posts: 25
Joined: Sat Jun 27, 2020 3:02 pm
Favourite Race: Tarth

Re: HOW TO: Fix issues with crashing and freezing

Post by MildewMan1 »

I was finally able to get around to cloning the XP box and trying out your suggestion, and it worked like a charm. I was able to get both of the boxes connected and start a game.

The sound works fine and no crashes when I zoomed into the territories!

I did have to download visual studio 2010 on the machine and compile the code there to get it to work right, and I also had to change 1 line of code in the WING32 code because it was BitBlting the images upside down in XP for some reason. I'll make the change to the code to account for this and reupload it to Github along with the DLLs that I compiled in XP.

Post Reply