A fix for SWAT4 'Massive' crashes

Linux

Management
Joined
Jan 28, 2013
Messages
1,858
Reaction score
233
This post addresses the following error (and those similar to it) which occurs when attempting to load A-Bomb Nightclub, Qwik-Fuel Convenience Store, Old Granite Hotel or DuPlesis Diamonds maps:
Code:
SWAT Build Number: 34688

Access Violation caused General protection fault!

History: UGameEngine::Tick <- UpdateWorld <- MainLoop->GenerateExtraCrashInfo [(GLevel: 'myLevel' PendingLevel: '(NULL)' NetMode: 'NM_Standalone'] <- MainLoop


Error summary

Since 7th September 2021, a 3rd party service, which is contacted by Swat4, ceased it's activities forever. Therefore, whenever Swat4 tries to load these maps, it leads the application to crash due to a null pointer. To summarize, Swat4 contacts the domain "madserver.net" (which is hardcoded in m4d.dll file), and receives an invalid reply. Thus, ALL SWAT 4 PLAYERS suffered with that crash issue, what could only be avoided by disabling the internet connection (which for MP is not a fix). Since that problem persists, all SWAT 4: Gold Edition copies sold by GOG.com (and many other games that depend on that 3rd party ad service) simply stopped working.

Thanks to @BaDTimE and @KrazyFire , we have a working fix for the SWAT4 crashes that have been happening lately. In the following week we will work on a global solution which will fix the game without the need for patches - since in the current state, every newcomer will crash on certain maps. Whoever is interested can read more about it in our Discord #support channel , however I will put the relevant details below as well.


Solutions

Currently, we have a number of solutions available, however unfortunately all of them require action from the user before the game is able to be played on mentioned maps:

1. Hosts file patch ( credits to @KrazyFire )​

Patch your hosts file to block the ad website - if you choose this option, check our Discord support channel for more details on which hosts to block. For now, we have confirmed that placing the following lines in %WINDIR%\system32\drivers\etc\hosts on Windows fixes the problem:
Code:
127.0.0.1   madserver.net

2. Swat4.ini patch ( credits to @Beppe_goodoldrebel )​

Add MassiveUpdateDelay=100000000 to your Swat4.ini configuration file under [Engine.GameEngine] section. Your file should then look something like this:
INI:
[Engine.GameEngine]
MassiveUpdateDelay=100000000
EnableDevTools=false
...

3. m4d.dll patch ( credits to @BaDTimE )​

Replace your m4d.dll with our custom edited dll which will contact localhost instead of the faulty host and since there will be no responses coming it will silently fail. This .dll file should replace the one found in Content/System folder of you Swat4 installation.

You can download the patched .dll from here (link comes from our Discord support channel). If you need the original back again, use this link.
 
Last edited:

BaDTimE

Senior Admin
Joined
Mar 10, 2013
Messages
55
Reaction score
20
4. Blocking connection using Windows Firewall

You just need to run the follow command with Administrator privileges:
Bash:
netsh advfirewall firewall add rule name="Swat 4 Patch" dir=out action=block remoteip=165.160.13.20,165.160.15.20 enable=yes

Use the follow command if you decided to remove the firewall rule created with the command above
Bash:
netsh advfirewall firewall delete rule "Swat 4 Patch"

By blocking the connection between your computer and the domain madserver.net, you will prevent that your game receives arbitrary data from the blocked domain, what leads to application crash during the load process of the previously mentioned maps.
 
  • Like
Reactions: EmoPig and Linux

Linux

Management
Joined
Jan 28, 2013
Messages
1,858
Reaction score
233

5. m4d.dll patch via script​

You can use the code from this gist to patch m4d.dll. Place the m4d.ps1 script into the Content/System folder of your SWAT4 invocation and run the script. It will patch the faulty DLL and backup it just in case.
 
  • Like
Reactions: EmoPig

BaDTimE

Senior Admin
Joined
Mar 10, 2013
Messages
55
Reaction score
20
6. Engine.dll Patch

This solution is an alternative to m4d.dll file replacement, since it contain fixes for 2 problems:
  • Game crashing during map loading;
  • Serverlist browse functionality.
Both problems solved by this patch occurs due same reason, which is 3rd party external services shutting down their actives; as respectively follow:
  • The Massive Network;
  • GameSpy MasterServer.
This file offers a fix for Swat 4 crashes, while at same time reintroduces the original game feature of listing, and joining, online servers, replacing GameSpy's by Swat4Stats' MasterServer.

You can find more details about how that works in Serge's GitHub: Master Server Patch

The patching process requires that you replace your original Engine.dll file, by these patched ones:
  • Engine.dll for v1.1 (\Content\System\Engine.dll);
  • Engine.dll for TSS (\ContentExpansion\System\Engine.dll).
(Note you can proceed with that operation even if you already had applied any of solutions previously posted in this forum. They are simply redundant, and wont cause any incompatibility problem. However, I suggest you use this current patch, since it offers fix for 2 issues at same time)

I strongly recommend you to perform a backup of your original Engine.dll, since its a good practice, and allows you restore your game to previous state (even though I think you will not want do that at all ;P)

If you face any difficulty, contact us in Discord #Support Channel

Bellow, you can see each version of the Engine.dll running:
Shot00001_1.png
Shot00000.png

To ensure that patches brought for you here are completely safe, feel free to check the results for malware scanning:
 
  • Like
Reactions: EmoPig and Linux

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)