diff options
Diffstat (limited to 'src/core/hle/service')
34 files changed, 943 insertions, 115 deletions
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp new file mode 100644 index 000000000..b39603bdf --- /dev/null +++ b/src/core/hle/service/ac_u.cpp @@ -0,0 +1,44 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/ac_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace AC_U + +namespace AC_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010000, nullptr, "CreateDefaultConfig"}, + {0x00040006, nullptr, "ConnectAsync"}, + {0x00050002, nullptr, "GetConnectResult"}, + {0x00080004, nullptr, "CloseAsync"}, + {0x00090002, nullptr, "GetCloseResult"}, + {0x000A0000, nullptr, "GetLastErrorCode"}, + {0x000D0000, nullptr, "GetWifiStatus"}, + {0x000E0042, nullptr, "GetCurrentAPInfo"}, + {0x00100042, nullptr, "GetCurrentNZoneInfo"}, + {0x00110042, nullptr, "GetNZoneApNumService"}, + {0x00240042, nullptr, "AddDenyApType "}, + {0x00270002, nullptr, "GetInfraPriority "}, + {0x002D0082, nullptr, "SetRequestEulaVersion"}, + {0x00300004, nullptr, "RegisterDisconnectEvent"}, + {0x003C0042, nullptr, "GetAPSSIDList"}, + {0x003E0042, nullptr, "IsConnected "}, + {0x00400042, nullptr, "SetClientVersion"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.h new file mode 100644 index 000000000..3c5958d27 --- /dev/null +++ b/src/core/hle/service/ac_u.h @@ -0,0 +1,29 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace AC_U + +// socket service "ac:u" + +namespace AC_U { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "ac:u"; + } +}; + +} // namespace diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt_u.cpp index 3753f1107..4f41ec5f4 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt_u.cpp @@ -8,13 +8,15 @@ #include "core/hle/hle.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/mutex.h" -#include "core/hle/service/apt.h" +#include "apt_u.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace APT_U namespace APT_U { +static Handle lock_handle = 0; + /// Signals used by APT functions enum class SignalType : u32 { None = 0x0, @@ -32,15 +34,32 @@ void Initialize(Service::Interface* self) { Kernel::SetEventLocked(cmd_buff[3], true); Kernel::SetEventLocked(cmd_buff[4], false); // Fire start event + _assert_msg_(KERNEL, (0 != lock_handle), "Cannot initialize without lock"); + Kernel::ReleaseMutex(lock_handle); + cmd_buff[1] = 0; // No error + DEBUG_LOG(KERNEL, "called"); } void GetLockHandle(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field + + if (0 == lock_handle) { + // TODO(bunnei): Verify if this is created here or at application boot? + lock_handle = Kernel::CreateMutex(false, "APT_U:Lock"); + Kernel::ReleaseMutex(lock_handle); + } cmd_buff[1] = 0; // No error - cmd_buff[5] = Kernel::CreateMutex(false, "APT_U:Lock"); + + // Not sure what these parameters are used for, but retail apps check that they are 0 after + // GetLockHandle has been called. + cmd_buff[2] = 0; + cmd_buff[3] = 0; + cmd_buff[4] = 0; + + cmd_buff[5] = lock_handle; DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]); } @@ -59,6 +78,25 @@ void InquireNotification(Service::Interface* self) { WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X", app_id); } +/** + * APT_U::ReceiveParameter service function. This returns the current parameter data from NS state, + * from the source process which set the parameters. Once finished, NS will clear a flag in the NS + * state so that this command will return an error if this command is used again if parameters were + * not set again. This is called when the second Initialize event is triggered. It returns a signal + * type indicating why it was triggered. + * Inputs: + * 1 : AppID + * 2 : Parameter buffer size, max size is 0x1000 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Unknown, for now assume AppID of the process which sent these parameters + * 3 : Unknown, for now assume Signal type + * 4 : Actual parameter buffer size, this is <= to the the input size + * 5 : Value + * 6 : Handle from the source process which set the parameters, likely used for shared memory + * 7 : Size + * 8 : Output parameter buffer ptr + */ void ReceiveParameter(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); u32 app_id = cmd_buff[1]; @@ -66,7 +104,7 @@ void ReceiveParameter(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = 0; cmd_buff[3] = static_cast<u32>(SignalType::AppJustStarted); // Signal type - cmd_buff[4] = 0x10; + cmd_buff[4] = 0x10; // Parameter buffer size (16) cmd_buff[5] = 0; cmd_buff[6] = 0; cmd_buff[7] = 0; @@ -74,35 +112,66 @@ void ReceiveParameter(Service::Interface* self) { } /** -* APT_U::GlanceParameter service function -* Inputs: -* 1 : AppID -* 2 : Parameter buffer size, max size is 0x1000 -* Outputs: -* 1 : Result of function, 0 on success, otherwise error code -* 2 : Unknown, for now assume AppID of the process which sent these parameters -* 3 : Unknown, for now assume Signal type -* 4 : Actual parameter buffer size, this is <= to the the input size -* 5 : Value -* 6 : Handle from the source process which set the parameters, likely used for shared memory -* 7 : Size -* 8 : Output parameter buffer ptr -*/ + * APT_U::GlanceParameter service function. This is exactly the same as APT_U::ReceiveParameter + * (except for the word value prior to the output handle), except this will not clear the flag + * (except when responseword[3]==8 || responseword[3]==9) in NS state. + * Inputs: + * 1 : AppID + * 2 : Parameter buffer size, max size is 0x1000 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Unknown, for now assume AppID of the process which sent these parameters + * 3 : Unknown, for now assume Signal type + * 4 : Actual parameter buffer size, this is <= to the the input size + * 5 : Value + * 6 : Handle from the source process which set the parameters, likely used for shared memory + * 7 : Size + * 8 : Output parameter buffer ptr + */ void GlanceParameter(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); u32 app_id = cmd_buff[1]; u32 buffer_size = cmd_buff[2]; + cmd_buff[1] = 0; // No error cmd_buff[2] = 0; cmd_buff[3] = static_cast<u32>(SignalType::AppJustStarted); // Signal type - cmd_buff[4] = 0; + cmd_buff[4] = 0x10; // Parameter buffer size (16) cmd_buff[5] = 0; cmd_buff[6] = 0; cmd_buff[7] = 0; - cmd_buff[8] = 0; + WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); } +/** + * APT_U::AppletUtility service function + * Inputs: + * 1 : Unknown, but clearly used for something + * 2 : Buffer 1 size (purpose is unknown) + * 3 : Buffer 2 size (purpose is unknown) + * 5 : Buffer 1 address (purpose is unknown) + * 65 : Buffer 2 address (purpose is unknown) + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void AppletUtility(Service::Interface* self) { + u32* cmd_buff = Service::GetCommandBuffer(); + + // These are from 3dbrew - I'm not really sure what they're used for. + u32 unk = cmd_buff[1]; + u32 buffer1_size = cmd_buff[2]; + u32 buffer2_size = cmd_buff[3]; + u32 buffer1_addr = cmd_buff[5]; + u32 buffer2_addr = cmd_buff[65]; + + cmd_buff[1] = 0; // No error + + WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " + "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size, + buffer1_addr, buffer2_addr); +} + const Interface::FunctionInfo FunctionTable[] = { {0x00010040, GetLockHandle, "GetLockHandle"}, {0x00020080, Initialize, "Initialize"}, @@ -178,7 +247,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00480100, nullptr, "GetProgramInfo"}, {0x00490180, nullptr, "Reboot"}, {0x004A0040, nullptr, "GetCaptureInfo"}, - {0x004B00C2, nullptr, "AppletUtility"}, + {0x004B00C2, AppletUtility, "AppletUtility"}, {0x004C0000, nullptr, "SetFatalErrDispMode"}, {0x004D0080, nullptr, "GetAppletProgramInfo"}, {0x004E0000, nullptr, "HardwareResetAsync"}, @@ -191,6 +260,8 @@ const Interface::FunctionInfo FunctionTable[] = { Interface::Interface() { Register(FunctionTable, ARRAY_SIZE(FunctionTable)); + + lock_handle = 0; } Interface::~Interface() { diff --git a/src/core/hle/service/apt.h b/src/core/hle/service/apt_u.h index 4c7dd07e7..5af39e085 100644 --- a/src/core/hle/service/apt.h +++ b/src/core/hle/service/apt_u.h @@ -29,7 +29,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "APT:U"; } }; diff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg_u.cpp new file mode 100644 index 000000000..822b0e2b8 --- /dev/null +++ b/src/core/hle/service/cfg_u.cpp @@ -0,0 +1,36 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/cfg_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace CFG_U + +namespace CFG_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010082, nullptr, "GetConfigInfoBlk2"}, + {0x00020000, nullptr, "SecureInfoGetRegion"}, + {0x00030000, nullptr, "GenHashConsoleUnique"}, + {0x00040000, nullptr, "GetRegionCanadaUSA"}, + {0x00050000, nullptr, "GetSystemModel"}, + {0x00060000, nullptr, "GetModelNintendo2DS"}, + {0x00070040, nullptr, "unknown"}, + {0x00080080, nullptr, "unknown"}, + {0x00090080, nullptr, "GetCountryCodeString"}, + {0x000A0040, nullptr, "GetCountryCodeID"}, +}; +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/cfg_u.h b/src/core/hle/service/cfg_u.h new file mode 100644 index 000000000..7525bd7c6 --- /dev/null +++ b/src/core/hle/service/cfg_u.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace CFG_U + +namespace CFG_U { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "cfg:u"; + } +}; + +} // namespace diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp new file mode 100644 index 000000000..9e84ac938 --- /dev/null +++ b/src/core/hle/service/dsp_dsp.cpp @@ -0,0 +1,52 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/dsp_dsp.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace DSP_DSP + +namespace DSP_DSP { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010040, nullptr, "RecvData"}, + {0x00020040, nullptr, "RecvDataIsReady"}, + {0x00030080, nullptr, "SendData"}, + {0x00040040, nullptr, "SendDataIsEmpty"}, + {0x00070040, nullptr, "WriteReg0x10"}, + {0x00080000, nullptr, "GetSemaphore"}, + {0x00090040, nullptr, "ClearSemaphore"}, + {0x000B0000, nullptr, "CheckSemaphoreRequest"}, + {0x000C0040, nullptr, "ConvertProcessAddressFromDspDram"}, + {0x000D0082, nullptr, "WriteProcessPipe"}, + {0x001000C0, nullptr, "ReadPipeIfPossible"}, + {0x001100C2, nullptr, "LoadComponent"}, + {0x00120000, nullptr, "UnloadComponent"}, + {0x00130082, nullptr, "FlushDataCache"}, + {0x00140082, nullptr, "InvalidateDCache "}, + {0x00150082, nullptr, "RegisterInterruptEvents"}, + {0x00160000, nullptr, "GetSemaphoreEventHandle"}, + {0x00170040, nullptr, "SetSemaphoreMask"}, + {0x00180040, nullptr, "GetPhysicalAddress"}, + {0x00190040, nullptr, "GetVirtualAddress" }, + {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"}, + {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"}, + {0x001C0082, nullptr, "SetIirFilterEQ"}, + {0x001F0000, nullptr, "GetHeadphoneStatus"}, + {0x00210000, nullptr, "GetIsDspOccupied"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h new file mode 100644 index 000000000..c439ed266 --- /dev/null +++ b/src/core/hle/service/dsp_dsp.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace DSP_DSP + +namespace DSP_DSP { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "dsp:DSP"; + } +}; + +} // namespace diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp new file mode 100644 index 000000000..917b2f8ca --- /dev/null +++ b/src/core/hle/service/err_f.cpp @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/err_f.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace ERR_F + +namespace ERR_F { + + const Interface::FunctionInfo FunctionTable[] = { + {0x00010800, nullptr, "ThrowFatalError"} + }; + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Interface class + + Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); + } + + Interface::~Interface() { + } + +} // namespace diff --git a/src/core/hle/service/err_f.h b/src/core/hle/service/err_f.h new file mode 100644 index 000000000..5da663267 --- /dev/null +++ b/src/core/hle/service/err_f.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace ERR_F + +namespace ERR_F { + + class Interface : public Service::Interface { + public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "err:f"; + } + }; + +} // namespace diff --git a/src/core/hle/service/frd_u.cpp b/src/core/hle/service/frd_u.cpp new file mode 100644 index 000000000..58023e536 --- /dev/null +++ b/src/core/hle/service/frd_u.cpp @@ -0,0 +1,35 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/frd_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace FRD_U + +namespace FRD_U { + + const Interface::FunctionInfo FunctionTable[] = { + {0x00050000, nullptr, "GetFriendKey"}, + {0x00080000, nullptr, "GetMyPresence"}, + {0x00100040, nullptr, "GetPassword"}, + {0x00190042, nullptr, "GetFriendFavoriteGame"}, + {0x001A00C4, nullptr, "GetFriendInfo"}, + {0x001B0080, nullptr, "IsOnFriendList"}, + {0x001C0042, nullptr, "DecodeLocalFriendCode"}, + {0x001D0002, nullptr, "SetCurrentlyPlayingText"}, + {0x00320042, nullptr, "SetClientSdkVersion"} + }; + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Interface class + + Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); + } + + Interface::~Interface() { + } + +} // namespace diff --git a/src/core/hle/service/frd_u.h b/src/core/hle/service/frd_u.h new file mode 100644 index 000000000..9df8a815a --- /dev/null +++ b/src/core/hle/service/frd_u.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace FRD_U + +namespace FRD_U { + + class Interface : public Service::Interface { + public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "frd:u"; + } + }; + +} // namespace diff --git a/src/core/hle/service/fs.cpp b/src/core/hle/service/fs_user.cpp index 662c4f247..9dc83291d 100644 --- a/src/core/hle/service/fs.cpp +++ b/src/core/hle/service/fs_user.cpp @@ -4,7 +4,9 @@ #include "common/common.h" -#include "core/hle/service/fs.h" +#include "fs_user.h" +#include "common/string_util.h" +#include "core/settings.h" #include "core/hle/kernel/archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -12,20 +14,6 @@ namespace FS_User { -// Command to access archive file -enum class LowPathType : u32 { - Invalid = 0, - Empty = 1, - Binary = 2, - Char = 3, - Wchar = 4 -}; - -std::string GetStringFromCmdBuff(const u32 pointer, const u32 size) { - auto data = reinterpret_cast<const char*>(Memory::GetPointer(pointer)); - return std::string(data, size - 1); -} - // We currently return 0 for success and -1 for failure in cmd_buff[1]. -1 was chosen because it // puts all the sections of the http://3dbrew.org/wiki/Error_codes to something non-zero, to make // sure we don't mislead the application into thinking something worked. @@ -43,32 +31,36 @@ void Initialize(Service::Interface* self) { void OpenFile(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - u32 transaction = cmd_buff[1]; // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. Handle archive_handle = static_cast<Handle>(cmd_buff[3]); - LowPathType type = static_cast<LowPathType>(cmd_buff[4]); - u32 size = cmd_buff[5]; + auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]); + u32 filename_size = cmd_buff[5]; FileSys::Mode mode; mode.hex = cmd_buff[6]; - u32 attributes = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes. - u32 pointer = cmd_buff[9]; - - if (type != LowPathType::Char) { - ERROR_LOG(KERNEL, "file LowPath type other than char is currently unsupported"); - cmd_buff[1] = -1; + u32 attributes = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes. + u32 filename_ptr = cmd_buff[9]; + + FileSys::Path file_path(filename_type, filename_size, filename_ptr); + std::string file_string; + switch (file_path.GetType()) { + case FileSys::Char: + case FileSys::Wchar: + file_string = file_path.AsString(); + break; + default: + WARN_LOG(KERNEL, "file LowPath type is currently unsupported; returning archive handle instead"); return; } - std::string file_name = GetStringFromCmdBuff(pointer, size); - - DEBUG_LOG(KERNEL, "type=%d size=%d mode=%d attrs=%d data=%s", type, size, mode, attributes, file_name.c_str()); + DEBUG_LOG(KERNEL, "type=%d size=%d mode=%d attrs=%d data=%s", + filename_type, filename_size, mode, attributes, file_string.c_str()); - Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_name, mode); + Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode); if (handle) { cmd_buff[1] = 0; cmd_buff[3] = handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_name.c_str()); + ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_string.c_str()); // TODO(Link Mauve): check for the actual error values, this one was just chosen arbitrarily. cmd_buff[1] = -1; } @@ -79,31 +71,25 @@ void OpenFile(Service::Interface* self) { void OpenFileDirectly(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - u32 transaction = cmd_buff[1]; - auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]); - LowPathType archive_type = static_cast<LowPathType>(cmd_buff[3]); - u32 archive_size = cmd_buff[4]; - LowPathType file_type = static_cast<LowPathType>(cmd_buff[5]); - u32 size = cmd_buff[6]; + auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]); + auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[3]); + u32 archivename_size = cmd_buff[4]; + auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[5]); + u32 filename_size = cmd_buff[6]; FileSys::Mode mode; mode.hex = cmd_buff[7]; - u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes. - u32 archive_pointer = cmd_buff[10]; - u32 pointer = cmd_buff[12]; + u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes. + u32 archivename_ptr = cmd_buff[10]; + u32 filename_ptr = cmd_buff[12]; - if (archive_type != LowPathType::Empty) { + DEBUG_LOG(KERNEL, "archive_type=%d archive_size=%d file_type=%d file_size=%d file_mode=%d file_attrs=%d", + archivename_type, archivename_size, filename_type, filename_size, mode, attributes); + + if (archivename_type != FileSys::Empty) { ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); cmd_buff[1] = -1; return; } - std::string archive_name = GetStringFromCmdBuff(archive_pointer, archive_size); - std::string file_name = GetStringFromCmdBuff(pointer, size); - - DEBUG_LOG(KERNEL, "archive_type=%d archive_size=%d archive_data=%s" - "file_type=%d file_size=%d file_mode=%d file_attrs=%d file_data=%s", - archive_type, archive_size, archive_name.c_str(), - file_type, size, mode, attributes, file_name.c_str()); - // TODO(Link Mauve): check if we should even get a handle for the archive, and don't leak it. Handle archive_handle = Kernel::OpenArchive(archive_id); if (archive_handle) { @@ -111,23 +97,30 @@ void OpenFileDirectly(Service::Interface* self) { // cmd_buff[2] isn't used according to 3dmoo's implementation. cmd_buff[3] = archive_handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for archive %s", archive_name.c_str()); + ERROR_LOG(KERNEL, "failed to get a handle for archive"); // TODO(Link Mauve): check for the actual error values, this one was just chosen arbitrarily. cmd_buff[1] = -1; return; } - if (file_type != LowPathType::Char) { - WARN_LOG(KERNEL, "file LowPath type other than char is currently unsupported; returning archive handle instead"); + FileSys::Path file_path(filename_type, filename_size, filename_ptr); + std::string file_string; + switch (file_path.GetType()) { + case FileSys::Char: + case FileSys::Wchar: + file_string = file_path.AsString(); + break; + default: + WARN_LOG(KERNEL, "file LowPath type is currently unsupported; returning archive handle instead"); return; } - Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_name, mode); + Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode); if (handle) { cmd_buff[1] = 0; cmd_buff[3] = handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_name.c_str()); + ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_string.c_str()); // TODO(Link Mauve): check for the actual error values, this one was just chosen arbitrarily. cmd_buff[1] = -1; } @@ -135,32 +128,76 @@ void OpenFileDirectly(Service::Interface* self) { DEBUG_LOG(KERNEL, "called"); } +/* + * FS_User::CreateDirectory service function + * Inputs: + * 2 : Archive handle lower word + * 3 : Archive handle upper word + * 4 : Directory path string type + * 5 : Directory path string size + * 8 : Directory path string data + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void CreateDirectory(Service::Interface* self) { + u32* cmd_buff = Service::GetCommandBuffer(); + + // TODO: cmd_buff[2], aka archive handle lower word, isn't used according to + // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. + Handle archive_handle = static_cast<Handle>(cmd_buff[3]); + auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]); + u32 dirname_size = cmd_buff[5]; + u32 dirname_ptr = cmd_buff[8]; + + FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); + std::string dir_string; + switch (dir_path.GetType()) { + case FileSys::Char: + case FileSys::Wchar: + dir_string = dir_path.AsString(); + break; + default: + cmd_buff[1] = -1; + return; + } + + DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str()); + + cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_string); + + DEBUG_LOG(KERNEL, "called"); +} + void OpenDirectory(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. Handle archive_handle = static_cast<Handle>(cmd_buff[2]); - LowPathType type = static_cast<LowPathType>(cmd_buff[3]); - u32 size = cmd_buff[4]; - u32 pointer = cmd_buff[6]; - - if (type != LowPathType::Char) { - ERROR_LOG(KERNEL, "directory LowPath type other than char is currently unsupported"); + auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[3]); + u32 dirname_size = cmd_buff[4]; + u32 dirname_ptr = cmd_buff[6]; + + FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); + std::string dir_string; + switch (dir_path.GetType()) { + case FileSys::Char: + case FileSys::Wchar: + dir_string = dir_path.AsString(); + break; + default: cmd_buff[1] = -1; return; } - std::string dir_name = GetStringFromCmdBuff(pointer, size); + DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str()); - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", type, size, dir_name.c_str()); - - Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_name); + Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_string); if (handle) { cmd_buff[1] = 0; cmd_buff[3] = handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for directory %s", dir_name.c_str()); + ERROR_LOG(KERNEL, "failed to get a handle for directory %s", dir_string.c_str()); // TODO(Link Mauve): check for the actual error values, this one was just chosen arbitrarily. cmd_buff[1] = -1; } @@ -171,28 +208,26 @@ void OpenDirectory(Service::Interface* self) { void OpenArchive(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - auto arch_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[1]); - LowPathType type = static_cast<LowPathType>(cmd_buff[2]); - u32 size = cmd_buff[3]; - u32 pointer = cmd_buff[5]; + auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[1]); + auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]); + u32 archivename_size = cmd_buff[3]; + u32 archivename_ptr = cmd_buff[5]; + + DEBUG_LOG(KERNEL, "type=%d size=%d", archivename_type, archivename_size); - if (type != LowPathType::Empty) { + if (archivename_type != FileSys::Empty) { ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); cmd_buff[1] = -1; return; } - std::string archive_name = GetStringFromCmdBuff(pointer, size); - - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", type, size, archive_name.c_str()); - - Handle handle = Kernel::OpenArchive(arch_id); + Handle handle = Kernel::OpenArchive(archive_id); if (handle) { cmd_buff[1] = 0; // cmd_buff[2] isn't used according to 3dmoo's implementation. cmd_buff[3] = handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for archive %s", archive_name.c_str()); + ERROR_LOG(KERNEL, "failed to get a handle for archive"); // TODO(Link Mauve): check for the actual error values, this one was just chosen arbitrarily. cmd_buff[1] = -1; } @@ -200,6 +235,21 @@ void OpenArchive(Service::Interface* self) { DEBUG_LOG(KERNEL, "called"); } +/* +* FS_User::IsSdmcDetected service function +* Outputs: +* 1 : Result of function, 0 on success, otherwise error code +* 2 : Whether the Sdmc could be detected +*/ +void IsSdmcDetected(Service::Interface* self) { + u32* cmd_buff = Service::GetCommandBuffer(); + + cmd_buff[1] = 0; + cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; + + DEBUG_LOG(KERNEL, "called"); +} + const Interface::FunctionInfo FunctionTable[] = { {0x000100C6, nullptr, "Dummy1"}, {0x040100C4, nullptr, "Control"}, @@ -211,7 +261,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x08060142, nullptr, "DeleteDirectory"}, {0x08070142, nullptr, "DeleteDirectoryRecursively"}, {0x08080202, nullptr, "CreateFile"}, - {0x08090182, nullptr, "CreateDirectory"}, + {0x08090182, CreateDirectory, "CreateDirectory"}, {0x080A0244, nullptr, "RenameDirectory"}, {0x080B0102, OpenDirectory, "OpenDirectory"}, {0x080C00C2, OpenArchive, "OpenArchive"}, @@ -225,7 +275,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x08140000, nullptr, "GetSdmcArchiveResource"}, {0x08150000, nullptr, "GetNandArchiveResource"}, {0x08160000, nullptr, "GetSdmcFatfsErro"}, - {0x08170000, nullptr, "IsSdmcDetected"}, + {0x08170000, IsSdmcDetected, "IsSdmcDetected"}, {0x08180000, nullptr, "IsSdmcWritable"}, {0x08190042, nullptr, "GetSdmcCid"}, {0x081A0042, nullptr, "GetNandCid"}, diff --git a/src/core/hle/service/fs.h b/src/core/hle/service/fs_user.h index 36f3697d3..005382540 100644 --- a/src/core/hle/service/fs.h +++ b/src/core/hle/service/fs_user.h @@ -23,7 +23,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "fs:USER"; } }; diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp_gpu.cpp index 614d9584d..6119e6300 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -9,7 +9,7 @@ #include "core/mem_map.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" -#include "core/hle/service/gsp.h" +#include "gsp_gpu.h" #include "core/hw/gpu.h" #include "video_core/gpu_debugger.h" diff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp_gpu.h index a09d59dbb..177ce8da6 100644 --- a/src/core/hle/service/gsp.h +++ b/src/core/hle/service/gsp_gpu.h @@ -167,7 +167,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "gsp::Gpu"; } diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid_user.cpp index b6ec1b8ff..0eb32ba4a 100644 --- a/src/core/hle/service/hid.cpp +++ b/src/core/hle/service/hid_user.cpp @@ -7,7 +7,7 @@ #include "core/hle/hle.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" -#include "core/hle/service/hid.h" +#include "hid_user.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace HID_User @@ -78,6 +78,10 @@ void PadButtonRelease(PadState pad_state) { void PadUpdateComplete() { PadData* pad_data = GetPadData(); + if (pad_data == nullptr) { + return; + } + // Update PadData struct pad_data->current_state.hex = next_state.hex; pad_data->index = next_index; diff --git a/src/core/hle/service/hid.h b/src/core/hle/service/hid_user.h index a077e25cd..9f6c4d5ed 100644 --- a/src/core/hle/service/hid.h +++ b/src/core/hle/service/hid_user.h @@ -111,7 +111,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "hid:USER"; } diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp new file mode 100644 index 000000000..58051f133 --- /dev/null +++ b/src/core/hle/service/mic_u.cpp @@ -0,0 +1,43 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/mic_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace MIC_U + +namespace MIC_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010042, nullptr, "MapSharedMem"}, + {0x00020000, nullptr, "UnmapSharedMem"}, + {0x00030140, nullptr, "Initialize"}, + {0x00040040, nullptr, "AdjustSampling"}, + {0x00050000, nullptr, "StopSampling"}, + {0x00060000, nullptr, "IsSampling"}, + {0x00070000, nullptr, "GetEventHandle"}, + {0x00080040, nullptr, "SetControl"}, + {0x00090000, nullptr, "GetControl"}, + {0x000A0040, nullptr, "SetBias"}, + {0x000B0000, nullptr, "GetBias"}, + {0x000C0042, nullptr, "size"}, + {0x000D0040, nullptr, "SetClamp"}, + {0x000E0000, nullptr, "GetClamp"}, + {0x000F0040, nullptr, "unknown_input1"}, + {0x00100040, nullptr, "unknown_input2"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/mic_u.h b/src/core/hle/service/mic_u.h new file mode 100644 index 000000000..72ba048ef --- /dev/null +++ b/src/core/hle/service/mic_u.h @@ -0,0 +1,29 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace MIC_U + +// mic service + +namespace MIC_U { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "mic:u"; + } +}; + +} // namespace diff --git a/src/core/hle/service/ndm.cpp b/src/core/hle/service/ndm_u.cpp index f6af0a153..37c0661bf 100644 --- a/src/core/hle/service/ndm.cpp +++ b/src/core/hle/service/ndm_u.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include "core/hle/hle.h" -#include "core/hle/service/ndm.h" +#include "ndm_u.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace NDM_U diff --git a/src/core/hle/service/ndm.h b/src/core/hle/service/ndm_u.h index d5ec28f5b..2ca9fcf22 100644 --- a/src/core/hle/service/ndm.h +++ b/src/core/hle/service/ndm_u.h @@ -24,7 +24,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "ndm:u"; } diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp new file mode 100644 index 000000000..14df86d85 --- /dev/null +++ b/src/core/hle/service/nwm_uds.cpp @@ -0,0 +1,35 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/nwm_uds.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace NWM_UDS + +namespace NWM_UDS { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00030000, nullptr, "Shutdown"}, + {0x000F0404, nullptr, "RecvBeaconBroadcastData"}, + {0x00100042, nullptr, "SetBeaconAdditionalData"}, + {0x001400C0, nullptr, "RecvBroadcastDataFrame"}, + {0x001B0302, nullptr, "Initialize"}, + {0x001D0044, nullptr, "BeginHostingNetwork"}, + {0x001E0084, nullptr, "ConnectToNetwork"}, + {0x001F0006, nullptr, "DecryptBeaconData"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/nwm_uds.h b/src/core/hle/service/nwm_uds.h new file mode 100644 index 000000000..a956ca812 --- /dev/null +++ b/src/core/hle/service/nwm_uds.h @@ -0,0 +1,29 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace NWM_UDS + +// local-WLAN service + +namespace NWM_UDS { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "nwm:UDS"; + } +}; + +} // namespace diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp new file mode 100644 index 000000000..f6a14d509 --- /dev/null +++ b/src/core/hle/service/ptm_u.cpp @@ -0,0 +1,42 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/ptm_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace PTM_U + +namespace PTM_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010002, nullptr, "RegisterAlarmClient"}, + {0x00020080, nullptr, "SetRtcAlarm"}, + {0x00030000, nullptr, "GetRtcAlarm"}, + {0x00040000, nullptr, "CancelRtcAlarm"}, + {0x00050000, nullptr, "GetAdapterState"}, + {0x00060000, nullptr, "GetShellState "}, + {0x00070000, nullptr, "GetBatteryLevel"}, + {0x00080000, nullptr, "GetBatteryChargeState"}, + {0x00090000, nullptr, "GetPedometerState"}, + {0x000A0042, nullptr, "GetStepHistoryEntry"}, + {0x000B00C2, nullptr, "GetStepHistory "}, + {0x000C0000, nullptr, "GetTotalStepCount "}, + {0x000D0040, nullptr, "SetPedometerRecordingMode"}, + {0x000E0000, nullptr, "GetPedometerRecordingMode"}, + {0x000F0084, nullptr, "GetStepHistoryAll"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/ptm_u.h b/src/core/hle/service/ptm_u.h new file mode 100644 index 000000000..82749fa39 --- /dev/null +++ b/src/core/hle/service/ptm_u.h @@ -0,0 +1,29 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace PTM_U + +// ptm service + +namespace PTM_U { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "ptm:u"; + } +}; + +} // namespace diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 9eb1726aa..bb0f80e98 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -6,12 +6,22 @@ #include "common/string_util.h" #include "core/hle/service/service.h" -#include "core/hle/service/apt.h" -#include "core/hle/service/fs.h" -#include "core/hle/service/gsp.h" -#include "core/hle/service/hid.h" -#include "core/hle/service/ndm.h" +#include "core/hle/service/ac_u.h" +#include "core/hle/service/apt_u.h" +#include "core/hle/service/cfg_u.h" +#include "core/hle/service/dsp_dsp.h" +#include "core/hle/service/err_f.h" +#include "core/hle/service/fs_user.h" +#include "core/hle/service/frd_u.h" +#include "core/hle/service/gsp_gpu.h" +#include "core/hle/service/hid_user.h" +#include "core/hle/service/mic_u.h" +#include "core/hle/service/ndm_u.h" +#include "core/hle/service/nwm_uds.h" +#include "core/hle/service/ptm_u.h" +#include "core/hle/service/soc_u.h" #include "core/hle/service/srv.h" +#include "core/hle/service/ssl_c.h" namespace Service { @@ -66,11 +76,21 @@ void Init() { g_manager = new Manager; g_manager->AddService(new SRV::Interface); + g_manager->AddService(new AC_U::Interface); g_manager->AddService(new APT_U::Interface); + g_manager->AddService(new CFG_U::Interface); + g_manager->AddService(new DSP_DSP::Interface); + g_manager->AddService(new ERR_F::Interface); + g_manager->AddService(new FRD_U::Interface); g_manager->AddService(new FS_User::Interface); g_manager->AddService(new GSP_GPU::Interface); g_manager->AddService(new HID_User::Interface); + g_manager->AddService(new MIC_U::Interface); g_manager->AddService(new NDM_U::Interface); + g_manager->AddService(new NWM_UDS::Interface); + g_manager->AddService(new PTM_U::Interface); + g_manager->AddService(new SOC_U::Interface); + g_manager->AddService(new SSL_C::Interface); NOTICE_LOG(HLE, "initialized OK"); } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index c0e803bda..2f5a866c9 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -39,11 +39,11 @@ class Interface : public Kernel::Object { friend class Manager; public: - std::string GetName() const { return GetPortName(); } - std::string GetTypeName() const { return GetPortName(); } + std::string GetName() const override { return GetPortName(); } + std::string GetTypeName() const override { return GetPortName(); } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Service; } - Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Service; } + Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Service; } typedef void (*Function)(Interface*); @@ -80,7 +80,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 = GetCommandBuffer(); auto itr = m_functions.find(cmd_buff[0]); @@ -113,7 +113,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 function"); return 0; diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp new file mode 100644 index 000000000..2f8910468 --- /dev/null +++ b/src/core/hle/service/soc_u.cpp @@ -0,0 +1,58 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/soc_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace SOC_U + +namespace SOC_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010044, nullptr, "InitializeSockets"}, + {0x000200C2, nullptr, "socket"}, + {0x00030082, nullptr, "listen"}, + {0x00040082, nullptr, "accept"}, + {0x00050084, nullptr, "bind"}, + {0x00060084, nullptr, "connect"}, + {0x00070104, nullptr, "recvfrom_other"}, + {0x00080102, nullptr, "recvfrom"}, + {0x00090106, nullptr, "sendto_other"}, + {0x000A0106, nullptr, "sendto"}, + {0x000B0042, nullptr, "close"}, + {0x000C0082, nullptr, "shutdown"}, + {0x000D0082, nullptr, "gethostbyname"}, + {0x000E00C2, nullptr, "gethostbyaddr"}, + {0x000F0106, nullptr, "unknown_resolve_ip"}, + {0x00110102, nullptr, "getsockopt"}, + {0x00120104, nullptr, "setsockopt"}, + {0x001300C2, nullptr, "fcntl"}, + {0x00140084, nullptr, "poll"}, + {0x00150042, nullptr, "sockatmark"}, + {0x00160000, nullptr, "gethostid"}, + {0x00170082, nullptr, "getsockname"}, + {0x00180082, nullptr, "getpeername"}, + {0x00190000, nullptr, "ShutdownSockets"}, + {0x001A00C0, nullptr, "GetNetworkOpt"}, + {0x001B0040, nullptr, "ICMPSocket"}, + {0x001C0104, nullptr, "ICMPPing"}, + {0x001D0040, nullptr, "ICMPCancel"}, + {0x001E0040, nullptr, "ICMPClose"}, + {0x001F0040, nullptr, "GetResolverInfo"}, + {0x00210002, nullptr, "CloseSockets"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.h new file mode 100644 index 000000000..e27a2b1fe --- /dev/null +++ b/src/core/hle/service/soc_u.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace SOC_U + +namespace SOC_U { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "soc:U"; + } +}; + +} // namespace diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index eb2c73f93..6c02a43d9 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -57,6 +57,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00030100, nullptr, "RegisterService"}, {0x000400C0, nullptr, "UnregisterService"}, {0x00050100, GetServiceHandle, "GetServiceHandle"}, + {0x000B0000, nullptr, "ReceiveNotification"}, + {0x000C0080, nullptr, "PublishToSubscriber"} }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h index 9451472de..6d5fe5048 100644 --- a/src/core/hle/service/srv.h +++ b/src/core/hle/service/srv.h @@ -22,7 +22,7 @@ public: * Gets the string name used by CTROS for the service * @return Port name of service */ - std::string GetPortName() const { + std::string GetPortName() const override { return "srv:"; } diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp new file mode 100644 index 000000000..4aa660ecc --- /dev/null +++ b/src/core/hle/service/ssl_c.cpp @@ -0,0 +1,31 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/log.h" +#include "core/hle/hle.h" +#include "core/hle/service/ssl_c.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace SSL_C + +namespace SSL_C { + +const Interface::FunctionInfo FunctionTable[] = { + {0x000200C2, nullptr, "CreateContext"}, + {0x00050082, nullptr, "AddTrustedRootCA"}, + {0x00150082, nullptr, "Read"}, + {0x00170082, nullptr, "Write"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/ssl_c.h b/src/core/hle/service/ssl_c.h new file mode 100644 index 000000000..7b4e7fd8a --- /dev/null +++ b/src/core/hle/service/ssl_c.h @@ -0,0 +1,27 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace SSL_C + +namespace SSL_C { + +class Interface : public Service::Interface { +public: + Interface(); + ~Interface(); + /** + * Gets the string port name used by CTROS for the service + * @return Port name of service + */ + std::string GetPortName() const { + return "ssl:C"; + } +}; + +} // namespace |