mirror of
https://github.com/rvtr/unlaunch-installer_dev.git
synced 2026-01-26 13:43:08 -05:00
Fixed proto uninstall code
This commit is contained in:
parent
52cc3acad1
commit
c94678b506
@ -237,7 +237,18 @@ bool restoreMainTmd(const char* path)
|
|||||||
}
|
}
|
||||||
else if(c != 0x47)
|
else if(c != 0x47)
|
||||||
{
|
{
|
||||||
messageBox("\x1B[31mError:\x1B[33m Unlaunch was installed with a different method\aborting\n");
|
if (unlaunchFound) {
|
||||||
|
// Trim the old unlaunch installed TMDs to 520b
|
||||||
|
messageBox(" Unlaunch was installed with the legacy method\nTrimming tmd\n");
|
||||||
|
if (ftruncate(fileno(launcherTmd), 520) != 0) {
|
||||||
|
messageBox("\x1B[31mError:\x1B[33m Failed to remove unlaunch\n");
|
||||||
|
fclose(launcherTmd);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fclose(launcherTmd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
messageBox("\x1B[31mError:\x1B[33m Unlaunch was installed with an\nunknown method\naborting\n");
|
||||||
fclose(launcherTmd);
|
fclose(launcherTmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -254,7 +265,9 @@ bool restoreProtoTmd(const char* path)
|
|||||||
messageBox("\x1B[31mError:\x1B[33m No original tmd found!\nCan't uninstall unlaunch.\n");
|
messageBox("\x1B[31mError:\x1B[33m No original tmd found!\nCan't uninstall unlaunch.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
remove(path);
|
||||||
copyFile("nand:/title/00030017/484e4141/content/title.tmd.bak", path);
|
copyFile("nand:/title/00030017/484e4141/content/title.tmd.bak", path);
|
||||||
|
remove("nand:/title/00030017/484e4141/content/title.tmd.bak");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -303,13 +316,6 @@ int main(int argc, char **argv)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
region = launcherTid & 0xFF;
|
region = launcherTid & 0xFF;
|
||||||
// I own and know of many people with retail and dev prototypes
|
|
||||||
// These can normally be identified by having the region set to ALL (41)
|
|
||||||
if (region == 0x41 || region == 0xFF)
|
|
||||||
{
|
|
||||||
notProto = false;
|
|
||||||
hasTitleTmdMatchingLauncher = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(launcherTmdPath, "nand:/title/00030017/%08lx/content/title.tmd", launcherTid);
|
sprintf(launcherTmdPath, "nand:/title/00030017/%08lx/content/title.tmd", launcherTid);
|
||||||
unsigned long long tmdSize = getFileSizePath(launcherTmdPath);
|
unsigned long long tmdSize = getFileSizePath(launcherTmdPath);
|
||||||
@ -322,6 +328,13 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
hasTitleTmdMatchingLauncher = false;
|
hasTitleTmdMatchingLauncher = false;
|
||||||
}
|
}
|
||||||
|
// I own and know of many people with retail and dev prototypes
|
||||||
|
// These can normally be identified by having the region set to ALL (0x41)
|
||||||
|
if (region == 0x41 || region == 0xFF)
|
||||||
|
{
|
||||||
|
notProto = false;
|
||||||
|
hasTitleTmdMatchingLauncher = true;
|
||||||
|
}
|
||||||
// HWINFO_S may not always exist (PRE_IMPORT). Fill in defaults if that happens.
|
// HWINFO_S may not always exist (PRE_IMPORT). Fill in defaults if that happens.
|
||||||
} else {
|
} else {
|
||||||
sprintf(launcherTmdPath, "nand:/title/00030017/484e4141/content/title.tmd");
|
sprintf(launcherTmdPath, "nand:/title/00030017/484e4141/content/title.tmd");
|
||||||
@ -387,13 +400,16 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!toggleReadOnly(launcherTmdPath, false) || !restoreProtoTmd(launcherTmdPath)) {
|
if (!toggleReadOnly("nand:/title/00030017/484e4141/content/title.tmd", false) || !restoreProtoTmd("nand:/title/00030017/484e4141/content/title.tmd")) {
|
||||||
messageBox("\x1B[31mError:\x1B[33m Uninstall failed\n");
|
messageBox("\x1B[31mError:\x1B[33m Uninstall failed\n");
|
||||||
nandio_lock_writing();
|
nandio_lock_writing();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nandio_lock_writing();
|
nandio_lock_writing();
|
||||||
|
messageBox("Uninstall successful!\n");
|
||||||
|
} else {
|
||||||
|
messageBox("\x1B[31mError:\x1B[33m Unlaunch is not installed\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user