Unknown Block Type -Corrupt Files? (KINDA SOLVED)

Started by Baron, Sun 04/09/2011 05:07:53

Previous topic - Next topic

Baron

I wasn't doing anything crazy this evening, just some new room objects (room 56) and some scripting in the interactions.  Nothing out of the ordinary.  I F5ed and all the room scripts resaved because they had changed, which was weird (like for a compile or a script header change, but I hadn't done any of that), and then the game crashed with a simple error report:
 
QuoteError: LoadRoom: unknown block type 0 encountered in 'room199.crm'

I thought I'd investigate Room 199 and sure enough there were only two things in room_load: SetBackgroundFrame (0); and gMain.Visible =true; (I hadn't edited this room for ages and have run the game just fine hundreds of time since then).  Well, silly me, I thought I'd try changing the offending "0" to "1" and F5ed again -AGS reeeeeally didn't like that.  I got a massive error this time:

Quote
Error: LoadRoom: unknown block type 0 encountered in 'room199.crm'
Version: AGS 3.2.1.111

AGS.Types.AGSEditorException: LoadRoom: unknown block type 0 encountered in 'room199.crm'
  at ThrowManagedException(SByte* message)
  at load_room_file(SByte* )
  at load_crm_file(UnloadedRoom roomToLoad)
  at AGS.Native.NativeMethods.LoadRoomFile(UnloadedRoom roomToLoad)
  at AGS.Editor.Components.RoomsComponent.LoadNewRoomIntoMemory(UnloadedRoom newRoom, CompileMessages errors)
  at AGS.Editor.Components.RoomsComponent.RecompileAnyRoomsWhereTheScriptHasChanged(CompileMessages errors, Boolean rebuildAll)
  at AGS.Editor.Components.RoomsComponent.AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
  at AGS.Editor.AGSEditor.PreCompileGameHandler.Invoke(PreCompileGameEventArgs evArgs)
  at AGS.Editor.AGSEditor.CompileGame(Boolean forceRebuild, Boolean createMiniExeForDebug)
  at AGS.Editor.Components.BuildCommandsComponent.TestGame(Boolean withDebugger)
  at AGS.Editor.Components.BuildCommandsComponent.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)

 Apparently I am strongly recommended to back-up without saving as AGS is unstable and might blow up at anytime (...or my game files are corrupt, something like that).  I restarted the editor and tried to open room 199 and got the same message without even being able to see the contents of the script this time.  Clearly something is rotten in Denmark....
 The good news is I have a backup from last night, and I would only be out four hours of work if my files were corrupt.  The bad news is that I am reluctant to continue my project until I figure out exactly what has gone wrong and whether or not any of my recent work can be salvaged.  I have done nothing non-routine this evening.  Yesterday (before back-up) the game ran fine.  I think I did some work on a dialog without testing afterwards, since today I got errors when I tried to save (but before I F5ed).  I think I had called a function without a critical parameter and I had some code outside the final return/stop -just a comment because I was interrupted.  That's all of the circumstances I can think of that might somehow be relevant.
  Does anyone know what's going on here?  Thanks!

EDIT THE NEXT DAY:  Well, I've examined Room 199 in my backup files and noticed that it was about twice the size of the "corrupt" Room199 file in my working version.  So I replaced that one room file in my working version folder from my backup and ran the game smoothly with all my latest work intact.  So.... I know if it ain't broke I'm not supposed to want to mess around further, but I'm wondering how a room file I haven't worked on in a month suddenly became corrupt.  I guess this isn't a critical issue anymore, but if someone has any helpful advice about avoiding this in future please feel free to communicate it.

SMF spam blocked by CleanTalk