diff options
Diffstat (limited to 'src/core/hle/service/fs/fs_user.cpp')
-rw-r--r-- | src/core/hle/service/fs/fs_user.cpp | 85 |
1 files changed, 76 insertions, 9 deletions
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index d8d1d5547..0d2a426b0 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -2,10 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/common.h" +#include "common/assert.h" +#include "common/common_types.h" #include "common/file_util.h" +#include "common/logging/log.h" #include "common/scope_exit.h" #include "common/string_util.h" + #include "core/hle/result.h" #include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/fs_user.h" @@ -20,6 +23,8 @@ using Kernel::Session; namespace Service { namespace FS { +static u32 priority = -1; ///< For SetPriority and GetPriority service functions + static ArchiveHandle MakeArchiveHandle(u32 low_word, u32 high_word) { return (u64)low_word | ((u64)high_word << 32); } @@ -215,7 +220,7 @@ static void DeleteDirectory(Service::Interface* self) { LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); - + cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw; } @@ -424,7 +429,7 @@ static void IsSdmcWriteable(Service::Interface* self) { cmd_buff[1] = RESULT_SUCCESS.raw; // If the SD isn't enabled, it can't be writeable...else, stubbed true cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; - + LOG_DEBUG(Service_FS, " (STUBBED)"); } @@ -511,7 +516,7 @@ static void CreateExtSaveData(Service::Interface* self) { MediaType media_type = static_cast<MediaType>(cmd_buff[1] & 0xFF); u32 save_low = cmd_buff[2]; u32 save_high = cmd_buff[3]; - + LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " "cmd_buff[9]=%08X cmd_buff[10]=%08X cmd_buff[11]=%08X", save_high, save_low, @@ -573,7 +578,7 @@ static void DeleteSystemSaveData(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 savedata_high = cmd_buff[1]; u32 savedata_low = cmd_buff[2]; - + cmd_buff[1] = DeleteSystemSaveData(savedata_high, savedata_low).raw; } @@ -601,12 +606,72 @@ static void CreateSystemSaveData(Service::Interface* self) { LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " - "cmd_buff[9]=%08X", savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], + "cmd_buff[9]=%08X", savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9]); cmd_buff[1] = CreateSystemSaveData(savedata_high, savedata_low).raw; } +/** + * FS_User::InitializeWithSdkVersion service function. + * Inputs: + * 0 : 0x08610042 + * 1 : Unknown + * 2 : Unknown + * 3 : Unknown + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +static void InitializeWithSdkVersion(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + u32 unk1 = cmd_buff[1]; + u32 unk2 = cmd_buff[2]; + u32 unk3 = cmd_buff[3]; + + cmd_buff[1] = RESULT_SUCCESS.raw; + + LOG_WARNING(Service_FS, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, unk3=0x%08X", + unk1, unk2, unk3); +} + +/** + * FS_User::SetPriority service function. + * Inputs: + * 0 : 0x08620040 + * 1 : priority + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +static void SetPriority(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + priority = cmd_buff[1]; + + cmd_buff[1] = RESULT_SUCCESS.raw; + + LOG_DEBUG(Service_FS, "called priority=0x%08X", priority); +} + +/** + * FS_User::GetPriority service function. + * Inputs: + * 0 : 0x08630000 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : priority + */ +static void GetPriority(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + ASSERT(priority != -1); + + cmd_buff[1] = RESULT_SUCCESS.raw; + cmd_buff[2] = priority; + + LOG_DEBUG(Service_FS, "called priority=0x%08X", priority); +} + const Interface::FunctionInfo FunctionTable[] = { {0x000100C6, nullptr, "Dummy1"}, {0x040100C4, nullptr, "Control"}, @@ -695,15 +760,17 @@ const Interface::FunctionInfo FunctionTable[] = { {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"}, {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"}, {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"}, - {0x08610042, nullptr, "InitializeWithSdkVersion"}, - {0x08620040, nullptr, "SetPriority"}, - {0x08630000, nullptr, "GetPriority"}, + {0x08610042, InitializeWithSdkVersion, "InitializeWithSdkVersion"}, + {0x08620040, SetPriority, "SetPriority"}, + {0x08630000, GetPriority, "GetPriority"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class Interface::Interface() { + + priority = -1; Register(FunctionTable); } |