Two annoying things I've fixed…

Posted 09 June 2005, 11:29 | by | | Perma-link

Ok, well, I got a new PC last month, and very nice it is too. I bought a couple of new games to play on it (Lego® Star Wars™: The Game - very cool and The Lord of the Rings™, The Battle for Middle-earth™ also very cool).

After I'd installed various other bits and pieces and basically got my machine all set up as I liked it, I found that 2 things were broken.

The following details the symptoms and fixes I've put in place:

LotR:BfMe would no longer run

The initial splash screen would appear, then disappear, and the secondary screen would not appear - it just hung. Looking in Task Manager revealed the three processes involved just sitting there (lotrbfme.exe, game.dat and ~e5.0001) but nothing happening with any of them - no new CPU time, no increase in memory nothing.

I finally tracked the problem down to my mouse settings (not drivers) - I've got a five button MS intellimouse, and prefer to have the side buttons set to Shift and Ctrl and the middle button as "middle button" rather than their defaults of Back, Forward and "Next Window" - I use Mouse Gestures in FireFox, so don't need buttons, and I find that Ctrl and Shift are more use in 3ds max and windows than those - however LotR:BfMe doens't like me doing that and won't run. Checking the "Enable program-specific settings" and browsing to lotrbfme.exe and telling the drivers to do their default thing when it's running seems to have fixed it.

Installing DirectX SDK Update (June 2005) breaks Tom Miller's Beginning 3D Game Programming code

Ok, this one's even more involved.

Basically, I bought Tom Miller's Beginning 3D Game Programming a couple of months ago, and instead of installing the October or December SDK that came with it, I pulled down the April one and used that - I also used the April framework code instead of his - this obviously lead to some compile errors - mostly from a couple of methods that required an extra (null) parameter passed into them.

However, I've just installed the June SDK on the new PC, and things were even more broken - Microsoft have removed a couple of methods and interfaces from the framework - namely the Framework.SetMouseCallback and Framework.SetKeyboardCallback used in listing 4.1

These should be replaced with the following:

sampleFramework.Window.KeyDown += new KeyEventHandler(blockersEngine.OnKeyDown);
sampleFramework.Window.MouseMove += new MouseEventHandler(blockersEngine.OnMouseMove);
sampleFramework.Window.MouseDown += new MouseEventHandler(blockersEngine.OnMouseDown);

And moved below the line from listing 4.5 that reads:

sampleFramework.CreateWindow("Blockers - The Game");

You'll then need to modify your event handlers as follows:

/// <summary>
/// Hook the mouse moves.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>  
private void OnMouseMove (object sender, MouseEventArgs e)
{
  if (isMainMenuShowing)
  {
    mainScreen.OnMouseMove(e.X, e.Y);
  }
  else if (isSelectScreenShowing)
  {
    selectScreen.OnMouseMove(e.X, e.Y);
  }
}

/// <summary>
/// Handle mouse clicks
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnMouseDown (object sender, MouseEventArgs e)
{
  if (MouseButtons.Left == e.Button)
  {
    if (isMainMenuShowing)
    {
      mainScreen.OnMouseClick(e.X, e.Y);
    }
    else if (isSelectScreenShowing)
    {
      selectScreen.OnMouseClick(e.X, e.Y);
    }
  }
}

/// <summary>
/// Handle the keyboard strokes.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
  if (isMainMenuShowing)
  {
    mainScreen.OnKeyPress(e.KeyData);
  }
  else if (isSelectScreenShowing)
  {
    selectScreen.OnKeyPress(e.KeyData);
  }
}

Enjoy.

Filed under: 3D, Fixes, Games, Hardware