Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Toxicmaboroshi on Sat 18/07/2009 17:33:31

Title: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sat 18/07/2009 17:33:31
Hi

I have received this message:

getSpriteAsBitmap32bit: Unable to find sprite 0

It says if you are unable to resolve the error post on the forum.

My game save will not open...so I am unable rectify any possible problem. Does anyone know how to resolve this issue so I can get my game back?


Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: NsMn on Sat 18/07/2009 17:52:01
Solution: Delete the file acsesprite (or something like that) and rename the file backup_acsesprite (or so) to only acsesprite (I won't comment it again :P ). Then try to load the game again.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sat 18/07/2009 17:59:52
Quote from: NsMn on Sat 18/07/2009 17:52:01
Solution: Delete the file acsesprite (or something like that) and rename the file backup_acsesprite (or so) to only acsesprite (I won't comment it again :P ). Then try to load the game again.


Thanks for replying, I have found the file acsprset in the game folder, however I can not find the back up file which you describe? I guess it would be in teh same place as the original file?

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sat 18/07/2009 18:40:01
After not finding the backup file in he folder I replaced the old file...

I now have a whole new error message......a 'square', hexadecimal value 0x06, is an invalid characer. Line 1, position 1.

***PLEASE IGNORE THIS SECTION THIS HAS BEEN RESOLVED****

The below error continues:


getSpriteAsBitmap32bit: Unable to find sprite 0

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sat 18/07/2009 19:54:19
What happened before you saw this message for the first time? Was there an error saving the game before it started doing this?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sat 18/07/2009 21:20:48
Quote from: Pumaman on Sat 18/07/2009 19:54:19
What happened before you saw this message for the first time? Was there an error saving the game before it started doing this?

I imported a new sprite and applied it to an inventory item, I then ran the game to see what it looked like in game. The game ran its usual loading screen and then stopped throwing up the error:

getSpriteAsBitmap32bit: Unable to find sprite 0

I then wasn't able to save the game, I thought if I reload it from the last place I saved it would be okay, but I continued to get the above getSprite..... message.

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 19/07/2009 19:49:34
It sounds like your game's sprite file is corrupt, though I think I've only seen this happen before where there was some sort of error saving the game, and then this message started to come up whenever you tried to load it in future.

If you can zip up and upload your game folder I can take a look, though it's likely you'll need to restore from a previous backup version.

Did you use the Send Error Report button when this message first appeared?
Which version of AGS are you running?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Mon 20/07/2009 11:05:57
Quote from: Pumaman on Sun 19/07/2009 19:49:34
It sounds like your game's sprite file is corrupt, though I think I've only seen this happen before where there was some sort of error saving the game, and then this message started to come up whenever you tried to load it in future.

If you can zip up and upload your game folder I can take a look, though it's likely you'll need to restore from a previous backup version.

Did you use the Send Error Report button when this message first appeared?
Which version of AGS are you running?


Thinking about it, it may have been when I saved it? I often press save before running the game to test it.

I didn't have a back up version, so I found the acsprset file in the demo game and loaded it in. This allowed me to open my game, all the coding was still there but all the graphics had gone. So I started again added everything back in...but now I have been given the error message again! So I am not sure what I am doing but it doesn't like something! I am not sure if the resolutions are too big for the game?

I did report it the first time as AGS offered me to report the bug.

I think I am using the latest version of AGS as I downloaded it only a week ago. I'll try to zip up the file and post it as soon as I can.

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Mon 20/07/2009 19:10:22
Oh, if you've replaced the sprite file with one from the demo game I wouldn't expect that to work.

Is it possible you tried to save the game in the editor while it was running? This is a known problem that can break the sprite file, and in the next version the Save option will be disabled while you're running the game.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Shane 'ProgZmax' Stevens on Wed 22/07/2009 00:35:12
CJ - Instead of disabling it would it be better to have it auto-close the game and then save?  Sometimes people click save because they're worried something bad is going to happen (power outage, crash) so this would satisfy emergencies and protect the sprite file.  Just a thought.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Wed 22/07/2009 19:13:19
Well, I think that would make people complain that it had closed the game they were in the middle of debugging .. besides, in order to run the game it will have had to save it at that point, and you're unlikely to be making extensive changes in one debugging session.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Shane 'ProgZmax' Stevens on Thu 23/07/2009 03:35:58
Fair enough.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sat 25/07/2009 20:08:14
I am fairly sure I saved the game before running it. However, I built the same game a second time because of the crash...and it happened again and that time I definately didn't save whilst the game was running. Weirdly though it let me add more than it did last time before crashing?

Could it be due to file size? Or the resolution the pictures are in?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sat 25/07/2009 20:35:04
Is the game folder on your hard drive or are you trying to run it off a USB stick or something? I seem to remember somebody having strange problems when they were trying to develop the game on a USB drive...
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sun 26/07/2009 22:42:45
No, none of my stuff is on remote or extended storage it is all soted on the internal hard drive. It is just really strange how it has happened twice now?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 26/07/2009 23:43:25
Hmm yes, you shoudln't get this error once, let alone twice... I presume you're running the latest version of AGS?

When this error happens, is there still a file called ACSPRSET.SPR in the game folder?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Mon 27/07/2009 17:31:09
I am indeed using the latest version, downloaded the new one no more than a few weeks ago?

Yes that file is present when the error happens, there is no "backup" file of the same name when the error occurs.

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Mon 27/07/2009 17:56:20
I looked through the Error Reports log and found this, which was sent at about the time of your original post:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at save_sprites(Boolean )
   at AGS.Native.NativeMethods.SaveGame(Game game)
   at AGS.Editor.NativeProxy.SaveGame(Game game)
   at AGS.Editor.AGSEditor.SaveGameFilesProcess(Object parameter)
   at AGS.Editor.BusyDialog.RunHandlerOnThread()

Do you remember if this is the first error message that you got? If so, that indicates that it crashed while trying to save the sprite file (and therefore leaving a corrupt sprite file which couldn't be opened in future, leading to the Unable To Find Sprite 0 error).

The puzzling thing is why it crashed saving the file ... would it be possible to upload the image file that you had just imported at the time? If you import it again now, does it cause the crash again or does it work fine?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Fri 31/07/2009 11:13:13
That could well be the error message, I didn't read it too closely but it sounds about right for the error that I had.

I have to be honest I couldn't tell you which sprite it was.....I imported several all at the same time. A number for a walk view, several as objects and invent items?

I guess the only thing I could do is import everything one by one and press save each time to see if it catches a certain file when crashing?

Although I think the second time it crashed, I had imported more than the first time?

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Fri 31/07/2009 19:41:19
Strange, has anyone else had any problems like this?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sun 02/08/2009 18:11:28
Re loaded all the graphics and had no problems, realised that the sprites were too big for my walk view deleted them and hit save and this came up:

Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Version: AGS 3.1.2.82

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at save_sprites(Boolean )
   at AGS.Native.NativeMethods.SaveGame(Game game)
   at AGS.Editor.NativeProxy.SaveGame(Game game)
   at AGS.Editor.AGSEditor.SaveGameFilesProcess(Object parameter)
   at AGS.Editor.BusyDialog.RunHandlerOnThread()
   --- End of inner exception stack trace ---
   at AGS.Editor.BusyDialog.Show(String message, ProcessingHandler handler, Object parameter)
   at AGS.Editor.AGSEditor.SaveGameFiles()
   at AGS.Editor.Components.FileCommandsComponent.CommandClick(String controlID)
   at AGS.Editor.ToolBarManager.ToolbarEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

And now I am receiving the same getspriteasbitmap error I had 2 times before? I submitted this as well when it asked me to? Really is odd how I can't seem to get pass this?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 02/08/2009 18:18:12
Hmm, have you been re-ordering sprites by dragging them around?

There's a known bug in 3.1.2 SP1 where if you drag a sprite to the end of the list it doesn't move it but instead duplicates it, and you end up with that sprite then in the list twice; as a result the sprite file can get corrupted.

This bug will be fixed in the next version of AGS, but if you have been dragging sprites around then please can you try not doing so, and see if that gets rid of the problem?
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sun 09/08/2009 14:10:52
Nope haven't been dragging sprites around at all, I replaced a few...based on that I had sized them too large edited them and replaced them with a smaller version? However I have not been dragging or moving any of the files around?

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 09/08/2009 18:48:09
Are there any duplicate sprites in your Sprite Manager window? (ie. you see more than one sprite with the same number?)
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Sun 09/08/2009 22:49:23
The first time this happened I am sure there were not duplicate sprites, as I replaced old sprites rather than adding new. I can not be so sure the second time as I went in and started adding new sprites so they may have doubled?

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 09/08/2009 23:41:25
Hmm, well as you're having this problem such a lot, would you mind making a backup copy of your game, then trying out the AGS 3.2 Beta 4 release? It has a few fixes and it would be interesting to see whether you still get the problem with the new beta.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Toxicmaboroshi on Mon 10/08/2009 14:22:07
Yeah, I'll go get the download now see what happens?

Thanks
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: (deleted) on Fri 04/09/2009 15:57:54
Sorry to dig up an aging thread, but I encountered a similar problem, using the new beta 3.2.0.93.

I'd been seeing the (bizarre?) "read or write of protected memory" crash described here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37668.msg507261#msg507261) once every three or four work sessions with the new beta.

AGS crashed this way during the pre-"Run without debugger" autosave. After restarting, all sprites were black single-color squares, and the sprite cache was drastically smaller in file size! Like trees at the blast site, all the imagery was vaporized - leaving only blackened skeletons!

GOOD THING I BACKED UP.

Sorry I can't be more precise about this, but it happened so fast. I'm using XP 5.1 SP2 if that helps. This crash definitely occurred in the middle of the autosave, though.
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: abstauber on Sat 05/09/2009 11:53:05
@Hofmeier:

why not downgrading to AGS 3.2 Beta 3, that release is pretty stable. At least, that's what I did ;)
Title: Re: getSpriteAsBitmap32bit: Unable to find sprite 0
Post by: Pumaman on Sun 06/09/2009 22:41:47
Quote from: hofmeier on Fri 04/09/2009 15:57:54
Sorry to dig up an aging thread, but I encountered a similar problem, using the new beta 3.2.0.93.

I'd been seeing the (bizarre?) "read or write of protected memory" crash described here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37668.msg507261#msg507261) once every three or four work sessions with the new beta.

Please post problems with the beta in the Beta thread. Also, if you're getting an editor crash PLEASE use the Send Error Report button so that I get notified about it with details that will help me fix it.