Added more debug log output when launching games

This commit is contained in:
Leon Styhre 2023-10-09 21:47:32 +02:00
parent 7e8566b557
commit bd4e8d0f61

View file

@ -823,7 +823,9 @@ void FileData::launchGame()
{ {
Window* window {Window::getInstance()}; Window* window {Window::getInstance()};
LOG(LogInfo) << "Launching game \"" << this->metadata.get("name") << "\"..."; LOG(LogInfo) << "Launching game \"" << this->metadata.get("name") << "\" from system \""
<< getSourceFileData()->getSystem()->getFullName() << " ("
<< getSourceFileData()->getSystem()->getName() << ")\"...";
SystemData* gameSystem {nullptr}; SystemData* gameSystem {nullptr};
std::string command; std::string command;
@ -855,9 +857,8 @@ void FileData::launchGame()
<< "\" as configured for the specific game"; << "\" as configured for the specific game";
} }
} }
// Check if there is a system-wide alternative emulator configured. // Check if there is a system-wide alternative emulator configured.
if (command == "" && alternativeEmulator != "") { else if (command == "" && alternativeEmulator != "") {
command = gameSystem->getLaunchCommandFromLabel(alternativeEmulator); command = gameSystem->getLaunchCommandFromLabel(alternativeEmulator);
if (command == "") { if (command == "") {
LOG(LogWarning) << "Invalid alternative emulator \"" LOG(LogWarning) << "Invalid alternative emulator \""
@ -870,6 +871,10 @@ void FileData::launchGame()
<< " as configured for system \"" << gameSystem->getName() << "\""; << " as configured for system \"" << gameSystem->getName() << "\"";
} }
} }
else {
LOG(LogDebug) << "FileData::launchGame(): Using default emulator \""
<< mEnvData->mLaunchCommands.front().second << "\"";
}
if (command.empty()) if (command.empty())
command = mEnvData->mLaunchCommands.front().first; command = mEnvData->mLaunchCommands.front().first;
@ -1042,8 +1047,8 @@ void FileData::launchGame()
return; return;
} }
else { else {
LOG(LogDebug) << "FileData::launchGame(): Found pre-command binary \"" << preCommandPath LOG(LogDebug) << "FileData::launchGame(): Pre-command binary set to \""
<< "\""; << preCommandPath << "\"";
} }
} }
@ -1097,10 +1102,10 @@ void FileData::launchGame()
Utils::String::replace(binaryPath, "%ESPATH%", esPath), "/", "\\")}; Utils::String::replace(binaryPath, "%ESPATH%", esPath), "/", "\\")};
if (binaryLogPath.front() != '\"' && binaryLogPath.back() != '\"') if (binaryLogPath.front() != '\"' && binaryLogPath.back() != '\"')
binaryLogPath = "\"" + binaryLogPath + "\""; binaryLogPath = "\"" + binaryLogPath + "\"";
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary " << binaryLogPath; LOG(LogDebug) << "FileData::launchGame(): Emulator binary set to " << binaryLogPath;
#else #else
else if (!isShortcut) { else if (!isShortcut) {
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary \"" LOG(LogDebug) << "FileData::launchGame(): Emulator binary set to \""
<< Utils::String::replace(binaryPath, "%ESPATH%", esPath) << "\""; << Utils::String::replace(binaryPath, "%ESPATH%", esPath) << "\"";
#endif #endif
} }
@ -1827,6 +1832,9 @@ const std::string FileData::findEmulatorPath(std::string& command, const bool pr
if (pathStatus == ERROR_SUCCESS) { if (pathStatus == ERROR_SUCCESS) {
if (Utils::FileSystem::isRegularFile(Utils::String::wideStringToString(registryPath)) || if (Utils::FileSystem::isRegularFile(Utils::String::wideStringToString(registryPath)) ||
Utils::FileSystem::isSymlink(Utils::String::wideStringToString(registryPath))) { Utils::FileSystem::isSymlink(Utils::String::wideStringToString(registryPath))) {
LOG(LogDebug) << "FileData::findEmulatorPath(): "
<< (preCommand ? "Pre-command binary" : "Emulator binary")
<< " found via winregistrypath rule";
exePath = Utils::FileSystem::getEscapedPath( exePath = Utils::FileSystem::getEscapedPath(
Utils::String::wideStringToString(registryPath)); Utils::String::wideStringToString(registryPath));
command.replace(startPos, endPos - startPos + 1, exePath); command.replace(startPos, endPos - startPos + 1, exePath);
@ -1896,6 +1904,9 @@ const std::string FileData::findEmulatorPath(std::string& command, const bool pr
if (pathStatus == ERROR_SUCCESS) { if (pathStatus == ERROR_SUCCESS) {
if (Utils::FileSystem::isRegularFile(Utils::String::wideStringToString(path)) || if (Utils::FileSystem::isRegularFile(Utils::String::wideStringToString(path)) ||
Utils::FileSystem::isSymlink(Utils::String::wideStringToString(path))) { Utils::FileSystem::isSymlink(Utils::String::wideStringToString(path))) {
LOG(LogDebug) << "FileData::findEmulatorPath(): "
<< (preCommand ? "Pre-command binary" : "Emulator binary")
<< " found via winregistryvalue rule";
exePath = exePath =
Utils::FileSystem::getEscapedPath(Utils::String::wideStringToString(path)); Utils::FileSystem::getEscapedPath(Utils::String::wideStringToString(path));
command.replace(startPos, endPos - startPos + 1, exePath); command.replace(startPos, endPos - startPos + 1, exePath);
@ -1927,6 +1938,9 @@ const std::string FileData::findEmulatorPath(std::string& command, const bool pr
} }
} }
if (exePath != "") { if (exePath != "") {
LOG(LogDebug) << "FileData::findEmulatorPath(): "
<< (preCommand ? "Pre-command binary" : "Emulator binary")
<< " found via systempath rule";
exePath += "\\" + path; exePath += "\\" + path;
exePath = Utils::FileSystem::getEscapedPath(exePath); exePath = Utils::FileSystem::getEscapedPath(exePath);
command.replace(startPos, endPos - startPos + 1, exePath); command.replace(startPos, endPos - startPos + 1, exePath);
@ -1935,6 +1949,9 @@ const std::string FileData::findEmulatorPath(std::string& command, const bool pr
#else #else
exePath = Utils::FileSystem::getPathToBinary(path); exePath = Utils::FileSystem::getPathToBinary(path);
if (exePath != "") { if (exePath != "") {
LOG(LogDebug) << "FileData::findEmulatorPath(): "
<< (preCommand ? "Pre-command binary" : "Emulator binary")
<< " found via systempath rule";
exePath += "/" + path; exePath += "/" + path;
command.replace(startPos, endPos - startPos + 1, exePath); command.replace(startPos, endPos - startPos + 1, exePath);
return exePath; return exePath;
@ -1974,6 +1991,9 @@ const std::string FileData::findEmulatorPath(std::string& command, const bool pr
} }
if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) { if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) {
LOG(LogDebug) << "FileData::findEmulatorPath(): "
<< (preCommand ? "Pre-command binary" : "Emulator binary")
<< " found via staticpath rule";
if (replaceCommand == "") { if (replaceCommand == "") {
exePath = Utils::FileSystem::getEscapedPath(path); exePath = Utils::FileSystem::getEscapedPath(path);
} }