0

I'm using the .Start process to run an emulator and a command line for the emulator to open the game, but when I run it, it opens the emulator but without the command line and the game that is selected in a listbox, would anyone have any ideas for this command line.

Command Line arguments: -L "cores\genesis_plus_gx_libretro.dll"

private void StartGame()
{
   string rom = @"ROMFILES\" + RomfilesList.Text.ToString() + ".zip".ToString();
   string emulator = @"EMULATOR\retroarch.exe";
   string commandline = @"-L cores\genesis_plus_gx_libretro.dll" + rom;

   if (!File.Exists(emulator))
   {
      MessageBox.Show("Emulator is required to continue.", "ERROR", MessageBoxButtons.OK,MessageBoxIcon.Error);
   }

   if (File.Exists(emulator))
   {
      Process.Start(emulator, "\"" + commandline);
   }
}
  • The following may be helpful: https://stackoverflow.com/a/75465116/10024425. Also see [ProcessStartInfo.Arguments](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.arguments?view=net-7.0) – Tu deschizi eu inchid Feb 16 '23 at 20:06
  • As it stands, your command line will be "-L cores\genesis_plus_gx_libretro.dllROMFILES\...". You'll definitely need a space there between the "dll" and "ROMFILES". ALso, your double `File.Exists` check is a bit odd. Why not just call `Process.Start` and handle the error that's returned (or exception that's thrown) if it's unsuccessful? No need for a `File.Exists` check at all. – Jim Mischel Feb 16 '23 at 20:52

1 Answers1

0

It looks like there's a small issue in constructing the command line string. The commandline variable is missing a space between the path to the core and the ROM file.

try this

private void StartGame()
{
   string rom = @"ROMFILES\" + RomfilesList.Text.ToString() + ".zip";
   string emulator = @"EMULATOR\retroarch.exe";
   string corePath = @"cores\genesis_plus_gx_libretro.dll";
   string commandline = "-L \"" + corePath + "\" \"" + rom + "\"";

   if (!File.Exists(emulator))
   {
      MessageBox.Show("Emulator is required to continue.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
   }
   else
   {
      Process.Start(emulator, commandline);
   }
}