Merge pull request #2 from Antidote/cmake

Fix crashes while attempting to load MP2 and MP3
This commit is contained in:
Jack Andersen 2019-05-27 01:01:51 -10:00 committed by GitHub
commit c4cc4b8657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 8 deletions

View File

@ -105,7 +105,9 @@ namespace CompressionUtil
bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut) bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut)
{ {
#if USE_LZOKAY #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) if (Result < lzokay::EResult::Success)
{ {

View File

@ -19,7 +19,7 @@ public:
static bool PathValid(const QString& kPath) static bool PathValid(const QString& kPath)
{ {
QFileInfo FileInfo(kPath); QFileInfo FileInfo(kPath);
return FileInfo.exists() && FileInfo.suffix() == "exe"; return FileInfo.exists() && FileInfo.isExecutable();
} }
}; };
@ -74,7 +74,7 @@ CQuickplayPropertyEditor::~CQuickplayPropertyEditor()
void CQuickplayPropertyEditor::BrowseForDolphin() void CQuickplayPropertyEditor::BrowseForDolphin()
{ {
QString Path = UICommon::OpenFileDialog(this, "Open Dolphin", "Dolphin.exe"); QString Path = UICommon::OpenFileDialog(this, "Open Dolphin", "Dolphin");
if (!Path.isEmpty()) if (!Path.isEmpty())
{ {

View File

@ -41,7 +41,6 @@ void CQuickplayRelay::QuickplayStarted()
void CQuickplayRelay::QuickplayFinished(int ReturnCode) void CQuickplayRelay::QuickplayFinished(int ReturnCode)
{ {
debugf("Quickplay session finished."); debugf("Quickplay session finished.");
disconnect(gpDolphinProcess, 0, this, 0); disconnect(gpDolphinProcess, 0, this, 0);
CleanupQuickplayFiles(gpQuickplayProject); CleanupQuickplayFiles(gpQuickplayProject);
gpDolphinProcess->waitForFinished(); gpDolphinProcess->waitForFinished();
@ -95,7 +94,7 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget,
if (Path.isEmpty()) if (Path.isEmpty())
{ {
// Allow the user to select the Dolphin exe. // 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)); 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? //@todo Validate the build version to make sure the build supports quickplay? Necessary?
QFileInfo DolphinFile(kDolphinPath); QFileInfo DolphinFile(kDolphinPath);
if (!DolphinFile.exists() || DolphinFile.suffix() != "exe") if (!DolphinFile.exists() || !DolphinFile.isExecutable())
{ {
if (!bSilent) 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; 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 // Build is legit, stash it
QSettings Settings; QSettings Settings;
Settings.setValue(gkDolphinPathSetting, kDolphinPath); Settings.setValue(gkDolphinPathSetting, kDolphinPath);

View File

@ -35,7 +35,7 @@
</Element> </Element>
<Element> <Element>
<Key>AMKF</Key> <Key>AMKF</Key>
<Value Path="Script/ActorMultiKeyframe.xml"/> <Value Path="Script/ActorMultiKeyFrame.xml"/>
</Element> </Element>
<Element> <Element>
<Key>AOCL</Key> <Key>AOCL</Key>