From e321decf98a6b0041e4d6b30ca79f24308bbb82c Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 14 Dec 2014 03:30:11 -0200 Subject: Remove SyncRequest from K::Object and create a new K::Session type This is a first step at fixing the conceptual insanity that is our handling of service and IPC calls. For now, interfaces still directly derived from Session because we don't have the infrastructure to do it properly. (That is, Processes and scheduling them.) --- src/core/hle/kernel/archive.cpp | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'src/core/hle/kernel/archive.cpp') diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index ddc09e13..0e3eb456 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include + #include "common/common_types.h" #include "common/file_util.h" #include "common/math_util.h" @@ -10,8 +12,8 @@ #include "core/file_sys/archive_sdmc.h" #include "core/file_sys/directory.h" #include "core/hle/kernel/archive.h" +#include "core/hle/kernel/session.h" #include "core/hle/result.h" -#include "core/hle/service/service.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Kernel namespace @@ -41,19 +43,15 @@ enum class DirectoryCommand : u32 { Close = 0x08020000, }; -class Archive : public Object { +class Archive : public Kernel::Session { public: - std::string GetTypeName() const override { return "Archive"; } - std::string GetName() const override { return name; } - - static Kernel::HandleType GetStaticHandleType() { return HandleType::Archive; } - Kernel::HandleType GetHandleType() const override { return HandleType::Archive; } + std::string GetName() const override { return "Archive: " + name; } std::string name; ///< Name of archive (optional) FileSys::Archive* backend; ///< Archive backend interface ResultVal SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); FileCommand cmd = static_cast(cmd_buff[0]); switch (cmd) { @@ -102,7 +100,8 @@ public: default: { LOG_ERROR(Service_FS, "Unknown command=0x%08X", cmd); - return UnimplementedFunction(ErrorModule::FS); + cmd_buff[0] = UnimplementedFunction(ErrorModule::FS).raw; + return MakeResult(false); } } cmd_buff[1] = 0; // No error @@ -110,19 +109,15 @@ public: } }; -class File : public Object { +class File : public Kernel::Session { public: - std::string GetTypeName() const override { return "File"; } - std::string GetName() const override { return path.DebugStr(); } - - static Kernel::HandleType GetStaticHandleType() { return HandleType::File; } - Kernel::HandleType GetHandleType() const override { return HandleType::File; } + std::string GetName() const override { return "Path: " + path.DebugStr(); } FileSys::Path path; ///< Path of the file std::unique_ptr backend; ///< File backend interface ResultVal SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); FileCommand cmd = static_cast(cmd_buff[0]); switch (cmd) { @@ -188,19 +183,15 @@ public: } }; -class Directory : public Object { +class Directory : public Kernel::Session { public: - std::string GetTypeName() const override { return "Directory"; } - std::string GetName() const override { return path.DebugStr(); } - - static Kernel::HandleType GetStaticHandleType() { return HandleType::Directory; } - Kernel::HandleType GetHandleType() const override { return HandleType::Directory; } + std::string GetName() const override { return "Directory: " + path.DebugStr(); } FileSys::Path path; ///< Path of the directory std::unique_ptr backend; ///< File backend interface ResultVal SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); DirectoryCommand cmd = static_cast(cmd_buff[0]); switch (cmd) { @@ -230,7 +221,7 @@ public: 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 error; + return MakeResult(false); } cmd_buff[1] = 0; // No error return MakeResult(false); -- cgit v1.2.3