1

Closed

Hard coded system, game and process names

description

In Main.cs: LaunchGame() is this bit of code.
This clips off the .zip extension so zsnes can launch from the command line.
Could probably just be done with a batch file instead.
 
            // Super nes hack
            if (systemName != "Super NES")
                game = rom.Replace(".zip", "");
            else
                game = rom;
 
 
Also, there is this monstrous bit of code for special handling of the NES, Super NES and a couple other games that I hacked in there.
This uses GetProcessesByName() to get the emulator name, so it can be terminated when the keyboard listener gets the global terminate keys (1 + 2 + LeftCtrl)
 
In Main.cs:
 
    // Games that need custom handling of process
    string[] specialGames = { "sfiii3", "daytona", "vcop", "srallyc", 
                                   "hotd", "gunblade", "stcc", "dynamcop",
                                   "motoraid", "hotd3", "Raiden3" };
    // this is a total hack, it needs to be a flag in the XML for the game,
    // to determine whether it needs to be terminated or not.
    // also needs a process name to look for.
 
 
In LaunchGame() :
 
            Process[] emulator = null;
 
            if (systemName == "NES") // hack
                emulator = Process.GetProcessesByName("nestopia");
            else if (systemName == "Super NES") // hack
                emulator = Process.GetProcessesByName("zsnesw");
            else
            {
                foreach (string s in specialGames)
                {
                    if (game == s)
                    {
                        if (game == "sfiii3")
                            emulator = Process.GetProcessesByName("EMULATOR");
                        else if (game == "hotd3")
                            emulator = Process.GetProcessesByName("hod3pc");
                        else if (game == "raiden3")
                            emulator = Process.GetProcessesByName("raiden3");
                        else
                            emulator = Process.GetProcessesByName("emulator"); // model 2 emulator
                        break;
                    }
                }
            }
 
This is complete rubbish, see the comment in the code for how it should be fixed. I just can't be arsed fixing it.
Closed Jan 6, 2008 at 11:05 AM by spamdog
Fixed now. All this stuff is defined in the XML file as of 1.1

comments