Interstate '76 + Nitro Pack AiO Patch

Answers to all your Interstate dilemmas!
UCyborg
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

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: 2344
Joined: Wed Dec 31, 1969 4:00 pm
Location: Somewhere in the Southwest
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Lightfoot »

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

http://twitch.tv/dsavage66
http://discord.me/ultrafunk

If only you could see what I've seen...
UCyborg
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

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: 676
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek »

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: 47
Joined: Mon May 09, 2016 11:11 am
Location: Somewhere over the rainbow

Re: Interstate '76 + Nitro Pack AiO Patch

Post by OfficerWizard »

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
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

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
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

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: 2344
Joined: Wed Dec 31, 1969 4:00 pm
Location: Somewhere in the Southwest
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Lightfoot »

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

http://twitch.tv/dsavage66
http://discord.me/ultrafunk

If only you could see what I've seen...
Wayek
Snowback
Posts: 676
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek »

You should use Windows XP instead
Bring water to a boil. Lightly salt and oil. Add pasta. Cook until al dente...
UCyborg
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

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: 676
Joined: Sat Mar 19, 2016 2:46 pm
Location: Somewhere in Northern Ontario...
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by Wayek »

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...
UCyborg
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

Whenever I get back to it, both games leak GDI handles. If you manage to accumulate crapload of them, computer's graphics performance degrades and possibly other oddities appear.
OfficerWizard
Trunk Monkey
Posts: 47
Joined: Mon May 09, 2016 11:11 am
Location: Somewhere over the rainbow

Re: Interstate '76 + Nitro Pack AiO Patch

Post by OfficerWizard »

Can't tell you how much I appreciate your efforts, UCyborg. How hard would it be to tackle the ANET server-side bugs?
KIV 6051 [SH]
Legend
Posts: 582
Joined: Wed Mar 31, 2004 3:53 pm
Contact:

Re: Interstate '76 + Nitro Pack AiO Patch

Post by KIV 6051 [SH] »

Thank you, UCyborg.

I should mention I'm no fan of nGlide, as you can't adjust much, and it is made more or less for ATI and AMD hardware. If the textures get mixed up in 3D enhanced mode using nGlide, well, too bad. With dgVoodoo2 you can adjust the texture memory size under the Glide tab. Most people set the texture memory to 2048kB to prevent the texture mix-up bug, but it comes at the cost of having 1 frame/5 seconds every time "too many" objects are in view, and setting the texture memory to 4096kB will unfortunately reveal the texture bug. I have yet to encounter the texture bug at a limit of 3072kB, and I've yet to have any video lag either. The problem with dgVoodoo2 is it seems to have a registry flaw where it won't update certain parameters (the resolution and anti-aliasing I believe), so you have to export the config files and manually save them to C:\Users\[username]\AppData\Roaming\dgVoodoo every time you change one of them.

I should also mention I'm using win7 64-bit on a core2 duo, and I can't help but notice the artificial frame limit, at least the 30fps one in the nitro exe, causes the video to get choppy when the camera pans; that's why I use nVIDIA profile inspector on my desktop. The 30fps nitro exe is however a Godsend for my old laptop.

You may want to check out my posts here and here in the Texture corruption in both glide and D3D modes thread for more clues regarding video bugs. This is all of course only relevant depending on whether or not you plan on tackling any of it.

Speaking of texture bugs, there's a nasty one in classic Interstate '76 that made its way into the Playstation version of Vigilante 8. I believe if you look at the PS1 Vigilante 8 and Dreamcast Vigilante 8: Second Offense code, you might find inspiration for fixing the terrain pop-up, but I'm probably just cloud dreamin'
UCyborg
Road Toad
Posts: 15
Joined: Thu Aug 01, 2019 8:34 am

Re: Interstate '76 + Nitro Pack AiO Patch

Post by UCyborg »

I recommended nGlide because it works with minimal fuss without glitches from my own personal experience. I haven't been able to get glitch-free experience with dgVoodoo2, though I haven't tried 3072 KB setting specifically yet.

I don't remember any glitches with dgVoodoo 1.50 Beta2 with the following configuration:

Image

It'd be nice to fix as the issue occur on real hardware as well as in an emulator such as PCem, though there's supposedly a workaround that includes setting SST_TMUMEM_SIZE=2 (an environment variable). There are some conditional statements doing signed comparison in the area where calls to glide2x._grTexCalcMemRequired@16 and glide2x._grTexMaxAddress@4 are made. Maybe it has something to do with the problem.
KIV 6051 [SH] wrote: Tue Sep 17, 2019 9:08 pmI believe if you look at the PS1 Vigilante 8 and Dreamcast Vigilante 8: Second Offense code, you might find inspiration for fixing the terrain pop-up, but I'm probably just cloud dreamin'
This assumes a lot of knowledge on my end, like MIPS assembly. I've also never done any real graphics programming. Oh well.
OfficerWizard wrote: Fri Sep 06, 2019 6:00 pmHow hard would it be to tackle the ANET server-side bugs?
No idea, ANET is definitely not easy. The thing doesn't even compile with modern compilers. I only found the original version's code shared, though play.interstate76.com runs slightly modified version I think. I played with the code a little, just so it compiled (still with a bunch of warnings). But I wasn't sure about how you're supposed to invoke it. Well, when I got it running, I couldn't connect to it.

PS: I made a small update a while back. The original post on VOGONS has been updated and so was the entry on PCGW, but I can't edit posts here.
Post Reply