1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-22 02:12:06 +00:00

ncm: update enums, refactor comparison operators

This commit is contained in:
Michael Scire 2022-10-18 11:10:17 -07:00
parent 05fee5d53c
commit 8ce4f19615
7 changed files with 52 additions and 49 deletions

View file

@ -27,6 +27,7 @@ namespace ams::ncm {
ContentMetaAttribute_None = (0 << 0),
ContentMetaAttribute_IncludesExFatDriver = (1 << 0),
ContentMetaAttribute_Rebootless = (1 << 1),
ContentMetaAttribute_Compacted = (1 << 2),
};
struct ContentMetaInfo {
@ -101,7 +102,7 @@ namespace ams::ncm {
u32 required_application_version;
u8 content_accessibilities;
u8 padding[3];
u64 data_patch_id; /* TODO: DataPatchId? */
DataPatchId data_patch_id;
};
struct LegacyAddOnContentMetaExtendedHeader {

View file

@ -26,6 +26,9 @@ namespace ams::ncm {
return { this->value };
}
constexpr inline bool operator==(const ApplicationId &) const = default;
constexpr inline bool operator!=(const ApplicationId &) const = default;
static const ApplicationId Start;
static const ApplicationId End;
};
@ -53,6 +56,9 @@ namespace ams::ncm {
constexpr operator ProgramId() const {
return { this->value };
}
constexpr inline bool operator==(const PatchId &) const = default;
constexpr inline bool operator!=(const PatchId &) const = default;
};
struct PatchGroupId {
@ -65,6 +71,9 @@ namespace ams::ncm {
constexpr operator DataId() const {
return { this->value };
}
constexpr inline bool operator==(const AddOnContentId &) const = default;
constexpr inline bool operator!=(const AddOnContentId &) const = default;
};
struct DeltaId {
@ -73,6 +82,20 @@ namespace ams::ncm {
constexpr operator ProgramId() const {
return { this->value };
}
constexpr inline bool operator==(const DeltaId &) const = default;
constexpr inline bool operator!=(const DeltaId &) const = default;
};
struct DataPatchId {
u64 value;
constexpr operator DataId() const {
return { this->value };
}
constexpr inline bool operator==(const DataPatchId &) const = default;
constexpr inline bool operator!=(const DataPatchId &) const = default;
};
}

View file

@ -29,6 +29,7 @@ namespace ams::ncm {
Patch = 0x81,
AddOnContent = 0x82,
Delta = 0x83,
DataPatch = 0x84,
};
const char *GetContentMetaTypeString(ContentMetaType type);

View file

@ -22,32 +22,10 @@ namespace ams::ncm {
u64 value;
static const DataId Invalid;
constexpr inline auto operator<=>(const DataId &) const = default;
};
inline constexpr bool operator==(const DataId &lhs, const DataId &rhs) {
return lhs.value == rhs.value;
}
inline constexpr bool operator!=(const DataId &lhs, const DataId &rhs) {
return lhs.value != rhs.value;
}
inline constexpr bool operator<(const DataId &lhs, const DataId &rhs) {
return lhs.value < rhs.value;
}
inline constexpr bool operator<=(const DataId &lhs, const DataId &rhs) {
return lhs.value <= rhs.value;
}
inline constexpr bool operator>(const DataId &lhs, const DataId &rhs) {
return lhs.value > rhs.value;
}
inline constexpr bool operator>=(const DataId &lhs, const DataId &rhs) {
return lhs.value >= rhs.value;
}
inline constexpr const DataId DataId::Invalid = {};
inline constexpr const DataId InvalidDataId = DataId::Invalid;

View file

@ -27,32 +27,10 @@ namespace ams::ncm {
return { this->value };
}
#endif
constexpr inline auto operator<=>(const ProgramId &) const = default;
};
inline constexpr bool operator==(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value == rhs.value;
}
inline constexpr bool operator!=(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value != rhs.value;
}
inline constexpr bool operator<(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value < rhs.value;
}
inline constexpr bool operator<=(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value <= rhs.value;
}
inline constexpr bool operator>(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value > rhs.value;
}
inline constexpr bool operator>=(const ProgramId &lhs, const ProgramId &rhs) {
return lhs.value >= rhs.value;
}
inline constexpr const ProgramId InvalidProgramId = {};
}

View file

@ -228,6 +228,9 @@ namespace ams::ncm {
return { this->value };
}
constexpr inline bool operator==(const SystemDataId &) const = default;
constexpr inline bool operator!=(const SystemDataId &) const = default;
static const SystemDataId Start;
static const SystemDataId CertStore;
@ -340,6 +343,9 @@ namespace ams::ncm {
constexpr operator DataId() const {
return { this->value };
}
constexpr inline bool operator==(const SystemUpdateId &) const = default;
constexpr inline bool operator!=(const SystemUpdateId &) const = default;
};
struct SystemAppletId {
@ -349,6 +355,9 @@ namespace ams::ncm {
return { this->value };
}
constexpr inline bool operator==(const SystemAppletId &) const = default;
constexpr inline bool operator!=(const SystemAppletId &) const = default;
static const SystemAppletId Start;
static const SystemAppletId Qlaunch;
@ -433,6 +442,9 @@ namespace ams::ncm {
return { this->value };
}
constexpr inline bool operator==(const SystemDebugAppletId &) const = default;
constexpr inline bool operator!=(const SystemDebugAppletId &) const = default;
static const SystemDebugAppletId Start;
static const SystemDebugAppletId SnapShotDumper;
@ -465,6 +477,9 @@ namespace ams::ncm {
return static_cast<SystemAppletId>(*this);
}
constexpr inline bool operator==(const LibraryAppletId &) const = default;
constexpr inline bool operator!=(const LibraryAppletId &) const = default;
static const LibraryAppletId Auth;
static const LibraryAppletId Controller;
static const LibraryAppletId Error;
@ -527,6 +542,9 @@ namespace ams::ncm {
return static_cast<SystemAppletId>(*this);
}
constexpr inline bool operator==(const WebAppletId &) const = default;
constexpr inline bool operator!=(const WebAppletId &) const = default;
static const WebAppletId Web;
static const WebAppletId Shop;
static const WebAppletId OfflineWeb;
@ -558,6 +576,9 @@ namespace ams::ncm {
constexpr operator ProgramId() const {
return { this->value };
}
constexpr inline bool operator==(const SystemApplicationId &) const = default;
constexpr inline bool operator!=(const SystemApplicationId &) const = default;
};
}

View file

@ -22,6 +22,7 @@ namespace ams::ncm {
case ContentMetaType::Application: return "Application";
case ContentMetaType::Patch: return "Patch";
case ContentMetaType::AddOnContent: return "AddOnContent";
case ContentMetaType::DataPatch: return "DataPatch";
default: return "(unknown)";
}
}