mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Fixed multiple issues with the find rules logic and with launching games.
Also added some more debug logging when launching games.
This commit is contained in:
parent
11ae6ba6f5
commit
bad7aaf4be
|
@ -815,6 +815,16 @@ void FileData::launchGame(Window* window)
|
||||||
window->setInfoPopup(s);
|
window->setInfoPopup(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
#if defined(_WIN64)
|
||||||
|
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary \"" <<
|
||||||
|
Utils::String::replace(Utils::String::replace(
|
||||||
|
binaryPath, "%ESPATH%", esPath), "/", "\\") << "\"";
|
||||||
|
#else
|
||||||
|
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary \"" <<
|
||||||
|
Utils::String::replace(binaryPath, "%ESPATH%", esPath) << "\"";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// If %EMUPATH% is used in es_systems.xml for this system, then check that the core
|
// If %EMUPATH% is used in es_systems.xml for this system, then check that the core
|
||||||
// file actually exists.
|
// file actually exists.
|
||||||
|
@ -890,7 +900,6 @@ void FileData::launchGame(Window* window)
|
||||||
// If a %CORE_ find rule entry is used in es_systems.xml for this system, then try to find
|
// If a %CORE_ find rule entry is used in es_systems.xml for this system, then try to find
|
||||||
// the emulator core using the rules defined in es_find_rules.xml.
|
// the emulator core using the rules defined in es_find_rules.xml.
|
||||||
for (std::string path : emulatorCorePaths) {
|
for (std::string path : emulatorCorePaths) {
|
||||||
|
|
||||||
// The position of the %CORE_ variable could have changed as there may have been an
|
// The position of the %CORE_ variable could have changed as there may have been an
|
||||||
// %EMULATOR_ variable that was substituted for the actual emulator binary.
|
// %EMULATOR_ variable that was substituted for the actual emulator binary.
|
||||||
coreEntryPos = command.find("%CORE_");
|
coreEntryPos = command.find("%CORE_");
|
||||||
|
@ -1195,6 +1204,8 @@ std::string FileData::findEmulatorPath(std::string& command)
|
||||||
|
|
||||||
for (std::string path : emulatorStaticPaths) {
|
for (std::string path : emulatorStaticPaths) {
|
||||||
path = Utils::FileSystem::expandHomePath(path);
|
path = Utils::FileSystem::expandHomePath(path);
|
||||||
|
// If %ESPATH% is used for the rule, then expand it to the binary directory of ES-DE.
|
||||||
|
path = Utils::String::replace(path, "%ESPATH%", Utils::FileSystem::getExePath());
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
path = Utils::String::replace(path, "/", "\\");
|
path = Utils::String::replace(path, "/", "\\");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1207,6 +1218,12 @@ std::string FileData::findEmulatorPath(std::string& command)
|
||||||
|
|
||||||
// Method 2, exact emulator binary name:
|
// Method 2, exact emulator binary name:
|
||||||
|
|
||||||
|
// If %ESPATH% is used, then expand it to the binary directory of ES-DE.
|
||||||
|
command = Utils::String::replace(command, "%ESPATH%", Utils::FileSystem::getExePath());
|
||||||
|
#if defined(_WIN64)
|
||||||
|
command = Utils::String::replace(command, "/", "\\");
|
||||||
|
#endif
|
||||||
|
|
||||||
// If the first character is a quotation mark, then we need to extract up to the
|
// If the first character is a quotation mark, then we need to extract up to the
|
||||||
// next quotation mark, otherwise we'll only extract up to the first space character.
|
// next quotation mark, otherwise we'll only extract up to the first space character.
|
||||||
if (command.front() == '\"') {
|
if (command.front() == '\"') {
|
||||||
|
@ -1228,20 +1245,19 @@ std::string FileData::findEmulatorPath(std::string& command)
|
||||||
|
|
||||||
SearchPathW(nullptr, emuExecutableWide.c_str(), L".exe", size + 1 ,
|
SearchPathW(nullptr, emuExecutableWide.c_str(), L".exe", size + 1 ,
|
||||||
pathBuffer.data(), &fileName);
|
pathBuffer.data(), &fileName);
|
||||||
std::wstring pathString = pathBuffer.data();
|
|
||||||
|
|
||||||
if (pathString.length()) {
|
exePath = Utils::String::wideStringToString(pathBuffer.data());
|
||||||
exePath = Utils::String::wideStringToString(pathString.substr(0, pathString.size() -
|
|
||||||
std::wstring(fileName).size()));
|
|
||||||
exePath.pop_back();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (Utils::FileSystem::isRegularFile(emuExecutable) ||
|
if (Utils::FileSystem::isRegularFile(emuExecutable) ||
|
||||||
Utils::FileSystem::isSymlink(emuExecutable))
|
Utils::FileSystem::isSymlink(emuExecutable)) {
|
||||||
exePath = Utils::FileSystem::getParent(emuExecutable);
|
exePath = emuExecutable;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
exePath = Utils::FileSystem::getPathToBinary(emuExecutable);
|
exePath = Utils::FileSystem::getPathToBinary(emuExecutable);
|
||||||
|
if (exePath != "")
|
||||||
|
exePath += "/" + emuExecutable;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return exePath;
|
return exePath;
|
||||||
|
|
Loading…
Reference in a new issue