Heretic II Problems

Heretic II. Cool game. Shame the source was never released, though, because it is rapidly accumulating problems when running on modern systems.

To spare anybody else interested in it from searching the web in vain for hours trying to find a solution to one of them, I will document it here.

If you start up the program in OpenGL mode on pretty much anything newer than a Voodoo or a Rage Pro, it will crash. The crash is a common idTech 2 issue and results from Carmack's incessant use of sprintf() on fixed-size buffers - it tries to read in the OpenGL extensions string at startup just to show it to the user, but on modern cards this string is way longer than they anticipated.

To fix this, open ref_gl.dll in a hex editor of your choice and find the string "GL_EXTENSIONS: %s". Change the %s to "xx" or any two other characters not including a %. This will disable sprintf from accessing the too-large string passed to it.

Unfortunately the music also won't loop in Windows 7, which is a ANOTHER bug in the MCI API on that platform. I don't have a solution for this one yet.

Share this post


Link to post

How feasible would it be to Strife it? It's a Q2 engine game IIRC, can't be too big a difference between engine and DLL communications.

/me prepares to eat own words.

Share this post


Link to post
Quasar said:

The crash is a common idTech 2 issue and results from Carmack's incessant use of sprintf() on fixed-size buffers - it tries to read in the OpenGL extensions string at startup just to show it to the user, but on modern cards this string is way longer than they anticipated.

That's real dumb.

To fix this, open ref_gl.dll in a hex editor of your choice and find the string "GL_EXTENSIONS: %s". Change the %s to "xx" or any two other characters not including a %. This will disable sprintf from accessing the too-large string passed to it.

Thank you. I hope it will work. Even though I'm not much of a Heretic 2 fan, I'm pissed that I can only get to play Heretic 1.

Share this post


Link to post
GooberMan said:

How feasible would it be to Strife it? It's a Q2 engine game IIRC, can't be too big a difference between engine and DLL communications.

/me prepares to eat own words.

If I were more knowledgeable of the idTech 2 architecture, the project would be of similar complexity to Chocolate Strife.

This is because the Quake 2 source for the core engine is available, and I've also been told that the Heretic II game DLL source code is supposedly available *somewhere* (I have never found it so far though), and with those two together, putting the missing puzzle pieces together in IDA Pro would be simple.

So then you'd take some advanced Quake 2 source port and do some Chinese Copypasta, as I like to call it. Voila, Heretic II source port.

There are a couple of things that would get lost in the mix, however. The Creative EAX code in the sound engine is patented and copyrighted and would need to be dropped. The Smacker library used for videos is also highly proprietary and a successful attempt at reversing it would probably result in a lawsuit.

The best that could be done for the videos would be to de-mux them and then re-encode them into some open-spec format, right on the end-user's machine.

Share this post


Link to post
Quasar said:

The best that could be done for the videos would be to de-mux them and then re-encode them into some open-spec format, right on the end-user's machine.

The way I "fixed" this was by ripping the music right off the disk, then running it outside of the game in a separate media player. It's an inelegant solution, but it works.

I didn't run into too many issues while playing through Heretic II a few months ago on Windows 7, but I was probably using the Direct3D renderer.

Share this post


Link to post

Good to see some love for Heretic II. I thought it was a pretty decent game but it seems to get a bit of a hard time from some people.

Share this post


Link to post
Snarboo said:

The way I "fixed" this was by ripping the music right off the disk, then running it outside of the game in a separate media player. It's an inelegant solution, but it works.

I didn't run into too many issues while playing through Heretic II a few months ago on Windows 7, but I was probably using the Direct3D renderer.

There's a Direct3D renderer?

I have some ideas that I haven't ruled out on the music yet; it might be possible to fool with the DLL imports or strings, depending on how Quake 2 invokes the MCI API to do CD music, to change the function or its parameters that results in the broken looping on Windows 7.

I bet if I could get xttl interested in that particular problem, it'd be fixed within a day's time ;)

Share this post


Link to post
Quasar said:

There's a Direct3D renderer?

I could have sworn there was, but I might be misremembering. I was able to play through the game using hardware acceleration without issue. Perhaps it was added in a patch?

Edit:
I should note that I'm using an ATI card, in case that has anything to do with it. :p

Edit 2:

Enjay said:

Good to see some love for Heretic II. I thought it was a pretty decent game but it seems to get a bit of a hard time from some people.

My biggest issue with the game was how the story resolved itself. I thought it was incredibly insulting that the big bad got off Scott free.

Share this post


Link to post

Well, technically there's a Direct3D renderer if you're running on Vista or Windows 7. All OpenGL calls are translated to Direct3D calls there with the default drivers. Might be the same for manufacturer drivers too.

Quasar said:

I've also been told that the Heretic II game DLL source code is supposedly available *somewhere*


Apparently it's in the Tool Kit. I haven't installed/extracted to confirm though.

Share this post


Link to post
Snarboo said:

I could have sworn there was, but I might be misremembering. I was able to play through the game using hardware acceleration without issue. Perhaps it was added in a patch?

Edit:
I should note that I'm using an ATI card, in case that has anything to do with it. :p

Edit 2:
My biggest issue with the game was how the story resolved itself. I thought it was incredibly insulting that the big bad got off Scott free.

There's an "expansion" floating around called Ogle's Quest, and while it's unofficial, I think it does a very good job of turning that goofy ending on its head. There are some play throughs of it on Youtube if you're interested.

Share this post


Link to post
Quasar said:

There's an "expansion" floating around called Ogle's Quest, and while it's unofficial, I think it does a very good job of turning that goofy ending on its head. There are some play throughs of it on Youtube if you're interested.

Wow, Heretic 2 can be modded? Awesome, maybe this way I can forget about the Doom 3 shit and try something requiring less art.

Or maybe not.

Share this post


Link to post

Didn't ATI and Nvidia add exceptions for the Quake 2 engine games in their drivers? I can play Vanilla Quake 2 just fine without any changes with the latest ATI drivers.

EDIT: Just tested Heretic 2 as well. Works just fine. I remember when the games using the Q2 engine crashed. But that was a few years ago now.

Share this post


Link to post
kristus said:

Didn't ATI and Nvidia add exceptions for the Quake 2 engine games in their drivers? I can play Vanilla Quake 2 just fine without any changes with the latest ATI drivers.

EDIT: Just tested Heretic 2 as well. Works just fine. I remember when the games using the Q2 engine crashed. But that was a few years ago now.

ATi Radeon 4850 is not immune. Otherwise I wouldn't have been posting this thread :P

Share this post


Link to post

Pretty sure it worked fine on my 4750 a couple years ago. Or was that my 8800 before that died? Hmm, I forget now. Either way, I've never had any problems with it on any of my hardware so far.

Last time I played it we were also running T-Mod, which is a clever bit of hackery that adds source-port-like features mostly in the form of extended multiplayer support. It's hard to find now, but poking in the (horrible) docs, I don't think it made any changes to prevent graphics-related crashes.

I feel the need to say I don't even like Heretic II very much. It's just a boring shooter.

Share this post


Link to post
Aliotroph? said:

I feel the need to say I don't even like Heretic II very much. It's just a boring shooter.

Me neither, I never played very far into it.

Share this post


Link to post
Quasar said:

There's an "expansion" floating around called Ogle's Quest, and while it's unofficial, I think it does a very good job of turning that goofy ending on its head. There are some play throughs of it on Youtube if you're interested.

Thanks! I'll have to look into that. :)

Share this post


Link to post
Quasar said:

The Smacker library used for videos is also highly proprietary and a successful attempt at reversing it would probably result in a lawsuit.

The best that could be done for the videos would be to de-mux them and then re-encode them into some open-spec format, right on the end-user's machine.

The Linux version uses mpeg videos. (As I cover in my conversion guide.) I guess you could always make a port of that version and avoid this issue.

Share this post


Link to post
Aliotroph? said:

Pretty sure it worked fine on my 4750 a couple years ago. Or was that my 8800 before that died? Hmm, I forget now. Either way, I've never had any problems with it on any of my hardware so far.

I WILL take this moment to note that the problem in question is inconsistent because it involves memory corruption. It's possible that, when run on different machines, or even during different runs on the same machine, that the game won't crash every time, or possibly ever, due to this issue.

And it definitely will NOT crash if your video card driver is detecting the application doing the request and moderating the length of its GL extensions string.

Anyway, why do people feel the need to comment about a posting on a crash fix for a crash they're not having in a way that suggests nobody should be having that problem? I notice this happens all the time, everywhere.

(I am not suggesting that you are doing this in particular by using the word "you" below, but it's an impression I get in general)

Just because you aren't doesn't mean there are not a lot of people who have this issue. I had this issue, and so did other people. I never suggested it happens everywhere and you know what, if it doesn't, you should be happy for yourself. That's how I see it.

Share this post


Link to post
Blzut3 said:

The Linux version uses mpeg videos.

Interestingly, that sheds light on how you could do a Windows port and avoid any legal issues. If a Smacker codec is installed - say, with an ffmpeg distribution - then all you need to do is configure the input pin in DirectShow with an ffmpeg decoder and let someone else assume the legal liability for you.

Of course, that only works for as long as it takes RAD to harass ffmpeg about their implementation. And it's useless for platform portability. No idea how you'd tackle an in-port implementation for Linux or OSX.

Share this post


Link to post
BilboHicks said:

I realize that this is an ancient thread, but thank you Quasar for this! I just used it to get Quake2Max0.44 to work on my ATI card. AFAIK, its the only source port to work properly with the very cool Oblivion mission pack http://tenfourmaps.telefragged.com/phpbb2/viewtopic.php?t=498148 and Max has an awesome cel shading mode.

I assume it suffers the same format string problem?

Share this post


Link to post

So, i've asked Quasar and gave me the permission to necrobump this thread with a method which brings back Heretic 2 music on newer windows (at least for XP,7 and 8.1):

1 - Apply the 1.6 patch that you can find here: http://www.fileplanet.com/22357/20000/fileinfo/Heretic-II-Enhancement-Pack-v1.06
2 - Apply the quake2.dll patch that you can find here: http://www.zeus-software.com/files/nglide/heretic2_patch.zip
3 - Following this post: http://www.the-nextlevel.com/tnl/threads/58926-Fix-CD-audio-looping-in-Windows-7-with-certain-games download the program and patch the quake2.dll and rip the Heretic 2 music into wav or mp3
4 - Enjoy the correct music (looped) while you play

Notes:
- On Windows 8.1 x64 loading a savegame crashes the game (solved using a VMWare Workstation Virtual Machine with Windows XP SP3 and 3D Acceleration), but I haven't found a real solution, and maybe, there is no solution at all: we are talking about Windows versions which removed a lot of legacy stuff.
- You can use nGlide or OpenGL acceleration: they are working on Win 8.1 x64 and on the XP Virtual Machine

Share this post


Link to post
Quasar said:

Just because you aren't doesn't mean there are not a lot of people who have this issue. I had this issue, and so did other people. I never suggested it happens everywhere and you know what, if it doesn't, you should be happy for yourself. That's how I see it.

Actually. Yes you did so very much in the very first post. Which is why you got the replies you got. Because people like me were confused by your claim that it wouldn't run on anything newer than whatever hardware you mentioned in the OP.

Share this post


Link to post

Quasar did make it sound like almost nobody could play it, but my previous reply was still stupid. It seems very likely the mod I was running fixed this issue considering nobody involved in playing it with me at the time had any issues either.

Share this post


Link to post
Quasar said:

If you start up the program in OpenGL mode on pretty much anything newer than a Voodoo or a Rage Pro, it will crash. The crash is a common idTech 2 issue and results from Carmack's incessant use of sprintf() on fixed-size buffers - it tries to read in the OpenGL extensions string at startup just to show it to the user, but on modern cards this string is way longer than they anticipated.

To fix this, open ref_gl.dll in a hex editor of your choice and find the string "GL_EXTENSIONS: %s". Change the %s to "xx" or any two other characters not including a %. This will disable sprintf from accessing the too-large string passed to it.

Unfortunately the music also won't loop in Windows 7, which is a ANOTHER bug in the MCI API on that platform. I don't have a solution for this one yet.

Is this fix possible on Soldier of Fortune?
Because i've been looking and trying to fix the annoying and frustating crash on startup.

Share this post


Link to post
kristus said:

Actually. Yes you did so very much in the very first post. Which is why you got the replies you got. Because people like me were confused by your claim that it wouldn't run on anything newer than whatever hardware you mentioned in the OP.



I understand bringing back an old topic with relevant information, but reviving a two year old argument?

Share this post


Link to post
Clonehunter said:

I understand bringing back an old topic with relevant information, but reviving a two year old argument?


Doom is a 22 year old argument, we have yet to settle on which weapon is the best for all situations.

Share this post


Link to post
GhostlyDeath said:

Doom is a 22 year old argument, we have yet to settle on which weapon is the best for all situations.


Duh. The Unmaker.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now