19 changed files with 246 additions and 167 deletions
-
1src/core/CMakeLists.txt
-
6src/core/hle/ipc_helpers.h
-
14src/core/hle/kernel/client_port.cpp
-
38src/core/hle/kernel/client_session.cpp
-
21src/core/hle/kernel/client_session.h
-
2src/core/hle/kernel/hle_ipc.cpp
-
13src/core/hle/kernel/hle_ipc.h
-
1src/core/hle/kernel/object.cpp
-
1src/core/hle/kernel/object.h
-
115src/core/hle/kernel/server_session.cpp
-
49src/core/hle/kernel/server_session.h
-
32src/core/hle/kernel/session.cpp
-
57src/core/hle/kernel/session.h
-
9src/core/hle/kernel/svc.cpp
-
2src/core/hle/service/nfp/nfp.cpp
-
4src/core/hle/service/service.cpp
-
5src/core/hle/service/sm/controller.cpp
-
33src/core/hle/service/sm/sm.cpp
-
6src/core/hle/service/sm/sm.h
@ -1,12 +1,36 @@ |
|||||
// Copyright 2015 Citra Emulator Project
|
|
||||
|
// Copyright 2019 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||
|
|
||||
|
#include "common/assert.h"
|
||||
|
#include "core/hle/kernel/client_session.h"
|
||||
|
#include "core/hle/kernel/server_session.h"
|
||||
#include "core/hle/kernel/session.h"
|
#include "core/hle/kernel/session.h"
|
||||
#include "core/hle/kernel/thread.h"
|
|
||||
|
|
||||
namespace Kernel { |
namespace Kernel { |
||||
|
|
||||
Session::Session() {} |
|
||||
Session::~Session() {} |
|
||||
|
Session::Session(KernelCore& kernel) : WaitObject{kernel} {} |
||||
|
Session::~Session() = default; |
||||
|
|
||||
|
Session::SessionPair Session::Create(KernelCore& kernel, std::string name) { |
||||
|
auto session{std::make_shared<Session>(kernel)}; |
||||
|
auto client_session{Kernel::ClientSession::Create(kernel, session, name + "_Client").Unwrap()}; |
||||
|
auto server_session{Kernel::ServerSession::Create(kernel, session, name + "_Server").Unwrap()}; |
||||
|
|
||||
|
session->name = std::move(name); |
||||
|
session->client = client_session; |
||||
|
session->server = server_session; |
||||
|
|
||||
|
return std::make_pair(std::move(client_session), std::move(server_session)); |
||||
|
} |
||||
|
|
||||
|
bool Session::ShouldWait(const Thread* thread) const { |
||||
|
UNIMPLEMENTED(); |
||||
|
return {}; |
||||
|
} |
||||
|
|
||||
|
void Session::Acquire(Thread* thread) { |
||||
|
UNIMPLEMENTED(); |
||||
|
} |
||||
|
|
||||
} // namespace Kernel
|
} // namespace Kernel
|
||||
@ -1,27 +1,64 @@ |
|||||
// Copyright 2018 yuzu emulator team |
|
||||
|
// Copyright 2019 yuzu emulator team |
||||
// Licensed under GPLv2 or any later version |
// Licensed under GPLv2 or any later version |
||||
// Refer to the license.txt file included. |
// Refer to the license.txt file included. |
||||
|
|
||||
#pragma once |
#pragma once |
||||
|
|
||||
#include "core/hle/kernel/object.h" |
|
||||
|
#include <memory> |
||||
|
#include <string> |
||||
|
|
||||
|
#include "core/hle/kernel/wait_object.h" |
||||
|
#include "core/hle/result.h" |
||||
|
|
||||
namespace Kernel { |
namespace Kernel { |
||||
|
|
||||
class ClientSession; |
class ClientSession; |
||||
class ClientPort; |
|
||||
class ServerSession; |
class ServerSession; |
||||
|
|
||||
/** |
/** |
||||
* Parent structure to link the client and server endpoints of a session with their associated |
* Parent structure to link the client and server endpoints of a session with their associated |
||||
* client port. The client port need not exist, as is the case for portless sessions like the |
|
||||
* FS File and Directory sessions. When one of the endpoints of a session is destroyed, its |
|
||||
* corresponding field in this structure will be set to nullptr. |
|
||||
|
* client port. |
||||
*/ |
*/ |
||||
class Session final { |
|
||||
|
class Session final : public WaitObject { |
||||
public: |
public: |
||||
std::weak_ptr<ClientSession> client; ///< The client endpoint of the session. |
|
||||
std::weak_ptr<ServerSession> server; ///< The server endpoint of the session. |
|
||||
std::shared_ptr<ClientPort> port; ///< The port that this session is associated with (optional). |
|
||||
|
explicit Session(KernelCore& kernel); |
||||
|
~Session() override; |
||||
|
|
||||
|
using SessionPair = std::pair<std::shared_ptr<ClientSession>, std::shared_ptr<ServerSession>>; |
||||
|
|
||||
|
static SessionPair Create(KernelCore& kernel, std::string name = "Unknown"); |
||||
|
|
||||
|
std::string GetName() const override { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
static constexpr HandleType HANDLE_TYPE = HandleType::Session; |
||||
|
HandleType GetHandleType() const override { |
||||
|
return HANDLE_TYPE; |
||||
|
} |
||||
|
|
||||
|
bool ShouldWait(const Thread* thread) const override; |
||||
|
|
||||
|
void Acquire(Thread* thread) override; |
||||
|
|
||||
|
std::shared_ptr<ClientSession> Client() { |
||||
|
if (auto result{client.lock()}) { |
||||
|
return result; |
||||
|
} |
||||
|
return {}; |
||||
|
} |
||||
|
|
||||
|
std::shared_ptr<ServerSession> Server() { |
||||
|
if (auto result{server.lock()}) { |
||||
|
return result; |
||||
|
} |
||||
|
return {}; |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
std::string name; |
||||
|
std::weak_ptr<ClientSession> client; |
||||
|
std::weak_ptr<ServerSession> server; |
||||
}; |
}; |
||||
|
|
||||
} // namespace Kernel |
} // namespace Kernel |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue