Compare commits

...

5 Commits
1.3.1 ... 1.3.2

Author SHA1 Message Date
Such Meme, Many Skill
7c7dd7178f Bump version 2020-03-06 12:26:54 +01:00
Such Meme, Many Skill
d93b50205a Add battery indicator 2020-03-03 15:19:42 +01:00
Such Meme, Many Skill
405cb46b77 (Potentially) Fix file based emummc's not mounting 2020-02-22 19:49:25 +01:00
Such Meme, Many Skill
7f7c2e65ee Fix freeing errors in copy-recursive 2020-02-22 19:05:50 +01:00
Such Meme, Many Skill
c2df3d80dd Clean up main menu 2020-02-11 17:18:29 +01:00
6 changed files with 147 additions and 141 deletions

View File

@@ -11,7 +11,7 @@ include $(DEVKITARM)/base_rules
IPL_LOAD_ADDR := 0x40003000 IPL_LOAD_ADDR := 0x40003000
LPVERSION_MAJOR := 2 LPVERSION_MAJOR := 2
LPVERSION_MINOR := 3 LPVERSION_MINOR := 3
LPVERSION_BUGFX := 1 LPVERSION_BUGFX := 2
################################################################################ ################################################################################

View File

@@ -84,6 +84,7 @@ int mount_mmc(const char *partition, const int biskeynumb){
void connect_mmc(short mmctype){ void connect_mmc(short mmctype){
if (mmctype != currentlyMounted){ if (mmctype != currentlyMounted){
disconnect_mmc(); disconnect_mmc();
h_cfg.emummc_force_disable = 0;
switch (mmctype){ switch (mmctype){
case SYSMMC: case SYSMMC:
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4); sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4);

View File

@@ -8,6 +8,7 @@
#include "gfx.h" #include "gfx.h"
#include "fs.h" #include "fs.h"
#include "../mem/minerva.h" #include "../mem/minerva.h"
#include "../power/max17050.h"
#include <stdarg.h> #include <stdarg.h>
const char fixedoptions[3][50] = { const char fixedoptions[3][50] = {
@@ -24,10 +25,22 @@ const char sizevalues[4][3] = {
}; };
void clearscreen(){ void clearscreen(){
int battery = 0;
max17050_get_property(MAX17050_RepSOC, &battery);
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
SWAPCOLOR(COLOR_DEFAULT);
SWAPBGCOLOR(COLOR_WHITE);
gfx_box(0, 1263, 719, 1279, COLOR_WHITE);
gfx_con_setpos(0, 1263);
gfx_printf("Move: Vol+/- | Select: Pow | Battery: %3d%%", battery >> 8);
gfx_box(0, 0, 719, 15, COLOR_WHITE); gfx_box(0, 0, 719, 15, COLOR_WHITE);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("%k%KTegraexplorer v1.3.1%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT); gfx_printf("Tegraexplorer v1.3.2\n");
RESETCOLOR;
} }
int message(u32 color, const char* message, ...){ int message(u32 color, const char* message, ...){

View File

@@ -3,6 +3,7 @@
#include "fs.h" #include "fs.h"
#define SWAPCOLOR(color) gfx_printf("%k", color) #define SWAPCOLOR(color) gfx_printf("%k", color)
#define SWAPBGCOLOR(color) gfx_printf("%K", color)
#define RESETCOLOR gfx_printf("%k%K", COLOR_WHITE, COLOR_DEFAULT) #define RESETCOLOR gfx_printf("%k%K", COLOR_WHITE, COLOR_DEFAULT)
int makemenu(menu_item menu[], int menuamount); int makemenu(menu_item menu[], int menuamount);

View File

@@ -166,7 +166,7 @@ int del_recursive(char *path){
makestring(path, &localpath); makestring(path, &localpath);
if ((res = f_opendir(&dir, localpath))){ if ((res = f_opendir(&dir, localpath))){
message(COLOR_RED, "Error during f_opendir: %d", res); //message(COLOR_RED, "Error during f_opendir: %d", res);
return -1; return -1;
} }
@@ -240,9 +240,6 @@ int copy_recursive(char *path, char *dstpath){
} }
f_closedir(&dir); f_closedir(&dir);
free(startpath);
free(destpath);
free(destfoldername);
if (f_stat(startpath, &fno)) if (f_stat(startpath, &fno))
return 22; return 22;
@@ -250,6 +247,9 @@ int copy_recursive(char *path, char *dstpath){
if ((res = f_chmod(destpath, fno.fattrib, 0x3A))) if ((res = f_chmod(destpath, fno.fattrib, 0x3A)))
return res; return res;
free(startpath);
free(destpath);
free(destfoldername);
return 0; return 0;
} }

View File

@@ -9,6 +9,7 @@
#include "../utils/btn.h" #include "../utils/btn.h"
#include "emmc.h" #include "emmc.h"
#include "../storage/emummc.h" #include "../storage/emummc.h"
#include "script.h"
extern bool sd_mount(); extern bool sd_mount();
extern void sd_unmount(); extern void sd_unmount();
@@ -68,6 +69,130 @@ const char emmc_entries[3][8] = {
"USER" "USER"
}; };
int res = 0;
void MainMenu_SDCard(){
fileexplorer("SD:/");
}
void MainMenu_EMMC(){
if (makewaitmenu("You're about to enter EMMC\nModifying anything here\n can result in a BRICK!\n\nPlease only continue\n if you know what you're doing\n\nPress Vol+/- to return\n", "Press Power to enter", 4)){
connect_mmc(SYSMMC);
if (!mount_mmc(emmc_entries[res - 2], res - 1))
fileexplorer("emmc:/");
else
message(COLOR_RED, "EMMC failed to mount!");
}
}
void MainMenu_EMUMMC(){
connect_mmc(EMUMMC);
if (!mount_mmc(emmc_entries[res - 5], res - 4))
fileexplorer("emmc:/");
else
message(COLOR_RED, "EMUMMC failed to mount!");
}
void MainMenu_MountSD(){
if (return_sd_mounted(1))
sd_unmount();
else
sd_mount();
}
void MainMenu_Tools(){
res = makemenu(toolsmenu, 6);
switch(res){
case DISPLAY_INFO:
displayinfo();
break;
case DISPLAY_GPIO:
displaygpio();
break;
case DUMPFIRMWARE:
dumpfirmware(SYSMMC);
break;
case DUMPUSERSAVE:
if (mainmenu[4].property >= 0){
if ((res = makemenu(mmcChoice, 3)) >= 0)
dumpusersaves(res);
}
else
dumpusersaves(SYSMMC);
break;
}
}
void MainMenu_SDFormat(){
res = makemenu(formatmenu, 4);
if (res >= 0){
if(makewaitmenu("Are you sure you want to format your sd?\nThis will delete everything on your SD card\nThis action is irreversible!\n\nPress Vol+/- to cancel\n", "Press Power to continue", 10)){
if (format(res)){
sd_unmount();
}
}
}
}
void MainMenu_Credits(){
message(COLOR_WHITE, CREDITS_MESSAGE);
}
void MainMenu_Exit(){
if (return_sd_mounted(1)){
shutdownmenu[5].property = (checkfile("/bootloader/update.bin")) ? 1 : -1;
shutdownmenu[6].property = (checkfile("/atmosphere/reboot_payload.bin")) ? 1 : -1;
}
else {
shutdownmenu[5].property = -1;
shutdownmenu[6].property = -1;
}
res = makemenu(shutdownmenu, 7);
switch(res){
case REBOOT_RCM:
reboot_rcm();
case REBOOT_NORMAL:
reboot_normal();
case POWER_OFF:
power_off();
case HEKATE:
launch_payload("/bootloader/update.bin");
case AMS:
launch_payload("/atmosphere/reboot_payload.bin");
} //todo declock bpmp
}
part_handler mainmenu_functions[] = {
MainMenu_SDCard,
MainMenu_EMMC,
MainMenu_EMMC,
MainMenu_EMMC,
MainMenu_EMUMMC,
MainMenu_EMUMMC,
MainMenu_EMUMMC,
MainMenu_MountSD,
MainMenu_Tools,
MainMenu_SDFormat,
MainMenu_Credits,
MainMenu_Exit,
};
void RunMenuOption(int option){
if (option > 0)
mainmenu_functions[option - 1]();
}
void fillmainmenu(){ void fillmainmenu(){
int i; int i;
@@ -100,7 +225,6 @@ void fillmainmenu(){
} }
void te_main(){ void te_main(){
int res;
if (dump_biskeys() == -1){ if (dump_biskeys() == -1){
message(COLOR_RED, "Biskeys failed to dump!\nEmmc will not be mounted!"); message(COLOR_RED, "Biskeys failed to dump!\nEmmc will not be mounted!");
@@ -120,139 +244,6 @@ void te_main(){
while (1){ while (1){
fillmainmenu(); fillmainmenu();
res = makemenu(mainmenu, MAINMENU_AMOUNT); res = makemenu(mainmenu, MAINMENU_AMOUNT);
RunMenuOption(res);
switch(res){
case SD_CARD:
fileexplorer("SD:/");
break;
case EMMC_SAF:
case EMMC_SYS:
case EMMC_USR:
if (makewaitmenu("You're about to enter EMMC\nModifying anything here\n can result in a BRICK!\n\nPlease only continue\n if you know what you're doing\n\nPress Vol+/- to return\n", "Press Power to enter", 4)){
connect_mmc(SYSMMC);
if (!mount_mmc(emmc_entries[res - 2], res - 1)){
fileexplorer("emmc:/");
}
else
message(COLOR_RED, "EMMC failed to mount!");
}
break;
case EMUMMC_SAF:
case EMUMMC_SYS:
case EMUMMC_USR:
connect_mmc(EMUMMC);
if (!mount_mmc(emmc_entries[res - 5], res - 4)){
fileexplorer("emmc:/");
}
else
message(COLOR_RED, "EMUMMC failed to mount!");
break;
case MOUNT_SD:
if (return_sd_mounted(1))
sd_unmount();
else
sd_mount();
break;
case TOOLS:
res = makemenu(toolsmenu, 6);
switch(res){
case DISPLAY_INFO:
displayinfo();
break;
case DISPLAY_GPIO:
displaygpio();
break;
case DUMPFIRMWARE:
/*
if (mainmenu[4].property >= 0){
res = makemenu(mmcChoice, 3);
if (res >= 0)
dumpfirmware(res);
}
else
*/
dumpfirmware(SYSMMC);
break;
case DUMPUSERSAVE:
if (mainmenu[4].property >= 0){
res = makemenu(mmcChoice, 3);
if (res >= 0)
dumpusersaves(res);
}
else
dumpusersaves(SYSMMC);
break;
}
break;
case SD_FORMAT:
res = makemenu(formatmenu, 4);
if (res >= 0){
if(makewaitmenu("Are you sure you want to format your sd?\nThis will delete everything on your SD card\nThis action is irreversible!\n\nPress Vol+/- to cancel\n", "Press Power to continue", 10)){
if (format(res)){
sd_unmount();
}
}
}
break;
case CREDITS:
message(COLOR_WHITE, CREDITS_MESSAGE);
break;
case EXIT:
if (return_sd_mounted(1)){
if (checkfile("/bootloader/update.bin"))
shutdownmenu[5].property = 1;
else
shutdownmenu[5].property = -1;
if (checkfile("/atmosphere/reboot_payload.bin"))
shutdownmenu[6].property = 1;
else
shutdownmenu[6].property = -1;
}
else {
shutdownmenu[5].property = -1;
shutdownmenu[6].property = -1;
}
res = makemenu(shutdownmenu, 7);
switch(res){
case REBOOT_RCM:
reboot_rcm();
case REBOOT_NORMAL:
reboot_normal();
case POWER_OFF:
power_off();
case HEKATE:
launch_payload("/bootloader/update.bin");
case AMS:
launch_payload("/atmosphere/reboot_payload.bin");
} //todo declock bpmp
break;
}
} }
} }