mirror of
https://github.com/RetroPie/EmulationStation.git
synced 2025-04-02 10:41:48 -04:00
Compare commits
5 commits
21733bd567
...
75ea3484a5
Author | SHA1 | Date | |
---|---|---|---|
|
75ea3484a5 | ||
|
81c62c97ee | ||
|
75c01f73ab | ||
|
72892db014 | ||
|
d03b0e60c7 |
2 changed files with 22 additions and 7 deletions
|
@ -180,6 +180,7 @@ bool parseArgs(int argc, char* argv[])
|
||||||
"--screensize WIDTH HEIGHT for a canvas smaller than the full resolution,\n"
|
"--screensize WIDTH HEIGHT for a canvas smaller than the full resolution,\n"
|
||||||
" or if rotating into portrait mode\n"
|
" or if rotating into portrait mode\n"
|
||||||
"--screenoffset X Y move the canvas by x,y pixels\n"
|
"--screenoffset X Y move the canvas by x,y pixels\n"
|
||||||
|
"--fullscreen-borderless borderless fullscreen window\n"
|
||||||
"--windowed not fullscreen, should be used with --resolution\n"
|
"--windowed not fullscreen, should be used with --resolution\n"
|
||||||
"\nGame and settings visibility in ES and behaviour of ES:\n"
|
"\nGame and settings visibility in ES and behaviour of ES:\n"
|
||||||
"--force-disable-filters force the UI to ignore applied filters on\n"
|
"--force-disable-filters force the UI to ignore applied filters on\n"
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#include <SDL_events.h>
|
#include <SDL_events.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <codecvt>
|
#include <windows.h>
|
||||||
|
#include "Shlwapi.h"
|
||||||
|
#pragma comment(lib, "Shlwapi.lib")
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,12 +33,24 @@ int runRestartCommand()
|
||||||
int runSystemCommand(const std::string& cmd_utf8)
|
int runSystemCommand(const std::string& cmd_utf8)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// on Windows we use _wsystem to support non-ASCII paths
|
std::string args = std::string(PathGetArgs(cmd_utf8.c_str()));
|
||||||
// which requires converting from utf8 to a wstring
|
std::string program = cmd_utf8.substr(0, cmd_utf8.length() - args.length());
|
||||||
typedef std::codecvt_utf8<wchar_t> convert_type;
|
SHELLEXECUTEINFO ShExecInfo = {0};
|
||||||
std::wstring_convert<convert_type, wchar_t> converter;
|
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||||
std::wstring wchar_str = converter.from_bytes(cmd_utf8);
|
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
||||||
return _wsystem(wchar_str.c_str());
|
ShExecInfo.hwnd = NULL;
|
||||||
|
ShExecInfo.lpVerb = NULL;
|
||||||
|
ShExecInfo.lpFile = program.c_str();
|
||||||
|
ShExecInfo.lpParameters = args.c_str();
|
||||||
|
ShExecInfo.lpDirectory = NULL;
|
||||||
|
ShExecInfo.nShow = SW_SHOW;
|
||||||
|
ShExecInfo.hInstApp = NULL;
|
||||||
|
ShellExecuteEx(&ShExecInfo);
|
||||||
|
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
||||||
|
CloseHandle(ShExecInfo.hProcess);
|
||||||
|
DWORD dwExitCode = 0;
|
||||||
|
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
|
||||||
|
return dwExitCode;
|
||||||
#else
|
#else
|
||||||
return system(cmd_utf8.c_str());
|
return system(cmd_utf8.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue