Aloshi / EmulationStation

A flexible emulator front-end supporting keyboardless navigation and custom system themes.
MIT License
2.08k stars 905 forks source link

launch terminated with nonzero exit code 1 every time, even when code works in cmd #431

Open ffux opened 9 years ago

ffux commented 9 years ago

Log: lvl2: EmulationStation - v2.0.1a, built Mar 8 2015 - 16:10:39 lvl2: Creating surface... lvl2: Created window successfully. lvl2: Added known joystick XInput Controller #1 (instance ID: 0, device index: 0) lvl2: Checking available OpenGL extensions... lvl2: ARB_texture_non_power_of_two: ok lvl2: Loading system config file C:/Users/Tim/.emulationstation/es_systems.cfg... lvl2: Parsing XML file "C:/Users/Tim/.emulationstation/gamelists/dolphin/gamelist.xml"... lvl2: Parsing XML file "C:/Users/Tim/.emulationstation/gamelists/ps2/gamelist.xml"... lvl2: req sound [basic.launch] lvl2: (missing) lvl2: Attempting to launch game... lvl2: getting volume as 34 ( from float 0.34) lvl2: "C:\Program Files (x86)\PCSX2 1.2.1\pcsx2-r5875.exe" "D:\Games\PCSXGames\ShadowOfTheColossus.iso" lvl1: ...launch terminated with nonzero exit code 1! lvl2: Creating surface... lvl2: Created window successfully. lvl2: Added known joystick XInput Controller #1 (instance ID: 1, device index: 0) lvl2: Added known joystick XInput Controller #1 (instance ID: 1, device index: 0) lvl2: req sound [basic.launch] lvl2: (missing) lvl2: Attempting to launch game... lvl2: "C:\Program Files (x86)\PCSX2 1.2.1\pcsx2-r5875.exe" "D:\Games\PCSXGames\Kingdom_Hearts_2.iso" lvl1: ...launch terminated with nonzero exit code 1! lvl2: Creating surface... lvl2: Created window successfully. lvl2: Added known joystick XInput Controller #1 (instance ID: 2, device index: 0) lvl2: Added known joystick XInput Controller #1 (instance ID: 2, device index: 0) lvl2: req sound [basic.launch] lvl2: (missing) lvl2: Attempting to launch game... lvl2: "C:\Program Files (x86)\PCSX2 1.2.1\pcsx2-r5875.exe" "D:\Games\PCSXGames\Final_FantasyXII(USA).iso" lvl1: ...launch terminated with nonzero exit code 1! lvl2: Creating surface... lvl2: Created window successfully. lvl2: Added known joystick XInput Controller #1 (instance ID: 3, device index: 0) lvl2: Added known joystick XInput Controller #1 (instance ID: 3, device index: 0) lvl2: EmulationStation cleanly shutting down.

System:

ps2 Sony Playstation 2 D:\Games\PCSXGames .iso .ISO .cue .CUE "C:\Program Files (x86)\PCSX2 1.2.1\pcsx2-r5875.exe" "%ROM_RAW%" ps2 ps2

I have tried with and without quotes for each command location, with %ROM% and with %ROM_RAW% I'm stumped

SillyPilleus commented 9 years ago

Try removing the space from the PCSX2 folder name, Windows sometimes doesn't like them (alternatively it might work to put quotes around the folder name). My command for PCSX2 looks like -

C:\path\to\emulators\folder\PCSX2\pcsx2-r5875.exe "%ROM_RAW%" --fullscreen --nogui

This works for me. Hope this helps.

Smannesman commented 9 years ago

I can confirm the issue, ES seems to either not pass a filename to PCSX2 or breaks up the filename in a strange place if there are spaces in the path. Running the command shown in the log will launch the application perfectly and other frontends don't seem to have the problem either. Obviously renaming everything will 'fix' the problem, but that is not a solution just a workaround. In this day and age programs should be able to handle a few spaces.

YardGnomeNinja commented 8 years ago

Issue still exists as of 9/21/2016.

lpchaim commented 7 years ago

I can confirm this still happens at version 2.0.1.0 on Windows. The exact same command from the log works normally if pasted into a cmd window.

Anamon commented 7 years ago

This is due to a peculiarity with the method that EmulationStation uses to run a command on Windows systems. It uses the _wsystem() function, which itself runs the command using cmd /C.

This way of running a command checks how many quotes are in the command line. If there's more than one pair and the entire command starts with a quotation mark, such as is the case in the commands shown in your example log (one pair around the emulator executable path, and another pair around the game file path) then the first and last quotation marks of the command line are removed. So what ends up effectively being run is a command line that only has quotation marks between the emulator executable and the path of the game, with the rest being unescaped, which won't work if there are spaces in either of the paths.

The simplest way you can work around this issue is by simply modifying the <command> in your es_systems.cfg to include additional quotation marks at the very beginning and end of the entire line. This will make cmd remove only those two extra quotation marks and leave the rest intact. Other ways would be to use short filenames to avoid, or caret characters to escape spaces in the emulator executable path.

A naïve way of handling this from EmulationStation's code would be to just check if a command to be run on a Win32 system starts with a quotation mark, and if so, slap another pair of quotation marks around the entire line.

AucardThe3rd commented 7 years ago

i get the same issue, here is a section of my cfg

<system>
    <name>nes</name>
    <fullname>Nintendo Entertainment System</fullname>
    <path>F:\roms\nes</path>
    <extension>.nes .NES</extension>
    <command>%HOMEPATH%\.emulationstation\systems\retroarch\retroarch.exe -L %HOMEPATH%\.emulationstation\systems\retroarch\cores\fceumm_libretro.dll "%ROM_RAW%"</command>
    <platform>nes</platform>
    <theme>nes</theme>  
</system>
OtavioAugusto commented 4 years ago

i get the same issue, here is a section of my cfg

<system>
  <name>nes</name>
  <fullname>Nintendo Entertainment System</fullname>
  <path>F:\roms\nes</path>
  <extension>.nes .NES</extension>
  <command>%HOMEPATH%\.emulationstation\systems\retroarch\retroarch.exe -L %HOMEPATH%\.emulationstation\systems\retroarch\cores\fceumm_libretro.dll "%ROM_RAW%"</command>
  <platform>nes</platform>
  <theme>nes</theme>  
</system>

One way to solve is confirm if emulator's dll are the same in line of cfg to the cores folder. Taking the example above, the fceumm_libretro.dll is the same core of NES emulator in cores folder?

qbyss commented 2 years ago

This is due to a peculiarity with the method that EmulationStation uses to run a command on Windows systems. It uses the _wsystem() function, which itself runs the command using cmd /C.

This way of running a command checks how many quotes are in the command line. If there's more than one pair and the entire command starts with a quotation mark, such as is the case in the commands shown in your example log (one pair around the emulator executable path, and another pair around the game file path) then the first and last quotation marks of the command line are removed. So what ends up effectively being run is a command line that only has quotation marks between the emulator executable and the path of the game, with the rest being unescaped, which won't work if there are spaces in either of the paths.

The simplest way you can work around this issue is by simply modifying the <command> in your es_systems.cfg to include additional quotation marks at the very beginning and end of the entire line. This will make cmd remove only those two extra quotation marks and leave the rest intact. Other ways would be to use short filenames to avoid, or caret characters to escape spaces in the emulator executable path.

A naïve way of handling this from EmulationStation's code would be to just check if a command to be run on a Win32 system starts with a quotation mark, and if so, slap another pair of quotation marks around the entire line.

Thanks a lot. I was having trouble making this work.

For those that didn't quite get it, here is a command that work with dolphin. My username has a space in it, same as the rom. <command>""%HOMEPATH%\.emulationstation\systems\dolphin\Dolphin.exe" -e "%ROM_RAW%""</command>

rahul-kumar-bly commented 1 year ago

This is due to a peculiarity with the method that EmulationStation uses to run a command on Windows systems. It uses the _wsystem() function, which itself runs the command using cmd /C.

This way of running a command checks how many quotes are in the command line. If there's more than one pair and the entire command starts with a quotation mark, such as is the case in the commands shown in your example log (one pair around the emulator executable path, and another pair around the game file path) then the first and last quotation marks of the command line are removed. So what ends up effectively being run is a command line that only has quotation marks between the emulator executable and the path of the game, with the rest being unescaped, which won't work if there are spaces in either of the paths.

The simplest way you can work around this issue is by simply modifying the <command> in your es_systems.cfg to include additional quotation marks at the very beginning and end of the entire line. This will make cmd remove only those two extra quotation marks and leave the rest intact. Other ways would be to use short filenames to avoid, or caret characters to escape spaces in the emulator executable path.

A naïve way of handling this from EmulationStation's code would be to just check if a command to be run on a Win32 system starts with a quotation mark, and if so, slap another pair of quotation marks around the entire line.

thanks a lot, working fine now with pcsx2