The short story is I'm writing a front-end for the emulator MAME as a study in WPF and C#.
The GUI is set, it's reading cfg's properly, everything is fine except for actually launching MAME.
From the command line (Windows 7) I can type the following and have the emulator launch properly.
c:\MAME\Emulator\mame.exe mslug.zip
That launches the emulator with no issue exactly as designed. However I have tried all of the following.
Process Mame = new Process(emulatorPath);
Mame.StartInfo.Arguments = romSelected;
Mame.Start();
I tried the above with both the variable and putting Mame.StartInfo.Arguments = "mslug.zip"
ProcessStartInfo Mame = new ProcessStartInfo(emulatorPath);
Mame.Arguments = romSelected;
Process.Start(Mame);
I tried this also with both the variable and putting "mslug.zip" in it's place.
Finally I tried the following.
Process.Start(@"c:\Mame\emulator\mame.exe", "mslug.zip");
And it acts the same as the previous attempts.
If I don't try passing arguments to it, the program launches fine and just tells me there was no rom. Any of the above methods of passing arguments all resulted in a quick command prompt blip showing the same info it would show if it the rom's zip file was empty.
From what I've read about Process.Start and the like, what I've typed above should equate to opening the command line and entering the command I started this post with. But if that were the case then this should have worked with no issue. I'm not sure if I'm doing something wrong or if there is a better way to go about this.
Note: I also went through the Windows GUI and created a shortcut to mame.exe and edited it's properties to pass mslug.zip as an argument and it worked as well, so it doesn't require it to be done through the command line as far as I can tell.
As an asside, I have debug textboxes in the gui of the app that are updated with the variables used in my code to verify that the variables are correct.
Update:
I wanted to add that the program (for those not familiar) relies on the filename of the rom you try to launch. Meaning passing the argument mslug.zip causes the program to goto it's own rom directory (currently C:\mame\emulator\roms) and search for mslug.zip. I can run that command from any directory in my system and get the same result. I can also pass the path to the rom like
c:\mame\emulator\mame.exe c:\mame\emulator\roms\mslug.zip
That will also work regardless of where I run it. And I have tried that within my code, both by passing the paths as variables and by passing them like
string romSelected = @"c:\mame\emulator\roms\mslug.zip";
Both fail in the same fashion.