Memory corruption hunting

Hi! I’ve been fixing lots of things in Operation Stealth. I started using Valgrind because the Cine engine corrupted memory and I didn’t know where to start fixing it. I’ve now got Valgrind running ScummVM under Ubuntu 8.04 which I’m running in VirtualBox. A virtual machine (VirtualBox) running a virtual machine (Valgrind), yay! One could think that it’d be dead slow, but actually it runs ok.

So I recommend trying out Valgrind if you’ve got memory corruption problems with a program you’re developing even if you don’t run Linux natively, it can be used through a virtual machine like VirtualBox, QEMU or VMWare. I already got some memory corruption problems fixed with Valgrind’s help.

Stuff done since last update:

Bugfixes:

  • Fixed popup boxes blocking animation (r33686)
  • Partially fixed Adlib volume setting (r33700 trunk, r33701 0.12.0)
  • Fixed ‘text hard to read’ problems (r33792)
  • Fixed inventory showing (r33795)
  • Fixed verb handling bug (r33805)

New functionality:

  • Implemented game speed changing by pressing – or + (r33689)
  • Added moving using keyboard (r33698 & r33710)
  • Basic support for CD Future Wars (r33703 trunk, r33705 0.12.0)
  • Added drawing of type 22 overlays as filled rectangles (r33713)
  • Preliminary drawing of type 21 overlays (r33721 & r33722). WIP!
  • Implemented transparent cutscene textboxes (r33790)
Cutscene textboxes working in ScummVM

Cutscene textboxes working in ScummVM

Memory corruption and out of bounds access related changes:

  • Fixed rectangle drawing (r33687 & r33811 trunk, r33814 0.12.0)
  • Added sanity tests to background scrolling (r33688)
  • Converted objectTable to Common::Array (r33725)
  • Converted animDataTable to Common::Array (r33726)
  • Converted zoneData & zoneQuery to Common::Array (r33727)
  • Converted partBuffer to Common::Array (r33783)
  • Converted palPtr to Common::Array (r33785)
  • Fixed fontParamTable freeing (r33786)
  • Converted commandBuffer to Common::String (r33793)
  • Fixed handling of incorrect input data in loadMsg (r33810)
  • Fixed initialization of instrument data (r33812 trunk, r33813 0.12.0)

Cleanup:

  • Removed unnecessary textDataPtr (r33784)

And as Valgrind noticed some memory problems in the AGI engine’s sound engine I committed some fixes related to them (r33816 & r33822 trunk, r33820 & r33823 0.12.0). I had previously noticed that the AGI engine’s sound engine sometimes crashed when starting the first sound in an AGI game, so hopefully that’s fixed now.

What next?

Well, I got to the part where the player character is dropped into the sea with a woman, but I’m currently stuck there. After sorting out the memory corruption problems and testing the original game’s behaviour in this particular part it seems the problem is somehow related to incorrect character moving. The character should first swim near the girl and then try “Operate Girl” to untie her ropes (It works that way in the original). Here’s a picture of the thing working in DOSBox:

Untying the girl's ropes under DOSBox

Freeing the girl in DOSBox

But alas in ScummVM currently the player character can only be moved to the left and he automatically moves upwards almost all the time. So I can’t get to the girl to untie her and they both drown. With the memory corruption problems out of the way I’m looking into fixing this character moving problem next.

Advertisements

Tags: ,

2 Responses to “Memory corruption hunting”

  1. Abraham Macreno Says:

    Hello, I belive this is actually a useful internet site with superior stuff. That could be why I are going to request you if I can talk about your online site on my website if I present you with hyperlink back?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: