mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-11-23 03:09:55 +00:00
Fixes encoding in update text (#1283)
* Fixes encoding in update text * +
This commit is contained in:
parent
ce53c41205
commit
01fb320f4e
@ -374,11 +374,17 @@ void CheckUpdate::Install() {
|
|||||||
QString userPath;
|
QString userPath;
|
||||||
Common::FS::PathToQString(userPath, Common::FS::GetUserPath(Common::FS::PathType::UserDir));
|
Common::FS::PathToQString(userPath, Common::FS::GetUserPath(Common::FS::PathType::UserDir));
|
||||||
|
|
||||||
QString startingUpdate = tr("Starting Update...");
|
|
||||||
QString tempDirPath = userPath + "/temp_download_update";
|
|
||||||
QString rootPath;
|
QString rootPath;
|
||||||
Common::FS::PathToQString(rootPath, std::filesystem::current_path());
|
Common::FS::PathToQString(rootPath, std::filesystem::current_path());
|
||||||
|
|
||||||
|
QString tempDirPath = userPath + "/temp_download_update";
|
||||||
|
QString startingUpdate = tr("Starting Update...");
|
||||||
|
|
||||||
|
QString binaryStartingUpdate;
|
||||||
|
for (QChar c : startingUpdate) {
|
||||||
|
binaryStartingUpdate.append(QString::number(c.unicode(), 2).rightJustified(16, '0'));
|
||||||
|
}
|
||||||
|
|
||||||
QString scriptContent;
|
QString scriptContent;
|
||||||
QString scriptFileName;
|
QString scriptFileName;
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
@ -389,7 +395,13 @@ void CheckUpdate::Install() {
|
|||||||
scriptFileName = tempDirPath + "/update.ps1";
|
scriptFileName = tempDirPath + "/update.ps1";
|
||||||
scriptContent = QStringLiteral(
|
scriptContent = QStringLiteral(
|
||||||
"Set-ExecutionPolicy Bypass -Scope Process -Force\n"
|
"Set-ExecutionPolicy Bypass -Scope Process -Force\n"
|
||||||
"Write-Output '%1'\n"
|
"$binaryStartingUpdate = '%1'\n"
|
||||||
|
"$chars = @()\n"
|
||||||
|
"for ($i = 0; $i -lt $binaryStartingUpdate.Length; $i += 16) {\n"
|
||||||
|
" $chars += [char]([convert]::ToInt32($binaryStartingUpdate.Substring($i, 16), 2))\n"
|
||||||
|
"}\n"
|
||||||
|
"$startingUpdate = -join $chars\n"
|
||||||
|
"Write-Output $startingUpdate\n"
|
||||||
"Expand-Archive -Path '%2\\temp_download_update.zip' -DestinationPath '%2' -Force\n"
|
"Expand-Archive -Path '%2\\temp_download_update.zip' -DestinationPath '%2' -Force\n"
|
||||||
"Start-Sleep -Seconds 3\n"
|
"Start-Sleep -Seconds 3\n"
|
||||||
"Copy-Item -Recurse -Force '%2\\*' '%3\\'\n"
|
"Copy-Item -Recurse -Force '%2\\*' '%3\\'\n"
|
||||||
@ -512,7 +524,12 @@ void CheckUpdate::Install() {
|
|||||||
QFile scriptFile(scriptFileName);
|
QFile scriptFile(scriptFileName);
|
||||||
if (scriptFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (scriptFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QTextStream out(&scriptFile);
|
QTextStream out(&scriptFile);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
out << scriptContent.arg(binaryStartingUpdate).arg(tempDirPath).arg(rootPath);
|
||||||
|
#endif
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
out << scriptContent.arg(startingUpdate).arg(tempDirPath).arg(rootPath);
|
out << scriptContent.arg(startingUpdate).arg(tempDirPath).arg(rootPath);
|
||||||
|
#endif
|
||||||
scriptFile.close();
|
scriptFile.close();
|
||||||
|
|
||||||
// Make the script executable on Unix-like systems
|
// Make the script executable on Unix-like systems
|
||||||
|
Loading…
Reference in New Issue
Block a user