diff --git a/README.md b/README.md index e7f3edc..74faefb 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,7 @@ Ohne verbundene Joy-Cons: - Deaktiviert automatischen Sysmodule-Start (kann Startprobleme nach Updates beheben) - Loescht installierte Themes (kann Startprobleme nach Updates beheben) -- Macht Aenderungen durch ClingWrap rueckgaengig - Behebt Archiv-Bit (SD-Karte) -- Behebt fehlerhafte AIO-Updater-Updates - Entfernt Mac-Sonderordner ## Support diff --git a/source/apl/apl.c b/source/apl/apl.c index e356d35..ff3ba4e 100644 --- a/source/apl/apl.c +++ b/source/apl/apl.c @@ -74,7 +74,7 @@ int _StartsWith(const char *a, const char *b) return 0; } -int listdir(char *path, u32 hos_folder) +int listdir(char *path, u32 hos_folder, int *deleted_count) { FRESULT res; DIR dir; @@ -119,10 +119,11 @@ int listdir(char *path, u32 hos_folder) strcmp(fno.fname, ".TemporaryItems") == 0 ) { _FolderDelete(path); + if (deleted_count) (*deleted_count)++; } // Enter the directory. - listdir(path, 0); + listdir(path, 0, deleted_count); if (res != FR_OK) break; } else { @@ -136,6 +137,7 @@ int listdir(char *path, u32 hos_folder) _StartsWith(fno.fname, "._") ) { _DeleteFileSimple(path); + if (deleted_count) (*deleted_count)++; } } } @@ -254,121 +256,65 @@ void m_entry_fixArchiveBit(u32 type){ } -void m_entry_fixAIOUpdate(){ +static void _fixAMSErrorFolder(const char *titleId, const char *label){ gfx_clearscreen(); - gfx_printf("\n\n-- Behebe fehlerhaftes AIO-switch-updater Update.\n\n"); - - char *aio_fs_path = CpyStr("sd:/atmosphere/fusee-secondary.bin.aio"); - char *aio_p_path = CpyStr("sd:/sept/payload.bin.aio"); - char *aio_strt_path = CpyStr("sd:/atmosphere/stratosphere.romfs.aio"); - - char *o_fs_path = CpyStr("sd:/atmosphere/fusee-secondary.bin"); - char *o_p_path = CpyStr("sd:/sept/payload.bin"); - char *o_strt_path = CpyStr("sd:/atmosphere/stratosphere.romfs"); - - if (FileExists(aio_fs_path)) { - gfx_printf("Von AIO aktualisierte fusee-secondary erkannt -> ersetze Original\n\n"); - if (FileExists(o_fs_path)) { - _DeleteFileSimple(o_fs_path); - } - _RenameFileSimple(aio_fs_path, o_fs_path); + gfx_printf("\n\n-- Fix Fehlercode %s --\n\n", label); + if (!sd_mount()) { + gfx_printf("SD-Karte konnte nicht gemountet werden.\n"); + hidWait(); + return; } - free(aio_fs_path); - free(o_fs_path); - - if (FileExists(aio_p_path)) { - gfx_printf("Von AIO aktualisierte payload erkannt -> ersetze Original\n\n"); - if (FileExists(o_p_path)) { - _DeleteFileSimple(o_p_path); - } - _RenameFileSimple(aio_p_path, o_p_path); + char *path = CpyStr("sd:/atmosphere/contents"); + char *full = CombinePaths(path, titleId); + free(path); + if (FileExists(full)) { + gfx_printf("Entferne Ordner %s ...\n", titleId); + FolderDelete(full); + gfx_printf("Ordner erfolgreich geloescht.\n"); + } else { + gfx_printf("Ordner %s nicht gefunden (evtl. bereits behoben).\n", titleId); } - free(aio_p_path); - free(o_p_path); - - if (FileExists(aio_strt_path)) { - gfx_printf("Von AIO aktualisierte stratosphere erkannt -> ersetzte Original\n\n"); - if (FileExists(o_strt_path)) { - _DeleteFileSimple(o_strt_path); - } - _RenameFileSimple(aio_strt_path, o_strt_path); - } - free(aio_strt_path); - free(o_strt_path); - - - gfx_printf("\n\n Fertig, druecke eine Taste um Fortzufahren."); - hidWait(); -} - -void m_entry_fixClingWrap(){ - gfx_clearscreen(); - gfx_printf("\n\n-- Repariere Bootloader, Kips und Patches.\n\n"); - char *bpath = CpyStr("sd:/_b0otloader"); - char *bopath = CpyStr("sd:/bootloader"); - char *kpath = CpyStr("sd:/atmosphere/_k1ps"); - char *kopath = CpyStr("sd:/atmosphere/kips"); - - char *ppath = CpyStr("sd:/bootloader/_patchesCW.ini"); - char *popath = CpyStr("sd:/atmosphere/patches.ini"); - - if (FileExists(bpath)) { - if (FileExists(bopath)) { - FolderDelete(bopath); - } - int res = f_rename(bpath, bopath); - if (res){ - DrawError(newErrCode(res)); - } - gfx_printf("-- Bootloader repariert!\n"); - } - - if (FileExists(kpath)) { - if (FileExists(kopath)) { - FolderDelete(kopath); - } - int res = f_rename(kpath, kopath); - if (res){ - DrawError(newErrCode(res)); - } - gfx_printf("-- kips repariert!\n"); - } - - if (FileExists(ppath)) { - if (FileExists(popath)) { - _DeleteFileSimple(popath); - } - _RenameFileSimple(ppath,popath); - gfx_printf("-- patches.ini repariert!\n"); - } - - free(bpath); - free(bopath); - free(kpath); - free(kopath); - free(ppath); - free(popath); - + free(full); gfx_printf("\n\n Fertig! Druecke eine Taste um zurueckzukehren"); hidWait(); } -void _deleteTheme(char* basePath, char* folderId){ +void m_entry_fixAMSError_4200(void){ + _fixAMSErrorFolder("4200000000000010", "4200000000000010"); +} + +void m_entry_fixAMSError_6900(void){ + _fixAMSErrorFolder("690000000000000D", "690000000000000D"); +} + +void m_entry_fixAMSError_BD00(void){ + _fixAMSErrorFolder("010000000000BD00", "010000000000BD00"); +} + +static int _deleteTheme(char* basePath, char* folderId){ + int removed = 0; char *path = CombinePaths(basePath, folderId); if (FileExists(path)) { gfx_printf("-- Theme gefunden: %s\n", path); FolderDelete(path); + removed = 1; } free(path); + return removed; } void m_entry_deleteInstalledThemes(){ gfx_clearscreen(); gfx_printf("\n\n-- Loesche installierte Themes.\n\n"); - _deleteTheme("sd:/atmosphere/contents", "0100000000001000"); - _deleteTheme("sd:/atmosphere/contents", "0100000000001007"); - _deleteTheme("sd:/atmosphere/contents", "0100000000001013"); + int count = 0; + count += _deleteTheme("sd:/atmosphere/contents", "0100000000001000"); + count += _deleteTheme("sd:/atmosphere/contents", "0100000000001007"); + count += _deleteTheme("sd:/atmosphere/contents", "0100000000001013"); + if (count > 0) + gfx_printf("\n%d Theme(s) geloescht.\n", count); + else + gfx_printf("\nKeine installierten Themes gefunden.\n"); gfx_printf("\n\n Fertig! Druecke eine Taste um zurueckzukehren"); hidWait(); } @@ -378,6 +324,7 @@ void m_entry_deleteBootFlags(){ gfx_printf("\n\n-- Automatisches starten der sysmodule deaktivieren.\n\n"); char *storedPath = CpyStr("sd:/atmosphere/contents"); int readRes = 0; + int count = 0; Vector_t fileVec = ReadFolder(storedPath, &readRes); if (readRes){ clearFileVector(&fileVec); @@ -393,6 +340,7 @@ void m_entry_deleteBootFlags(){ if (FileExists(flagPath)) { gfx_printf("Loesche: %s\n", flagPath); _DeleteFileSimple(flagPath); + count++; } else { free(flagPath); } @@ -400,6 +348,10 @@ void m_entry_deleteBootFlags(){ clearFileVector(&fileVec); free(storedPath); } + if (count > 0) + gfx_printf("\n%d Boot-Flag(s) geloescht.\n", count); + else if (!readRes) + gfx_printf("\nKeine Boot-Flags gefunden.\n"); gfx_printf("\n\n Fertig! Druecke eine Taste um zurueckzukehren"); hidWait(); } @@ -409,15 +361,15 @@ void m_entry_deleteBootFlags(){ void m_entry_fixMacSpecialFolders(){ gfx_clearscreen(); gfx_printf("\n\n-- Mac-Ordner reparieren (dies kann ein wenig dauern, bitte warten.)\n\n"); - listdir("/", 0); + int deleted = 0; + char *path = CpyStr("sd:/"); + listdir(path, 0, &deleted); + if (deleted > 0) + gfx_printf("\n%d Mac-Datei(en)/Ordner entfernt.\n", deleted); + else + gfx_printf("\nKeine Mac-Sonderdateien oder -ordner gefunden.\n"); gfx_printf("\n\n Fertig! Druecke eine Taste um zurueckzukehren"); hidWait(); - - // browse path - // list files & folders - // if file -> delete - // if folder !== nintendo - // if folder m_entry_fixMacSpecialFolders with new path } void m_entry_stillNoBootInfo(){ @@ -447,9 +399,6 @@ void m_entry_fixAll(){ gfx_clearscreen(); m_entry_deleteBootFlags(); m_entry_deleteInstalledThemes(); - m_entry_fixClingWrap(); - m_entry_fixAIOUpdate(); - m_entry_stillNoBootInfo(); } diff --git a/source/apl/apl.h b/source/apl/apl.h index ee8fbda..bee4948 100644 --- a/source/apl/apl.h +++ b/source/apl/apl.h @@ -2,8 +2,9 @@ #include void m_entry_fixArchiveBit(u32 type); -void m_entry_fixAIOUpdate(); -void m_entry_fixClingWrap(); +void m_entry_fixAMSError_4200(void); +void m_entry_fixAMSError_6900(void); +void m_entry_fixAMSError_BD00(void); void m_entry_deleteInstalledThemes(); void m_entry_deleteBootFlags(); void m_entry_ViewCredits(); diff --git a/source/gfx/gfxutils.h b/source/gfx/gfxutils.h index dbb9546..adbdf5a 100644 --- a/source/gfx/gfxutils.h +++ b/source/gfx/gfxutils.h @@ -11,7 +11,7 @@ #define COLOR_VIOLET 0xFFEE82EE #define COLOR_PURPLE 0xFF7C49EF #define COLOR_BLUE 0xFF0000FF -#define COLOR_CYAN 0xFF00FFFF +#define COLOR_CYAN 0xFF00CCFF #define COLOR_RED 0xFF0000FF #define COLOR_YELLOW 0xFFFFFF00 diff --git a/source/tegraexplorer/mainmenu.c b/source/tegraexplorer/mainmenu.c index 28fe41a..428b219 100644 --- a/source/tegraexplorer/mainmenu.c +++ b/source/tegraexplorer/mainmenu.c @@ -33,11 +33,13 @@ enum { MainExplore = 0, DeleteBootFlags, DeleteThemes, - FixClingWrap, - FixAIOUpdaterBoot, FixArchiveBitA, FixArchiveBitN, // FixAll, + MainAMS, + FixAMS_4200, + FixAMS_6900, + FixAMS_BD00, MainConvenience, FixMacSpecialFolders, MainOther, @@ -54,12 +56,15 @@ MenuEntry_t mainMenuEntries[] = { [MainExplore] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "-- Behebe Start Probleme --"}, [DeleteBootFlags] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Automatisches starten der sysmodule deaktivieren"}, [DeleteThemes] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Loesche installierte Themes"}, - [FixClingWrap] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Repariere SigPatches"}, - [FixAIOUpdaterBoot] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Behebe fehlerhaftes AIO-switch-updater Update"}, [FixArchiveBitA] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Behebe Archive Bit (alle Ordner ausser Nintendo)"}, [FixArchiveBitN] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Behebe Archive Bit (Nintendo Ordner)"}, // [FixAll] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Try everything"}, + [MainAMS] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Atmosphere Fehlercodes --"}, + [FixAMS_4200] = {.optionUnion = COLORTORGB(COLOR_CYAN), .name = "Fix 4200000000000010 (ldn_mitm)"}, + [FixAMS_6900] = {.optionUnion = COLORTORGB(COLOR_CYAN), .name = "Fix 690000000000000D (sys-con)"}, + [FixAMS_BD00] = {.optionUnion = COLORTORGB(COLOR_CYAN), .name = "Fix 010000000000BD00 (MissionControl)"}, + [MainConvenience] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Bequemlichkeit --"}, [FixMacSpecialFolders] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Entferne spezielle MacOS Dateien"}, @@ -124,10 +129,11 @@ void archBitHelperN(){ menuPaths mainMenuPaths[] = { [DeleteBootFlags] = m_entry_deleteBootFlags, [DeleteThemes] = m_entry_deleteInstalledThemes, - [FixClingWrap] = m_entry_fixClingWrap, - [FixAIOUpdaterBoot] = m_entry_fixAIOUpdate, [FixArchiveBitA] = archBitHelperA, [FixArchiveBitN] = archBitHelperN, + [FixAMS_4200] = m_entry_fixAMSError_4200, + [FixAMS_6900] = m_entry_fixAMSError_6900, + [FixAMS_BD00] = m_entry_fixAMSError_BD00, [FixMacSpecialFolders] = m_entry_fixMacSpecialFolders, // [FixAll] = m_entry_fixAll, [MainViewStillNoBootInfo] = m_entry_stillNoBootInfo, diff --git a/source/tegraexplorer/tools.c b/source/tegraexplorer/tools.c index 436855e..399233f 100644 --- a/source/tegraexplorer/tools.c +++ b/source/tegraexplorer/tools.c @@ -325,11 +325,11 @@ void TakeScreenshot(){ return; char *name, *path; - const char basepath[] = "sd:/tegraexplorer/screenshots"; + const char basepath[] = "sd:/APL/screenshots"; name = malloc(40); s_printf(name, "Screenshot_%08X.bmp", get_tmr_us()); - f_mkdir("sd:/tegraexplorer"); + f_mkdir("sd:/APL"); f_mkdir(basepath); path = CombinePaths(basepath, name); free(name);