diff options
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 51 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.h | 12 | ||||
-rw-r--r-- | src/core/hle/kernel/event.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 8 |
7 files changed, 64 insertions, 41 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 174d4cd6e..2b21657da 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -17,11 +17,11 @@ namespace Kernel { class AddressArbiter : public Object { public: - std::string GetTypeName() const { return "Arbiter"; } - std::string GetName() const { return name; } + std::string GetTypeName() const override { return "Arbiter"; } + std::string GetName() const override { return name; } static Kernel::HandleType GetStaticHandleType() { return HandleType::AddressArbiter; } - Kernel::HandleType GetHandleType() const { return HandleType::AddressArbiter; } + Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; } std::string name; ///< Name of address arbiter object (optional) @@ -30,7 +30,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); return 0; diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 86aba7489..764082d71 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -42,11 +42,11 @@ enum class DirectoryCommand : u32 { class Archive : public Object { public: - std::string GetTypeName() const { return "Archive"; } - std::string GetName() const { return name; } + 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 { return HandleType::Archive; } + Kernel::HandleType GetHandleType() const override { return HandleType::Archive; } std::string name; ///< Name of archive (optional) FileSys::Archive* backend; ///< Archive backend interface @@ -56,7 +56,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result SyncRequest(bool* wait) { + Result SyncRequest(bool* wait) override { u32* cmd_buff = Service::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); @@ -119,7 +119,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); return 0; @@ -128,11 +128,11 @@ public: class File : public Object { public: - std::string GetTypeName() const { return "File"; } - std::string GetName() const { return path; } + std::string GetTypeName() const override { return "File"; } + std::string GetName() const override { return path; } static Kernel::HandleType GetStaticHandleType() { return HandleType::File; } - Kernel::HandleType GetHandleType() const { return HandleType::File; } + Kernel::HandleType GetHandleType() const override { return HandleType::File; } std::string path; ///< Path of the file std::unique_ptr<FileSys::File> backend; ///< File backend interface @@ -142,7 +142,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result SyncRequest(bool* wait) { + Result SyncRequest(bool* wait) override { u32* cmd_buff = Service::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); switch (cmd) { @@ -153,7 +153,7 @@ public: u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32; u32 length = cmd_buff[3]; u32 address = cmd_buff[5]; - DEBUG_LOG(KERNEL, "Read %s %s: offset=0x%x length=%d address=0x%x", + DEBUG_LOG(KERNEL, "Read %s %s: offset=0x%llx length=%d address=0x%x", GetTypeName().c_str(), GetName().c_str(), offset, length, address); cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address)); break; @@ -166,7 +166,7 @@ public: u32 length = cmd_buff[3]; u32 flush = cmd_buff[4]; u32 address = cmd_buff[6]; - DEBUG_LOG(KERNEL, "Write %s %s: offset=0x%x length=%d address=0x%x, flush=0x%x", + DEBUG_LOG(KERNEL, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush); cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address)); break; @@ -184,7 +184,7 @@ public: case FileCommand::SetSize: { u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32); - DEBUG_LOG(KERNEL, "SetSize %s %s size=%d", GetTypeName().c_str(), GetName().c_str(), size); + DEBUG_LOG(KERNEL, "SetSize %s %s size=%llu", GetTypeName().c_str(), GetName().c_str(), size); backend->SetSize(size); break; } @@ -211,7 +211,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); return 0; @@ -220,11 +220,11 @@ public: class Directory : public Object { public: - std::string GetTypeName() const { return "Directory"; } - std::string GetName() const { return path; } + std::string GetTypeName() const override { return "Directory"; } + std::string GetName() const override { return path; } static Kernel::HandleType GetStaticHandleType() { return HandleType::Directory; } - Kernel::HandleType GetHandleType() const { return HandleType::Directory; } + Kernel::HandleType GetHandleType() const override { return HandleType::Directory; } std::string path; ///< Path of the directory std::unique_ptr<FileSys::Directory> backend; ///< File backend interface @@ -234,7 +234,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result SyncRequest(bool* wait) { + Result SyncRequest(bool* wait) override { u32* cmd_buff = Service::GetCommandBuffer(); DirectoryCommand cmd = static_cast<DirectoryCommand>(cmd_buff[0]); switch (cmd) { @@ -274,7 +274,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); return 0; @@ -381,6 +381,21 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const } /** + * Create a Directory from an Archive + * @param archive_handle Handle to an open Archive object + * @param path Path to the Directory inside of the Archive + * @return Opened Directory object + */ +Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path) { + Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); + if (archive == nullptr) + return -1; + if (archive->backend->CreateDirectory(path)) + return 0; + return -1; +} + +/** * Open a Directory from an Archive * @param archive_handle Handle to an open Archive object * @param path Path to the Directory inside of the Archive diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h index 593861f8e..0230996b6 100644 --- a/src/core/hle/kernel/archive.h +++ b/src/core/hle/kernel/archive.h @@ -43,7 +43,15 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name); * @param mode Mode under which to open the File * @return Opened File object */ -Handle OpenFileFromArchive(Handle handle, const std::string& name, const FileSys::Mode mode); +Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const FileSys::Mode mode); + +/** + * Create a Directory from an Archive + * @param archive_handle Handle to an open Archive object + * @param path Path to the Directory inside of the Archive + * @return Whether creation of directory succeeded + */ +Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name); /** * Open a Directory from an Archive @@ -51,7 +59,7 @@ Handle OpenFileFromArchive(Handle handle, const std::string& name, const FileSys * @param path Path to the Directory inside of the Archive * @return Opened Directory object */ -Handle OpenDirectoryFromArchive(Handle handle, const std::string& name); +Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& name); /// Initialize archives void ArchiveInit(); diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 64f6a9649..45ed79be8 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -16,11 +16,11 @@ namespace Kernel { class Event : public Object { public: - std::string GetTypeName() const { return "Event"; } - std::string GetName() const { return name; } + std::string GetTypeName() const override { return "Event"; } + std::string GetName() const override { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } - Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } + Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Event; } ResetType intitial_reset_type; ///< ResetType specified at Event initialization ResetType reset_type; ///< Current ResetType @@ -35,7 +35,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { *wait = locked; if (locked) { Handle thread = GetCurrentThreadHandle(); diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 5d7d65dd9..fcfd061ac 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -15,11 +15,11 @@ namespace Kernel { class Mutex : public Object { public: - std::string GetTypeName() const { return "Mutex"; } - std::string GetName() const { return name; } + std::string GetTypeName() const override { return "Mutex"; } + std::string GetName() const override { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } - Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } + Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Mutex; } bool initial_locked; ///< Initial lock state when mutex was created bool locked; ///< Current locked state @@ -32,7 +32,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result SyncRequest(bool* wait) { + Result SyncRequest(bool* wait) override { // TODO(bunnei): ImplementMe locked = true; return 0; @@ -43,7 +43,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe *wait = locked; diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 2a6a483a1..f538c6550 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -11,17 +11,17 @@ namespace Kernel { class SharedMemory : public Object { public: - std::string GetTypeName() const { return "SharedMemory"; } + std::string GetTypeName() const override { return "SharedMemory"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } - Kernel::HandleType GetHandleType() const { return Kernel::HandleType::SharedMemory; } + Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; } /** * Wait for kernel object to synchronize * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { // TODO(bunnei): ImplementMe ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); return 0; @@ -72,7 +72,7 @@ Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { ERROR_LOG(KERNEL, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", - handle); + handle, address); return -1; } SharedMemory* shared_memory = Kernel::g_object_pool.GetFast<SharedMemory>(handle); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 33c0b2a47..e15590c49 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -21,11 +21,11 @@ namespace Kernel { class Thread : public Kernel::Object { public: - std::string GetName() const { return name; } - std::string GetTypeName() const { return "Thread"; } + std::string GetName() const override { return name; } + std::string GetTypeName() const override { return "Thread"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } - Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } + Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Thread; } inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; } @@ -38,7 +38,7 @@ public: * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ - Result WaitSynchronization(bool* wait) { + Result WaitSynchronization(bool* wait) override { if (status != THREADSTATUS_DORMANT) { Handle thread = GetCurrentThreadHandle(); if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { |