mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
Add support for renamed GameCardUtil class, and now uses GameCardUtil for enum->string resolution.
This commit is contained in:
parent
c71eb3227b
commit
5e4f4b90f8
|
@ -2,7 +2,7 @@
|
|||
#include <iomanip>
|
||||
#include <fnd/SimpleTextOutput.h>
|
||||
#include <fnd/OffsetAdjustedIFile.h>
|
||||
#include <nn/hac/GameCardUtils.h>
|
||||
#include <nn/hac/GameCardUtil.h>
|
||||
#include "GameCardProcess.h"
|
||||
|
||||
GameCardProcess::GameCardProcess() :
|
||||
|
@ -108,7 +108,7 @@ void GameCardProcess::importHeader()
|
|||
fnd::aes::sAes128Key header_key;
|
||||
if (mKeyCfg.getXciHeaderKey(header_key))
|
||||
{
|
||||
nn::hac::GameCardUtils::decryptXciHeader(&hdr_ptr->header, header_key.key);
|
||||
nn::hac::GameCardUtil::decryptXciHeader(&hdr_ptr->header, header_key.key);
|
||||
mProccessExtendedHeader = true;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ void GameCardProcess::displayHeader()
|
|||
{
|
||||
std::cout << "[GameCard Header]" << std::endl;
|
||||
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
||||
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
||||
std::cout << " RomSize: " << nn::hac::GameCardUtil::getRomSizeAsString((nn::hac::gc::RomSize)mHdr.getRomSizeType());
|
||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||
std::cout << " (0x" << std::hex << (uint32_t)mHdr.getRomSizeType() << ")";
|
||||
std::cout << std::endl;
|
||||
|
@ -132,14 +132,14 @@ void GameCardProcess::displayHeader()
|
|||
{
|
||||
if (_HAS_BIT(mHdr.getFlags(), i))
|
||||
{
|
||||
std::cout << " " << getHeaderFlagStr(i) << std::endl;
|
||||
std::cout << " " << nn::hac::GameCardUtil::getHeaderFlagsAsString((nn::hac::gc::HeaderFlags)i) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||
{
|
||||
std::cout << " InitialData:" << std::endl;
|
||||
std::cout << " KekIndex: " << getKekIndexStr(mHdr.getKekIndex()) << "(" << std::dec << (uint32_t)mHdr.getKekIndex() << ")" << std::endl;
|
||||
std::cout << " KekIndex: " << nn::hac::GameCardUtil::getKekIndexAsString((nn::hac::gc::KekIndex)mHdr.getKekIndex()) << "(" << std::dec << (uint32_t)mHdr.getKekIndex() << ")" << std::endl;
|
||||
std::cout << " TitleKeyDecIndex: " << std::dec << (uint32_t)mHdr.getTitleKeyDecIndex() << std::endl;
|
||||
std::cout << " Hash:" << std::endl;
|
||||
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getInitialDataHash().bytes, 0x10, true, ":") << std::endl;
|
||||
|
@ -157,22 +157,22 @@ void GameCardProcess::displayHeader()
|
|||
{
|
||||
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
||||
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtil::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
||||
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtil::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
||||
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtil::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
||||
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
||||
std::cout << " (0x" << std::hex << nn::hac::GameCardUtil::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " PartitionFs Header:" << std::endl;
|
||||
|
@ -190,15 +190,15 @@ void GameCardProcess::displayHeader()
|
|||
if (mProccessExtendedHeader)
|
||||
{
|
||||
std::cout << "[GameCard Extended Header]" << std::endl;
|
||||
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVersion() << "(" << getCardFwVersionDescriptionStr(mHdr.getFwVersion()) << ")" << std::endl;
|
||||
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVersion() << "(" << nn::hac::GameCardUtil::getCardFwVersionDescriptionAsString((nn::hac::gc::FwVersion)mHdr.getFwVersion()) << ")" << std::endl;
|
||||
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
||||
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
||||
std::cout << " CardClockRate: " << nn::hac::GameCardUtil::getCardClockRateAsString((nn::hac::gc::CardClockRate)mHdr.getAccCtrl1()) << std::endl;
|
||||
std::cout << " Wait1TimeRead: 0x" << std::hex << mHdr.getWait1TimeRead() << std::endl;
|
||||
std::cout << " Wait2TimeRead: 0x" << std::hex << mHdr.getWait2TimeRead() << std::endl;
|
||||
std::cout << " Wait1TimeWrite: 0x" << std::hex << mHdr.getWait1TimeWrite() << std::endl;
|
||||
std::cout << " Wait2TimeWrite: 0x" << std::hex << mHdr.getWait2TimeWrite() << std::endl;
|
||||
std::cout << " FwMode: 0x" << std::hex << mHdr.getFwMode() << std::endl;
|
||||
std::cout << " CompatibilityType: " << getCardCompatibiltyType(mHdr.getCompatibilityType()) << "(" << std::dec << mHdr.getCompatibilityType() << ")" << std::endl;
|
||||
std::cout << " CompatibilityType: " << nn::hac::GameCardUtil::getCompatibilityTypeAsString((nn::hac::gc::CompatibilityType)mHdr.getCompatibilityType()) << "(" << std::dec << mHdr.getCompatibilityType() << ")" << std::endl;
|
||||
std::cout << " Update Partition Info:" << std::endl;
|
||||
#define _SPLIT_VER(ver) std::dec << ((ver>>26) & 0x3f) << "." << ((ver>>20) & 0x3f) << "." << ((ver>>16) & 0xf) << "." << (ver & 0xffff)
|
||||
std::cout << " CUP Version: v" << std::dec << mHdr.getUppVersion() << " (" << _SPLIT_VER(mHdr.getUppVersion()) << ")" << std::endl;
|
||||
|
@ -265,149 +265,4 @@ void GameCardProcess::processPartitionPfs()
|
|||
|
||||
tmp.process();
|
||||
}
|
||||
}
|
||||
|
||||
const char* GameCardProcess::getKekIndexStr(byte_t kek_index) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (kek_index)
|
||||
{
|
||||
case (nn::hac::gc::KEK_PROD):
|
||||
str = "Production";
|
||||
break;
|
||||
case (nn::hac::gc::KEK_DEV):
|
||||
str = "Development";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
const char* GameCardProcess::getRomSizeStr(byte_t rom_size) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (rom_size)
|
||||
{
|
||||
case (nn::hac::gc::ROM_SIZE_1GB):
|
||||
str = "1GB";
|
||||
break;
|
||||
case (nn::hac::gc::ROM_SIZE_2GB):
|
||||
str = "2GB";
|
||||
break;
|
||||
case (nn::hac::gc::ROM_SIZE_4GB):
|
||||
str = "4GB";
|
||||
break;
|
||||
case (nn::hac::gc::ROM_SIZE_8GB):
|
||||
str = "8GB";
|
||||
break;
|
||||
case (nn::hac::gc::ROM_SIZE_16GB):
|
||||
str = "16GB";
|
||||
break;
|
||||
case (nn::hac::gc::ROM_SIZE_32GB):
|
||||
str = "32GB";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
const char* GameCardProcess::getHeaderFlagStr(byte_t flag) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case (nn::hac::gc::FLAG_AUTOBOOT):
|
||||
str = "AutoBoot";
|
||||
break;
|
||||
case (nn::hac::gc::FLAG_HISTORY_ERASE):
|
||||
str = "HistoryErase";
|
||||
break;
|
||||
case (nn::hac::gc::FLAG_REPAIR_TIME_REVISOR_TOOL):
|
||||
str = "RepairTimeRevisorTool";
|
||||
break;
|
||||
case (nn::hac::gc::FLAG_ALLOW_CUP_TO_CHINA):
|
||||
str = "AllowCupToChina";
|
||||
break;
|
||||
case (nn::hac::gc::FLAG_ALLOW_CUP_TO_GLOBAL):
|
||||
str = "AllowCupToGlobal";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
const char* GameCardProcess::getCardFwVersionDescriptionStr(uint64_t version) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case (nn::hac::gc::FWVER_DEV):
|
||||
str = "ForDevelopment";
|
||||
break;
|
||||
case (nn::hac::gc::FWVER_PROD):
|
||||
str = "1.0.0+";
|
||||
break;
|
||||
case (nn::hac::gc::FWVER_PROD_SINCE_4_0_0NUP):
|
||||
str = "4.0.0+";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
const char* GameCardProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (acc_ctrl_1)
|
||||
{
|
||||
case (nn::hac::gc::CLOCK_RATE_25):
|
||||
str = "20 MHz";
|
||||
break;
|
||||
case (nn::hac::gc::CLOCK_RATE_50):
|
||||
str = "50 MHz";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
const char* GameCardProcess::getCardCompatibiltyType(byte_t flag) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case (nn::hac::gc::COMPAT_GLOBAL):
|
||||
str = "Global";
|
||||
break;
|
||||
case (nn::hac::gc::COMPAT_CHINA):
|
||||
str = "China";
|
||||
break;
|
||||
default:
|
||||
str = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
|
@ -73,12 +73,4 @@ private:
|
|||
void validateXciSignature();
|
||||
void processRootPfs();
|
||||
void processPartitionPfs();
|
||||
|
||||
// strings
|
||||
const char* getKekIndexStr(byte_t kek_index) const;
|
||||
const char* getRomSizeStr(byte_t rom_size) const;
|
||||
const char* getHeaderFlagStr(byte_t flag) const;
|
||||
const char* getCardFwVersionDescriptionStr(uint64_t version) const;
|
||||
const char* getCardClockRate(uint32_t acc_ctrl_1) const;
|
||||
const char* getCardCompatibiltyType(byte_t flag) const;
|
||||
};
|
Loading…
Reference in a new issue