From 84e17b59267c61e3de3445826aa10af4e7bb8a24 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 10 Mar 2020 18:50:52 +0800 Subject: [PATCH] Remove references to nn::hac::meta::InstructionType --- src/NroProcess.cpp | 4 ++-- src/NroProcess.h | 2 +- src/NsoProcess.cpp | 9 ++++++--- src/NsoProcess.h | 4 ++-- src/RoMetadataProcess.cpp | 8 ++++---- src/RoMetadataProcess.h | 4 ++-- src/UserSettings.cpp | 22 +++++++++++----------- src/UserSettings.h | 6 +++--- 8 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/NroProcess.cpp b/src/NroProcess.cpp index ca7401b..465c1cc 100644 --- a/src/NroProcess.cpp +++ b/src/NroProcess.cpp @@ -43,9 +43,9 @@ void NroProcess::setVerifyMode(bool verify) mVerify = verify; } -void NroProcess::setInstructionType(nn::hac::meta::InstructionType type) +void NroProcess::setIs64BitInstruction(bool flag) { - mRoMeta.setInstructionType(type); + mRoMeta.setIs64BitInstruction(flag); } void NroProcess::setListApi(bool listApi) diff --git a/src/NroProcess.h b/src/NroProcess.h index b019208..2ef222f 100644 --- a/src/NroProcess.h +++ b/src/NroProcess.h @@ -22,7 +22,7 @@ public: void setCliOutputMode(CliOutputMode type); void setVerifyMode(bool verify); - void setInstructionType(nn::hac::meta::InstructionType type); + void setIs64BitInstruction(bool flag); void setListApi(bool listApi); void setListSymbols(bool listSymbols); diff --git a/src/NsoProcess.cpp b/src/NsoProcess.cpp index 7db1e16..7b8db33 100644 --- a/src/NsoProcess.cpp +++ b/src/NsoProcess.cpp @@ -9,7 +9,10 @@ NsoProcess::NsoProcess(): mFile(), mCliOutputMode(_BIT(OUTPUT_BASIC)), - mVerify(false) + mVerify(false), + mIs64BitInstruction(true), + mListApi(false), + mListSymbols(false) { } @@ -38,9 +41,9 @@ void NsoProcess::setVerifyMode(bool verify) mVerify = verify; } -void NsoProcess::setInstructionType(nn::hac::meta::InstructionType type) +void NsoProcess::setIs64BitInstruction(bool flag) { - mRoMeta.setInstructionType(type); + mRoMeta.setIs64BitInstruction(flag); } void NsoProcess::setListApi(bool listApi) diff --git a/src/NsoProcess.h b/src/NsoProcess.h index 70b2f31..2d29784 100644 --- a/src/NsoProcess.h +++ b/src/NsoProcess.h @@ -21,7 +21,7 @@ public: void setCliOutputMode(CliOutputMode type); void setVerifyMode(bool verify); - void setInstructionType(nn::hac::meta::InstructionType type); + void setIs64BitInstruction(bool flag); void setListApi(bool listApi); void setListSymbols(bool listSymbols); @@ -32,7 +32,7 @@ private: fnd::SharedPtr mFile; CliOutputMode mCliOutputMode; bool mVerify; - nn::hac::meta::InstructionType mInstructionType; + bool mIs64BitInstruction; bool mListApi; bool mListSymbols; diff --git a/src/RoMetadataProcess.cpp b/src/RoMetadataProcess.cpp index 3025fbf..14bdb1c 100644 --- a/src/RoMetadataProcess.cpp +++ b/src/RoMetadataProcess.cpp @@ -7,7 +7,7 @@ RoMetadataProcess::RoMetadataProcess() : mCliOutputMode(_BIT(OUTPUT_BASIC)), - mInstructionType(nn::hac::meta::INSTR_64BIT), + mIs64BitInstruction(true), mListApi(false), mListSymbols(false), mApiInfo(), @@ -57,9 +57,9 @@ void RoMetadataProcess::setCliOutputMode(CliOutputMode type) mCliOutputMode = type; } -void RoMetadataProcess::setInstructionType(nn::hac::meta::InstructionType type) +void RoMetadataProcess::setIs64BitInstruction(bool flag) { - mInstructionType = type; + mIs64BitInstruction = flag; } void RoMetadataProcess::setListApi(bool listApi) @@ -126,7 +126,7 @@ void RoMetadataProcess::importApiList() if (mDynSym.size > 0) { - mSymbolList.parseData(mRoBlob.data() + mDynSym.offset, mDynSym.size, mRoBlob.data() + mDynStr.offset, mDynStr.size, mInstructionType == nn::hac::meta::INSTR_64BIT); + mSymbolList.parseData(mRoBlob.data() + mDynSym.offset, mDynSym.size, mRoBlob.data() + mDynStr.offset, mDynStr.size, mIs64BitInstruction); } } diff --git a/src/RoMetadataProcess.h b/src/RoMetadataProcess.h index bef72d9..d94030a 100644 --- a/src/RoMetadataProcess.h +++ b/src/RoMetadataProcess.h @@ -24,7 +24,7 @@ public: void setCliOutputMode(CliOutputMode type); - void setInstructionType(nn::hac::meta::InstructionType type); + void setIs64BitInstruction(bool flag); void setListApi(bool listApi); void setListSymbols(bool listSymbols); @@ -37,7 +37,7 @@ private: const std::string kModuleName = "RoMetadataProcess"; CliOutputMode mCliOutputMode; - nn::hac::meta::InstructionType mInstructionType; + bool mIs64BitInstruction; bool mListApi; bool mListSymbols; diff --git a/src/UserSettings.cpp b/src/UserSettings.cpp index 97fae08..955dd97 100644 --- a/src/UserSettings.cpp +++ b/src/UserSettings.cpp @@ -138,9 +138,9 @@ bool UserSettings::isListSymbols() const return mListSymbols; } -nn::hac::meta::InstructionType UserSettings::getInstType() const +bool UserSettings::getIs64BitInstruction() const { - return mInstructionType; + return mIs64BitInstruction; } const sOptional& UserSettings::getXciUpdatePath() const @@ -564,9 +564,9 @@ void UserSettings::populateUserSettings(sCmdArgs& args) // determine the architecture type for NSO/NRO if (args.inst_type.isSet) - mInstructionType = getInstructionTypeFromString(*args.inst_type); + mIs64BitInstruction = getIs64BitInstructionFromString(*args.inst_type); else - mInstructionType = nn::hac::meta::INSTR_64BIT; // default 64bit + mIs64BitInstruction = true; // default 64bit mListApi = args.list_api.isSet; mListSymbols = args.list_sym.isSet; @@ -800,7 +800,7 @@ bool UserSettings::determineValidNacpFromSample(const fnd::Vec& sample) const nn::hac::sApplicationControlProperty* data = (const nn::hac::sApplicationControlProperty*)sample.data(); - if (data->logo_type > nn::hac::nacp::LOGO_Nintendo) + if (data->logo_type > (byte_t)nn::hac::nacp::LogoType::Nintendo) return false; if (data->display_version[0] == 0) @@ -862,20 +862,20 @@ bool UserSettings::determineValidEsTikFromSample(const fnd::Vec& sample) return true; } -nn::hac::meta::InstructionType UserSettings::getInstructionTypeFromString(const std::string & type_str) +bool UserSettings::getIs64BitInstructionFromString(const std::string & type_str) { std::string str = type_str; std::transform(str.begin(), str.end(), str.begin(), ::tolower); - nn::hac::meta::InstructionType type; + bool flag; if (str == "32bit") - type = nn::hac::meta::INSTR_32BIT; + flag = false; else if (str == "64bit") - type = nn::hac::meta::INSTR_64BIT; + flag = true; else throw fnd::Exception(kModuleName, "Unsupported instruction type: " + str); - return type; + return flag; } void UserSettings::getHomePath(std::string& path) const @@ -944,7 +944,7 @@ void UserSettings::dumpKeyConfig() const dumpAesKey(aes_key, "Extended Header Encryption Key", 2); - if (mKeyCfg.getAcidSignKey(rsa2048_key) == true) + if (mKeyCfg.getAcidSignKey(rsa2048_key, 0x00) == true) dumpRsa2048Key(rsa2048_key, "ACID Signer Key", 1); diff --git a/src/UserSettings.h b/src/UserSettings.h index dff6153..379fb9b 100644 --- a/src/UserSettings.h +++ b/src/UserSettings.h @@ -29,7 +29,7 @@ public: bool isListFs() const; bool isListApi() const; bool isListSymbols() const; - nn::hac::meta::InstructionType getInstType() const; + bool getIs64BitInstruction() const; // specialised paths const sOptional& getXciUpdatePath() const; @@ -114,7 +114,7 @@ private: bool mListApi; bool mListSymbols; - nn::hac::meta::InstructionType mInstructionType; + bool mIs64BitInstruction; void populateCmdArgs(const std::vector& arg_list, sCmdArgs& cmd_args); void populateKeyset(sCmdArgs& args); @@ -126,7 +126,7 @@ private: bool determineValidNacpFromSample(const fnd::Vec& sample) const; bool determineValidEsCertFromSample(const fnd::Vec& sample) const; bool determineValidEsTikFromSample(const fnd::Vec& sample) const; - nn::hac::meta::InstructionType getInstructionTypeFromString(const std::string& type_str); + bool getIs64BitInstructionFromString(const std::string& type_str); void getHomePath(std::string& path) const; void getSwitchPath(std::string& path) const;