Added AMS section and fixed inconsistencies

This commit is contained in:
2026-02-07 23:00:29 +01:00
parent 59f7dde33a
commit 763cb43983
6 changed files with 75 additions and 121 deletions

View File

@@ -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();
}