Difference between revisions of "Stack Overflow Information"
Line 14: | Line 14: | ||
== Solutions == | == Solutions == | ||
− | # Don't create a stack heavy picture.<br /><br />Don't fill around brushed objects. In the Pimp Quest case, you should fill the screen first before drawing in the title with the brush. Here's the actual modified picture file.<br /><br />[[File:stakt_pimp_bad.png]]<br />Bad picture. (filled after)<br /> | + | # Don't create a stack heavy picture.<br /><br />Don't fill around brushed objects. In the Pimp Quest case, you should fill the screen first before drawing in the title with the brush. Here's the actual modified picture file.<br /><br />[[File:stakt_pimp_bad.png]]<br />Bad picture. (filled after)<br /><br />[[File:stakt_pimp_good.png]]<br />Good picture. (filled before)<br /><br /> |
− | <br />[[File:stakt_pimp_good.png]]<br />Good picture. (filled before)<br /><br /> | ||
# Don't use Windows<br /><br />You could go straight into pure DOS if you *really* wanted to. This isn't very helpful if you're using AGI Studio as your main editor. | # Don't use Windows<br /><br />You could go straight into pure DOS if you *really* wanted to. This isn't very helpful if you're using AGI Studio as your main editor. | ||
# Patch the Interpreter | # Patch the Interpreter |
Revision as of 15:36, 25 December 2013
Last updated 23/2/2001
Windows users may encounter the "stack blown error". Most Sierra AGI games work just under Windows. This happens when the stack is becomes filled. The culprits are AGI itself (in the case with Pimp Quest because it is filling around a brushed object in the title screen.. so there's lots of little lines to fill up and all these lines get pushed onto stack) and Windows. I'm not quite sure, but I think Windows has some sort of timer running in DOS mode that is called and pushes a bit too much on the stack.
So while the picture fill routine has a lot of information pushed onto the stack, Windows pushes some extra stuff on and the stack overflows. AGI actually checks if the head of the stack is overwritten and so trips this stack error in the middle of a screen write.
Solutions
- Don't create a stack heavy picture.
Don't fill around brushed objects. In the Pimp Quest case, you should fill the screen first before drawing in the title with the brush. Here's the actual modified picture file.
Bad picture. (filled after)
Good picture. (filled before) - Don't use Windows
You could go straight into pure DOS if you *really* wanted to. This isn't very helpful if you're using AGI Studio as your main editor. - Patch the Interpreter
This is what I kinda wrote myself. I wrote a small patch program (that will only work in Windows.. I used MinGW as my compiler) that lets you change the stack size in the interpreter. It's usually 0xA00 bytes (in all interpreter's I have checked).
The cool thing about this program is that it works with all the versions of Sierra's interpreter that I have checked. (including v3!) The stack code didn't vary much over the different versions.
Steps
- Get a working AGI file. Try Demo Pack 3, which is version 2.917 . There is a later v2.936 interpreter that shipped with some versions of SQ2 and KQ3.
- Decompress AGI executable file. Sierra encrypted their interpreters most of the time and some (like the demo pack 3) aren't encrypted. Use SUP to insert a key into SIERRA.COM/AGI.COM and the ADECRYPT to decrypt the AGI file.
- Run STACKPATCH.EXE. The proper way to run it is:
STACKPATCH AGI.EXE 0xA00
where AGI.EXE is the interpreter and 0xA00 is the stack size to change. 0xA00 is the AGI default. If you get a stack error, try increasing it to 0xB00 or 0xC00
- Play with your working game.
Anyway, if you want more information, check out this discussion that had all this information (except about the patch) and probably a bit more.
Files:
stackpatch try this stuff man modified agi 2.936 with stack set to 0xC00. Works with Pimp Quest on my computer. modified PIC file for the title