Archive for the ‘Computers’ category

Call of Duty: Black Ops Multiple Profiles

November 12th, 2010

Black Ops Multiple Profiles Launcher

I created this launcher to provide multiple profiles for the single player game of Call of Duty: Black Ops. This is similar to the loader I wrote for Modern Warfare 2 which you can find here. As there are multiple ways to acquire this game and install it, this may not work for everyone.

Instructions:

  1. Download the zip file here
  2. Extract the contents to the install directory for Black Ops
  3. Create a shortcut on your desktop for Black Ops Loader.exe and use it instead of launching the game directly.
  4. When you click “Launch” and you’re asked to select a program or shortcut to run, navigate to the shortcut you would normally use to launch the single player game and select it. This will ensure that the game is run through Steam.
  5. If for some reason you need to re-select a program or shortcut to run, you can do this by resetting the Loader. To do this you need to delete the profiles.xml file located in:
    (XP) C:\Documents and Settings\All Users\Application Data\BO_Loader\
    (Vista) C:\Program Data\BO_Loader\
    (Win7) C:\ProgramData\BO_Loader\
  6. If you don’t already have the Microsoft .Net Framework 3.5 installed on your system, you will need to download it here

Here’s a picture of what the game directory should look like after you’ve extracted the file:
Black Ops Install Directory

Note: This only works for the PC version of the game and as far as I know only changes your Single Player profile, which includes all game settings and saved games.

If you have any questions or comments please feel free to post them below. Feedback and praise is always welcome!

Call of Duty: Modern Warfare 2 Multiple Profiles

November 14th, 2009

Modern Warfare 2 Launcher

I created this launcher to provide multiple profiles for the single player game of Call of Duty: Modern Warfare 2. As there are multiple ways to acquire this game and install it, this may not work for everyone.

Instructions:

  1. Download the zip file here
  2. Extract the contents to the install directory for Modern Warfare 2
  3. Create a shortcut on your desktop for MW2 Loader.exe and use it instead of launching the game directly.
  4. When you click “Launch” and you’re asked to select a program or shortcut to run, navigate to the shortcut you would normally use to launch the single player game and select it. This will ensure that the game is run through Steam.
  5. If for some reason you need to re-select a program or shortcut to run, you can do this by resetting the Loader. To do this you need to delete the profiles.xml file located in:
    (XP) C:\Documents and Settings\All Users\Application Data\MW2_Loader\
    (Vista) C:\Program Data\MW2_Loader\
    (Win7) C:\ProgramData\MW2_Loader\
  6. If you don’t already have the Microsoft .Net Framework 3.5 installed on your system, you will need to download it here

Here’s a picture of what the game directory should look like after you’ve extracted the file:
mw2_dir

Note: This only works for the PC version of the game and as far as I know only changes your Single Player profile, which includes all game settings and saved games.

If you have any questions or comments please feel free to post them below. Feedback and praise is always welcome!

Updates:

2009-11-16:

  • Fixed System.IO.FileFormatException: The image format is unrecognized bug.

2009-11-15:

  • Fixed bug with new profiles disappearing when not launched.
  • Changed program icon in an attempt to better support Vista and WPF.
  • Implemented ability to choose program or shortcut to launch after loading a profile. You should use this to select the shortcut you regularly use to launch the game with Steam.

C#: Set File Type Association

April 14th, 2009

While searching for some simple C# code to set the program and icon associated with a file type in Windows I ran across these beautiful functions that illustrate how to accomplish this by using the registry.

All credit goes to cristiscu (source).

Here’s the code:

using Microsoft.Win32;
using System.Runtime.InteropServices;
 
public class FileAssociation
{
    // Associate file extension with progID, description, icon and application
    public static void Associate(string extension, 
           string progID, string description, string icon, string application)
    {
        Registry.ClassesRoot.CreateSubKey(extension).SetValue("", progID);
        if (progID != null && progID.Length > 0)
            using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progID))
            {
                if (description != null)
                    key.SetValue("", description);
                if (icon != null)
                    key.CreateSubKey("DefaultIcon").SetValue("", ToShortPathName(icon));
                if (application != null)
                    key.CreateSubKey(@"Shell\Open\Command").SetValue("", 
                                ToShortPathName(application) + " \"%1\"");
            }
    }
 
    // Return true if extension already associated in registry
    public static bool IsAssociated(string extension)
    {
        return (Registry.ClassesRoot.OpenSubKey(extension, false) != null);
    }
 
    [DllImport("Kernel32.dll")]
    private static extern uint GetShortPathName(string lpszLongPath, 
        [Out] StringBuilder lpszShortPath, uint cchBuffer);
 
    // Return short path format of a file name
    private static string ToShortPathName(string longName)
    {
        StringBuilder s = new StringBuilder(1000);
        uint iSize = (uint)s.Capacity;
        uint iRet = GetShortPathName(longName, s, iSize);
        return s.ToString();
    }
}

And here’s how you’d use it:

if (!FileAssociation.IsAssociated(".ext"))
   Associate(".ext", "ClassID.ProgID", "ext File", "YourIcon.ico", "YourApplication.exe");

A couple caveats to this code that I’ve noticed:

  1. The second parameter passed to Associate() can be any string you’d like to use to represent your program in the registry, just make sure you’re consistent with it.
  2. ToShortPathName() will return an empty string if the file path you pass it doesn’t exist, i.e. if you pass it a path to an icon file that doesn’t exist it won’t work.
  3. IsAssociated() will return true if the file extension is associated with any program, not just yours. If you want to be specific about it checking whether it’s associated with your program, then just check whether it’s default key is set to your programs ProgID.

Green Sudoku, a C# App

September 27th, 2008

So I’ve written a small Sudoku game in C#. I originally started writing it so that I could have an interface to test my Sudoku Solving Algorithm. But as I worked on it, it became more and more a nice little application worthy of its own existence.

It only has 3 puzzles hard-coded into it that I’ve been using for testing purposes, but they’re fun to play, even though they’re a little on the easy side. My plan is to update the game to automatically download puzzles from some of the major Sudoku game websites that are out there. This would allow you to play literally millions of puzzles from several different levels of difficulty.

So I post it here for your puzzle-solving pleasure! Please be patient with it as it has a few bugs I’m still working out. If you happen to find any please let me know by commenting in this post!

This link will provide you with a direct download to a zip file that contains the game and a few files it needs to run. After downloading it just extract it anywhere you’d like and enjoy!

*GreenSudoku.zip (360KB)

Green Sudoku Screenshot

Green Sudoku Screenshot

*Note: You need to have .NET framework version 2.0 or later installed on your system. If you’re not sure whether you have it you can download and run this small program from Microsoft which will install it if it’s not present on your system.

Spore, suprisingly entertaining

September 25th, 2008

So about a week ago my wonderful wife purchased me the latest video game title to splash onto the market, Spore. Although the game was announced over a year ago as the next big simulation franchise from the creative genius of Will Wright, and seemed to be receiving the praises from many a person I know as well as some good scores from online review sites, I admit I had my reservations.

Nevertheless I acquired it (by legal means this time, which is unusual for me). I was hesitant to just install it on my computers due to some discussions I’ve read concerning its use of nasty, nasty DRM software such as SecuROM. I’ve also read ill-reports of EA’s new method of controlling their software by limiting the number of installations possible from a single product key. This made me curious if there was an alternative.

So I did a little looking around and sure enough there was already a pirated image of the install disk that supposedly came without the DRM and without the install cap. This I downloaded and used to install on my gaming rig and laptop, being sure to include EA’s download manager so that I wouldn’t have go through the pain of manually keeping the game up to date and so that I could fully enjoy the benefits of Spore’s use of online shared content.

After a brief amount of setup and configuration I created a new game and entered the world as a small, single-celled organism equipped with a beak, a flagellum, and a pair of eyes. I admit the eyes were kinda silly, but they served to introduce me to the unique, almost cartoony, universe of spore. I quickly progressed through the cell stage, followed by the creature stage and arrived at the tribal stage with a feeling that I was finally getting the handle on this game; after all I was at the top of the food chain and was able to send any wobbly legged or googly eyed creature Maxis could throw at me running for their lives. » Read more: Spore, suprisingly entertaining