mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2025-02-16 21:45:39 +00:00
GameCardTab: display table with gamecard properties.
This commit is contained in:
parent
49d7ec8ab8
commit
3629f0029f
4 changed files with 85 additions and 4 deletions
|
@ -137,7 +137,8 @@ typedef enum {
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GameCardCompatibilityType_Normal = 0,
|
GameCardCompatibilityType_Normal = 0,
|
||||||
GameCardCompatibilityType_Terra = 1
|
GameCardCompatibilityType_Terra = 1,
|
||||||
|
GameCardCompatibilityType_Count = 2
|
||||||
} GameCardCompatibilityType;
|
} GameCardCompatibilityType;
|
||||||
|
|
||||||
/// Encrypted using AES-128-CBC with the XCI header key (found in FS program memory under HOS 9.0.0+) and the IV from `GameCardHeader`.
|
/// Encrypted using AES-128-CBC with the XCI header key (found in FS program memory under HOS 9.0.0+) and the IV from `GameCardHeader`.
|
||||||
|
|
|
@ -39,6 +39,16 @@ namespace nxdt::views
|
||||||
ErrorFrame *error_frame = nullptr;
|
ErrorFrame *error_frame = nullptr;
|
||||||
|
|
||||||
brls::List *list = nullptr;
|
brls::List *list = nullptr;
|
||||||
|
|
||||||
|
brls::Table *properties_table = nullptr;
|
||||||
|
brls::TableRow *capacity = nullptr;
|
||||||
|
brls::TableRow *total_size = nullptr;
|
||||||
|
brls::TableRow *trimmed_size = nullptr;
|
||||||
|
brls::TableRow *update_version = nullptr;
|
||||||
|
brls::TableRow *lafw_version = nullptr;
|
||||||
|
brls::TableRow *sdk_version = nullptr;
|
||||||
|
brls::TableRow *compatibility_type = nullptr;
|
||||||
|
|
||||||
brls::ListItem *dump_card_image = nullptr;
|
brls::ListItem *dump_card_image = nullptr;
|
||||||
brls::ListItem *dump_certificate = nullptr;
|
brls::ListItem *dump_certificate = nullptr;
|
||||||
brls::ListItem *dump_header = nullptr;
|
brls::ListItem *dump_header = nullptr;
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"list": {
|
"list": {
|
||||||
|
"properties_table": {
|
||||||
|
"header": "Gamecard properties",
|
||||||
|
"capacity": "Capacity",
|
||||||
|
"total_size": "Total size",
|
||||||
|
"trimmed_size": "Trimmed size",
|
||||||
|
"update_version": "Bundled update version",
|
||||||
|
"lafw_version": "Required Lotus ASIC firmware version",
|
||||||
|
"lafw_version_value": "%lu or greater",
|
||||||
|
"sdk_version": "SDK version",
|
||||||
|
"compatibility_type": "Compatibility type"
|
||||||
|
},
|
||||||
|
|
||||||
|
"dump_options": "Dump options",
|
||||||
|
|
||||||
"dump_card_image": {
|
"dump_card_image": {
|
||||||
"label": "Dump gamecard image",
|
"label": "Dump gamecard image",
|
||||||
"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."
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nxdt_includes.h>
|
#include <nxdt_utils.h>
|
||||||
#include <gamecard_tab.hpp>
|
#include <gamecard_tab.hpp>
|
||||||
|
|
||||||
namespace i18n = brls::i18n; /* For getStr(). */
|
namespace i18n = brls::i18n; /* For getStr(). */
|
||||||
|
@ -27,15 +27,36 @@ using namespace i18n::literals; /* For _i18n. */
|
||||||
|
|
||||||
namespace nxdt::views
|
namespace nxdt::views
|
||||||
{
|
{
|
||||||
|
static const char *GameCardCompatibilityTypeStrings[GameCardCompatibilityType_Count] = {
|
||||||
|
[GameCardCompatibilityType_Normal] = "Normal",
|
||||||
|
[GameCardCompatibilityType_Terra] = "Terra"
|
||||||
|
};
|
||||||
|
|
||||||
GameCardTab::GameCardTab(nxdt::tasks::GameCardTask *gc_status_task) : brls::LayerView(), gc_status_task(gc_status_task)
|
GameCardTab::GameCardTab(nxdt::tasks::GameCardTask *gc_status_task) : brls::LayerView(), gc_status_task(gc_status_task)
|
||||||
{
|
{
|
||||||
/* Add error frame. */
|
/* Error frame. */
|
||||||
this->error_frame = new ErrorFrame("gamecard_tab/error_frame/not_inserted"_i18n);
|
this->error_frame = new ErrorFrame("gamecard_tab/error_frame/not_inserted"_i18n);
|
||||||
this->addLayerWrapper(this->error_frame);
|
this->addLayerWrapper(this->error_frame);
|
||||||
|
|
||||||
/* Add list. */
|
/* List. */
|
||||||
this->list = new brls::List();
|
this->list = new brls::List();
|
||||||
|
|
||||||
|
/* Gamecard properties table. */
|
||||||
|
this->list->addView(new brls::Header("gamecard_tab/list/properties_table/header"_i18n));
|
||||||
|
|
||||||
|
this->properties_table = new brls::Table();
|
||||||
|
this->capacity = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/capacity"_i18n);
|
||||||
|
this->total_size = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/total_size"_i18n);
|
||||||
|
this->trimmed_size = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/trimmed_size"_i18n);
|
||||||
|
this->update_version = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/update_version"_i18n);
|
||||||
|
this->lafw_version = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/lafw_version"_i18n);
|
||||||
|
this->sdk_version = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/sdk_version"_i18n);
|
||||||
|
this->compatibility_type = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/compatibility_type"_i18n);
|
||||||
|
this->list->addView(this->properties_table);
|
||||||
|
|
||||||
|
/* ListItem elements. */
|
||||||
|
this->list->addView(new brls::Header("gamecard_tab/list/dump_options"_i18n));
|
||||||
|
|
||||||
this->dump_card_image = new brls::ListItem("gamecard_tab/list/dump_card_image/label"_i18n, "gamecard_tab/list/dump_card_image/description"_i18n);
|
this->dump_card_image = new brls::ListItem("gamecard_tab/list/dump_card_image/label"_i18n, "gamecard_tab/list/dump_card_image/description"_i18n);
|
||||||
this->list->addView(this->dump_card_image);
|
this->list->addView(this->dump_card_image);
|
||||||
|
|
||||||
|
@ -78,8 +99,43 @@ namespace nxdt::views
|
||||||
this->error_frame->SetMessage(i18n::getStr("gamecard_tab/error_frame/info_not_loaded"_i18n, GITHUB_NEW_ISSUE_URL));
|
this->error_frame->SetMessage(i18n::getStr("gamecard_tab/error_frame/info_not_loaded"_i18n, GITHUB_NEW_ISSUE_URL));
|
||||||
break;
|
break;
|
||||||
case GameCardStatus_InsertedAndInfoLoaded:
|
case GameCardStatus_InsertedAndInfoLoaded:
|
||||||
|
{
|
||||||
|
u64 size = 0;
|
||||||
|
GameCardInfo card_info = {0};
|
||||||
|
char strbuf[0x100] = {0};
|
||||||
|
|
||||||
|
gamecardGetRomCapacity(&size);
|
||||||
|
utilsGenerateFormattedSizeString(size, strbuf, sizeof(strbuf));
|
||||||
|
this->capacity->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
gamecardGetTotalSize(&size);
|
||||||
|
utilsGenerateFormattedSizeString(size, strbuf, sizeof(strbuf));
|
||||||
|
this->total_size->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
gamecardGetTrimmedSize(&size);
|
||||||
|
utilsGenerateFormattedSizeString(size, strbuf, sizeof(strbuf));
|
||||||
|
this->trimmed_size->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
gamecardGetDecryptedCardInfoArea(&card_info);
|
||||||
|
|
||||||
|
snprintf(strbuf, sizeof(strbuf), "%u.%u.%u-%u.%u (v%u)", card_info.upp_version.major, card_info.upp_version.minor, card_info.upp_version.micro, \
|
||||||
|
card_info.upp_version.major_relstep, card_info.upp_version.minor_relstep, card_info.upp_version.value);
|
||||||
|
this->update_version->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
snprintf(strbuf, sizeof(strbuf), "gamecard_tab/list/properties_table/lafw_version_value"_i18n.c_str(), card_info.fw_version + 1);
|
||||||
|
this->lafw_version->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
snprintf(strbuf, sizeof(strbuf), "%u.%u.%u-%u (v%u)", card_info.fw_mode.major, card_info.fw_mode.minor, card_info.fw_mode.micro, card_info.fw_mode.relstep, card_info.fw_mode.value);
|
||||||
|
this->sdk_version->setValue(std::string(strbuf));
|
||||||
|
|
||||||
|
snprintf(strbuf, sizeof(strbuf), "%s (%u)", \
|
||||||
|
card_info.compatibility_type >= GameCardCompatibilityType_Count ? "Unknown" : GameCardCompatibilityTypeStrings[card_info.compatibility_type], card_info.compatibility_type);
|
||||||
|
this->compatibility_type->setValue(std::string(strbuf));
|
||||||
|
|
||||||
this->changeLayerWrapper(this->list);
|
this->changeLayerWrapper(this->list);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue