From e31a569b130d30eccd3f41ef5691cb2aca77e4f6 Mon Sep 17 00:00:00 2001 From: Sun Daowen Date: Sat, 25 May 2019 10:03:17 +0800 Subject: [PATCH] sync with libsundaowen_src --- CMakeLists.txt | 2 +- README.md | 1 + bin/ext_key.txt | 4 ++++ src/romfs.cpp | 2 +- src/utility.h | 56 +++++++++++++++++++++++++++---------------------- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fb2fa02..4346c09e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ if(APPLE) endif() set(_3DSTOOL_MAJOR 1) set(_3DSTOOL_MINOR 2) -set(_3DSTOOL_PATCHLEVEL 5) +set(_3DSTOOL_PATCHLEVEL 6) if(NOT MSVC_IDE AND NOT XCODE_VERSION AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() diff --git a/README.md b/README.md index f61fec32..2221960f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ An all-in-one tool for extracting/creating 3ds roms. - v1.2.3 @ 2018.09.03 - Fix extract cxi without exefs bug - v1.2.4 @ 2019.03.28 - Improve lock region - v1.2.5 @ 2019.04.20 - Fix extract exefs without exefs-dir bug +- v1.2.6 @ 2019.05.25 - Sync with libsundaowen_src ### v1.1 diff --git a/bin/ext_key.txt b/bin/ext_key.txt index f14202bd..8ea9c008 100644 --- a/bin/ext_key.txt +++ b/bin/ext_key.txt @@ -1261,6 +1261,7 @@ 00040000001C0800 11B5116D0D352DA9273CC1F5285581AF 00040000001C0900 68983CB2C595FCA3437E21A450EC7961 00040000001C0A00 BDEABDA61114C66E270C095724C7FEE8 +00040000001C0B00 337E15A572F8ACCF07A732A46D7955B4 00040000001C0D00 10D3EC899520A290B36CB2C03D2F6F96 00040000001C0E00 3965CADA8B34D1DCB93733EF7604B0A0 00040000001C0F00 008BB1FDEF704045434C9933B0DB69B9 @@ -1397,6 +1398,7 @@ 00040000001CD900 B71BB287BAE85D3620F422EC6D694E15 00040000001CDD00 E9BDC86CAE90B6BC9AFAD809FDF44BEF 00040000001CDE00 6563EB16B265D6F6237C2B4F5234C321 +00040000001CDF00 0B94739B63E1058B5FCAD795DB566AE3 00040000001CE000 B9C2D4CFDD33FEC7A65A5BC474A7AE1D 00040000001CE100 71D654EAA1A6B322D23D36B8A91A4201 00040000001CE800 BA12D61C0947FE59A22CC94EB32D3B5A @@ -1462,6 +1464,7 @@ 00040000001D3E00 9A616CF2F3DA6848EA1294283A4E8E13 00040000001D3F00 1A82A36C84C2ECF1933D6156D7E3F333 00040000001D4000 80CA8BB3E11F631F01E7540AA3454CAE +00040000001D4100 174DE15226508C9460F23A68D5A37EB5 00040000001D4500 9F62F7E161D51974F2CCE8B860CE749F 00040000001D4C00 DAC522C7FA4B8E1F3ED9D78A424624C9 00040000001D4E00 227757FFA5299D99F4D47DCBBB96CB67 @@ -1493,6 +1496,7 @@ 00040000001D7300 4245F9F8820DFFCD18020FC5A7A9FFE9 00040000001D7400 BC02E6103907A3604599573F37FE73EC 00040000001D7500 E63BDD6E998EC03E75E0B0AD4AE9208A +00040000001D7600 1D367936B876528FEB7D22C1F33592CA 00040000001D7800 EB704CAC88F3CFF78B27F268C679CB1A 00040000001D7D00 14A95854B221AA65D740FDD4682DF318 00040000001D7E00 1D2C4FD379D03B2881AEA20BD5EA6081 diff --git a/src/romfs.cpp b/src/romfs.cpp index 2a47987b..034843d8 100644 --- a/src/romfs.cpp +++ b/src/romfs.cpp @@ -289,7 +289,7 @@ void CRomFs::buildIgnoreList() if (StartWith(sTxt, "//")) { vector vIngoreTag = Split(sTxt.c_str() + strlen("//"), ":"); - if (vIngoreTag.size() == 1 && EndWith(sTxt, ":")) + if (vIngoreTag.size() == 2 && vIngoreTag[1].empty()) { vIngoreTag[0] = Trim(vIngoreTag[0]); if (vIngoreTag[0] == "ignore") diff --git a/src/utility.h b/src/utility.h index 20161df7..4859b003 100644 --- a/src/utility.h +++ b/src/utility.h @@ -359,21 +359,24 @@ template vector Split(const T& a_sString, const T& a_sSeparator) { vector vString; - for (typename T::size_type uOffset = 0; uOffset < a_sString.size(); uOffset += a_sSeparator.size()) + if (a_sSeparator.size() != 0) { - typename T::size_type uPos = a_sString.find(a_sSeparator, uOffset); - if (uPos != T::npos) + for (typename T::size_type uOffset = 0; uOffset <= a_sString.size(); uOffset += a_sSeparator.size()) { - vString.push_back(a_sString.substr(uOffset, uPos - uOffset)); - uOffset = uPos; - } - else - { - vString.push_back(a_sString.substr(uOffset)); - break; + typename T::size_type uPos = a_sString.find(a_sSeparator, uOffset); + if (uPos != T::npos) + { + vString.push_back(a_sString.substr(uOffset, uPos - uOffset)); + uOffset = uPos; + } + else + { + vString.push_back(a_sString.substr(uOffset)); + break; + } } } - if (vString.empty()) + else { vString.push_back(a_sString); } @@ -399,21 +402,24 @@ template vector SplitOf(const T& a_sString, const T& a_sSeparatorSet) { vector vString; - for (typename T::const_iterator it = a_sString.begin(); it != a_sString.end(); ++it) + if (a_sSeparatorSet.size() != 0) { - typename T::const_iterator itPos = find_first_of(it, a_sString.end(), a_sSeparatorSet.begin(), a_sSeparatorSet.end()); - if (itPos != a_sString.end()) + for (typename T::size_type uOffset = 0; uOffset <= a_sString.size(); uOffset++) { - vString.push_back(a_sString.substr(it - a_sString.begin(), itPos - it)); - it = itPos; - } - else - { - vString.push_back(a_sString.substr(it - a_sString.begin())); - break; + typename T::size_type uPos = a_sString.find_first_of(a_sSeparatorSet, uOffset); + if (uPos != T::npos) + { + vString.push_back(a_sString.substr(uOffset, uPos - uOffset)); + uOffset = uPos; + } + else + { + vString.push_back(a_sString.substr(uOffset)); + break; + } } } - if (vString.empty()) + else { vString.push_back(a_sString); } @@ -436,9 +442,9 @@ vector SplitOf(const T& a_sString, const typename T::value_type* a_pSeparator } template -bool StartWith(const T& a_sString, const T& a_sPrefix, u32 a_uStart = 0) +bool StartWith(const T& a_sString, const T& a_sPrefix, typename T::size_type a_uStart = 0) { - if (a_uStart > static_cast(a_sString.size())) + if (a_uStart > a_sString.size()) { return false; } @@ -449,7 +455,7 @@ bool StartWith(const T& a_sString, const T& a_sPrefix, u32 a_uStart = 0) } template -bool StartWith(const T& a_sString, const typename T::value_type* a_pPrefix, u32 a_uStart = 0) +bool StartWith(const T& a_sString, const typename T::value_type* a_pPrefix, typename T::size_type a_uStart = 0) { if (a_pPrefix == nullptr) {