mirror of
https://github.com/rvtr/unlaunch-installer_dev.git
synced 2026-01-26 13:43:08 -05:00
Don't write unlaunch tmd if the one already present is the same
This commit is contained in:
parent
f6a503a2a3
commit
f5b54fbd0f
@ -165,15 +165,20 @@ bool uninstallUnlaunch(bool retailConsole, const char* retailLauncherTmdPath)
|
||||
|
||||
static bool writeUnlaunchTmd(const char* path)
|
||||
{
|
||||
Sha1Digest expectedDigest, actualDigest;
|
||||
swiSHA1Calc(expectedDigest.data(), unlaunchInstallerBuffer, unlaunchInstallerSize + 520);
|
||||
if(calculateFileSha1Path(path, actualDigest.data()) && expectedDigest == actualDigest)
|
||||
{
|
||||
// the tmd hasn't changed, no need to do anything
|
||||
return true;
|
||||
}
|
||||
|
||||
FILE* targetTmd = fopen(path, "wb");
|
||||
if (!targetTmd)
|
||||
{
|
||||
messageBox("\x1B[31mError:\x1B[33m Failed to open target unlaunch tmd\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
Sha1Digest expectedDigest, actualDigest;
|
||||
swiSHA1Calc(expectedDigest.data(), unlaunchInstallerBuffer, unlaunchInstallerSize + 520);
|
||||
|
||||
if(!writeToFile(targetTmd, unlaunchInstallerBuffer, unlaunchInstallerSize + 520))
|
||||
{
|
||||
@ -182,10 +187,10 @@ static bool writeUnlaunchTmd(const char* path)
|
||||
messageBox("\x1B[31mError:\x1B[33m Failed write unlaunch to tmd\n");
|
||||
return false;
|
||||
}
|
||||
fclose(targetTmd);
|
||||
calculateFileSha1Path(path, actualDigest.data());
|
||||
|
||||
if(expectedDigest != actualDigest)
|
||||
fclose(targetTmd);
|
||||
|
||||
if(!calculateFileSha1Path(path, actualDigest.data()) || expectedDigest != actualDigest)
|
||||
{
|
||||
remove(path);
|
||||
messageBox("\x1B[31mError:\x1B[33m Unlaunch tmd was not properly written\n");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user