Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6518f37b1c | ||
|
|
81e97fa820 | ||
|
|
12802bf371 |
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ include $(DEVKITARM)/base_rules
|
|||||||
|
|
||||||
IPL_LOAD_ADDR := 0x40003000
|
IPL_LOAD_ADDR := 0x40003000
|
||||||
LPVERSION_MAJOR := 2
|
LPVERSION_MAJOR := 2
|
||||||
LPVERSION_MINOR := 0
|
LPVERSION_MINOR := 1
|
||||||
LPVERSION_BUGFX := 0
|
LPVERSION_BUGFX := 0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ DRESULT disk_read (
|
|||||||
__attribute__ ((aligned (16))) static u64 prev_cluster = -1;
|
__attribute__ ((aligned (16))) static u64 prev_cluster = -1;
|
||||||
__attribute__ ((aligned (16))) static u32 prev_sector = 0;
|
__attribute__ ((aligned (16))) static u32 prev_sector = 0;
|
||||||
bool needs_cache_sector = false;
|
bool needs_cache_sector = false;
|
||||||
|
/*
|
||||||
if (secindex == 0 || clear_sector_cache) {
|
if (secindex == 0 || clear_sector_cache) {
|
||||||
if (!sector_cache)
|
if (!sector_cache)
|
||||||
sector_cache = (sector_cache_t *)malloc(sizeof(sector_cache_t) * MAX_SEC_CACHE_ENTRIES);
|
sector_cache = (sector_cache_t *)malloc(sizeof(sector_cache_t) * MAX_SEC_CACHE_ENTRIES);
|
||||||
@@ -179,6 +179,7 @@ DRESULT disk_read (
|
|||||||
secindex++;
|
secindex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//system_part (pdrv == 1) ? system_part_sys : system_part_usr
|
//system_part (pdrv == 1) ? system_part_sys : system_part_usr
|
||||||
if (nx_emmc_part_read(&storage, system_part, sector, count, buff)) {
|
if (nx_emmc_part_read(&storage, system_part, sector, count, buff)) {
|
||||||
u32 tweak_exp = 0;
|
u32 tweak_exp = 0;
|
||||||
@@ -195,10 +196,12 @@ DRESULT disk_read (
|
|||||||
|
|
||||||
// fatfs will never pull more than a cluster
|
// fatfs will never pull more than a cluster
|
||||||
_emmc_xts(9, 8, 0, tweak, regen_tweak, tweak_exp, prev_cluster, buff, buff, count * 0x200);
|
_emmc_xts(9, 8, 0, tweak, regen_tweak, tweak_exp, prev_cluster, buff, buff, count * 0x200);
|
||||||
|
/*
|
||||||
if (needs_cache_sector) {
|
if (needs_cache_sector) {
|
||||||
memcpy(sector_cache[s].cached_sector, buff, 0x200);
|
memcpy(sector_cache[s].cached_sector, buff, 0x200);
|
||||||
memcpy(sector_cache[s].tweak, tweak, 0x10);
|
memcpy(sector_cache[s].tweak, tweak, 0x10);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
prev_sector = sector + count - 1;
|
prev_sector = sector + count - 1;
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,11 +45,20 @@
|
|||||||
sdmmc_t sd_sdmmc;
|
sdmmc_t sd_sdmmc;
|
||||||
sdmmc_storage_t sd_storage;
|
sdmmc_storage_t sd_storage;
|
||||||
__attribute__ ((aligned (16))) FATFS sd_fs;
|
__attribute__ ((aligned (16))) FATFS sd_fs;
|
||||||
static bool sd_mounted;
|
static bool sd_mounted, sd_inited;
|
||||||
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
|
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
|
||||||
hekate_config h_cfg;
|
hekate_config h_cfg;
|
||||||
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
||||||
|
|
||||||
|
bool return_sd_mounted(int value){
|
||||||
|
switch(value){
|
||||||
|
case 1:
|
||||||
|
return sd_mounted;
|
||||||
|
case 7:
|
||||||
|
return sd_inited;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool sd_mount()
|
bool sd_mount()
|
||||||
{
|
{
|
||||||
if (sd_mounted)
|
if (sd_mounted)
|
||||||
@@ -58,9 +67,11 @@ bool sd_mount()
|
|||||||
if (!sdmmc_storage_init_sd(&sd_storage, &sd_sdmmc, SDMMC_1, SDMMC_BUS_WIDTH_4, 11))
|
if (!sdmmc_storage_init_sd(&sd_storage, &sd_sdmmc, SDMMC_1, SDMMC_BUS_WIDTH_4, 11))
|
||||||
{
|
{
|
||||||
EPRINTF("Failed to init SD card.\nMake sure that it is inserted.\nOr that SD reader is properly seated!");
|
EPRINTF("Failed to init SD card.\nMake sure that it is inserted.\nOr that SD reader is properly seated!");
|
||||||
|
sd_inited = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sd_inited = true;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
res = f_mount(&sd_fs, "sd:", 1);
|
res = f_mount(&sd_fs, "sd:", 1);
|
||||||
if (res == FR_OK)
|
if (res == FR_OK)
|
||||||
@@ -84,6 +95,7 @@ void sd_unmount()
|
|||||||
f_mount(NULL, "sd:", 1);
|
f_mount(NULL, "sd:", 1);
|
||||||
sdmmc_storage_end(&sd_storage);
|
sdmmc_storage_end(&sd_storage);
|
||||||
sd_mounted = false;
|
sd_mounted = false;
|
||||||
|
sd_inited = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -320,6 +320,10 @@ int delfile(const char *path, const char *filename){
|
|||||||
void filemenu(const char *startpath){
|
void filemenu(const char *startpath){
|
||||||
int amount, res, tempint;
|
int amount, res, tempint;
|
||||||
char temp[100];
|
char temp[100];
|
||||||
|
|
||||||
|
if (!strcmp(rootpath, "emmc:/") && !strcmp(startpath, "emmc:/"))
|
||||||
|
clipboardhelper = 0;
|
||||||
|
|
||||||
strcpy(rootpath, startpath);
|
strcpy(rootpath, startpath);
|
||||||
writecurpath(startpath);
|
writecurpath(startpath);
|
||||||
amount = readfolder(currentpath);
|
amount = readfolder(currentpath);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void clearscreen(){
|
|||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
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.0.2%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
gfx_printf("%k%KTegraexplorer v1.1.0%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int message(char* message, u32 color){
|
int message(char* message, u32 color){
|
||||||
|
|||||||
@@ -10,12 +10,14 @@
|
|||||||
|
|
||||||
extern bool sd_mount();
|
extern bool sd_mount();
|
||||||
extern void sd_unmount();
|
extern void sd_unmount();
|
||||||
|
extern bool return_sd_mounted(int value);
|
||||||
extern int launch_payload(char *path);
|
extern int launch_payload(char *path);
|
||||||
bool sd_mounted;
|
|
||||||
|
|
||||||
menu_item mainmenu[MAINMENU_AMOUNT] = {
|
menu_item mainmenu[MAINMENU_AMOUNT] = {
|
||||||
{"[SD:/] SD CARD", COLOR_GREEN, SD_CARD, 1},
|
{"[SD:/] SD CARD\n", COLOR_GREEN, SD_CARD, 1},
|
||||||
{"[SYSTEM:/] EMMC", COLOR_GREEN, EMMC_SYS, 1},
|
{"[SYSTEM:/] EMMC", COLOR_ORANGE, EMMC_SYS, 1},
|
||||||
|
{"[USER:/] EMMC", COLOR_ORANGE, EMMC_USR, 1},
|
||||||
|
{"[SAFE:/] EMMC", COLOR_ORANGE, EMMC_SAF, 1},
|
||||||
{"\nMount/Unmount SD", COLOR_WHITE, MOUNT_SD, 1},
|
{"\nMount/Unmount SD", COLOR_WHITE, MOUNT_SD, 1},
|
||||||
{"Tools", COLOR_VIOLET, TOOLS, 1},
|
{"Tools", COLOR_VIOLET, TOOLS, 1},
|
||||||
{"SD format", COLOR_VIOLET, SD_FORMAT, 1},
|
{"SD format", COLOR_VIOLET, SD_FORMAT, 1},
|
||||||
@@ -48,20 +50,26 @@ menu_item formatmenu[4] = {
|
|||||||
{"Format for EmuMMC setup (FAT32/RAW)", COLOR_RED, FORMAT_EMUMMC, 1}
|
{"Format for EmuMMC setup (FAT32/RAW)", COLOR_RED, FORMAT_EMUMMC, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char emmc_entries[3][8] = {
|
||||||
|
"SAFE",
|
||||||
|
"SYSTEM",
|
||||||
|
"USER"
|
||||||
|
};
|
||||||
|
|
||||||
void fillmainmenu(){
|
void fillmainmenu(){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAINMENU_AMOUNT; i++){
|
for (i = 0; i < MAINMENU_AMOUNT; i++){
|
||||||
switch (i + 1) {
|
switch (i + 1) {
|
||||||
case 1:
|
case 1:
|
||||||
case 5:
|
case 7:
|
||||||
if (sd_mounted)
|
if (return_sd_mounted(i + 1))
|
||||||
mainmenu[i].property = 1;
|
mainmenu[i].property = 1;
|
||||||
else
|
else
|
||||||
mainmenu[i].property = -1;
|
mainmenu[i].property = -1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 5:
|
||||||
if (sd_mounted){
|
if (return_sd_mounted(1)){
|
||||||
mainmenu[i].property = 2;
|
mainmenu[i].property = 2;
|
||||||
strcpy(mainmenu[i].name, "\nUnmount SD");
|
strcpy(mainmenu[i].name, "\nUnmount SD");
|
||||||
}
|
}
|
||||||
@@ -80,12 +88,9 @@ void te_main(){
|
|||||||
if (dump_biskeys() == -1){
|
if (dump_biskeys() == -1){
|
||||||
message("Biskeys failed to dump!\nEmmc will not be mounted!", COLOR_RED);
|
message("Biskeys failed to dump!\nEmmc will not be mounted!", COLOR_RED);
|
||||||
mainmenu[1].property = -1;
|
mainmenu[1].property = -1;
|
||||||
|
mainmenu[2].property = -1;
|
||||||
|
mainmenu[3].property = -1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
mount_emmc("SYSTEM", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
sd_mounted = sd_mount();
|
|
||||||
|
|
||||||
while (1){
|
while (1){
|
||||||
fillmainmenu();
|
fillmainmenu();
|
||||||
@@ -95,23 +100,26 @@ void te_main(){
|
|||||||
case SD_CARD:
|
case SD_CARD:
|
||||||
filemenu("SD:/");
|
filemenu("SD:/");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EMMC_SAF:
|
||||||
case EMMC_SYS:
|
case EMMC_SYS:
|
||||||
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))
|
|
||||||
filemenu("emmc:/");
|
|
||||||
break;
|
|
||||||
/*
|
|
||||||
case EMMC_USR:
|
case EMMC_USR:
|
||||||
mount_emmc("USER", 2);
|
|
||||||
filemenu("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)){
|
||||||
break;
|
if (!mount_emmc(emmc_entries[res - 2], res - 1)){
|
||||||
*/
|
filemenu("emmc:/");
|
||||||
case MOUNT_SD:
|
}
|
||||||
if (sd_mounted){
|
|
||||||
sd_mounted = false;
|
|
||||||
sd_unmount();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
sd_mounted = sd_mount();
|
message("EMMC failed to mount!", COLOR_RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOUNT_SD:
|
||||||
|
if (return_sd_mounted(1))
|
||||||
|
sd_unmount();
|
||||||
|
else
|
||||||
|
sd_mount();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -138,7 +146,6 @@ void te_main(){
|
|||||||
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(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)){
|
if (format(res)){
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
sd_mounted = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +157,7 @@ void te_main(){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIT:
|
case EXIT:
|
||||||
if (sd_mounted){
|
if (return_sd_mounted(1)){
|
||||||
if (checkfile("/bootloader/update.bin"))
|
if (checkfile("/bootloader/update.bin"))
|
||||||
shutdownmenu[5].property = 1;
|
shutdownmenu[5].property = 1;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../utils/types.h"
|
#include "../utils/types.h"
|
||||||
|
|
||||||
#define MAINMENU_AMOUNT 7
|
#define MAINMENU_AMOUNT 9
|
||||||
#define CREDITS_MESSAGE "\nTegraexplorer, made by:\nSuch Meme, Many Skill\n\nProject based on:\nLockpick_RCM\nHekate\n\nCool people:\nshchmue\ndennthecafebabe\nDax"
|
#define CREDITS_MESSAGE "\nTegraexplorer, made by:\nSuch Meme, Many Skill\n\nProject based on:\nLockpick_RCM\nHekate\n\nCool people:\nshchmue\ndennthecafebabe\nDax"
|
||||||
|
|
||||||
typedef struct _menu_item {
|
typedef struct _menu_item {
|
||||||
@@ -13,6 +13,7 @@ typedef struct _menu_item {
|
|||||||
|
|
||||||
enum mainmenu_return {
|
enum mainmenu_return {
|
||||||
SD_CARD = 1,
|
SD_CARD = 1,
|
||||||
|
EMMC_SAF,
|
||||||
EMMC_SYS,
|
EMMC_SYS,
|
||||||
EMMC_USR,
|
EMMC_USR,
|
||||||
MOUNT_SD,
|
MOUNT_SD,
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ int dumpfirmware(){
|
|||||||
u32 timer = get_tmr_s();
|
u32 timer = get_tmr_s();
|
||||||
|
|
||||||
clearscreen();
|
clearscreen();
|
||||||
|
mount_emmc("SYSTEM", 2);
|
||||||
|
|
||||||
gfx_printf("PKG1 version: %d\n", pkg1ver);
|
gfx_printf("PKG1 version: %d\n", pkg1ver);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user