forked from ShuriZma/suyu
1
0
Fork 0

hle: kernel: KSession: Improve implementation of CloneCurrentObject.

This commit is contained in:
bunnei 2021-05-10 15:53:07 -07:00
parent cfed6936f3
commit 44c763f9c6
1 changed files with 10 additions and 2 deletions

View File

@ -26,15 +26,23 @@ void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
// TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong // TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong
// and that we probably want to actually make an entirely new Session, but we still need to // and that we probably want to actually make an entirely new Session, but we still need to
// verify this on hardware. // verify this on hardware.
LOG_DEBUG(Service, "called"); LOG_DEBUG(Service, "called");
auto session = ctx.Session()->GetParent();
// Open a reference to the session to simulate a new one being created.
session->Open();
session->GetClientSession().Open();
session->GetServerSession().Open();
IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushMoveObjects(ctx.Session()->GetParent()->GetClientSession()); rb.PushMoveObjects(session->GetClientSession());
} }
void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) { void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called, using CloneCurrentObject"); LOG_DEBUG(Service, "called");
CloneCurrentObject(ctx); CloneCurrentObject(ctx);
} }