Skip to content

Commit 4700b6c

Browse files
author
Calvin Fuchs
committed
Added AiO-Updater fixed & styling
1 parent 3633c6b commit 4700b6c

1 file changed

Lines changed: 88 additions & 1 deletion

File tree

source/tegraexplorer/mainmenu.c

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "../fs/readers/folderReader.h"
2222
#include "../fs/fstypes.h"
2323
#include "../fs/fscopy.h"
24+
#include <utils/sprintf.h>
2425

2526
extern hekate_config h_cfg;
2627

@@ -29,8 +30,10 @@ enum {
2930
DeleteBootFlags,
3031
DeleteThemes,
3132
FixClingWrap,
33+
FixAIOUpdaterBoot,
3234
FixAll,
3335
MainOther,
36+
MainViewStillNoBootInfo,
3437
// MainBrowseSd,
3538
// MainMountSd,
3639
// MainBrowseEmmc,
@@ -50,9 +53,10 @@ enum {
5053

5154
MenuEntry_t mainMenuEntries[] = {
5255
[MainExplore] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "-- Tools --"},
53-
[DeleteBootFlags] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Delete boot2.flags"},
56+
[DeleteBootFlags] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Disable automatic sysmodule startup"},
5457
[DeleteThemes] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Delete installed themes"},
5558
[FixClingWrap] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Fix ClingWrap"},
59+
[FixAIOUpdaterBoot] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Fix Switch-AiO-Updater update"},
5660
[FixAll] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Try everything"},
5761

5862
// [MainBrowseSd] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Browse SD"},
@@ -64,6 +68,7 @@ MenuEntry_t mainMenuEntries[] = {
6468
// [MainDumpFw] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Dump Firmware"},
6569
// [MainViewKeys] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "View dumped keys"},
6670
[MainOther] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Other --"},
71+
[MainViewStillNoBootInfo] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "My switch still does not boot"},
6772
[MainViewCredits] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "Credits"},
6873
[MainExit] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Exit --"},
6974
[MainPowerOff] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Power off"},
@@ -151,9 +156,16 @@ void DeleteFileSimple(char *thing){
151156
DrawError(newErrCode(res));
152157
free(thing);
153158
}
159+
void RenameFileSimple(char *sourcePath, char *destPath){
160+
int res = f_rename(sourcePath, destPath);
161+
if (res){
162+
DrawError(newErrCode(res));
163+
}
164+
}
154165

155166
void deleteBootFlags(){
156167
gfx_clearscreen();
168+
gfx_printf("\n\n-- Disabling automatic sysmodule startup.\n\n");
157169
char *storedPath = CpyStr("sd:/atmosphere/contents");
158170
int readRes = 0;
159171
Vector_t fileVec = ReadFolder(storedPath, &readRes);
@@ -190,6 +202,7 @@ void deleteTheme(char* basePath, char* folderId){
190202

191203
void deleteInstalledThemes(){
192204
gfx_clearscreen();
205+
gfx_printf("\n\n-- Deleting installed themes.\n\n");
193206
deleteTheme("sd:/atmosphere/contents", "0100000000001000");
194207
deleteTheme("sd:/atmosphere/contents", "0100000000001007");
195208
deleteTheme("sd:/atmosphere/contents", "0100000000001013");
@@ -200,6 +213,7 @@ void deleteInstalledThemes(){
200213

201214
void fixClingWrap(){
202215
gfx_clearscreen();
216+
gfx_printf("\n\n-- Fixing ClingWrap.\n\n");
203217
char *bpath = CpyStr("sd:/_b0otloader");
204218
char *bopath = CpyStr("sd:/bootloader");
205219
char *kpath = CpyStr("sd:/atmosphere/_k1ps");
@@ -227,6 +241,76 @@ void fixClingWrap(){
227241
gfx_printf("-- Fixed kips\n");
228242
}
229243

244+
free(bpath);
245+
free(bopath);
246+
free(kpath);
247+
free(kopath);
248+
249+
gfx_printf("\n\n Done, press a key to proceed.");
250+
hidWait();
251+
}
252+
253+
void fixAIOUpdate(){
254+
gfx_clearscreen();
255+
gfx_printf("\n\n-- Fix broken Switch-AiO-Updater update.\n\n");
256+
257+
char *aio_fs_path = CpyStr("sd:/atmosphere/fusee-secondary.bin.aio");
258+
char *aio_p_path = CpyStr("sd:/sept/payload.bin.aio");
259+
char *aio_strt_path = CpyStr("sd:/atmosphere/stratosphere.romfs.aio");
260+
261+
char *o_fs_path = CpyStr("sd:/atmosphere/fusee-secondary.bin");
262+
char *o_p_path = CpyStr("sd:/sept/payload.bin");
263+
char *o_strt_path = CpyStr("sd:/atmosphere/stratosphere.romfs");
264+
265+
if (FileExists(aio_fs_path)) {
266+
gfx_printf("Detected aio updated fusee-secondary file -> replacing original\n\n");
267+
if (FileExists(o_fs_path)) {
268+
DeleteFileSimple(o_fs_path);
269+
}
270+
RenameFileSimple(aio_fs_path, o_fs_path);
271+
}
272+
free(aio_fs_path);
273+
free(o_fs_path);
274+
275+
if (FileExists(aio_p_path)) {
276+
gfx_printf("Detected aio updated paload file -> replacing original\n\n");
277+
if (FileExists(o_p_path)) {
278+
DeleteFileSimple(o_p_path);
279+
}
280+
RenameFileSimple(aio_p_path, o_p_path);
281+
}
282+
free(aio_p_path);
283+
free(o_p_path);
284+
285+
if (FileExists(aio_strt_path)) {
286+
gfx_printf("Detected aio updated stratosphere file -> replacing original\n\n");
287+
if (FileExists(o_strt_path)) {
288+
DeleteFileSimple(o_strt_path);
289+
}
290+
RenameFileSimple(aio_strt_path, o_strt_path);
291+
}
292+
free(aio_strt_path);
293+
free(o_strt_path);
294+
295+
296+
gfx_printf("\n\n Done, press a key to proceed.");
297+
hidWait();
298+
299+
}
300+
301+
void stillNoBootInfo(){
302+
gfx_clearscreen();
303+
gfx_printf("\n\n-- My switch still does not boot.\n\n");
304+
305+
gfx_printf("%kDo you have a gamecard inserted?\n", COLOR_WHITE);
306+
gfx_printf("Try taking it out and reboot.\n\n");
307+
308+
gfx_printf("%kDid you recently update Atmosphere/DeepSea?\n", COLOR_WHITE);
309+
gfx_printf("Insert your sdcard into a computer, delete 'atmosphere', 'bootloader' & 'sept', download your preffered CFW and put the files back on your switch.\n\n");
310+
311+
gfx_printf("%kDid you just buy a new SD-card?\n", COLOR_WHITE);
312+
gfx_printf("Make sure its not a fake card.\n\n");
313+
230314
gfx_printf("\n\n Done, press a key to proceed.");
231315
hidWait();
232316
}
@@ -236,13 +320,16 @@ void fixAll(){
236320
deleteBootFlags();
237321
deleteInstalledThemes();
238322
fixClingWrap();
323+
stillNoBootInfo();
239324
}
240325

241326
menuPaths mainMenuPaths[] = {
242327
[DeleteBootFlags] = deleteBootFlags,
243328
[DeleteThemes] = deleteInstalledThemes,
244329
[FixClingWrap] = fixClingWrap,
330+
[FixAIOUpdaterBoot] = fixAIOUpdate,
245331
[FixAll] = fixAll,
332+
[MainViewStillNoBootInfo] = stillNoBootInfo,
246333
// [MainBrowseSd] = HandleSD,
247334
// [MainMountSd] = MountOrUnmountSD,
248335
// [MainBrowseEmmc] = HandleEMMC,

0 commit comments

Comments
 (0)