Kernel: Add a dedicated SetHleHandler method to ServerPort/ServerSession

This allows attaching a HLE handle to a ServerPort at any point after it
is created, allowing port/session creation to be generic between HLE and
regular services.
This commit is contained in:
Yuri Kunde Schlesner
2017-06-05 22:39:26 -07:00
parent 7e5dd46cf4
commit 6354d08359
11 changed files with 73 additions and 62 deletions

View File

@ -84,6 +84,10 @@ File::File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path&
File::~File() {}
void File::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) {
using Kernel::ClientSession;
using Kernel::ServerSession;
using Kernel::SharedPtr;
u32* cmd_buff = Kernel::GetCommandBuffer();
FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
switch (cmd) {
@ -162,10 +166,9 @@ void File::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_ses
case FileCommand::OpenLinkFile: {
LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
auto sessions = Kernel::ServerSession::CreateSessionPair(GetName(), shared_from_this());
ClientConnected(std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions));
cmd_buff[3] = Kernel::g_handle_table
.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
auto sessions = ServerSession::CreateSessionPair(GetName());
ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
cmd_buff[3] = Kernel::g_handle_table.Create(std::get<SharedPtr<ClientSession>>(sessions))
.ValueOr(INVALID_HANDLE);
break;
}