summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/citra_qt/debugger/wait_tree.cpp1
-rw-r--r--src/core/hle/kernel/client_port.cpp1
-rw-r--r--src/core/hle/kernel/client_port.h32
-rw-r--r--src/core/hle/kernel/client_session.cpp3
-rw-r--r--src/core/hle/kernel/client_session.h17
-rw-r--r--src/core/hle/kernel/kernel.h34
-rw-r--r--src/core/hle/kernel/server_session.cpp1
-rw-r--r--src/core/hle/kernel/server_session.h9
-rw-r--r--src/core/hle/service/fs/archive.cpp8
-rw-r--r--src/core/hle/service/service.h50
-rw-r--r--src/core/hle/service/srv.cpp3
11 files changed, 76 insertions, 83 deletions
diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp
index be5a51e52..51e70fae3 100644
--- a/src/citra_qt/debugger/wait_tree.cpp
+++ b/src/citra_qt/debugger/wait_tree.cpp
@@ -8,7 +8,6 @@
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/semaphore.h"
-#include "core/hle/kernel/session.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/timer.h"
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp
index de67688c9..5ee7679eb 100644
--- a/src/core/hle/kernel/client_port.cpp
+++ b/src/core/hle/kernel/client_port.cpp
@@ -7,7 +7,6 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/server_port.h"
#include "core/hle/kernel/server_session.h"
-#include "core/hle/service/service.h"
namespace Kernel {
diff --git a/src/core/hle/kernel/client_port.h b/src/core/hle/kernel/client_port.h
index 7a53c93b8..4848cb4c4 100644
--- a/src/core/hle/kernel/client_port.h
+++ b/src/core/hle/kernel/client_port.h
@@ -5,14 +5,9 @@
#pragma once
#include <string>
-#include <memory>
#include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
-namespace Service {
-class Interface;
-}
-
namespace Kernel {
class ServerPort;
@@ -21,6 +16,17 @@ class ServerSession;
class ClientPort final : public Object {
public:
friend class ServerPort;
+ std::string GetTypeName() const override {
+ return "ClientPort";
+ }
+ std::string GetName() const override {
+ return name;
+ }
+
+ static const HandleType HANDLE_TYPE = HandleType::ClientPort;
+ HandleType GetHandleType() const override {
+ return HANDLE_TYPE;
+ }
/**
* Adds the specified server session to the queue of pending sessions of the associated ServerPort
@@ -28,18 +34,10 @@ public:
*/
void AddWaitingSession(SharedPtr<ServerSession> server_session);
- std::string GetTypeName() const override { return "ClientPort"; }
- std::string GetName() const override { return name; }
-
- static const HandleType HANDLE_TYPE = HandleType::ClientPort;
- HandleType GetHandleType() const override {
- return HANDLE_TYPE;
- }
-
- SharedPtr<ServerPort> server_port; ///< ServerPort associated with this client port.
- u32 max_sessions; ///< Maximum number of simultaneous sessions the port can have
- u32 active_sessions; ///< Number of currently open sessions to this port
- std::string name; ///< Name of client port (optional)
+ SharedPtr<ServerPort> server_port; ///< ServerPort associated with this client port.
+ u32 max_sessions; ///< Maximum number of simultaneous sessions the port can have
+ u32 active_sessions; ///< Number of currently open sessions to this port
+ std::string name; ///< Name of client port (optional)
private:
ClientPort();
~ClientPort() override;
diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp
index 31ea8045a..c8be29b0a 100644
--- a/src/core/hle/kernel/client_session.cpp
+++ b/src/core/hle/kernel/client_session.cpp
@@ -4,11 +4,8 @@
#include "common/assert.h"
-#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/server_session.h"
-#include "core/hle/kernel/kernel.h"
-#include "core/hle/service/service.h"
namespace Kernel {
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h
index a951ea4d6..e34528301 100644
--- a/src/core/hle/kernel/client_session.h
+++ b/src/core/hle/kernel/client_session.h
@@ -11,13 +11,8 @@
#include "core/hle/kernel/kernel.h"
-namespace Service {
-class Interface;
-}
-
namespace Kernel {
-class ClientPort;
class ServerSession;
class ClientSession final : public Object {
@@ -30,11 +25,17 @@ public:
*/
static ResultVal<SharedPtr<ClientSession>> Create(SharedPtr<ServerSession> server_session, std::string name = "Unknown");
- std::string GetTypeName() const override { return "ClientSession"; }
- std::string GetName() const override { return name; }
+ std::string GetTypeName() const override {
+ return "ClientSession";
+ }
+ std::string GetName() const override {
+ return name;
+ }
static const HandleType HANDLE_TYPE = HandleType::ClientSession;
- HandleType GetHandleType() const override { return HANDLE_TYPE; }
+ HandleType GetHandleType() const override {
+ return HANDLE_TYPE;
+ }
/**
* Handle a SyncRequest from the emulated application.
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 4bd505b5d..9808d375b 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -31,24 +31,22 @@ enum KernelHandle : Handle {
};
enum class HandleType : u32 {
- Unknown = 0,
-
-
- Event = 3,
- Mutex = 4,
- SharedMemory = 5,
- Redirection = 6,
- Thread = 7,
- Process = 8,
- AddressArbiter = 9,
- Semaphore = 10,
- Timer = 11,
- ResourceLimit = 12,
- CodeSet = 13,
- ClientPort = 14,
- ServerPort = 15,
- ClientSession = 16,
- ServerSession = 17,
+ Unknown,
+ Event,
+ Mutex,
+ SharedMemory,
+ Redirection,
+ Thread,
+ Process,
+ AddressArbiter,
+ Semaphore,
+ Timer,
+ ResourceLimit,
+ CodeSet,
+ ClientPort,
+ ServerPort,
+ ClientSession,
+ ServerSession,
};
enum {
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index 200a7b815..006d67e65 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -4,7 +4,6 @@
#include <tuple>
-#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/thread.h"
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h
index 86fe641c0..70661e9af 100644
--- a/src/core/hle/kernel/server_session.h
+++ b/src/core/hle/kernel/server_session.h
@@ -16,7 +16,6 @@
namespace Kernel {
class ClientSession;
-class ClientPort;
/**
* Kernel object representing the server endpoint of an IPC session. Sessions are the basic CTR-OS
@@ -44,10 +43,14 @@ public:
*/
static ResultVal<SharedPtr<ServerSession>> Create(std::string name = "Unknown", std::shared_ptr<Service::SessionRequestHandler> hle_handler = nullptr);
- std::string GetTypeName() const override { return "ServerSession"; }
+ std::string GetTypeName() const override {
+ return "ServerSession";
+ }
static const HandleType HANDLE_TYPE = HandleType::ServerSession;
- HandleType GetHandleType() const override { return HANDLE_TYPE; }
+ HandleType GetHandleType() const override {
+ return HANDLE_TYPE;
+ }
/**
* Creates a pair of ServerSession and an associated ClientSession.
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index e40483c72..a9f457726 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -25,9 +25,9 @@
#include "core/hle/hle.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/result.h"
-#include "core/hle/service/service.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/fs/fs_user.h"
+#include "core/hle/service/service.h"
#include "core/memory.h"
// Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map.
@@ -97,6 +97,7 @@ ResultCode File::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> serv
u32* cmd_buff = Kernel::GetCommandBuffer();
FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
switch (cmd) {
+
// Read from file...
case FileCommand::Read: {
u64 offset = cmd_buff[1] | ((u64)cmd_buff[2]) << 32;
@@ -170,8 +171,7 @@ ResultCode File::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> serv
break;
}
- case FileCommand::OpenLinkFile:
- {
+ case FileCommand::OpenLinkFile: {
LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
auto sessions = Kernel::ServerSession::CreateSessionPair(GetName(), shared_from_this());
cmd_buff[3] = Kernel::g_handle_table.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions)).ValueOr(INVALID_HANDLE);
@@ -195,7 +195,7 @@ ResultCode File::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> serv
LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
ResultCode error = UnimplementedFunction(ErrorModule::FS);
cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
- return RESULT_SUCCESS;
+ return error;
}
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
return RESULT_SUCCESS;
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index dd268f39c..931512339 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -50,23 +50,23 @@ enum DescriptorType : u32 {
};
/**
-* @brief Creates a command header to be used for IPC
-* @param command_id ID of the command to create a header for.
-* @param normal_params Size of the normal parameters in words. Up to 63.
-* @param translate_params_size Size of the translate parameters in words. Up to 63.
-* @return The created IPC header.
-*
-* Normal parameters are sent directly to the process while the translate parameters might go
-* through modifications and checks by the kernel.
-* The translate parameters are described by headers generated with the IPC::*Desc functions.
-*
-* @note While #normal_params is equivalent to the number of normal parameters,
-* #translate_params_size includes the size occupied by the translate parameters headers.
-*/
+ * @brief Creates a command header to be used for IPC
+ * @param command_id ID of the command to create a header for.
+ * @param normal_params Size of the normal parameters in words. Up to 63.
+ * @param translate_params_size Size of the translate parameters in words. Up to 63.
+ * @return The created IPC header.
+ *
+ * Normal parameters are sent directly to the process while the translate parameters might go
+ * through modifications and checks by the kernel.
+ * The translate parameters are described by headers generated with the IPC::*Desc functions.
+ *
+ * @note While #normal_params is equivalent to the number of normal parameters,
+ * #translate_params_size includes the size occupied by the translate parameters headers.
+ */
constexpr u32 MakeHeader(u16 command_id, unsigned int normal_params,
unsigned int translate_params_size) {
return (u32(command_id) << 16) | ((u32(normal_params) & 0x3F) << 6) |
- (u32(translate_params_size) & 0x3F);
+ (u32(translate_params_size) & 0x3F);
}
union Header {
@@ -77,7 +77,7 @@ union Header {
};
inline Header ParseHeader(u32 header) {
- return{ header };
+ return {header};
}
constexpr u32 MoveHandleDesc(u32 num_handles = 1) {
@@ -111,19 +111,19 @@ union StaticBufferDescInfo {
};
inline StaticBufferDescInfo ParseStaticBufferDesc(const u32 desc) {
- return{ desc };
+ return {desc};
}
/**
-* @brief Creates a header describing a buffer to be sent over PXI.
-* @param size Size of the buffer. Max 0x00FFFFFF.
-* @param buffer_id The Id of the buffer. Max 0xF.
-* @param is_read_only true if the buffer is read-only. If false, the buffer is considered to have
-* read-write access.
-* @return The created PXI buffer header.
-*
-* The next value is a phys-address of a table located in the BASE memregion.
-*/
+ * @brief Creates a header describing a buffer to be sent over PXI.
+ * @param size Size of the buffer. Max 0x00FFFFFF.
+ * @param buffer_id The Id of the buffer. Max 0xF.
+ * @param is_read_only true if the buffer is read-only. If false, the buffer is considered to have
+ * read-write access.
+ * @return The created PXI buffer header.
+ *
+ * The next value is a phys-address of a table located in the BASE memregion.
+ */
inline u32 PXIBufferDesc(u32 size, unsigned buffer_id, bool is_read_only) {
u32 type = PXIBuffer;
if (is_read_only)
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 6731afc22..d228e3523 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -6,11 +6,10 @@
#include "common/common_types.h"
#include "common/logging/log.h"
-#include "core/hle/service/srv.h"
#include "core/hle/kernel/client_session.h"
+#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/srv.h"
-#include "core/hle/kernel/server_session.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace SRV