mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-04 01:09:58 +00:00
patch_manager: Make a few functions internally linked
These functions are only used within this translation unit, so we can make them internally linked.
This commit is contained in:
parent
0bac7b6a95
commit
637ab14ae6
2 changed files with 12 additions and 15 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
namespace {
|
||||||
|
|
||||||
constexpr u64 SINGLE_BYTE_MODULUS = 0x100;
|
constexpr u64 SINGLE_BYTE_MODULUS = 0x100;
|
||||||
constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
|
constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
|
||||||
|
@ -36,7 +37,13 @@ constexpr std::array<const char*, 14> EXEFS_FILE_NAMES{
|
||||||
"subsdk3", "subsdk4", "subsdk5", "subsdk6", "subsdk7", "subsdk8", "subsdk9",
|
"subsdk3", "subsdk4", "subsdk5", "subsdk6", "subsdk7", "subsdk8", "subsdk9",
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string FormatTitleVersion(u32 version, TitleVersionFormat format) {
|
enum class TitleVersionFormat : u8 {
|
||||||
|
ThreeElements, ///< vX.Y.Z
|
||||||
|
FourElements, ///< vX.Y.Z.W
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string FormatTitleVersion(u32 version,
|
||||||
|
TitleVersionFormat format = TitleVersionFormat::ThreeElements) {
|
||||||
std::array<u8, sizeof(u32)> bytes{};
|
std::array<u8, sizeof(u32)> bytes{};
|
||||||
bytes[0] = version % SINGLE_BYTE_MODULUS;
|
bytes[0] = version % SINGLE_BYTE_MODULUS;
|
||||||
for (std::size_t i = 1; i < bytes.size(); ++i) {
|
for (std::size_t i = 1; i < bytes.size(); ++i) {
|
||||||
|
@ -49,6 +56,8 @@ std::string FormatTitleVersion(u32 version, TitleVersionFormat format) {
|
||||||
return fmt::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]);
|
return fmt::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a directory with name matching name case-insensitive. Returns nullptr if directory
|
||||||
|
// doesn't have a directory with name.
|
||||||
VirtualDir FindSubdirectoryCaseless(const VirtualDir dir, std::string_view name) {
|
VirtualDir FindSubdirectoryCaseless(const VirtualDir dir, std::string_view name) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return dir->GetSubdirectory(name);
|
return dir->GetSubdirectory(name);
|
||||||
|
@ -64,6 +73,7 @@ VirtualDir FindSubdirectoryCaseless(const VirtualDir dir, std::string_view name)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
PatchManager::PatchManager(u64 title_id) : title_id(title_id) {}
|
PatchManager::PatchManager(u64 title_id) : title_id(title_id) {}
|
||||||
|
|
||||||
|
@ -472,8 +482,7 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
|
||||||
if (meta_ver.value_or(0) == 0) {
|
if (meta_ver.value_or(0) == 0) {
|
||||||
out.insert_or_assign(update_label, "");
|
out.insert_or_assign(update_label, "");
|
||||||
} else {
|
} else {
|
||||||
out.insert_or_assign(
|
out.insert_or_assign(update_label, FormatTitleVersion(*meta_ver));
|
||||||
update_label, FormatTitleVersion(*meta_ver, TitleVersionFormat::ThreeElements));
|
|
||||||
}
|
}
|
||||||
} else if (update_raw != nullptr) {
|
} else if (update_raw != nullptr) {
|
||||||
out.insert_or_assign(update_label, "PACKED");
|
out.insert_or_assign(update_label, "PACKED");
|
||||||
|
|
|
@ -22,18 +22,6 @@ namespace FileSys {
|
||||||
class NCA;
|
class NCA;
|
||||||
class NACP;
|
class NACP;
|
||||||
|
|
||||||
enum class TitleVersionFormat : u8 {
|
|
||||||
ThreeElements, ///< vX.Y.Z
|
|
||||||
FourElements, ///< vX.Y.Z.W
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string FormatTitleVersion(u32 version,
|
|
||||||
TitleVersionFormat format = TitleVersionFormat::ThreeElements);
|
|
||||||
|
|
||||||
// Returns a directory with name matching name case-insensitive. Returns nullptr if directory
|
|
||||||
// doesn't have a directory with name.
|
|
||||||
VirtualDir FindSubdirectoryCaseless(VirtualDir dir, std::string_view name);
|
|
||||||
|
|
||||||
// A centralized class to manage patches to games.
|
// A centralized class to manage patches to games.
|
||||||
class PatchManager {
|
class PatchManager {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue