mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 22:58:50 +00:00
manta rings code + macos fixes
This commit is contained in:
parent
6c346d12de
commit
0a53480f3f
3 changed files with 143 additions and 90 deletions
|
@ -710,6 +710,14 @@ $Minigame - Fish n' Drips - 3 Players have 2 Less Rounds [Tabitha]
|
||||||
0442D31C 42820000
|
0442D31C 42820000
|
||||||
E2000001 80008000
|
E2000001 80008000
|
||||||
|
|
||||||
|
$Minigame - Manta Rings - Just Hold A [Tabitha]
|
||||||
|
281D3CE2 00000009
|
||||||
|
04005FA4 60000000
|
||||||
|
E2000001 80000000
|
||||||
|
2A1D3CE2 00000009
|
||||||
|
04005FA4 7F83032E
|
||||||
|
E2000001 80008000
|
||||||
|
|
||||||
$Minigame - Three Throw - All Hoops Empty [gamemasterplc]
|
$Minigame - Three Throw - All Hoops Empty [gamemasterplc]
|
||||||
20434274 3800000A
|
20434274 3800000A
|
||||||
04434260 38800000
|
04434260 38800000
|
||||||
|
|
|
@ -79,7 +79,7 @@ void DownloadUpdateDialog::onDownloadFinished()
|
||||||
installationDirectory = QCoreApplication::applicationDirPath(); // Set the installation directory
|
installationDirectory = QCoreApplication::applicationDirPath(); // Set the installation directory
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
installationDirectory = QCoreApplication::applicationDirPath() + "/../../"
|
installationDirectory = QCoreApplication::applicationDirPath() + QStringLiteral("/../../")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use QStandardPaths to get the system's temporary directory
|
// Use QStandardPaths to get the system's temporary directory
|
||||||
|
|
|
@ -44,13 +44,13 @@ InstallUpdateDialog::~InstallUpdateDialog(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallUpdateDialog::install(void)
|
void InstallUpdateDialog::install()
|
||||||
{
|
{
|
||||||
QString fullFilePath = QCoreApplication::applicationDirPath() + QStringLiteral("/") + this->filename;
|
QString fullFilePath = QCoreApplication::applicationDirPath() + QStringLiteral("/") + this->filename;
|
||||||
QString appPath = QCoreApplication::applicationDirPath();
|
QString appPath = QCoreApplication::applicationDirPath();
|
||||||
QString appPid = QString::number(QCoreApplication::applicationPid());
|
QString appPid = QString::number(QCoreApplication::applicationPid());
|
||||||
|
|
||||||
// Convert paths to use the right path separator
|
// Convert paths to native format
|
||||||
this->temporaryDirectory = QDir::toNativeSeparators(this->temporaryDirectory);
|
this->temporaryDirectory = QDir::toNativeSeparators(this->temporaryDirectory);
|
||||||
fullFilePath = QDir::toNativeSeparators(fullFilePath);
|
fullFilePath = QDir::toNativeSeparators(fullFilePath);
|
||||||
appPath = QDir::toNativeSeparators(appPath);
|
appPath = QDir::toNativeSeparators(appPath);
|
||||||
|
@ -58,30 +58,36 @@ void InstallUpdateDialog::install(void)
|
||||||
if (this->filename.endsWith(QStringLiteral(".exe")))
|
if (this->filename.endsWith(QStringLiteral(".exe")))
|
||||||
{
|
{
|
||||||
this->label->setText(QStringLiteral("Executing %1...").arg(this->filename));
|
this->label->setText(QStringLiteral("Executing %1...").arg(this->filename));
|
||||||
QStringList scriptLines =
|
|
||||||
{
|
#ifdef _WIN32
|
||||||
|
QStringList scriptLines = {
|
||||||
QStringLiteral("@echo off"),
|
QStringLiteral("@echo off"),
|
||||||
QStringLiteral("("),
|
QStringLiteral("("),
|
||||||
QStringLiteral(" echo == Attempting to kill PID ") + appPid,
|
QStringLiteral(" echo == Attempting to kill PID ") + appPid,
|
||||||
QStringLiteral(" taskkill /F /PID:") + appPid,
|
QStringLiteral(" taskkill /F /PID:") + appPid,
|
||||||
QStringLiteral(" echo == Attempting to start '") + fullFilePath + QStringLiteral("'"),
|
QStringLiteral(" echo == Attempting to start '") + fullFilePath + QStringLiteral("'"),
|
||||||
QStringLiteral(" \"") + fullFilePath + QStringLiteral("\" /CLOSEAPPLICATIONS /NOCANCEL /MERGETASKS=\"!desktopicon\" /SILENT /DIR=\"") + appPath + QStringLiteral("\""),
|
QStringLiteral(" \"") + fullFilePath +
|
||||||
|
QStringLiteral(
|
||||||
|
"\" /CLOSEAPPLICATIONS /NOCANCEL /MERGETASKS=\"!desktopicon\" /SILENT /DIR=\"") +
|
||||||
|
appPath + QStringLiteral("\""),
|
||||||
QStringLiteral(")"),
|
QStringLiteral(")"),
|
||||||
QStringLiteral("IF NOT ERRORLEVEL 0 ("),
|
QStringLiteral("IF NOT ERRORLEVEL 0 ("),
|
||||||
QStringLiteral(" start \"\" cmd /c \"echo Update failed, check the log for more information && pause\""),
|
QStringLiteral(" start \"\" cmd /c \"echo Update failed, check the log for more "
|
||||||
|
"information && pause\""),
|
||||||
QStringLiteral(")"),
|
QStringLiteral(")"),
|
||||||
// Remove temporary directory at last
|
|
||||||
QStringLiteral("rmdir /S /Q \"") + this->temporaryDirectory + QStringLiteral("\""),
|
QStringLiteral("rmdir /S /Q \"") + this->temporaryDirectory + QStringLiteral("\""),
|
||||||
};
|
};
|
||||||
this->writeAndRunScript(scriptLines);
|
this->writeAndRunScript(scriptLines);
|
||||||
this->accept();
|
this->accept();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->label->setText(QStringLiteral("Extracting %1...").arg(this->filename));
|
this->label->setText(QStringLiteral("Extracting %1...").arg(this->filename));
|
||||||
this->progressBar->setValue(50);
|
this->progressBar->setValue(50);
|
||||||
|
|
||||||
QString extractDirectory = this->temporaryDirectory + QDir::separator() + QStringLiteral("Dolphin-MPN");
|
QString extractDirectory =
|
||||||
|
this->temporaryDirectory + QDir::separator() + QStringLiteral("Dolphin-MPN");
|
||||||
|
|
||||||
// Ensure the extract directory exists before attempting to unzip
|
// Ensure the extract directory exists before attempting to unzip
|
||||||
QDir dir(this->temporaryDirectory);
|
QDir dir(this->temporaryDirectory);
|
||||||
|
@ -110,28 +116,50 @@ void InstallUpdateDialog::install(void)
|
||||||
|
|
||||||
extractDirectory = QDir::toNativeSeparators(extractDirectory);
|
extractDirectory = QDir::toNativeSeparators(extractDirectory);
|
||||||
|
|
||||||
QStringList scriptLines =
|
#ifdef __APPLE__
|
||||||
{
|
QStringList scriptLines = {
|
||||||
|
QStringLiteral("#!/bin/bash"),
|
||||||
|
QStringLiteral("echo '== Terminating application with PID ") + appPid + QStringLiteral("'"),
|
||||||
|
QStringLiteral("kill -9 ") + appPid,
|
||||||
|
QStringLiteral("echo '== Removing old application files'"),
|
||||||
|
QStringLiteral("rm -f \"") + fullFilePath + QStringLiteral("\""),
|
||||||
|
QStringLiteral("echo '== Copying new files to ") + appPath + QStringLiteral("'"),
|
||||||
|
QStringLiteral("cp -r \"") + extractDirectory + QStringLiteral("/\"* \"") + appPath +
|
||||||
|
QStringLiteral("\""),
|
||||||
|
QStringLiteral("echo '== Launching the updated application'"),
|
||||||
|
QStringLiteral("open \"") + appPath + QStringLiteral("/Dolphin-MPN.app\""),
|
||||||
|
QStringLiteral("echo '== Cleaning up temporary files'"),
|
||||||
|
QStringLiteral("rm -rf \"") + this->temporaryDirectory + QStringLiteral("\""),
|
||||||
|
QStringLiteral("exit 0")};
|
||||||
|
this->writeAndRunScript(scriptLines);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
QStringList scriptLines = {
|
||||||
QStringLiteral("@echo off"),
|
QStringLiteral("@echo off"),
|
||||||
QStringLiteral("("),
|
QStringLiteral("("),
|
||||||
QStringLiteral(" echo == Attempting to remove '") + fullFilePath + QStringLiteral("'"),
|
QStringLiteral(" echo == Attempting to remove '") + fullFilePath + QStringLiteral("'"),
|
||||||
QStringLiteral(" del /F /Q \"") + fullFilePath + QStringLiteral("\""),
|
QStringLiteral(" del /F /Q \"") + fullFilePath + QStringLiteral("\""),
|
||||||
QStringLiteral(" echo == Attempting to kill PID ") + appPid,
|
QStringLiteral(" echo == Attempting to kill PID ") + appPid,
|
||||||
QStringLiteral(" taskkill /F /PID:") + appPid,
|
QStringLiteral(" taskkill /F /PID:") + appPid,
|
||||||
QStringLiteral(" echo == Attempting to copy '") + extractDirectory + QStringLiteral("' to '") + appPath + QStringLiteral("'"),
|
QStringLiteral(" echo == Attempting to copy '") + extractDirectory +
|
||||||
QStringLiteral(" xcopy /S /Y /I \"") + extractDirectory + QStringLiteral("\\*\" \"") + appPath + QStringLiteral("\""),
|
QStringLiteral("' to '") + appPath + QStringLiteral("'"),
|
||||||
QStringLiteral(" echo == Attempting to start '") + appPath + QStringLiteral("\\Dolphin-MPN.exe'"),
|
QStringLiteral(" xcopy /S /Y /I \"") + extractDirectory + QStringLiteral("\\*\" \"") +
|
||||||
|
appPath + QStringLiteral("\""),
|
||||||
|
QStringLiteral(" echo == Attempting to start '") + appPath +
|
||||||
|
QStringLiteral("\\Dolphin-MPN.exe'"),
|
||||||
QStringLiteral(" start \"\" \"") + appPath + QStringLiteral("\\Dolphin-MPN.exe\""),
|
QStringLiteral(" start \"\" \"") + appPath + QStringLiteral("\\Dolphin-MPN.exe\""),
|
||||||
QStringLiteral(")"),
|
QStringLiteral(")"),
|
||||||
QStringLiteral("IF NOT ERRORLEVEL 0 ("),
|
QStringLiteral("IF NOT ERRORLEVEL 0 ("),
|
||||||
QStringLiteral(" start \"\" cmd /c \"echo Update failed && pause\""),
|
QStringLiteral(" start \"\" cmd /c \"echo Update failed && pause\""),
|
||||||
QStringLiteral(")"),
|
QStringLiteral(")"),
|
||||||
// Remove temporary directory at last
|
|
||||||
QStringLiteral("rmdir /S /Q \"") + this->temporaryDirectory + QStringLiteral("\""),
|
QStringLiteral("rmdir /S /Q \"") + this->temporaryDirectory + QStringLiteral("\""),
|
||||||
};
|
};
|
||||||
this->writeAndRunScript(scriptLines);
|
this->writeAndRunScript(scriptLines);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InstallUpdateDialog::unzipFile(const std::string& zipFilePath, const std::string& destDir)
|
bool InstallUpdateDialog::unzipFile(const std::string& zipFilePath, const std::string& destDir)
|
||||||
{
|
{
|
||||||
unzFile zipFile = unzOpen(zipFilePath.c_str());
|
unzFile zipFile = unzOpen(zipFilePath.c_str());
|
||||||
|
@ -197,24 +225,41 @@ bool InstallUpdateDialog::unzipFile(const std::string& zipFilePath, const std::s
|
||||||
|
|
||||||
void InstallUpdateDialog::writeAndRunScript(QStringList stringList)
|
void InstallUpdateDialog::writeAndRunScript(QStringList stringList)
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QString scriptPath = this->temporaryDirectory + QStringLiteral("/update.sh");
|
||||||
|
#else
|
||||||
QString scriptPath = this->temporaryDirectory + QStringLiteral("/update.bat");
|
QString scriptPath = this->temporaryDirectory + QStringLiteral("/update.bat");
|
||||||
|
#endif
|
||||||
|
|
||||||
QFile scriptFile(scriptPath);
|
QFile scriptFile(scriptPath);
|
||||||
if (!scriptFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!scriptFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Failed to open file for writing: %1").arg(filename));
|
QMessageBox::critical(this, tr("Error"),
|
||||||
|
tr("Failed to open file for writing: %1").arg(filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream textStream(&scriptFile);
|
QTextStream textStream(&scriptFile);
|
||||||
|
|
||||||
// Write script to file
|
#ifdef __APPLE__
|
||||||
|
// macOS: Write shell script
|
||||||
|
textStream << QStringLiteral("#!/bin/bash\n");
|
||||||
|
#else
|
||||||
|
// Windows: Write batch script
|
||||||
|
textStream << QStringLiteral("@echo off\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
for (const QString& str : stringList)
|
for (const QString& str : stringList)
|
||||||
{
|
{
|
||||||
textStream << str << "\n";
|
textStream << str << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner);
|
#ifdef __APPLE__
|
||||||
|
scriptFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner |
|
||||||
|
QFileDevice::ExeOwner);
|
||||||
|
#else
|
||||||
|
scriptFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||||
|
#endif
|
||||||
scriptFile.close();
|
scriptFile.close();
|
||||||
|
|
||||||
this->launchProcess(scriptPath, {});
|
this->launchProcess(scriptPath, {});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue