Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

ipc_helper: Add helper member function for popping enum values to RequestParser

Lioncash506fb32dd5fa
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 8b5b06f31d..ac1a633ba1 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -298,6 +298,14 @@ public:
template <typename First, typename... Other>
void Pop(First& first_value, Other&... other_values);
+ template <typename T>
+ T PopEnum() {
+ static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call.");
+ static_assert(!std::is_convertible_v<T, int>,
+ "enum type in PopEnum must be a strongly typed enum.");
+ return static_cast<T>(Pop<std::underlying_type_t<T>>());
+ }
+
/**
* @brief Reads the next normal parameters as a struct, by copying it
* @note: The output class must be correctly packed/padded to fit hardware layout.