Interstate '76 + Nitro Pack AiO Patch

Answers to all your Interstate dilemmas!
Post Reply
UCyborg
Skag
Posts: 5
Joined: Thu Aug 01, 2019 8:34 am

Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg » Fri Aug 02, 2019 6:05 am

Heya! Thought I'd stop by and share the new patch I made for Interstate '76 and its expansion pack. I made a thread about it on VOGONS as well and it's waiting for approval on PCGW. Here comes the copy-paste of the description I wrote on VOGONS, some things are already known by some of you:

Had this game on the TODO list for a while. When I recently tried to play it again, it was practically unplayable. Turned out it was much buggier than I was aware of. So I put together a patch which solves most of the problems people have been experiencing over the years. It even runs on the ancient Windows NT 4.0 (in software mode at least), which was totally unsupported until now. Of course, it runs great on Windows 10 as well and should theoretically run on computers with varying graphics hardware with nice graphics with the help of Glide wrapper. I recommend nGlide.

So now we assume you've already got it installed and got around the issue of 64-bit OSes not being able to run 16-bit installer. For base game, Gold Patch is prerequisite for applying my patch. For Nitro Pack, the only thing that's needed is A3D-Live! wrapper (included, can be installed any time) to fix the all-sounds-playing-at-100%-volume-at-player-position problem because game's DirectSound code is broken for some reason.

As usual for my patches, the goal is to get the game working with minimal amount of compatibility options. So you can turn off any compatibility options you've previously set on I76.EXE/nitro.exe executable and apply Disable_Interstate76_Compat_Shims.reg registry file. Game should have Modify permissions for its own folder. If it's located under Program Files and settings related to UAC/file system virtualization haven't been changed, there shouldn't be any problems, plus each user will have its own save files. Applies to Windows Vista and beyond. For older systems/other install locations, Users group may have to be granted Modify permissions explicitly on game folder (assuming we're running as user with limited rights).

Download link: Google Drive

Here comes the changelog:

Common:
  • Fixed some, worked-around other memory management bugs, which improves stability; mission 12 -> 13 transition works in I76, also no more need for EmulateHeap shim (the only semi-useful thing from Windows 95 compatibility mode), which doesn't actually fix anything.
  • Fixed game freezing when clicking menu option if hardware sound acceleration is available.
  • Fixed certain startup crashes/errors when initing graphics with 3D accelerated renderers enabled (Glide/D3D).
  • Skipped some unnecessary CPU checking code containing privileged instructions (crashes at startup if privileged instruction exceptions aren't ignored by the OS).
  • Corrected memory checking code to avoid error about insufficient memory when system has more than 2 GB of RAM.
  • Fixed an issue with laggy physics simulation that occurs when the system has been running for several days.
  • Fixed an issue with music playback not restarting during gameplay after the track has finished playing (another issue that occurs when the system has been running for extended periods of time).
  • After the music track has finished playing during gameplay, the mission specific track will play again now instead of always the 1st music track.
  • Rearview mirror refreshes every frame now.
  • Includes Shane's netcode patch for compatibility with NAT, Nitro Pack version also forwards port on router when hosting the game (if UPnP is supported).
  • Fixed registry handle leaks.
  • Added frame rate limiter which defaults to limiting the game to run at 20 FPS to workaround bugs that occur at higher frame-rates.
  • GDI windowed mode now works on Windows NT systems.
  • Embedded manifest in executables:
    • Marked as high-DPI aware.
    • Requests version 6.00 of Common Controls Library to enable visual styles in those occassional message boxes.
  • Executables have been flagged as compatible with DEP (Data Execution Prevention).
Nitro Pack specific:
  • Clicking Scenarios in main menu will no longer stop music playback.

Some thoughts
At some point, I've read about the magic 24 FPS as the ideal frame-rate to get properly working physics. Obviously, when the game was made, nobody was talking about frame rates as game physics isn't intentionally tied to frame-rate. Devs just write code, overlook some details when implementing it and leave it at that if it appears to work correctly.

Anyway, my issue with the supposedly magic 24 FPS is that 7.62 MM MG firing sound is being interrupted at regular intervals while it sounds fine at 20 FPS, hence why I set the limit to 20 FPS.

Another important thing, the game really only works as long as it does without crashing on Windows 95 by accident. Saw some really bizarre code in there: accessing buffers beyond their boundaries, overwriting variable holding a pointer (handle) to one heap with pointer to another heap, setting some variable based on the content of uninitialized memory.

Some of the memory management bugs are still lurking in there and could cause the crash out-of-the-blue (could be more obvious with player-made maps, with which I'm not familiar with), but the most obvious ones have been identified and fixed. I was going to fix them from A - Z, but the first thing that is found with Page Heap enabled is some access beyond buffer boundary mid-play in some giant function, would need thorough look to identify the start and the end of actually allocated memory.

Lightfoot
Legend of Sorts
Posts: 2092
Joined: Wed Dec 31, 1969 4:00 pm
Location: Somewhere in the Southwest
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Lightfoot » Tue Aug 06, 2019 4:52 pm

I let Shane know you were around and he should be dropping you a line.

:D

I've also tested your theory on 20fps and it seems to hold water. I'll test it in some multiplayer games tonight.

Thanks for swinging by.

Keep up the good work!

Oh, if you missed it, we fixed a LOT of the desktop crashing issues with a ZGLIDE.DLL update and A3D.EXE installation instruction change.
-Lightfoot
If only you could see what I've seen...

UCyborg
Skag
Posts: 5
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg » Thu Aug 08, 2019 10:50 am

Runs pretty stable here without messing with ZGLIDE.DLL (little over 4h playing single-player missions before it crashed in nGlide's glide2x.dll). When you say ZGLIDE.DLL update, do you mean that thing with replacing Nitro's ZGLIDE.DLL with I76's one? That's the only ZGLIDE.DLL related thing I found here, though it doesn't say where the replacement ZGLIDE.DLL comes from, but the checksum matches.

Did you test with my patched files and the original ZGLIDE.DLL? Because old nitro.exe has heap corruption bug which could be the real culprit.

About A3D, I did put that a3d.dll along with the installer and left the note about it in the ReadMe. Where does it come from anyway? I seem to remember Drakan: Order of The Flame crashing with A3D enabled when using A3D-Live's original a3d.dll, but works with the replacement DLL. Sound was messed up as well, same in the case of Nitro Pack when using A3D-Live's original a3d.dll. Speaking of which, the original unpatched files straight from CD don't have the issue and work OK when using DirectSound directly.

Wayek
Snowback
Posts: 543
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek » Thu Aug 15, 2019 3:22 pm

Did you fix muti-player in original I'76?
Bring water to a boil. Lightly salt and oil. Add pasta. Cook until al dente...

OfficerWizard
Trunk Monkey
Posts: 41
Joined: Mon May 09, 2016 11:11 am
Location: Somewhere over the rainbow

Re: Interstate '76 + Nitro Pack AiO Patch

Post by OfficerWizard » Thu Aug 15, 2019 11:32 pm

This sounds very promising. Would be great if we could package it and the game into some sort of installer, especially one that works in Windows 10.

UCyborg
Skag
Posts: 5
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg » Sun Aug 18, 2019 7:04 am

Wayek wrote:
Thu Aug 15, 2019 3:22 pm
Did you fix muti-player in original I'76?
Nothing was added beyond Shane's patched WINET.DLL. Direct IP connections work as far as I can tell (you can connect to someone's game if you know that someone's IP address and the person has UDP port 21157 opened/forwarded), registration with master server however does not.

Master server registration is not properly addressed in Nitro Pack neither and in addition to that, direct IP connections don't work. Regarding the first issue, the whole thing is done wrong on the ANET master server (actually, on all known online ANET servers). It excepts the game to send it its IP:port in one of the packets, something that cannot (and shouldn't) be done. Due to NAT, it can't know on which IP:port it is reachable from the outside. It's the server's job to figure out where the packet came from, that's what from parameter in recvfrom function is for.

So the current patch to Nitro Pack's WINETS2.DLL is really just a stupid hack that tries to make sure with the help of UPnP to map the known port for game traffic and to get external IP address to send both to the master server, which then hands that data to other people's computers looking for games to connect to. UPnP may not be available and is not even necessary in this case if the things were done the right way on the server.

Shane's UPnP patch for Nitro Pack also lacks error checking and doesn't free allocated resources. I fixed that yesterday and added alternative method for obtaining external IP address. But it's still pointless as the main problem is ANET server.

UCyborg
Skag
Posts: 5
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg » Sun Aug 18, 2019 7:20 am

OfficerWizard wrote:
Thu Aug 15, 2019 11:32 pm
This sounds very promising. Would be great if we could package it and the game into some sort of installer, especially one that works in Windows 10.
Original should run on 32-bit Windows 10. :mrgreen:

The used InstallShield installer is apparently so old that you can't just use 32-bit version (for those that didn't know, 32-bit installer is actually located at C:\Windows\SysWOW64\InstallShield, Windows uses it in-place for recognized 16-bit InstallShield installers).

Lightfoot
Legend of Sorts
Posts: 2092
Joined: Wed Dec 31, 1969 4:00 pm
Location: Somewhere in the Southwest
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Lightfoot » Sun Aug 18, 2019 1:29 pm

No offense, bro', but recommending anyone to use 32-bit Windows 10 is asinine.

If you're pinned to a 4GB ceiling you may as well run a XP VM and not worry about compatibility...

$0.02
-Lightfoot
If only you could see what I've seen...

Wayek
Snowback
Posts: 543
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek » Sun Aug 18, 2019 1:51 pm

You should use Windows XP instead
Bring water to a boil. Lightly salt and oil. Add pasta. Cook until al dente...

UCyborg
Skag
Posts: 5
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg » Sun Aug 18, 2019 4:58 pm

I meant to say that the original installer itself happens to run on 32-bit Windows 10. I didn't recommend anything to anyone. At least manual installation is not too tricky.

Wayek
Snowback
Posts: 543
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek » Sun Aug 18, 2019 6:08 pm

I kidd.... :lol: :mrgreen:


Come out for a race tonight!
Bring water to a boil. Lightly salt and oil. Add pasta. Cook until al dente...

Post Reply