Browse Source
Merge pull request #2752 from yuriks/move-session-request-handler
Merge pull request #2752 from yuriks/move-session-request-handler
HLE: Move SessionRequestHandler from Service:: to Kernel::pull/15/merge
committed by
GitHub
14 changed files with 100 additions and 73 deletions
-
2src/core/CMakeLists.txt
-
1src/core/hle/kernel/client_port.cpp
-
2src/core/hle/kernel/client_session.cpp
-
22src/core/hle/kernel/hle_ipc.cpp
-
52src/core/hle/kernel/hle_ipc.h
-
3src/core/hle/kernel/server_port.cpp
-
9src/core/hle/kernel/server_port.h
-
7src/core/hle/kernel/server_session.cpp
-
9src/core/hle/kernel/server_session.h
-
1src/core/hle/service/fs/archive.cpp
-
6src/core/hle/service/fs/archive.h
-
1src/core/hle/service/fs/fs_user.cpp
-
13src/core/hle/service/service.cpp
-
45src/core/hle/service/service.h
@ -0,0 +1,22 @@ |
|||||
|
// Copyright 2017 Citra Emulator Project
|
||||
|
// Licensed under GPLv2 or any later version
|
||||
|
// Refer to the license.txt file included.
|
||||
|
|
||||
|
#include <boost/range/algorithm_ext/erase.hpp>
|
||||
|
#include "common/assert.h"
|
||||
|
#include "common/common_types.h"
|
||||
|
#include "core/hle/kernel/hle_ipc.h"
|
||||
|
#include "core/hle/kernel/kernel.h"
|
||||
|
#include "core/hle/kernel/server_session.h"
|
||||
|
|
||||
|
namespace Kernel { |
||||
|
|
||||
|
void SessionRequestHandler::ClientConnected(SharedPtr<ServerSession> server_session) { |
||||
|
connected_sessions.push_back(server_session); |
||||
|
} |
||||
|
|
||||
|
void SessionRequestHandler::ClientDisconnected(SharedPtr<ServerSession> server_session) { |
||||
|
boost::range::remove_erase(connected_sessions, server_session); |
||||
|
} |
||||
|
|
||||
|
} // namespace Kernel
|
||||
@ -0,0 +1,52 @@ |
|||||
|
// Copyright 2017 Citra Emulator Project |
||||
|
// Licensed under GPLv2 or any later version |
||||
|
// Refer to the license.txt file included. |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <vector> |
||||
|
#include "core/hle/kernel/kernel.h" |
||||
|
|
||||
|
namespace Kernel { |
||||
|
|
||||
|
class ServerSession; |
||||
|
|
||||
|
/** |
||||
|
* Interface implemented by HLE Session handlers. |
||||
|
* This can be provided to a ServerSession in order to hook into several relevant events |
||||
|
* (such as a new connection or a SyncRequest) so they can be implemented in the emulator. |
||||
|
*/ |
||||
|
class SessionRequestHandler { |
||||
|
public: |
||||
|
/** |
||||
|
* Handles a sync request from the emulated application. |
||||
|
* @param server_session The ServerSession that was triggered for this sync request, |
||||
|
* it should be used to differentiate which client (As in ClientSession) we're answering to. |
||||
|
* TODO(Subv): Use a wrapper structure to hold all the information relevant to |
||||
|
* this request (ServerSession, Originator thread, Translated command buffer, etc). |
||||
|
* @returns ResultCode the result code of the translate operation. |
||||
|
*/ |
||||
|
virtual void HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) = 0; |
||||
|
|
||||
|
/** |
||||
|
* Signals that a client has just connected to this HLE handler and keeps the |
||||
|
* associated ServerSession alive for the duration of the connection. |
||||
|
* @param server_session Owning pointer to the ServerSession associated with the connection. |
||||
|
*/ |
||||
|
void ClientConnected(Kernel::SharedPtr<Kernel::ServerSession> server_session); |
||||
|
|
||||
|
/** |
||||
|
* Signals that a client has just disconnected from this HLE handler and releases the |
||||
|
* associated ServerSession. |
||||
|
* @param server_session ServerSession associated with the connection. |
||||
|
*/ |
||||
|
void ClientDisconnected(Kernel::SharedPtr<Kernel::ServerSession> server_session); |
||||
|
|
||||
|
protected: |
||||
|
/// List of sessions that are connected to this handler. |
||||
|
/// A ServerSession whose server endpoint is an HLE implementation is kept alive by this list |
||||
|
// for the duration of the connection. |
||||
|
std::vector<Kernel::SharedPtr<Kernel::ServerSession>> connected_sessions; |
||||
|
}; |
||||
|
|
||||
|
} // namespace Kernel |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue