Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ffux opened this issue Mar 26, 2015 · 9 comments

Comments

@ffux
Copy link

ffux commented Mar 26, 2015

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_Fantasy_XII_(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
Copy link

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
Copy link

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
Copy link

Issue still exists as of 9/21/2016.

@lpchaim
Copy link

lpchaim commented Dec 19, 2016

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
Copy link

Anamon commented Apr 4, 2017

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
Copy link

AucardThe3rd commented Jul 28, 2017

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
Copy link

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
Copy link

qbyss commented Aug 1, 2022

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants