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

[skip ci] GameCardTab: reflect current gamecard dump options

Other changes include:

* gamecard: rename gamecardGetDecryptedCardInfoArea() -> gamecardGetPlaintextCardInfoArea().

* FocusableItem, FocusableTable: add positional arguments for the FocusableItem class constructor.
This commit is contained in:
Pablo Curiel 2024-04-12 13:40:50 +02:00
parent fc5226bfce
commit 789a6d6eb8
9 changed files with 81 additions and 32 deletions

View file

@ -2641,7 +2641,7 @@ static bool saveGameCardCardInfo(void *userdata)
u32 crc = 0; u32 crc = 0;
char *filename = NULL; char *filename = NULL;
if (!gamecardGetDecryptedCardInfoArea(&gc_cardinfo)) if (!gamecardGetPlaintextCardInfoArea(&gc_cardinfo))
{ {
consolePrint("failed to get gamecard cardinfo\n"); consolePrint("failed to get gamecard cardinfo\n");
goto end; goto end;
@ -3494,7 +3494,7 @@ static bool browseNintendoContentArchiveFsSection(void *userdata)
pfs_ctx = (PartitionFileSystemContext*)fs_ctx; pfs_ctx = (PartitionFileSystemContext*)fs_ctx;
nca_fs_ctx = pfs_ctx->nca_fs_ctx; nca_fs_ctx = pfs_ctx->nca_fs_ctx;
snprintf(mount_name, MAX_ELEMENTS(mount_name), "%s", pfs_ctx->is_exefs ? "exefs" : "pfs"); snprintf(mount_name, MAX_ELEMENTS(mount_name), "%s", pfs_ctx->is_exefs ? "ncaexefs" : "ncapfs");
if (!devoptabMountPartitionFileSystemDevice(pfs_ctx, mount_name)) if (!devoptabMountPartitionFileSystemDevice(pfs_ctx, mount_name))
{ {

View file

@ -33,7 +33,7 @@ namespace nxdt::views
class AboutTabLabel: public FocusableLabel class AboutTabLabel: public FocusableLabel
{ {
public: public:
AboutTabLabel(brls::LabelStyle labelStyle, std::string text, bool center = false) : FocusableLabel(labelStyle, text, true) AboutTabLabel(brls::LabelStyle labelStyle, std::string text, bool center = false) : FocusableLabel(false, false, labelStyle, text, true)
{ {
if (center) this->setHorizontalAlign(NVG_ALIGN_CENTER); if (center) this->setHorizontalAlign(NVG_ALIGN_CENTER);
} }

View file

@ -307,7 +307,7 @@ bool gamecardReadStorage(void *out, u64 read_size, u64 offset);
bool gamecardGetHeader(GameCardHeader *out); bool gamecardGetHeader(GameCardHeader *out);
/// Fills the provided GameCardInfo pointer. /// Fills the provided GameCardInfo pointer.
bool gamecardGetDecryptedCardInfoArea(GameCardInfo *out); bool gamecardGetPlaintextCardInfoArea(GameCardInfo *out);
/// Fills the provided FsGameCardCertificate pointer. /// Fills the provided FsGameCardCertificate pointer.
/// This area can also be read using gamecardReadStorage(), starting at GAMECARD_CERTIFICATE_OFFSET. /// This area can also be read using gamecardReadStorage(), starting at GAMECARD_CERTIFICATE_OFFSET.

View file

@ -70,14 +70,14 @@ namespace nxdt::views
{ {
public: public:
template<typename... Types> template<typename... Types>
FocusableLabel(Types... args) : FocusableItem<brls::Label>(false, false, args...) { } FocusableLabel(bool highlight, bool highlight_bg, Types... args) : FocusableItem<brls::Label>(highlight, highlight_bg, args...) { }
}; };
class FocusableTable: public FocusableItem<brls::Table> class FocusableTable: public FocusableItem<brls::Table>
{ {
public: public:
template<typename... Types> template<typename... Types>
FocusableTable(Types... args) : FocusableItem<brls::Table>(true, false, args...) { } FocusableTable(bool highlight, bool highlight_bg, Types... args) : FocusableItem<brls::Table>(highlight, highlight_bg, args...) { }
}; };
} }

@ -1 +1 @@
Subproject commit 21122223a496b313c2d45cb02cabfc0e4680e7e7 Subproject commit 73831023b18d2c60df532bafbf61b1c18c2ab4f0

View file

@ -22,7 +22,6 @@
"trimmed_size": "Trimmed size", "trimmed_size": "Trimmed size",
"update_version": "Bundled update version", "update_version": "Bundled update version",
"lafw_version": "Required LAFW version", "lafw_version": "Required LAFW version",
"lafw_version_value": "%lu or greater (%s)",
"sdk_version": "SDK version", "sdk_version": "SDK version",
"compatibility_type": "Compatibility type", "compatibility_type": "Compatibility type",
"package_id": "Package ID", "package_id": "Package ID",
@ -36,29 +35,56 @@
"description": "Generates a raw gamecard image. This is the option most people will want to use." "description": "Generates a raw gamecard image. This is the option most people will want to use."
}, },
"advanced_disclaimer": "The following options are considered advanced and are mostly aimed at developers, preservationists and experienced users.",
"dump_initial_data": {
"label": "Dump InitialData area",
"description": "The InitialData area holds cryptographic information used by the Lotus ASIC to communicate with the gamecard.\nIt can't be dumped through normal means -- it's not part of the storage areas from gamecard images."
},
"dump_certificate": { "dump_certificate": {
"label": "Dump gamecard certificate", "label": "Dump gamecard certificate",
"description": "The gamecard certificate is used to unequivocally identify each individual gamecard." "description": "The gamecard certificate serves to unequivocally identify each individual gamecard.\nIt's mostly used for online operations, and it's stored at sector {0} in all gamecard images."
},
"dump_card_id_set": {
"label": "Dump card ID set",
"description": "The card ID set is composed of three 32-bit integers that hold information such as the gamecard's memory type and manufacturer.\nIt can't be dumped through normal means -- it's not part of the storage areas from gamecard images."
},
"dump_card_uid": {
"label": "Dump card UID",
"description": "The card UID is a 64-byte long area that serves as a unique identifier for the gamecard. It's mostly used in security contexts.\nIt can't be dumped through normal means -- it's not part of the storage areas from gamecard images."
}, },
"dump_header": { "dump_header": {
"label": "Dump gamecard header", "label": "Dump gamecard header",
"description": "The gamecard header holds information such as the location of the root HFS partition and the gamecard capacity.\nOnly useful for developers, preservationists and advanced users." "description": "The gamecard header holds information such as the location of the root HFS partition and the gamecard capacity.\nIt's stored at sector {0} in all gamecard images."
}, },
"dump_decrypted_cardinfo": { "dump_plaintext_cardinfo": {
"label": "Dump decrypted CardInfo area", "label": "Dump plaintext CardInfo area",
"description": "The CardInfo area holds information such as the bundled system update version and the Lotus ASIC firmware version required by the gamecard.\nThis area is part of the gamecard header, but it's always encrypted.\nOnly useful for developers, preservationists and advanced users." "description": "The CardInfo area holds information such as the bundled system update version and the Lotus ASIC firmware version required by the gamecard.\nThis area is part of the gamecard header, but it's always encrypted."
}, },
"dump_initial_data": { "dump_specific_data": {
"label": "Dump InitialData area", "label": "Dump SpecificData area",
"description": "The InitialData area holds cryptographic information used by the Lotus ASIC to communicate with the gamecard.\nIt can't be dumped through normal means - it's not part of the storage areas from gamecard images.\nOnly useful for developers, preservationists and advanced users." "description": "The SpecificData area is internally generated by the FS sysmodule, which means it can't be dumped through normal means.\nIt holds security data used at runtime by the Lotus ASIC."
}, },
"dump_hfs_partitions": { "dump_hfs_partitions": {
"label": "Dump Hash File System (HFS) partitions", "label": "Dump Hash File System (HFS) partitions",
"description": "Dumps data from the HFS partitions within the gamecard storage areas, in both raw and extracted forms." "description": "Dumps data from the HFS partitions located within the gamecard storage areas, in both raw and extracted forms."
},
"browse_hfs_partitions": {
"label": "Browse Hash File System (HFS) partitions",
"description": "Displays a filesystem browser with file dumping capabilities using a specific gamecard HFS partition."
},
"dump_lafw": {
"label": "Dump Lotus ASIC firmware (LAFW) blob",
"description": "Dumps the encrypted LAFW blob stored within the FS sysmodule program memory."
} }
} }
} }

View file

@ -127,7 +127,7 @@ static void gamecardFreeInfo(bool clear_status);
static bool gamecardReadHeader(void); static bool gamecardReadHeader(void);
static bool _gamecardGetDecryptedCardInfoArea(void); static bool _gamecardGetPlaintextCardInfoArea(void);
static bool gamecardReadSecurityInformation(GameCardSecurityInformation *out); static bool gamecardReadSecurityInformation(GameCardSecurityInformation *out);
@ -357,7 +357,7 @@ bool gamecardGetHeader(GameCardHeader *out)
return ret; return ret;
} }
bool gamecardGetDecryptedCardInfoArea(GameCardInfo *out) bool gamecardGetPlaintextCardInfoArea(GameCardInfo *out)
{ {
bool ret = false; bool ret = false;
@ -737,7 +737,7 @@ static void gamecardLoadInfo(void)
if (!gamecardReadHeader()) goto end; if (!gamecardReadHeader()) goto end;
/* Get decrypted CardInfo area from header. */ /* Get decrypted CardInfo area from header. */
if (!_gamecardGetDecryptedCardInfoArea()) goto end; if (!_gamecardGetPlaintextCardInfoArea()) goto end;
/* Check if we meet the Lotus ASIC firmware (LAFW) version requirement. */ /* Check if we meet the Lotus ASIC firmware (LAFW) version requirement. */
if (g_lafwVersion < g_gameCardInfoArea.fw_version) if (g_lafwVersion < g_gameCardInfoArea.fw_version)
@ -889,7 +889,7 @@ static bool gamecardReadHeader(void)
return true; return true;
} }
static bool _gamecardGetDecryptedCardInfoArea(void) static bool _gamecardGetPlaintextCardInfoArea(void)
{ {
const u8 *card_info_key = NULL; const u8 *card_info_key = NULL;
u8 card_info_iv[AES_128_KEY_SIZE] = {0}; u8 card_info_iv[AES_128_KEY_SIZE] = {0};

View file

@ -128,7 +128,7 @@ namespace nxdt::views
/* Information about how to handle HOS launch errors. */ /* Information about how to handle HOS launch errors. */
/* TODO: remove this if we ever find a way to fix this issue. */ /* TODO: remove this if we ever find a way to fix this issue. */
FocusableLabel *launch_error_info = new FocusableLabel(brls::LabelStyle::DESCRIPTION, "gamecard_tab/list/launch_error_info"_i18n, true); FocusableLabel *launch_error_info = new FocusableLabel(true, false, brls::LabelStyle::DESCRIPTION, "gamecard_tab/list/launch_error_info"_i18n, true);
launch_error_info->setHorizontalAlign(NVG_ALIGN_CENTER); launch_error_info->setHorizontalAlign(NVG_ALIGN_CENTER);
this->list->addView(launch_error_info); this->list->addView(launch_error_info);
@ -160,7 +160,7 @@ namespace nxdt::views
/* Populate gamecard properties table. */ /* Populate gamecard properties table. */
this->list->addView(new brls::Header("gamecard_tab/list/properties_table/header"_i18n)); this->list->addView(new brls::Header("gamecard_tab/list/properties_table/header"_i18n));
FocusableTable *properties_table = new FocusableTable(); FocusableTable *properties_table = new FocusableTable(true, false);
brls::TableRow *capacity = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/capacity"_i18n); brls::TableRow *capacity = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/capacity"_i18n);
brls::TableRow *total_size = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/total_size"_i18n); brls::TableRow *total_size = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/total_size"_i18n);
brls::TableRow *trimmed_size = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/trimmed_size"_i18n); brls::TableRow *trimmed_size = properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/trimmed_size"_i18n);
@ -176,7 +176,7 @@ namespace nxdt::views
trimmed_size->setValue(this->GetFormattedSizeString(&gamecardGetTrimmedSize)); trimmed_size->setValue(this->GetFormattedSizeString(&gamecardGetTrimmedSize));
gamecardGetHeader(&card_header); gamecardGetHeader(&card_header);
gamecardGetDecryptedCardInfoArea(&card_info); gamecardGetPlaintextCardInfoArea(&card_info);
gamecardGetCardIdSet(&card_id_set); gamecardGetCardIdSet(&card_id_set);
const SystemVersion upp_version = card_info.upp_version.system_version; const SystemVersion upp_version = card_info.upp_version.system_version;
@ -257,21 +257,44 @@ namespace nxdt::views
this->list->addView(dump_card_image); this->list->addView(dump_card_image);
brls::ListItem *dump_certificate = new brls::ListItem("gamecard_tab/list/dump_certificate/label"_i18n, "gamecard_tab/list/dump_certificate/description"_i18n); this->list->addView(new brls::ListItemGroupSpacing(true));
this->list->addView(dump_certificate);
brls::ListItem *dump_header = new brls::ListItem("gamecard_tab/list/dump_header/label"_i18n, "gamecard_tab/list/dump_header/description"_i18n); brls::Label *advanced_disclaimer = new brls::Label(brls::LabelStyle::DESCRIPTION, "gamecard_tab/list/advanced_disclaimer"_i18n, true);
this->list->addView(dump_header); advanced_disclaimer->setHorizontalAlign(NVG_ALIGN_CENTER);
this->list->addView(advanced_disclaimer);
brls::ListItem *dump_decrypted_cardinfo = new brls::ListItem("gamecard_tab/list/dump_decrypted_cardinfo/label"_i18n, "gamecard_tab/list/dump_decrypted_cardinfo/description"_i18n); this->list->addView(new brls::ListItemGroupSpacing(true));
this->list->addView(dump_decrypted_cardinfo);
brls::ListItem *dump_initial_data = new brls::ListItem("gamecard_tab/list/dump_initial_data/label"_i18n, "gamecard_tab/list/dump_initial_data/description"_i18n); brls::ListItem *dump_initial_data = new brls::ListItem("gamecard_tab/list/dump_initial_data/label"_i18n, "gamecard_tab/list/dump_initial_data/description"_i18n);
this->list->addView(dump_initial_data); this->list->addView(dump_initial_data);
brls::ListItem *dump_certificate = new brls::ListItem("gamecard_tab/list/dump_certificate/label"_i18n, fmt::format("gamecard_tab/list/dump_certificate/description"_i18n, GAMECARD_CERTIFICATE_OFFSET / GAMECARD_PAGE_SIZE));
this->list->addView(dump_certificate);
brls::ListItem *dump_card_id_set = new brls::ListItem("gamecard_tab/list/dump_card_id_set/label"_i18n, "gamecard_tab/list/dump_card_id_set/description"_i18n);
this->list->addView(dump_card_id_set);
brls::ListItem *dump_card_uid = new brls::ListItem("gamecard_tab/list/dump_card_uid/label"_i18n, "gamecard_tab/list/dump_card_uid/description"_i18n);
this->list->addView(dump_card_uid);
brls::ListItem *dump_header = new brls::ListItem("gamecard_tab/list/dump_header/label"_i18n, fmt::format("gamecard_tab/list/dump_header/description"_i18n, 0));
this->list->addView(dump_header);
brls::ListItem *dump_plaintext_cardinfo = new brls::ListItem("gamecard_tab/list/dump_plaintext_cardinfo/label"_i18n, "gamecard_tab/list/dump_plaintext_cardinfo/description"_i18n);
this->list->addView(dump_plaintext_cardinfo);
brls::ListItem *dump_specific_data = new brls::ListItem("gamecard_tab/list/dump_specific_data/label"_i18n, "gamecard_tab/list/dump_specific_data/description"_i18n);
this->list->addView(dump_specific_data);
brls::ListItem *dump_hfs_partitions = new brls::ListItem("gamecard_tab/list/dump_hfs_partitions/label"_i18n, "gamecard_tab/list/dump_hfs_partitions/description"_i18n); brls::ListItem *dump_hfs_partitions = new brls::ListItem("gamecard_tab/list/dump_hfs_partitions/label"_i18n, "gamecard_tab/list/dump_hfs_partitions/description"_i18n);
this->list->addView(dump_hfs_partitions); this->list->addView(dump_hfs_partitions);
brls::ListItem *browse_hfs_partitions = new brls::ListItem("gamecard_tab/list/browse_hfs_partitions/label"_i18n, "gamecard_tab/list/browse_hfs_partitions/description"_i18n);
this->list->addView(browse_hfs_partitions);
brls::ListItem *dump_lafw = new brls::ListItem("gamecard_tab/list/dump_lafw/label"_i18n, "gamecard_tab/list/dump_lafw/description"_i18n);
this->list->addView(dump_lafw);
/* Update focus stack, if needed. */ /* Update focus stack, if needed. */
if (focus_stack_index > -1) this->UpdateFocusStackViewAtIndex(focus_stack_index, this->GetListFirstFocusableChild()); if (focus_stack_index > -1) this->UpdateFocusStackViewAtIndex(focus_stack_index, this->GetListFirstFocusableChild());

View file

@ -293,7 +293,7 @@ namespace nxdt::views
std::stringstream ss(std::string(this->json_data.changelog)); std::stringstream ss(std::string(this->json_data.changelog));
/* Display version string at the top. */ /* Display version string at the top. */
FocusableLabel *version_lbl = new FocusableLabel(brls::LabelStyle::CRASH, std::string(this->json_data.version), true); FocusableLabel *version_lbl = new FocusableLabel(true, false, brls::LabelStyle::CRASH, std::string(this->json_data.version), true);
version_lbl->setHorizontalAlign(NVG_ALIGN_CENTER); version_lbl->setHorizontalAlign(NVG_ALIGN_CENTER);
this->changelog_list->addView(version_lbl); this->changelog_list->addView(version_lbl);
@ -327,7 +327,7 @@ namespace nxdt::views
/* Add line to the changelog view. */ /* Add line to the changelog view. */
if (!(line % 2)) if (!(line % 2))
{ {
this->changelog_list->addView(new FocusableLabel(brls::LabelStyle::SMALL, item, true)); this->changelog_list->addView(new FocusableLabel(false, false, brls::LabelStyle::SMALL, item, true));
} else { } else {
this->changelog_list->addView(new brls::Label(brls::LabelStyle::SMALL, item, true)); this->changelog_list->addView(new brls::Label(brls::LabelStyle::SMALL, item, true));
} }