Add exceptions, start file menu

This commit is contained in:
SuchMemeManySkill
2020-12-25 21:16:24 +01:00
parent 1a931b0256
commit 9588ffb89a
13 changed files with 215 additions and 46 deletions

View File

@@ -7,16 +7,19 @@
#include "../fs/menus/explorer.h"
#include <utils/btn.h>
#include <storage/nx_sd.h>
#include "tconf.h"
MenuEntry_t mainMenuEntries[] = {
{.R = 255, .G = 255, .B = 255, .skip = 1, .name = "-- Main Menu --"},
{.G = 255, .name = "SD:/"},
{.B = 255, .G = 255, .name = "Test Controllers"},
{.R = 255, .name = "Cause an exception"},
{.R = 255, .name = "Reboot to payload"}
};
void HandleSD(){
gfx_clearscreen();
TConf.curExplorerLoc = LOC_SD;
if (!sd_mount()){
gfx_printf("Sd is not mounted!");
hidWait();
@@ -25,16 +28,21 @@ void HandleSD(){
FileExplorer("sd:/");
}
void CrashTE(){
gfx_printf("%d", *((int*)0));
}
menuPaths mainMenuPaths[] = {
NULL,
HandleSD,
TestControllers,
CrashTE,
RebootToPayload
};
void EnterMainMenu(){
while (1){
FunctionMenuHandler(mainMenuEntries, 4, mainMenuPaths, 0);
FunctionMenuHandler(mainMenuEntries, ARR_LEN(mainMenuEntries), mainMenuPaths, 0);
}
}

View File

@@ -1,2 +1,17 @@
#include "tconf.h"
TConf_t TConf = {0};
#include <mem/heap.h>
TConf_t TConf = {0};
void ResetCopyParams(){
TConf.heldExplorerCopyLoc = LOC_None;
if (TConf.srcCopy != NULL)
free(TConf.srcCopy);
TConf.explorerCopyMode = CMODE_None;
}
void SetCopyParams(char *path, u8 mode){
ResetCopyParams();
TConf.heldExplorerCopyLoc = TConf.curExplorerLoc;
TConf.explorerCopyMode = mode;
TConf.srcCopy = path;
}

View File

@@ -2,7 +2,8 @@
#include <utils/types.h>
enum {
LOC_SD = 0,
LOC_None = 0,
LOC_SD,
LOC_EMMC,
LOC_EMUMMC
};
@@ -24,14 +25,18 @@ typedef struct {
char *srcCopy;
union {
struct {
u8 minervaEnabled:1;
u8 lastExplorerLoc:2;
u8 explorerCopyMode:2;
u8 currentlyMounted:2;
u16 minervaEnabled:1;
u16 curExplorerLoc:2;
u16 heldExplorerCopyLoc:2;
u16 explorerCopyMode:2;
u16 currentMMCMounted:2;
};
u8 optionUnion;
u16 optionUnion;
};
// Add keys here
} TConf_t;
extern TConf_t TConf;
extern TConf_t TConf;
void ResetCopyParams();
void SetCopyParams(char *path, u8 mode);