1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-09 20:21:45 +00:00

Update old codebase copy.

This commit is contained in:
Pablo Curiel 2020-05-18 01:37:36 -04:00
parent 3e47dd180d
commit 7d66da7308
4 changed files with 29 additions and 16 deletions

View file

@ -111,8 +111,6 @@ char *getReferenceTitleIDType(u8 type)
out = "PatchId";
break;
case NcmContentMetaType_Patch:
out = "OriginalId";
break;
case NcmContentMetaType_AddOnContent:
out = "ApplicationId";
break;

View file

@ -134,6 +134,7 @@ static const char *appControlsCommon = "[ " NINTENDO_FONT_DPAD " / " NINTENDO_FO
static const char *appControlsGameCardMultiApp = "[ " NINTENDO_FONT_DPAD " / " NINTENDO_FONT_LSTICK " / " NINTENDO_FONT_RSTICK " ] Move | [ " NINTENDO_FONT_A " ] Select | [ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_L " / " NINTENDO_FONT_R " / " NINTENDO_FONT_ZL " / " NINTENDO_FONT_ZR " ] Show info from another base application | [ " NINTENDO_FONT_PLUS " ] Exit";
static const char *appControlsNoContent = "[ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_PLUS " ] Exit";
static const char *appControlsSdCardEmmcFull = "[ " NINTENDO_FONT_DPAD " / " NINTENDO_FONT_LSTICK " / " NINTENDO_FONT_RSTICK " ] Move | [ " NINTENDO_FONT_A " ] Select | [ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_X " ] Batch mode | [ " NINTENDO_FONT_Y " ] Dump installed content with missing base application | [ " NINTENDO_FONT_PLUS " ] Exit";
static const char *appControlsSdCardEmmcNoOrphan = "[ " NINTENDO_FONT_DPAD " / " NINTENDO_FONT_LSTICK " / " NINTENDO_FONT_RSTICK " ] Move | [ " NINTENDO_FONT_A " ] Select | [ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_X " ] Batch mode | [ " NINTENDO_FONT_PLUS " ] Exit";
static const char *appControlsSdCardEmmcNoApp = "[ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_X " ] Batch mode | [ " NINTENDO_FONT_Y " ] Dump installed content with missing base application | [ " NINTENDO_FONT_PLUS " ] Exit";
static const char *appControlsRomFs = "[ " NINTENDO_FONT_DPAD " / " NINTENDO_FONT_LSTICK " / " NINTENDO_FONT_RSTICK " ] Move | [ " NINTENDO_FONT_A " ] Select | [ " NINTENDO_FONT_B " ] Back | [ " NINTENDO_FONT_Y " ] Dump current directory | [ " NINTENDO_FONT_PLUS " ] Exit";
@ -1026,7 +1027,7 @@ UIResult uiProcess()
{
uiDrawString(STRING_X_POS, STRING_Y_POS(breaks), FONT_COLOR_RGB, appControlsRomFs);
} else {
uiDrawString(STRING_X_POS, STRING_Y_POS(breaks), FONT_COLOR_RGB, appControlsCommon);
uiDrawString(STRING_X_POS, STRING_Y_POS(breaks), FONT_COLOR_RGB, appControlsSdCardEmmcNoOrphan);
}
} else {
if (titlePatchCount || titleAddOnCount)
@ -4333,7 +4334,7 @@ UIResult uiProcess()
{
if (scrollAmount > 0)
{
cursor = ((uiState == stateNspPatchDumpMenu && cursor == 3) ? 4 : 5);
cursor = ((uiState == stateNspPatchDumpMenu && cursor <= 3) ? 4 : 5);
} else
if (scrollAmount < 0)
{

View file

@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include <dirent.h>
#include <unistd.h>
@ -95,8 +96,8 @@ char strbuf[NAME_BUF_LEN] = {'\0'};
static const char *appLaunchPath = NULL;
FsStorage fatFsStorage;
static bool openBis = false, mountBisFatFs = false;
FsStorage fatFsStorage = {0};
static FATFS *fatFsObj = NULL;
u64 freeSpace = 0;
char freeSpaceStr[32] = {'\0'};
@ -352,33 +353,47 @@ static Result getGameCardStoragePartitionSize(u64 *out)
bool mountSysEmmcPartition()
{
FATFS fs;
Result result = 0;
FRESULT fr = FR_OK;
Result result = fsOpenBisStorage(&fatFsStorage, FsBisPartitionId_System);
result = fsOpenBisStorage(&fatFsStorage, FsBisPartitionId_System);
if (R_FAILED(result))
{
uiDrawString(STRING_DEFAULT_POS, FONT_COLOR_ERROR_RGB, "%s: failed to open BIS System partition! (0x%08X)", __func__, result);
return false;
}
openBis = true;
fatFsObj = calloc(1, sizeof(FATFS));
if (!fatFsObj)
{
uiDrawString(STRING_DEFAULT_POS, FONT_COLOR_ERROR_RGB, "%s: failed to allocate memory for FatFs object!", __func__);
return false;
}
FRESULT fr = f_mount(&fs, BIS_MOUNT_NAME, 1);
fr = f_mount(fatFsObj, BIS_MOUNT_NAME, 1);
if (fr != FR_OK)
{
uiDrawString(STRING_DEFAULT_POS, FONT_COLOR_ERROR_RGB, "%s: failed to mount BIS System partition! (%u)", __func__, fr);
return false;
}
mountBisFatFs = true;
return true;
}
void unmountSysEmmcPartition()
{
if (mountBisFatFs) f_unmount(BIS_MOUNT_NAME);
if (openBis) fsStorageClose(&fatFsStorage);
if (fatFsObj)
{
f_unmount(BIS_MOUNT_NAME);
free(fatFsObj);
fatFsObj = NULL;
}
if (serviceIsActive(&(fatFsStorage.s)))
{
fsStorageClose(&fatFsStorage);
memset(&fatFsStorage, 0, sizeof(FsStorage));
}
}
static bool isServiceRunning(const char *name)

View file

@ -17,8 +17,6 @@
#define BATCH_OVERRIDES_PATH NSP_DUMP_PATH "BatchOverrides/"
#define TICKET_PATH APP_BASE_PATH "Ticket/"
#define CONFIG_PATH APP_BASE_PATH "config.bin"
#define NRO_NAME APP_TITLE ".nro"
#define NRO_PATH APP_BASE_PATH NRO_NAME
@ -91,6 +89,7 @@
#define GAMECARD_TYPE1_PARTITION_CNT 3 // "update" (0), "normal" (1), "secure" (2)
#define GAMECARD_TYPE2_PARTITION_CNT 4 // "update" (0), "logo" (1), "normal" (2), "secure" (3)
#define GAMECARD_TYPE(x) ((x) == GAMECARD_TYPE1_PARTITION_CNT ? "Type 0x01" : ((x) == GAMECARD_TYPE2_PARTITION_CNT ? "Type 0x02" : "Unknown"))
#define GAMECARD_TYPE1_PART_NAMES(x) ((x) == 0 ? "Update" : ((x) == 1 ? "Normal" : ((x) == 2 ? "Secure" : "Unknown")))
#define GAMECARD_TYPE2_PART_NAMES(x) ((x) == 0 ? "Update" : ((x) == 1 ? "Logo" : ((x) == 2 ? "Normal" : ((x) == 3 ? "Secure" : "Unknown"))))
#define GAMECARD_PARTITION_NAME(x, y) ((x) == GAMECARD_TYPE1_PARTITION_CNT ? GAMECARD_TYPE1_PART_NAMES(y) : ((x) == GAMECARD_TYPE2_PARTITION_CNT ? GAMECARD_TYPE2_PART_NAMES(y) : "Unknown"))