Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: String manipulation caused Exception Access Violation  (Read 2573 times)

0 Members and 1 Guest are viewing this topic.

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
String manipulation caused Exception Access Violation
« on: August 23, 2008, 12:22:00 PM »

Hi

I've posted this under the heading 'Splitting Strings' but when it caused an access violation, that's different so I'm opening this new topic. OS is Vista Home Basic on a Celeron D with 512Mb RAM.

-----------------------------------------------------------------
---------- wme 1.8.006 crash report: 23-08-2008, 11:39 ----------
-----------------------------------------------------------------
wme.exe caused a EXCEPTION_ACCESS_VIOLATION in module wme.exe at 001B:0043FE88, CBGame::IsDirectXBound()+39000 byte(s)
EAX=00000007  EBX=0B9F480F  ECX=00000000  EDX=00000000  ESI=00000000
EDI=00000000  EBP=00C5DDE8  ESP=0012FD48  EIP=0043FE88  FLG=00210202
CS=001B   DS=0023  SS=0023  ES=0023   FS=003B  GS=0000
Stack trace:
001B:0043FE88 (0x00C5DDE8 0x00000000 0x00C51358 0x00000000) wme.exe, CBGame::IsDirectXBound()+39000 byte(s)
001B:00C51401 (0x00000000 0x00C51358 0x00000000 0x00000000) <UNKNOWN>
001B:00C5DDE8 (0x00C51358 0x00000000 0x00000000 0x00000000) <UNKNOWN>

Script running at the time was as below - compiles OK, the only thing changed to cause the violation was the addition of the global object 'Noel'

Code: WME Script
  1. function SetState()
  2. {
  3.   var BtnUp = this.GetControl("up");
  4.   var BtnDown = this.GetControl("down");
  5.   var BtnLoad = this.GetControl("load");
  6.  
  7.   var Thumbnail = this.GetControl("thumbnail");
  8.  
  9.   BtnUp.Disabled = (ScrollOffset <= 0);
  10.   BtnDown.Disabled = (ScrollOffset+NumSlotButtons > LastUsedSlot);
  11.   BtnLoad.Disabled = (SelectedSlot < 0);
  12.    
  13.  
  14.   for(var i=0; i<NumSlotButtons; i=i+1)
  15.   {
  16.     var SaveSlot = LastUsedSlot - ScrollOffset - i;
  17.     //var SlotButton = this.GetControl(i+1);
  18. var SlotButton = this.GetControl(i);
  19.     SlotButton.Pressed = (SaveSlot==(LastUsedSlot-SelectedSlot));
  20.     SlotButton.Text = SaveSlot;
  21.     if(SaveSlot >= 0 && Game.IsSaveSlotUsed(SaveSlot))
  22.     {
  23.         // Noel's date manuipulation code
  24.     var SlotDate;       
  25.         var q = Game.GetSaveSlotDescription(SaveSlot);
  26.         var StringSplit = String(q);
  27.         var l = StringSplit.Length;
  28.         global Noel;
  29.         Noel.l = l;
  30.         Noel.StringSplit = StringSplit;
  31.        
  32.         Game.Msg(StringSplit+" "+l);
  33.           if(l > 16)
  34.             {
  35.                 SlotDate[i] = StringSplit.Substr(0, 16);
  36.             Game.Msg("i is:"+i+"  SlotDate is:"+SlotDate[i]);
  37.             SlotButton.Text = StringSplit.Substr(16, l-16);
  38.             }
  39.           else
  40.             {
  41.             SlotButton.Text = Game.GetSaveSlotDescription(SaveSlot);
  42.             }
  43.           //
  44.        
  45.         // SlotButton.Text = Game.GetSaveSlotDescription(SaveSlot);
  46.         SlotButton.Disabled = false;
  47.     }
  48.     else
  49.     {
  50.       SlotButton.Text = "";
  51.       SlotButton.Disabled = true;
  52.     }
  53.   }
  54.  
  55.   var SelSlot = LastUsedSlot - SelectedSlot;
  56.   //
  57.         var t = this.GetControl("SaveDate");
  58.   //
  59.   if(Game.IsSaveSlotUsed(SelSlot))
  60.     {
  61.         Thumbnail.SetImage("savegame:" + SelSlot);
  62.         //
  63.         t.Text = SlotDate[SelectedSlot - 1];
  64.         //
  65.         }       
  66.   else
  67.     {
  68.         Thumbnail.SetImage(null);
  69.         //
  70.         t.Text = "";
  71.         //
  72.         }
  73. }
  74.  
« Last Edit: January 03, 2009, 02:25:42 AM by Jyujinkai »
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: String manipulation caused Exception Access Violation
« Reply #1 on: August 23, 2008, 12:52:55 PM »

the violation is imo caused by using unitialized object String. Really include the keyword new and let us know if it crashes.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: String manipulation caused Exception Access Violation
« Reply #2 on: August 23, 2008, 01:42:39 PM »

Meta

You were right, adding the 'new' seemed to stop the violation. Odd that removing it made no difference at first. Ah well. And now, a reboot later, my Game.Msg's have suddenly started working.

Nervous? Moi? Nah. I love unpredictability  :-\  But, with Game.Msg spitting stuff out now, time to see what was causing the string glitch in the first place.  ???

This enquiry can be closed.

Thanks for your help.
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com
 

Page created in 0.072 seconds with 24 queries.