diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 24605a273..8b5b06f31 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -174,6 +174,25 @@ public: template void Push(const First& first_value, const Other&... other_values); + /** + * Helper function for pushing strongly-typed enumeration values. + * + * @tparam Enum The enumeration type to be pushed + * + * @param value The value to push. + * + * @note The underlying size of the enumeration type is the size of the + * data that gets pushed. e.g. "enum class SomeEnum : u16" will + * push a u16-sized amount of data. + */ + template + void PushEnum(Enum value) { + static_assert(std::is_enum_v, "T must be an enum type within a PushEnum call."); + static_assert(!std::is_convertible_v, + "enum type in PushEnum must be a strongly typed enum."); + Push(static_cast>(value)); + } + /** * @brief Copies the content of the given trivially copyable class to the buffer as a normal * param