diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 4598e5925d..919de94e27 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -567,23 +567,41 @@ namespace fmt } }; - template - struct get_fmt - { - static std::string text(const char* fmt, size_t len, const char(&arg)[size]) - { - if (fmt[len - 1] == 's') - { - return std::string(arg, size); - } - else - { - throw "Invalid formatting (const char[size])"; - } + //template + //struct get_fmt + //{ + // static std::string text(const char* fmt, size_t len, const char(&arg)[size]) + // { + // if (fmt[len - 1] == 's') + // { + // return std::string(arg, size); + // } + // else + // { + // throw "Invalid formatting (char[size])"; + // } - return{}; - } - }; + // return{}; + // } + //}; + + //template + //struct get_fmt + //{ + // static std::string text(const char* fmt, size_t len, const char(&arg)[size]) + // { + // if (fmt[len - 1] == 's') + // { + // return std::string(arg, size); + // } + // else + // { + // throw "Invalid formatting (const char[size])"; + // } + + // return{}; + // } + //}; template<> struct get_fmt @@ -633,8 +651,9 @@ namespace fmt float (%x, %f) double (%x, %f) bool (%x, %d, %s) - char*, const char*, const char[N], std::string (%s) + char*, const char*, std::string (%s) be_t<> of any appropriate type in this list + enum of any appropriate type in this list Supported formatting: %d - decimal; only basic std::to_string() functionality diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index bf9fd0edea..4dcac95248 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -164,12 +164,12 @@ bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir) dec_pkg_f.Read(buf, entry.name_size); buf[entry.name_size] = 0; - switch (entry.type.ToBE() >> 24) + switch (entry.type.data()) { - case PKG_FILE_ENTRY_NPDRM: - case PKG_FILE_ENTRY_NPDRMEDAT: - case PKG_FILE_ENTRY_SDAT: - case PKG_FILE_ENTRY_REGULAR: + case se32(PKG_FILE_ENTRY_NPDRM): + case se32(PKG_FILE_ENTRY_NPDRMEDAT): + case se32(PKG_FILE_ENTRY_SDAT): + case se32(PKG_FILE_ENTRY_REGULAR): { rFile out; auto path = dir + std::string(buf, entry.name_size); @@ -199,7 +199,7 @@ bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir) } } - case PKG_FILE_ENTRY_FOLDER: + case se32(PKG_FILE_ENTRY_FOLDER): { auto path = dir + std::string(buf, entry.name_size); if (!rExists(path) && !rMkdir(path)) @@ -213,7 +213,7 @@ bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir) default: { - LOG_ERROR(LOADER, "PKG Loader: unknown PKG file entry: 0x%x", entry.type.ToLE()); + LOG_ERROR(LOADER, "PKG Loader: unknown PKG file entry: 0x%x", entry.type); return false; } }