diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-12-14 03:30:11 -0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-12-15 18:26:17 -0200 |
commit | e321decf98a6b0041e4d6b30ca79f24308bbb82c (patch) | |
tree | 5d458d4768cd95942154f1b2c9298fac04882700 /src/core/hle/kernel/archive.cpp | |
parent | 1ee740898ab6951e21fad864a40260c7d3c1027f (diff) |
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.)
Diffstat (limited to 'src/core/hle/kernel/archive.cpp')
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 39 |
1 files changed, 15 insertions, 24 deletions
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 <map> + #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<bool> SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(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<bool>(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<FileSys::File> backend; ///< File backend interface ResultVal<bool> SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(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<FileSys::Directory> backend; ///< File backend interface ResultVal<bool> SyncRequest() override { - u32* cmd_buff = Service::GetCommandBuffer(); + u32* cmd_buff = Kernel::GetCommandBuffer(); DirectoryCommand cmd = static_cast<DirectoryCommand>(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<bool>(false); } cmd_buff[1] = 0; // No error return MakeResult<bool>(false); |