mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed multiple game launching issues.
This commit is contained in:
parent
c197dde21e
commit
f4c9586eeb
|
@ -933,7 +933,11 @@ void FileData::launchGame()
|
||||||
|
|
||||||
// If there's a quotation mark before the %CORE_ variable, then remove it.
|
// If there's a quotation mark before the %CORE_ variable, then remove it.
|
||||||
// The closing quotation mark will be removed later below.
|
// The closing quotation mark will be removed later below.
|
||||||
|
bool hasCoreQuotation {false};
|
||||||
|
if (command.find("\"%CORE_") != std::string::npos) {
|
||||||
command = Utils::String::replace(command, "\"%CORE_", "%CORE_");
|
command = Utils::String::replace(command, "\"%CORE_", "%CORE_");
|
||||||
|
hasCoreQuotation = true;
|
||||||
|
}
|
||||||
|
|
||||||
coreEntryPos = command.find("%CORE_");
|
coreEntryPos = command.find("%CORE_");
|
||||||
if (coreEntryPos != std::string::npos) {
|
if (coreEntryPos != std::string::npos) {
|
||||||
|
@ -1019,8 +1023,14 @@ void FileData::launchGame()
|
||||||
std::string coreFile;
|
std::string coreFile;
|
||||||
if (spacePos != std::string::npos) {
|
if (spacePos != std::string::npos) {
|
||||||
coreRaw = command.substr(emuPathPos, spacePos - emuPathPos);
|
coreRaw = command.substr(emuPathPos, spacePos - emuPathPos);
|
||||||
|
#if defined(_WIN64)
|
||||||
|
coreFile = Utils::FileSystem::getParent(Utils::String::replace(binaryPath, "\"", "")) +
|
||||||
|
command.substr(emuPathPos + 9, spacePos - emuPathPos - 9);
|
||||||
|
coreFile = Utils::String::replace(coreFile, "/", "\\");
|
||||||
|
#else
|
||||||
coreFile = Utils::FileSystem::getParent(binaryPath) +
|
coreFile = Utils::FileSystem::getParent(binaryPath) +
|
||||||
command.substr(emuPathPos + 9, spacePos - emuPathPos - 9);
|
command.substr(emuPathPos + 9, spacePos - emuPathPos - 9);
|
||||||
|
#endif
|
||||||
if (hasQuotationMark) {
|
if (hasQuotationMark) {
|
||||||
coreRaw.pop_back();
|
coreRaw.pop_back();
|
||||||
coreFile.pop_back();
|
coreFile.pop_back();
|
||||||
|
@ -1103,9 +1113,10 @@ void FileData::launchGame()
|
||||||
size_t stringPos = coreFile.find("%EMUPATH%");
|
size_t stringPos = coreFile.find("%EMUPATH%");
|
||||||
if (stringPos != std::string::npos) {
|
if (stringPos != std::string::npos) {
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
coreFile = Utils::String::replace(
|
coreFile = coreFile.replace(
|
||||||
coreFile.replace(stringPos, 9, Utils::FileSystem::getParent(binaryPath)), "/",
|
stringPos, 9,
|
||||||
"\\");
|
Utils::FileSystem::getParent(Utils::String::replace(binaryPath, "\"", "")));
|
||||||
|
coreFile = Utils::String::replace(coreFile, "/", "\\");
|
||||||
#else
|
#else
|
||||||
coreFile = coreFile.replace(stringPos, 9, Utils::FileSystem::getParent(binaryPath));
|
coreFile = coreFile.replace(stringPos, 9, Utils::FileSystem::getParent(binaryPath));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1126,7 +1137,8 @@ void FileData::launchGame()
|
||||||
// Escape any blankspaces.
|
// Escape any blankspaces.
|
||||||
if (coreFile.find(" ") != std::string::npos)
|
if (coreFile.find(" ") != std::string::npos)
|
||||||
coreFile = Utils::FileSystem::getEscapedPath(coreFile);
|
coreFile = Utils::FileSystem::getEscapedPath(coreFile);
|
||||||
command.replace(coreEntryPos, separatorPos - coreEntryPos, coreFile);
|
command.replace(coreEntryPos,
|
||||||
|
separatorPos - coreEntryPos + (hasCoreQuotation ? 1 : 0), coreFile);
|
||||||
#if !defined(_WIN64)
|
#if !defined(_WIN64)
|
||||||
// Remove any quotation marks as it would make the launch function fail.
|
// Remove any quotation marks as it would make the launch function fail.
|
||||||
if (command.find("\"") != std::string::npos)
|
if (command.find("\"") != std::string::npos)
|
||||||
|
@ -1256,10 +1268,13 @@ void FileData::launchGame()
|
||||||
command = Utils::String::replace(command, "%ROMPATH%",
|
command = Utils::String::replace(command, "%ROMPATH%",
|
||||||
Utils::FileSystem::getEscapedPath(getROMDirectory()));
|
Utils::FileSystem::getEscapedPath(getROMDirectory()));
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
|
command = Utils::String::replace(
|
||||||
|
command, "%ESPATH%", Utils::String::replace(Utils::FileSystem::getExePath(), "/", "\\"));
|
||||||
command = Utils::String::replace(command, "%EMUDIR%",
|
command = Utils::String::replace(command, "%EMUDIR%",
|
||||||
Utils::FileSystem::getEscapedPath(Utils::FileSystem::getParent(
|
Utils::FileSystem::getEscapedPath(Utils::FileSystem::getParent(
|
||||||
Utils::String::replace(binaryPath, "\"", ""))));
|
Utils::String::replace(binaryPath, "\"", ""))));
|
||||||
#else
|
#else
|
||||||
|
command = Utils::String::replace(command, "%ESPATH%", Utils::FileSystem::getExePath());
|
||||||
command = Utils::String::replace(command, "%EMUDIR%",
|
command = Utils::String::replace(command, "%EMUDIR%",
|
||||||
Utils::FileSystem::getEscapedPath(Utils::FileSystem::getParent(
|
Utils::FileSystem::getEscapedPath(Utils::FileSystem::getParent(
|
||||||
Utils::String::replace(binaryPath, "\\", ""))));
|
Utils::String::replace(binaryPath, "\\", ""))));
|
||||||
|
|
Loading…
Reference in a new issue