From 7abcedb7e5d1765616f8d27e8b9be3543c489997 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 13 May 2023 16:45:01 +0800 Subject: [PATCH] Fix formatting of NCA Key Area. --- src/NcaProcess.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/NcaProcess.cpp b/src/NcaProcess.cpp index db0f87b..5a60744 100644 --- a/src/NcaProcess.cpp +++ b/src/NcaProcess.cpp @@ -488,22 +488,18 @@ void nstool::NcaProcess::displayHeader() if (mContentKey.kak_list.size() > 0 && mCliOutputMode.show_keydata) { fmt::print(" Key Area:\n"); - fmt::print(" <--------------------------------------------------------------------------------------------------------->\n"); - fmt::print(" | IDX | ENCRYPTED KEY | DECRYPTED KEY |\n"); - fmt::print(" |-----|-------------------------------------------------|-------------------------------------------------|\n"); + fmt::print(" <--------------------------------------------------------------------------->\n"); + fmt::print(" | IDX | ENCRYPTED KEY | DECRYPTED KEY |\n"); + fmt::print(" |-----|----------------------------------|----------------------------------|\n"); for (size_t i = 0; i < mContentKey.kak_list.size(); i++) { - fmt::print(" | {:3d} | {:s} | ", mContentKey.kak_list[i].index, tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].enc.data(), mContentKey.kak_list[i].enc.size(), true, "")); - + std::string enc_key = tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].enc.data(), mContentKey.kak_list[i].enc.size(), true, ""); + std::string dec_key = mContentKey.kak_list[i].decrypted ? tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].dec.data(), mContentKey.kak_list[i].dec.size(), true, "") : ""; - if (mContentKey.kak_list[i].decrypted) - fmt::print("{:s}", tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].dec.data(), mContentKey.kak_list[i].dec.size(), true, "")); - else - fmt::print(" "); - - fmt::print(" |\n"); + fmt::print(" | {:3d} | {:32s} | {:32s} |\n", mContentKey.kak_list[i].index, enc_key, dec_key); + } - fmt::print(" <--------------------------------------------------------------------------------------------------------->\n"); + fmt::print(" <--------------------------------------------------------------------------->\n"); } if (mCliOutputMode.show_layout)