mirror of
https://github.com/rvtr/unlaunch-installer_dev.git
synced 2026-01-26 13:43:08 -05:00
Fix unlaunch being wrongly detected as installed
This commit is contained in:
parent
a6e2c31c14
commit
e8956ae02e
@ -203,6 +203,7 @@ int main(int argc, char **argv)
|
|||||||
const char* hnaaTmdPath = "nand:/title/00030017/484e4141/content/title.tmd";
|
const char* hnaaTmdPath = "nand:/title/00030017/484e4141/content/title.tmd";
|
||||||
{
|
{
|
||||||
FILE* file = fopen("nand:/sys/HWINFO_S.dat", "rb");
|
FILE* file = fopen("nand:/sys/HWINFO_S.dat", "rb");
|
||||||
|
bool mainTmdIsPatched = false;
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
fseek(file, 0xA0, SEEK_SET);
|
fseek(file, 0xA0, SEEK_SET);
|
||||||
@ -224,6 +225,10 @@ int main(int argc, char **argv)
|
|||||||
//if size isn't 520 then the tmd either is not present (size 0), or is already invalid, thus no need to patch
|
//if size isn't 520 then the tmd either is not present (size 0), or is already invalid, thus no need to patch
|
||||||
retailLauncherTmdPresentAndToBePatched = false;
|
retailLauncherTmdPresentAndToBePatched = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainTmdIsPatched = isLauncherTmdPatched(retailLauncherTmdPath);
|
||||||
|
}
|
||||||
// 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.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +236,7 @@ int main(int argc, char **argv)
|
|||||||
// These can normally be identified by having the region set to ALL (0x41)
|
// These can normally be identified by having the region set to ALL (0x41)
|
||||||
retailConsole = (region != 0x41 && region != 0xFF);
|
retailConsole = (region != 0x41 && region != 0xFF);
|
||||||
|
|
||||||
if (!unlaunchFound)
|
if (!unlaunchFound && (mainTmdIsPatched || !retailConsole))
|
||||||
{
|
{
|
||||||
unsigned long long tmdSize = getFileSizePath(hnaaTmdPath);
|
unsigned long long tmdSize = getFileSizePath(hnaaTmdPath);
|
||||||
if (tmdSize > 520)
|
if (tmdSize > 520)
|
||||||
|
|||||||
@ -8,6 +8,20 @@
|
|||||||
static char unlaunchInstallerBuffer[0x30000];
|
static char unlaunchInstallerBuffer[0x30000];
|
||||||
static const char* hnaaTmdPath = "nand:/title/00030017/484e4141/content/title.tmd";
|
static const char* hnaaTmdPath = "nand:/title/00030017/484e4141/content/title.tmd";
|
||||||
|
|
||||||
|
bool isLauncherTmdPatched(const char* path)
|
||||||
|
{
|
||||||
|
FILE* launcherTmd = fopen(path, "rb");
|
||||||
|
if(!launcherTmd)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fseek(launcherTmd, 0x190, SEEK_SET);
|
||||||
|
char c;
|
||||||
|
fread(&c, 1, 1, launcherTmd);
|
||||||
|
fclose(launcherTmd);
|
||||||
|
return c == 0x47;
|
||||||
|
}
|
||||||
|
|
||||||
static bool restoreMainTmd(const char* path)
|
static bool restoreMainTmd(const char* path)
|
||||||
{
|
{
|
||||||
FILE* launcherTmd = fopen(path, "r+b");
|
FILE* launcherTmd = fopen(path, "r+b");
|
||||||
|
|||||||
@ -5,4 +5,6 @@
|
|||||||
bool uninstallUnlaunch(bool notProto, const char* retailLauncherTmdPath);
|
bool uninstallUnlaunch(bool notProto, const char* retailLauncherTmdPath);
|
||||||
bool installUnlaunch(bool retailConsole, const char* retailLauncherTmdPath);
|
bool installUnlaunch(bool retailConsole, const char* retailLauncherTmdPath);
|
||||||
|
|
||||||
|
bool isLauncherTmdPatched(const char* path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user