summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/event.h6
-rw-r--r--src/core/hle/kernel/kernel.cpp4
-rw-r--r--src/core/hle/kernel/kernel.h9
-rw-r--r--src/core/hle/kernel/thread.cpp4
-rw-r--r--src/core/hle/kernel/thread.h5
-rw-r--r--src/core/hle/kernel/timer.h1
-rw-r--r--src/core/hle/service/fs/archive.cpp12
-rw-r--r--src/core/hle/service/fs/archive.h9
-rw-r--r--src/core/hle/service/fs/fs_user.cpp75
-rw-r--r--src/core/hle/svc.cpp4
10 files changed, 100 insertions, 29 deletions
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index 6fe74065d..8dcd23edb 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -9,12 +9,6 @@
namespace Kernel {
-enum class ResetType {
- OneShot,
- Sticky,
- Pulse,
-};
-
class Event final : public WaitObject {
public:
/**
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 9a2c8ce05..9e1795927 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -40,6 +40,10 @@ void WaitObject::WakeupAllWaitingThreads() {
HLE::Reschedule(__func__);
}
+const std::vector<SharedPtr<Thread>>& WaitObject::GetWaitingThreads() const {
+ return waiting_threads;
+}
+
HandleTable::HandleTable() {
next_generation = 1;
Clear();
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 0e95f7ff0..6b8dbecff 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -53,6 +53,12 @@ enum {
DEFAULT_STACK_SIZE = 0x4000,
};
+enum class ResetType {
+ OneShot,
+ Sticky,
+ Pulse,
+};
+
class Object : NonCopyable {
public:
virtual ~Object() {}
@@ -149,6 +155,9 @@ public:
/// Wake up all threads waiting on this object
void WakeupAllWaitingThreads();
+ /// Get a const reference to the waiting threads list for debug use
+ const std::vector<SharedPtr<Thread>>& GetWaitingThreads() const;
+
private:
/// Threads waiting for this object to become available
std::vector<SharedPtr<Thread>> waiting_threads;
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 4486a812c..c4eeeee56 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -665,4 +665,8 @@ void ThreadingShutdown() {
ready_queue.clear();
}
+const std::vector<SharedPtr<Thread>>& GetThreadList() {
+ return thread_list;
+}
+
} // namespace
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index f63131716..e0ffcea8a 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -236,4 +236,9 @@ void ThreadingInit();
*/
void ThreadingShutdown();
+/**
+ * Get a const reference to the thread list for debug use
+ */
+const std::vector<SharedPtr<Thread>>& GetThreadList();
+
} // namespace
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
index 59a77aad3..18ea0236b 100644
--- a/src/core/hle/kernel/timer.h
+++ b/src/core/hle/kernel/timer.h
@@ -5,7 +5,6 @@
#pragma once
#include "common/common_types.h"
-#include "core/hle/kernel/event.h"
#include "core/hle/kernel/kernel.h"
namespace Kernel {
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 4dc7e1e3c..7f9696bfb 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -362,6 +362,18 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
ErrorSummary::Canceled, ErrorLevel::Status);
}
+ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
+ const FileSys::Path& path) {
+ ArchiveBackend* archive = GetArchive(archive_handle);
+ if (archive == nullptr)
+ return ERR_INVALID_ARCHIVE_HANDLE;
+
+ if (archive->DeleteDirectoryRecursively(path))
+ return RESULT_SUCCESS;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::Canceled, ErrorLevel::Status);
+}
+
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
u64 file_size) {
ArchiveBackend* archive = GetArchive(archive_handle);
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 533be34a4..41a76285c 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -133,6 +133,15 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
/**
+ * Delete a Directory and anything under it from an Archive
+ * @param archive_handle Handle to an open Archive object
+ * @param path Path to the Directory inside of the Archive
+ * @return Whether deletion succeeded
+ */
+ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
+ const FileSys::Path& path);
+
+/**
* Create a File in an Archive
* @param archive_handle Handle to an open Archive object
* @param path Path to the File inside of the Archive
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 94f053dc2..00edc7622 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -64,7 +64,7 @@ static void OpenFile(Service::Interface* self) {
u32 filename_ptr = cmd_buff[9];
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
- LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex,
+ LOG_DEBUG(Service_FS, "path=%s, mode=%u attrs=%u", file_path.DebugStr().c_str(), mode.hex,
attributes);
ResultVal<SharedPtr<File>> file_res = OpenFileFromArchive(archive_handle, file_path, mode);
@@ -112,15 +112,15 @@ static void OpenFileDirectly(Service::Interface* self) {
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
- LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%d",
- archive_id, archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex,
- attributes);
+ LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%u",
+ static_cast<u32>(archive_id), archive_path.DebugStr().c_str(),
+ file_path.DebugStr().c_str(), mode.hex, attributes);
ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path);
if (archive_handle.Failed()) {
LOG_ERROR(Service_FS,
"failed to get a handle for archive archive_id=0x%08X archive_path=%s",
- archive_id, archive_path.DebugStr().c_str());
+ static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
cmd_buff[1] = archive_handle.Code().raw;
cmd_buff[3] = 0;
return;
@@ -133,7 +133,7 @@ static void OpenFileDirectly(Service::Interface* self) {
cmd_buff[3] = Kernel::g_handle_table.Create(*file_res).MoveFrom();
} else {
cmd_buff[3] = 0;
- LOG_ERROR(Service_FS, "failed to get a handle for file %s mode=%u attributes=%d",
+ LOG_ERROR(Service_FS, "failed to get a handle for file %s mode=%u attributes=%u",
file_path.DebugStr().c_str(), mode.hex, attributes);
}
}
@@ -159,7 +159,7 @@ static void DeleteFile(Service::Interface* self) {
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
- LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size,
+ LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(filename_type), filename_size,
file_path.DebugStr().c_str());
cmd_buff[1] = DeleteFileFromArchive(archive_handle, file_path).raw;
@@ -198,9 +198,10 @@ static void RenameFile(Service::Interface* self) {
FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr);
LOG_DEBUG(Service_FS,
- "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
- src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
- dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
+ "src_type=%u src_size=%u src_data=%s dest_type=%u dest_size=%u dest_data=%s",
+ static_cast<u32>(src_filename_type), src_filename_size,
+ src_file_path.DebugStr().c_str(), static_cast<u32>(dest_filename_type),
+ dest_filename_size, dest_file_path.DebugStr().c_str());
cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle,
dest_file_path)
@@ -228,13 +229,42 @@ static void DeleteDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
- LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
+ LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str());
cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
}
/*
+ * FS_User::DeleteDirectoryRecursively service function
+ * Inputs:
+ * 0 : Command header 0x08070142
+ * 1 : Transaction
+ * 2 : Archive handle lower word
+ * 3 : Archive handle upper word
+ * 4 : Directory path string type
+ * 5 : Directory path string size
+ * 7 : Directory path string data
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+static void DeleteDirectoryRecursively(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
+ auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
+ u32 dirname_size = cmd_buff[5];
+ u32 dirname_ptr = cmd_buff[7];
+
+ FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
+
+ LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size,
+ dir_path.DebugStr().c_str());
+
+ cmd_buff[1] = DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path).raw;
+}
+
+/*
* FS_User::CreateFile service function
* Inputs:
* 0 : Command header 0x08080202
@@ -258,7 +288,7 @@ static void CreateFile(Service::Interface* self) {
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
- LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, file_size,
+ LOG_DEBUG(Service_FS, "type=%u size=%llu data=%s", static_cast<u32>(filename_type), file_size,
file_path.DebugStr().c_str());
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
@@ -285,7 +315,7 @@ static void CreateDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
- LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
+ LOG_DEBUG(Service_FS, "type=%u size=%d data=%s", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str());
cmd_buff[1] = CreateDirectoryFromArchive(archive_handle, dir_path).raw;
@@ -322,10 +352,10 @@ static void RenameDirectory(Service::Interface* self) {
FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr);
FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr);
- LOG_DEBUG(Service_FS,
- "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
- src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
- dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
+ LOG_DEBUG(
+ Service_FS, "src_type=%u src_size=%u src_data=%s dest_type=%u dest_size=%u dest_data=%s",
+ static_cast<u32>(src_dirname_type), src_dirname_size, src_dir_path.DebugStr().c_str(),
+ static_cast<u32>(dest_dirname_type), dest_dirname_size, dest_dir_path.DebugStr().c_str());
cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path,
dest_archive_handle, dest_dir_path)
@@ -355,7 +385,7 @@ static void OpenDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
- LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
+ LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str());
ResultVal<SharedPtr<Directory>> dir_res = OpenDirectoryFromArchive(archive_handle, dir_path);
@@ -390,7 +420,7 @@ static void OpenArchive(Service::Interface* self) {
u32 archivename_ptr = cmd_buff[5];
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
- LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", archive_id,
+ LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", static_cast<u32>(archive_id),
archive_path.DebugStr().c_str());
ResultVal<ArchiveHandle> handle = OpenArchive(archive_id, archive_path);
@@ -402,7 +432,7 @@ static void OpenArchive(Service::Interface* self) {
cmd_buff[2] = cmd_buff[3] = 0;
LOG_ERROR(Service_FS,
"failed to get a handle for archive archive_id=0x%08X archive_path=%s",
- archive_id, archive_path.DebugStr().c_str());
+ static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
}
}
@@ -485,7 +515,8 @@ static void FormatSaveData(Service::Interface* self) {
LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
if (archive_id != FS::ArchiveIdCode::SaveData) {
- LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", archive_id);
+ LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u",
+ static_cast<u32>(archive_id));
cmd_buff[1] = ResultCode(ErrorDescription::FS_InvalidPath, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage)
.raw;
@@ -868,7 +899,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x08040142, DeleteFile, "DeleteFile"},
{0x08050244, RenameFile, "RenameFile"},
{0x08060142, DeleteDirectory, "DeleteDirectory"},
- {0x08070142, nullptr, "DeleteDirectoryRecursively"},
+ {0x08070142, DeleteDirectoryRecursively, "DeleteDirectoryRecursively"},
{0x08080202, CreateFile, "CreateFile"},
{0x08090182, CreateDirectory, "CreateDirectory"},
{0x080A0244, RenameDirectory, "RenameDirectory"},
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 02b397eba..c6b80dc50 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -576,6 +576,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
using Kernel::Mutex;
SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
+ mutex->name = Common::StringFromFormat("mutex-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex)));
LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
@@ -646,6 +647,7 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max
using Kernel::Semaphore;
CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
+ semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(semaphore)));
LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X",
@@ -702,6 +704,7 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
using Kernel::Event;
SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type));
+ evt->name = Common::StringFromFormat("event-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,
@@ -748,6 +751,7 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
using Kernel::Timer;
SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type));
+ timer->name = Common::StringFromFormat("timer-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,