Merge pull request #427 from bunnei/domain-inputs
ipc: Add support for PopIpcInterface() method.
This commit is contained in:
commit
902182f80c
@ -167,6 +167,7 @@ struct DomainMessageHeader {
|
|||||||
struct {
|
struct {
|
||||||
union {
|
union {
|
||||||
BitField<0, 8, CommandType> command;
|
BitField<0, 8, CommandType> command;
|
||||||
|
BitField<8, 8, u32_le> input_object_count;
|
||||||
BitField<16, 16, u32_le> size;
|
BitField<16, 16, u32_le> size;
|
||||||
};
|
};
|
||||||
u32_le object_id;
|
u32_le object_id;
|
||||||
|
@ -298,6 +298,13 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Kernel::SharedPtr<T> GetCopyObject(size_t index);
|
Kernel::SharedPtr<T> GetCopyObject(size_t index);
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
std::shared_ptr<T> PopIpcInterface() {
|
||||||
|
ASSERT(context->Session()->IsDomain());
|
||||||
|
ASSERT(context->GetDomainMessageHeader()->input_object_count > 0);
|
||||||
|
return context->GetDomainRequestHandler<T>(Pop<u32>() - 1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Pop ///
|
/// Pop ///
|
||||||
|
@ -202,6 +202,16 @@ public:
|
|||||||
domain_objects.emplace_back(std::move(object));
|
domain_objects.emplace_back(std::move(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::shared_ptr<T> GetDomainRequestHandler(size_t index) const {
|
||||||
|
return std::static_pointer_cast<T>(domain_request_handlers[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDomainRequestHandlers(
|
||||||
|
const std::vector<std::shared_ptr<SessionRequestHandler>>& handlers) {
|
||||||
|
domain_request_handlers = handlers;
|
||||||
|
}
|
||||||
|
|
||||||
/// Clears the list of objects so that no lingering objects are written accidentally to the
|
/// Clears the list of objects so that no lingering objects are written accidentally to the
|
||||||
/// response buffer.
|
/// response buffer.
|
||||||
void ClearIncomingObjects() {
|
void ClearIncomingObjects() {
|
||||||
@ -245,6 +255,8 @@ private:
|
|||||||
unsigned data_payload_offset{};
|
unsigned data_payload_offset{};
|
||||||
unsigned buffer_c_offset{};
|
unsigned buffer_c_offset{};
|
||||||
u32_le command{};
|
u32_le command{};
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
@ -61,6 +61,9 @@ void ServerSession::Acquire(Thread* thread) {
|
|||||||
ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
|
ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
|
||||||
auto& domain_message_header = context.GetDomainMessageHeader();
|
auto& domain_message_header = context.GetDomainMessageHeader();
|
||||||
if (domain_message_header) {
|
if (domain_message_header) {
|
||||||
|
// Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
|
||||||
|
context.SetDomainRequestHandlers(domain_request_handlers);
|
||||||
|
|
||||||
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
||||||
const u32 object_id{context.GetDomainMessageHeader()->object_id};
|
const u32 object_id{context.GetDomainMessageHeader()->object_id};
|
||||||
switch (domain_message_header->command) {
|
switch (domain_message_header->command) {
|
||||||
|
Loading…
Reference in New Issue
Block a user