diff --git a/src/Core/CompressionUtil.cpp b/src/Core/CompressionUtil.cpp index b38393a2..cdcd7b9b 100644 --- a/src/Core/CompressionUtil.cpp +++ b/src/Core/CompressionUtil.cpp @@ -105,7 +105,9 @@ namespace CompressionUtil bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut) { #if USE_LZOKAY - lzokay::EResult Result = lzokay::decompress(pSrc, (size_t) SrcLen, pDst, (size_t&) rTotalOut); + size_t TotalOut = rTotalOut; + lzokay::EResult Result = lzokay::decompress(pSrc, (size_t) SrcLen, pDst, TotalOut); + rTotalOut = TotalOut; if (Result < lzokay::EResult::Success) { diff --git a/src/Editor/CQuickplayPropertyEditor.cpp b/src/Editor/CQuickplayPropertyEditor.cpp index d821913f..7414098e 100644 --- a/src/Editor/CQuickplayPropertyEditor.cpp +++ b/src/Editor/CQuickplayPropertyEditor.cpp @@ -19,7 +19,7 @@ public: static bool PathValid(const QString& kPath) { QFileInfo FileInfo(kPath); - return FileInfo.exists() && FileInfo.suffix() == "exe"; + return FileInfo.exists() && FileInfo.isExecutable(); } }; @@ -74,7 +74,7 @@ CQuickplayPropertyEditor::~CQuickplayPropertyEditor() void CQuickplayPropertyEditor::BrowseForDolphin() { - QString Path = UICommon::OpenFileDialog(this, "Open Dolphin", "Dolphin.exe"); + QString Path = UICommon::OpenFileDialog(this, "Open Dolphin", "Dolphin"); if (!Path.isEmpty()) { diff --git a/src/Editor/NDolphinIntegration.cpp b/src/Editor/NDolphinIntegration.cpp index f82e9400..d809b1a4 100644 --- a/src/Editor/NDolphinIntegration.cpp +++ b/src/Editor/NDolphinIntegration.cpp @@ -41,7 +41,6 @@ void CQuickplayRelay::QuickplayStarted() void CQuickplayRelay::QuickplayFinished(int ReturnCode) { debugf("Quickplay session finished."); - disconnect(gpDolphinProcess, 0, this, 0); CleanupQuickplayFiles(gpQuickplayProject); gpDolphinProcess->waitForFinished(); @@ -95,7 +94,7 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget, if (Path.isEmpty()) { // Allow the user to select the Dolphin exe. - Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "Dolphin.exe"); + Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "Dolphin"); } bool bGotDolphin = (!Path.isEmpty() && SetDolphinPath(pParentWidget, Path, true)); @@ -254,15 +253,46 @@ bool SetDolphinPath(QWidget* pParentWidget, const QString& kDolphinPath, bool bS //@todo Validate the build version to make sure the build supports quickplay? Necessary? QFileInfo DolphinFile(kDolphinPath); - if (!DolphinFile.exists() || DolphinFile.suffix() != "exe") + if (!DolphinFile.exists() || !DolphinFile.isExecutable()) { if (!bSilent) { - UICommon::ErrorMsg(pParentWidget, "The selected file is not a Dolphin exe!"); + UICommon::ErrorMsg(pParentWidget, "The selected file is not a Dolphin executable!"); } return false; } + // Try to obtain the version from Dolphin + QProcess DolphinProcess; + DolphinProcess.start(kDolphinPath, QStringList() << "--version"); + DolphinProcess.waitForFinished(); + QString VersionString = DolphinProcess.readLine().trimmed(); + + // Make sure we have a valid string + if (VersionString.isNull()) + { + if (!bSilent) + { + UICommon::ErrorMsg(pParentWidget, "Unable to validate version string, the selected file is likely not a Dolphin executable"); + } + return false; + } + + // Dolphin's version string is broken into two parts, the first part is the name the second is the version + // Dolphin unfortunately collide's with KDE Plasma's file manager which also happens to be named "Dolphin" + // Fortunately the latter uses a lowercase name so we can differentiate. + QStringList VersionParts = VersionString.split(' '); + if (VersionParts.count() != 2 || VersionParts[0] != "Dolphin") + { + if (!bSilent) + { + UICommon::ErrorMsg(pParentWidget, "The selected file is not a Dolphin executable!"); + } + return false; + } + + debugf("Found dolphin version %s", *TO_TSTRING(VersionParts[1])); + // Build is legit, stash it QSettings Settings; Settings.setValue(gkDolphinPathSetting, kDolphinPath); diff --git a/templates/DKCR/Game.xml b/templates/DKCR/Game.xml index 1cec2ae8..6642e6bb 100644 --- a/templates/DKCR/Game.xml +++ b/templates/DKCR/Game.xml @@ -35,7 +35,7 @@ AMKF - + AOCL