1818#include "../utils/utils.h"
1919#include "../config.h"
2020
21- #include "../fs/readers/folderReader.h"
22- #include "../fs/fstypes.h"
23- #include "../fs/fscopy.h"
24-
2521extern hekate_config h_cfg ;
2622
2723enum {
2824 MainExplore = 0 ,
29- DeleteBootFlags ,
30- DeleteThemes ,
31- FixClingWrap ,
32- FixAll ,
33- MainOther ,
34- // MainBrowseSd,
35- // MainMountSd,
36- // MainBrowseEmmc,
37- // MainBrowseEmummc,
38- // MainTools,
39- // MainPartitionSd,
40- // MainDumpFw,
41- // MainViewKeys,
25+ MainBrowseSd ,
26+ MainMountSd ,
27+ MainBrowseEmmc ,
28+ MainBrowseEmummc ,
29+ MainTools ,
30+ MainPartitionSd ,
31+ MainDumpFw ,
32+ MainViewKeys ,
4233 MainViewCredits ,
4334 MainExit ,
4435 MainPowerOff ,
4536 MainRebootRCM ,
46- // MainRebootNormal,
37+ MainRebootNormal ,
4738 MainRebootHekate ,
48- // MainRebootAMS,
39+ MainRebootAMS
4940};
5041
5142MenuEntry_t mainMenuEntries [] = {
52- [MainExplore ] = {.optionUnion = COLORTORGB (COLOR_WHITE ) | SKIPBIT , .name = "-- Tools --" },
53- [DeleteBootFlags ] = {.optionUnion = COLORTORGB (COLOR_GREEN ), .name = "Delete boot2.flags" },
54- [DeleteThemes ] = {.optionUnion = COLORTORGB (COLOR_GREEN ), .name = "Delete installed themes" },
55- [FixClingWrap ] = {.optionUnion = COLORTORGB (COLOR_GREEN ), .name = "Fix ClingWrap" },
56- [FixAll ] = {.optionUnion = COLORTORGB (COLOR_GREEN ), .name = "Try everything" },
57-
58- // [MainBrowseSd] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Browse SD"},
59- // [MainMountSd] = {.optionUnion = COLORTORGB(COLOR_YELLOW)}, // To mount/unmount the SD
60- // [MainBrowseEmmc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMMC"},
61- // [MainBrowseEmummc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMUMMC"},
62- // [MainTools] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Tools --"},
63- // [MainPartitionSd] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Partition the sd"},
64- // [MainDumpFw] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Dump Firmware"},
65- // [MainViewKeys] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "View dumped keys"},
66- [MainOther ] = {.optionUnion = COLORTORGB (COLOR_WHITE ) | SKIPBIT , .name = "\n-- Other --" },
43+ [MainExplore ] = {.optionUnion = COLORTORGB (COLOR_WHITE ) | SKIPBIT , .name = "-- Main --" },
44+ [MainBrowseSd ] = {.optionUnion = COLORTORGB (COLOR_GREEN ), .name = "Fix common Issues" },
6745 [MainViewCredits ] = {.optionUnion = COLORTORGB (COLOR_YELLOW ), .name = "Credits" },
6846 [MainExit ] = {.optionUnion = COLORTORGB (COLOR_WHITE ) | SKIPBIT , .name = "\n-- Exit --" },
6947 [MainPowerOff ] = {.optionUnion = COLORTORGB (COLOR_VIOLET ), .name = "Power off" },
7048 [MainRebootRCM ] = {.optionUnion = COLORTORGB (COLOR_VIOLET ), .name = "Reboot to RCM" },
71- // [MainRebootNormal] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot normally"},
49+ [MainRebootNormal ] = {.optionUnion = COLORTORGB (COLOR_VIOLET ), .name = "Reboot normally" },
7250 [MainRebootHekate ] = {.optionUnion = COLORTORGB (COLOR_VIOLET ), .name = "Reboot to bootloader/update.bin" },
73- // [MainRebootAMS] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to atmosphere/reboot_payload.bin"}
51+ [MainRebootAMS ] = {.optionUnion = COLORTORGB (COLOR_VIOLET ), .name = "Reboot to atmosphere/reboot_payload.bin" }
7452};
7553
7654void HandleSD (){
@@ -81,7 +59,7 @@ void HandleSD(){
8159 hidWait ();
8260 }
8361 else
84- FileExplorer ("sd:/" );
62+ FileExplorer ("sd:/atmosphere/contents " );
8563}
8664
8765void HandleEMMC (){
@@ -119,7 +97,10 @@ void ViewKeys(){
11997
12098void ViewCredits (){
12199 gfx_clearscreen ();
122- gfx_printf ("\nCommon Problem Resolver v%d.%d.%d\nBy Team Neptune\n\nBased on TegraExplorer by SuchMemeManySkill,\nLockpick_RCM & Hekate, from shchmue & CTCaer\n\n\n" , LP_VER_MJ , LP_VER_MN , LP_VER_BF );
100+ gfx_printf ("\nTegraexplorer v%d.%d.%d\nBy SuchMemeManySkill\n\nBased on Lockpick_RCM & Hekate, from shchmue & CTCaer\n\n\n" , LP_VER_MJ , LP_VER_MN , LP_VER_BF );
101+
102+ if (hidRead ()-> r )
103+ gfx_printf ("%k\"I'm not even sure if it works\" - meme" , COLOR_ORANGE );
123104 hidWait ();
124105}
125106
@@ -143,119 +124,20 @@ void MountOrUnmountSD(){
143124 hidWait ();
144125}
145126
146-
147- void DeleteFileSimple (char * thing ){
148- //char *thing = CombinePaths(path, entry.name);
149- int res = f_unlink (thing );
150- if (res )
151- DrawError (newErrCode (res ));
152- free (thing );
153- }
154-
155- void deleteBootFlags (){
156- gfx_clearscreen ();
157- char * storedPath = CpyStr ("sd:/atmosphere/contents" );
158- int readRes = 0 ;
159- Vector_t fileVec = ReadFolder (storedPath , & readRes );
160- if (readRes ){
161- clearFileVector (& fileVec );
162- DrawError (newErrCode (readRes ));
163- } else {
164- vecDefArray (FSEntry_t * , fsEntries , fileVec );
165- for (int i = 0 ; i < fileVec .count ; i ++ ){
166-
167- char * suf = "/flags/boot2.flag" ;
168- char * flagPath = CombinePaths (storedPath , fsEntries [i ].name );
169- flagPath = CombinePaths (flagPath , suf );
170-
171- if (FileExists (flagPath )) {
172- gfx_printf ("Deleting: %s\n" , flagPath );
173- DeleteFileSimple (flagPath );
174- }
175- free (flagPath );
176- }
177- }
178- gfx_printf ("\n\n Done, press a key to proceed." );
179- hidWait ();
180- }
181-
182- void deleteTheme (char * basePath , char * folderId ){
183- char * path = CombinePaths (basePath , folderId );
184- if (FileExists (path )) {
185- gfx_printf ("-- Theme found: %s\n" , path );
186- FolderDelete (path );
187- }
188- free (path );
189- }
190-
191- void deleteInstalledThemes (){
192- gfx_clearscreen ();
193- deleteTheme ("sd:/atmosphere/contents" , "0100000000001000" );
194- deleteTheme ("sd:/atmosphere/contents" , "0100000000001007" );
195- deleteTheme ("sd:/atmosphere/contents" , "0100000000001013" );
196-
197- gfx_printf ("\n\n Done, press a key to proceed." );
198- hidWait ();
199- }
200-
201- void fixClingWrap (){
202- gfx_clearscreen ();
203- char * bpath = CpyStr ("sd:/_b0otloader" );
204- char * bopath = CpyStr ("sd:/bootloader" );
205- char * kpath = CpyStr ("sd:/atmosphere/_k1ps" );
206- char * kopath = CpyStr ("sd:/atmosphere/kips" );
207-
208- if (FileExists (bpath )) {
209- if (FileExists (bopath )) {
210- FolderDelete (bopath );
211- }
212- int res = f_rename (bpath , bopath );
213- if (res ){
214- DrawError (newErrCode (res ));
215- }
216- gfx_printf ("-- Fixed Bootloader\n" );
217- }
218-
219- if (FileExists (kpath )) {
220- if (FileExists (kopath )) {
221- FolderDelete (kopath );
222- }
223- int res = f_rename (bpath , kopath );
224- if (res ){
225- DrawError (newErrCode (res ));
226- }
227- gfx_printf ("-- Fixed kips\n" );
228- }
229-
230- gfx_printf ("\n\n Done, press a key to proceed." );
231- hidWait ();
232- }
233-
234- void fixAll (){
235- gfx_clearscreen ();
236- deleteBootFlags ();
237- deleteInstalledThemes ();
238- fixClingWrap ();
239- }
240-
241127menuPaths mainMenuPaths [] = {
242- [DeleteBootFlags ] = deleteBootFlags ,
243- [DeleteThemes ] = deleteInstalledThemes ,
244- [FixClingWrap ] = fixClingWrap ,
245- [FixAll ] = fixAll ,
246- // [MainBrowseSd] = HandleSD,
247- // [MainMountSd] = MountOrUnmountSD,
248- // [MainBrowseEmmc] = HandleEMMC,
249- // [MainBrowseEmummc] = HandleEMUMMC,
250- // [MainPartitionSd] = FormatSD,
251- // [MainDumpFw] = DumpSysFw,
252- // [MainViewKeys] = ViewKeys,
253- // [MainRebootAMS] = RebootToAMS,
128+ [MainBrowseSd ] = HandleSD ,
129+ [MainMountSd ] = MountOrUnmountSD ,
130+ [MainBrowseEmmc ] = HandleEMMC ,
131+ [MainBrowseEmummc ] = HandleEMUMMC ,
132+ [MainPartitionSd ] = FormatSD ,
133+ [MainDumpFw ] = DumpSysFw ,
134+ [MainViewKeys ] = ViewKeys ,
135+ [MainRebootAMS ] = RebootToAMS ,
254136 [MainRebootHekate ] = RebootToHekate ,
255137 [MainRebootRCM ] = reboot_rcm ,
256138 [MainPowerOff ] = power_off ,
257139 [MainViewCredits ] = ViewCredits ,
258- // [MainRebootNormal] = reboot_normal
140+ [MainRebootNormal ] = reboot_normal ,
259141};
260142
261143void EnterMainMenu (){
@@ -264,18 +146,18 @@ void EnterMainMenu(){
264146 if (sd_get_card_removed ())
265147 sd_unmount ();
266148
267- // // -- Explore --
268- // mainMenuEntries[MainBrowseSd].hide = !sd_mounted;
269- // mainMenuEntries[MainMountSd].name = (sd_mounted) ? "Unmount SD" : "Mount SD";
270- // mainMenuEntries[MainBrowseEmummc].hide = (!emu_cfg.enabled || !sd_mounted);
149+ // -- Explore --
150+ mainMenuEntries [MainBrowseSd ].hide = !sd_mounted ;
151+ mainMenuEntries [MainMountSd ].name = (sd_mounted ) ? "Unmount SD" : "Mount SD" ;
152+ mainMenuEntries [MainBrowseEmummc ].hide = (!emu_cfg .enabled || !sd_mounted );
271153
272- // // -- Tools --
273- // mainMenuEntries[MainPartitionSd].hide = (!is_sd_inited || sd_get_card_removed());
274- // mainMenuEntries[MainDumpFw].hide = (!TConf.keysDumped || !sd_mounted);
275- // mainMenuEntries[MainViewKeys].hide = !TConf.keysDumped;
154+ // -- Tools --
155+ mainMenuEntries [MainPartitionSd ].hide = (!is_sd_inited || sd_get_card_removed ());
156+ mainMenuEntries [MainDumpFw ].hide = (!TConf .keysDumped || !sd_mounted );
157+ mainMenuEntries [MainViewKeys ].hide = !TConf .keysDumped ;
276158
277- // // -- Exit --
278- // mainMenuEntries[MainRebootAMS].hide = (!sd_mounted || !FileExists("sd:/atmosphere/reboot_payload.bin"));
159+ // -- Exit --
160+ mainMenuEntries [MainRebootAMS ].hide = (!sd_mounted || !FileExists ("sd:/atmosphere/reboot_payload.bin" ));
279161 mainMenuEntries [MainRebootHekate ].hide = (!sd_mounted || !FileExists ("sd:/bootloader/update.bin" ));
280162 mainMenuEntries [MainRebootRCM ].hide = h_cfg .t210b01 ;
281163
0 commit comments