Ok I don't know if this is a bug or a problem with my script. Please help if you can!
First off, I load the Restore GUI like this:
if (keycode==365) gui[5].Visible = true; // F7
LoadList.FillSaveGameList();
Looks fine, I see the list of games...cool. And then I click a game, and I click OK which does this:
function LoadOK_Click(GUIControl *control, MouseButton button) {
int index = LoadList.SelectedIndex;
if (button == eMouseLeft) {
gui[5].Visible = false;
RestoreGameSlot(savegameindex[index]);
}
else {}
}
I might be missing something, it loads fine about four times...then the fifth time I try to restore a saved game - WHAM! Critical error and AGS is no longer among the living. Is it incorrect code or something else?
I have no experience with custom save/load GUIs, but try this
if (keycode==365) { // F7
gui[5].Visible = true;
LoadList.FillSaveGameList();
}
Thanks Strazer, unfortunately it's still happening. Sometimes on the first try it crashes, other times it's fifteen restores before crashing...but it always crashes eventually. Funny. I might think this is a bug of some sort....I'll check the tech stuff out.
What's the exact error message?
Here it is:
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0046E64C ; program pointer is +6, ACI version 2.70.857, gtags (5,2)
AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.
But you know what? It only crashes when I run my custom restore stuff. If I run RestoreGameDialog(); then it will NOT crash. This is a bummer, cuz I can't figure out how to fix it. I tried reading some tutorials on GUIs but they will not work, and despite being supposedly backwards compatible, if I use the obsolete syntax all I get are errors and more errors.
I'm just not sure. I kind of think that the problem lies in this:
int index = LoadList.SelectedIndex;
It doesn't make sense to set the selected item based on whatever is going on after I click a button. But putting that in the SelectionChanged function for the Listbox doesn't seem to help either. Maybe if I get some sleep it will make sense tomorrow.....
EDIT: 5,2 in the error above I'm guessing refers to my Gui and control object, ie. the Listbox...
Quote5,2 in the error above I'm guessing refers to my Gui and control object, ie. the Listbox...
I don't think so, not sure though.
Here is what CJ had to say about similar error messages from an earlier version, maybe it helps you track down the problem:
QuoteAn exception 0xC0000094 occured in ACWIN.EXE at EIP = 0x0042182A ; program pointer is +6, ACI version 2.56.627, gtags (2,0)
CJ: "Hmm, it looks like a crash trying to display an empty line of text."
QuoteIllegal exception! 0xC0000005 occured in ACWIN.EXE at EIP = 0x0043C28E ; program pointer is +6, ACI version 2.56.627, gtags (1,17)
CJ: "The most likely cause is you've deleted the sprite for mouse cursor 6, which is the mouse pointer that comes up in the Ctrl+X window."
QuoteAn exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0040D2DB ; program pointer is +6, ACI version 2.56.627, gtags (0,19)
CJ: "That's some sort of text rendering problem."
Are all the save games saved under the exact same version of the game that you're restoring under? In my experience, if you've made some slight adjustments to the code after saving a game, it WILL allow you to restore without error messages, but the game gets buggy.
GarageGothic:
You're the man! Yup, I guess all it takes is one simple change and restoring a saved game from before the change can make things unstable. Works fine now.... Thanks for all the help!
Heh, glad I could be of help. I was struggling for several days with the exact same problem until I realized the cause. Doh! ;)
Hm I must just have had a really good luck streak of something. It's crashing again, same as before....I saved it too, and then made SURE I deleted all save game files. Then, I played the compiled game for a bit and naturally, I am afflicted with this again. I should also add I end up with an AGS Save.999 file. I haven't touched anything so unfortunately, problem's not solved :(
Is this a program bug or a Shabutie can't code right bug? I'm off to bed, tomorrow I will pull the rest of my hair out.
Damn, that sucks. I think that the 999 save file is some kind of autosave that is normally deleted when closing the game (if you multitask back to windows while playing a game, you'll see it in the dir).
Are you using savegames with screenshots by the way?
Hey - yah save games with screenshots is on, but I haven't implemented that into my custom gui or anything.
Oh, ok - I was thinking it might be some kind of memory leak in the dynamic sprite code. But that is not the case then.
Does this happen independent on WHICH game in the list you restore? And if you try to restore the same game repeatedly, does the crash always happen at the same try (e.g. on the fourth restore)?
This is slightly worrying; any chance you could upload the game so that I can try and replicate the problem?
Here's what I know for sure.
When crash occurs:
1. Only when using my custom Restore GUI. Updated code pasted below.
2. I make all the saves at exactly the same spot, first screen. Doesn't matter what I call the save.
3. Restore random number of times to crash - it's sometimes the very first restore or sometimes it takes five or more restores to crash.
4. Crashes while testing a single saved game (for instance only one save file exists) as well as when testing multiple saved games (two or more saved files).
To point out, I'm only testing the Restore GUI and am still using the standard built-in AGS Save Dialog function for saving games.
Here's the game, when you run it, click Begin Afresh from the menu...it's the middle choice. It will load a screen where you can do F5 to Save a game. Then, hit F7 and reload, hit F7 and reload again, etc. Check the code though, I wonder if it's something I'm doing wrong.:
http://www.360fusion.com/shabutie/Moosh%20Incarnation%2002.rar
Thanks for uploading it.
I haven't managed to replicate the crash myself, but I think I know where the problem is. It looks like a bug in AGS.
Can you try this patched ACWIN.EXE:
http://www.adventuregamestudio.co.uk/acwin.zip
just use it to replace the acwin.exe in your AGS folder, and then re-compile your game. See if it helps at all.
Good news! So far, no crashes! I will keep testing it though. Thanks so much!
Cool cool, do let me know if you do get any crashes with this version.