From 198c0ddc72d59f8e288c1074ee0bb1169f706cac Mon Sep 17 00:00:00 2001 From: purpasmart96 Date: Sat, 7 Mar 2015 17:54:16 -0800 Subject: Services: Stubs and minor changes --- src/core/hle/service/fs/fs_user.cpp | 80 +++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/fs') diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index d8d1d554..5bc94b1b 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -20,6 +20,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 +217,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 +426,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 +513,7 @@ static void CreateExtSaveData(Service::Interface* self) { MediaType media_type = static_cast(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 +575,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 +603,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 +757,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); } -- cgit v1.2.3