Illegal exception[SOLVED]

Started by Vincent, Wed 23/08/2017 01:15:35

Previous topic - Next topic

Vincent

Good Evening to all Agser.

Recently I had an issue but I am not sure how to solve it at the moment.
I am using a plugin "agsjoy" by Wyz with Ags 3.2.1.
Lately I have done a savestate with a joystick plugged into the pc.
But after closing the game and removing the joystick from the pc, when I am about to load the game I get this message.
I think I know what it's going on but I am not sure how can I avoid it into the script?

An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x62151082 ; program pointer is +2051, ACI version 3.21.1115, gtags (123,2)



Crimson Wizard

This is not a script error, this is either engine or plugin error, so you cannot fix it yourself.
The "program pointer is +2051" indicates it happens when save is loaded, so my guess is that plugin fails to restore its own data from savegame if no joystick is found.
I suggest reporting all this in plugin's thread.

Vincent

Thanks for the quickly response Crimson Wizard.
I think you guess is right, the plugin just fail to restore it's own data if no joystick is found.
So I was wondering if there's a way to check if the joystick is plugged or not when the game is about to be restored.

Crimson Wizard

#3
Quote from: Vincent on Wed 23/08/2017 01:42:03
So I was wondering if there's a way to check if the joystick is plugged or not when the game is about to be restored.

There is a way to know how many joysticks are found using plugin functions. But you won't be able to know what is inside savegame beforehand, and won't be able to tell plugin to load savegame differently.

Game restores all objects created in script at the moment of saving. If there were some objects created by plugin, it will try to recreate them anyway with the plugin's help. If plugin is failing at this task, there is nothing you can do.

Mandle

Quote from: Crimson Wizard on Wed 23/08/2017 02:36:52
If plugin is failing at this task, there is nothing you can do.

Well, he may be able to at least have the game not allow the game load and tell the player to plug in the joystick before attempting to load again, and prevent the crash.

Vincent

Thanks Crimson Wizard for the clarification and Mandle.
As the latter mentioned, I just would like to prevent somehow this crash.
Even though there is a way to know how many joysticks are found using plugin functions...
I won't be able to know what is inside savegame beforehand to see if a savegame was saved with a joystick or not.
I am surprised to be the first and only one to have this problem with this plugin?
What about the other people that used this plugin into their game?
How have you managed to solve this kind of issue?

Crimson Wizard

#6
Quote from: Mandle on Wed 23/08/2017 03:28:10
Quote from: Crimson Wizard on Wed 23/08/2017 02:36:52
If plugin is failing at this task, there is nothing you can do.
Well, he may be able to at least have the game not allow the game load and tell the player to plug in the joystick before attempting to load again, and prevent the crash.

If it is okay to do this check everytime regardless of what is in save, then yes, it is possible. All you have to do is to make such check before calling RestoreGameSlot or RestoreGameDialog. AFAIK there is plugin function "JoystickCount" that tells you amount of joysticks.

However, if in this game joystick is just an optional control method, such solution won't be a good one, because there is no way to tell whether player had joystick when making save in the first place.

(BTW, error in plugin is just a guess. This may be something in AGS too.)

Snarky

Quote from: Crimson Wizard on Wed 23/08/2017 15:06:36
However, if in this game joystick is just an optional control method, such solution won't be a good one, because there is no way to tell whether player had joystick when making save in the first place.

Well, he could write that info to a separate file upon save, then read it before trying to load the savegame.

Crimson Wizard

I see, so, again, instead of reporting and pursing to fix the actual error, invent 1000 workarounds. Okay.

Mandle

Quote from: Crimson Wizard on Wed 23/08/2017 15:40:37
I see, so, again, instead of reporting and pursing to fix the actual error, invent 1000 workarounds. Okay.

Those two options are not mutually exclusive.

Trying to get the plugin fixed is the best option but there's no telling if that will end up happening or how long it may take.

Meanwhile, use a workaround.

Seems reasonable to me.

Crimson Wizard

Yes, you are right, I was getting frustrated for some reason...

Mandle

Quote from: Crimson Wizard on Thu 24/08/2017 02:03:47
Yes, you are right, I was getting frustrated for some reason...

My wife shows me cat videos on her phone when that happens to me.

I pretend to calm down while it secretly annoys me further, just to make it stop...

(laugh)

Vincent

So guys, I found a text document made by Wyz about using the plugin and found this note inside.

[ Basic usage ]
     
First you need to know how many, if any, joysticks are available. You can
retrieve the name of them with out having to open them to give the user a
possibility to select one. After you are going to use one, you need to open
it and store the object at an appropriate place. After that you can access
all variables from the object.  If you want to use events,  you  have to
enable them, the  are turned  off by default.  When you're done with the
joystick you can close the object. This will not destroy it but will stop
it from updating, and renders it in valid. If you were using events, first
disable them. Another way for a joystick object to become invalid is when
the player restored a save game and the joystick was disconnected. In that
case you can show a windows or do something useful.


Well, I am still not sure how to do that?
Also, regarding Snarky's workaround, how should go ahead and do something like that via script?
Thanks a lot for all your help guys, I really appreciated.

Snarky

#13
Quote from: Vincent on Fri 25/08/2017 07:50:48
Well, I am still not sure how to do that?

You should start by doing what CW recommended way back in the first response:

Quote from: Crimson Wizard on Wed 23/08/2017 01:22:38
I suggest reporting all this in plugin's thread.

Here's a link: http://www.adventuregamestudio.co.uk/forums/index.php?topic=41658.0;all

Vincent

Thanks for the suggestion once again and for sharing the link so far... I appreciated! :)

Wyz

Hmmm, I guess this is a bug of some kind. Every plug-in object is serialized--turned into a data blob which is added to the save file--when the game is saved. When the game loads again the plug-in is then responsible for unserializing the objects, basically do whatever to make it work again. Looks like something goes wrong at the unserializing stage. I store the joystick state (which buttons are down etc) and the joystick's name. When the game loads again the state is restored and the plug-in checks whether the joystick's name has changed. It either is no longer present or the order of joysticks plugged in has changed; in both cases the object is invalidated.

That said I do have an idea what might be causing this. Which exact version of the plugin are you using?

Spoiler
I seriously need to revisit this plug-in; reading that poorly written manual alone made me cringe. :D
[close]
Life is like an adventure without the pixel hunts.

Vincent

Thank you very much for the clarifications. :)
Yes, that's what we thought was going on indeed. I hope somehow it could be fixed. :(

I am using agsjoy v.1.2.0.0 (Last modified says 17/10/2010) which I am not sure if it's the latest version?

Crimson Wizard

I'd also suggest to upgrade your game to AGS 3.3.0 at least, if you can, because we may diagnose its crash dumps to at least know where error occurs exactly, but we cannot do the same with AGS 3.2.1.

Wyz

#18
I've compiled a new version of the plug-in and uploaded it here (temporarily).
Kindly give it a go and see if it works. ;)

If so I'll re-release it then. (although I don't have a place to host such things anymore unfortunately)

Let me know and thanks for your feedback. :)
Life is like an adventure without the pixel hunts.

Vincent

First of all I would like to say thank you very much for the time you spent to do this fix.
I really much appreciated! I just hope it will work fine. :)
I am going to download this newest version and let you know as soon as possible, still thank you very much!

SMF spam blocked by CleanTalk