diff options
| author | 2014-04-15 23:28:03 -0400 | |
|---|---|---|
| committer | 2014-04-15 23:28:03 -0400 | |
| commit | ffabed8c25490be0e61409cebd1615eedb223c3d (patch) | |
| tree | 9dc74eb2673323a0627211bcdf6781e84f5f604a /src/core | |
| parent | fixed naming for APT_U (diff) | |
| download | yuzu-ffabed8c25490be0e61409cebd1615eedb223c3d.tar.gz yuzu-ffabed8c25490be0e61409cebd1615eedb223c3d.tar.xz yuzu-ffabed8c25490be0e61409cebd1615eedb223c3d.zip | |
restructured hle:services completely to use function lookup tables
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/apt.cpp | 200 | ||||
| -rw-r--r-- | src/core/hle/service/apt.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 28 | ||||
| -rw-r--r-- | src/core/hle/service/srv.cpp | 55 | ||||
| -rw-r--r-- | src/core/hle/service/srv.h | 39 |
5 files changed, 215 insertions, 137 deletions
diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index 288a68a86..e5c9dd873 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp | |||
| @@ -10,118 +10,104 @@ | |||
| 10 | 10 | ||
| 11 | namespace APT_U { | 11 | namespace APT_U { |
| 12 | 12 | ||
| 13 | const HLE::FunctionDef APT_U_Table[] = { | 13 | void Initialize() { |
| 14 | {0x00010040, NULL, "GetLockHandle"}, | 14 | NOTICE_LOG(OSHLE, "APT_U::Sync - Initialize"); |
| 15 | {0x00020080, NULL, "Initialize"}, | ||
| 16 | {0x00030040, NULL, "Enable"}, | ||
| 17 | {0x00040040, NULL, "Finalize"}, | ||
| 18 | {0x00050040, NULL, "GetAppletManInfo"}, | ||
| 19 | {0x00060040, NULL, "GetAppletInfo"}, | ||
| 20 | {0x00070000, NULL, "GetLastSignaledAppletId"}, | ||
| 21 | {0x00080000, NULL, "CountRegisteredApplet"}, | ||
| 22 | {0x00090040, NULL, "IsRegistered"}, | ||
| 23 | {0x000A0040, NULL, "GetAttribute"}, | ||
| 24 | {0x000B0040, NULL, "InquireNotification"}, | ||
| 25 | {0x000C0104, NULL, "SendParameter"}, | ||
| 26 | {0x000D0080, NULL, "ReceiveParameter"}, | ||
| 27 | {0x000E0080, NULL, "GlanceParameter"}, | ||
| 28 | {0x000F0100, NULL, "CancelParameter"}, | ||
| 29 | {0x001000C2, NULL, "DebugFunc"}, | ||
| 30 | {0x001100C0, NULL, "MapProgramIdForDebug"}, | ||
| 31 | {0x00120040, NULL, "SetHomeMenuAppletIdForDebug"}, | ||
| 32 | {0x00130000, NULL, "GetPreparationState"}, | ||
| 33 | {0x00140040, NULL, "SetPreparationState"}, | ||
| 34 | {0x00150140, NULL, "PrepareToStartApplication"}, | ||
| 35 | {0x00160040, NULL, "PreloadLibraryApplet"}, | ||
| 36 | {0x00170040, NULL, "FinishPreloadingLibraryApplet"}, | ||
| 37 | {0x00180040, NULL, "PrepareToStartLibraryApplet"}, | ||
| 38 | {0x00190040, NULL, "PrepareToStartSystemApplet"}, | ||
| 39 | {0x001A0000, NULL, "PrepareToStartNewestHomeMenu"}, | ||
| 40 | {0x001B00C4, NULL, "StartApplication"}, | ||
| 41 | {0x001C0000, NULL, "WakeupApplication"}, | ||
| 42 | {0x001D0000, NULL, "CancelApplication"}, | ||
| 43 | {0x001E0084, NULL, "StartLibraryApplet"}, | ||
| 44 | {0x001F0084, NULL, "StartSystemApplet"}, | ||
| 45 | {0x00200044, NULL, "StartNewestHomeMenu"}, | ||
| 46 | {0x00210000, NULL, "OrderToCloseApplication"}, | ||
| 47 | {0x00220040, NULL, "PrepareToCloseApplication"}, | ||
| 48 | {0x00230040, NULL, "PrepareToJumpToApplication"}, | ||
| 49 | {0x00240044, NULL, "JumpToApplication"}, | ||
| 50 | {0x002500C0, NULL, "PrepareToCloseLibraryApplet"}, | ||
| 51 | {0x00260000, NULL, "PrepareToCloseSystemApplet"}, | ||
| 52 | {0x00270044, NULL, "CloseApplication"}, | ||
| 53 | {0x00280044, NULL, "CloseLibraryApplet"}, | ||
| 54 | {0x00290044, NULL, "CloseSystemApplet"}, | ||
| 55 | {0x002A0000, NULL, "OrderToCloseSystemApplet"}, | ||
| 56 | {0x002B0000, NULL, "PrepareToJumpToHomeMenu"}, | ||
| 57 | {0x002C0044, NULL, "JumpToHomeMenu"}, | ||
| 58 | {0x002D0000, NULL, "PrepareToLeaveHomeMenu"}, | ||
| 59 | {0x002E0044, NULL, "LeaveHomeMenu"}, | ||
| 60 | {0x002F0040, NULL, "PrepareToLeaveResidentApplet"}, | ||
| 61 | {0x00300044, NULL, "LeaveResidentApplet"}, | ||
| 62 | {0x00310100, NULL, "PrepareToDoApplicationJump"}, | ||
| 63 | {0x00320084, NULL, "DoApplicationJump"}, | ||
| 64 | {0x00330000, NULL, "GetProgramIdOnApplicationJump"}, | ||
| 65 | {0x00340084, NULL, "SendDeliverArg"}, | ||
| 66 | {0x00350080, NULL, "ReceiveDeliverArg"}, | ||
| 67 | {0x00360040, NULL, "LoadSysMenuArg"}, | ||
| 68 | {0x00370042, NULL, "StoreSysMenuArg"}, | ||
| 69 | {0x00380040, NULL, "PreloadResidentApplet"}, | ||
| 70 | {0x00390040, NULL, "PrepareToStartResidentApplet"}, | ||
| 71 | {0x003A0044, NULL, "StartResidentApplet"}, | ||
| 72 | {0x003B0040, NULL, "CancelLibraryApplet"}, | ||
| 73 | {0x003C0042, NULL, "SendDspSleep"}, | ||
| 74 | {0x003D0042, NULL, "SendDspWakeUp"}, | ||
| 75 | {0x003E0080, NULL, "ReplySleepQuery"}, | ||
| 76 | {0x003F0040, NULL, "ReplySleepNotificationComplete"}, | ||
| 77 | {0x00400042, NULL, "SendCaptureBufferInfo"}, | ||
| 78 | {0x00410040, NULL, "ReceiveCaptureBufferInfo"}, | ||
| 79 | {0x00420080, NULL, "SleepSystem"}, | ||
| 80 | {0x00430040, NULL, "NotifyToWait"}, | ||
| 81 | {0x00440000, NULL, "GetSharedFont"}, | ||
| 82 | {0x00450040, NULL, "GetWirelessRebootInfo"}, | ||
| 83 | {0x00460104, NULL, "Wrap"}, | ||
| 84 | {0x00470104, NULL, "Unwrap"}, | ||
| 85 | {0x00480100, NULL, "GetProgramInfo"}, | ||
| 86 | {0x00490180, NULL, "Reboot"}, | ||
| 87 | {0x004A0040, NULL, "GetCaptureInfo"}, | ||
| 88 | {0x004B00C2, NULL, "AppletUtility"}, | ||
| 89 | {0x004C0000, NULL, "SetFatalErrDispMode"}, | ||
| 90 | {0x004D0080, NULL, "GetAppletProgramInfo"}, | ||
| 91 | {0x004E0000, NULL, "HardwareResetAsync"}, | ||
| 92 | }; | ||
| 93 | |||
| 94 | // Returns handle to APT Mutex. Not imlemented. | ||
| 95 | Syscall::Result Interface::GetLockHandle() { | ||
| 96 | return 0x00000000; | ||
| 97 | } | 15 | } |
| 98 | 16 | ||
| 99 | /** | 17 | void GetLockHandle() { |
| 100 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand | 18 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); |
| 101 | * @return Return result of svcSendSyncRequest passed back to user app | 19 | cmd_buff[5] = 0x00000000; // TODO: This should be an actual mutex handle |
| 102 | */ | 20 | } |
| 103 | Syscall::Result Interface::Sync() { | ||
| 104 | Syscall::Result res = 0; | ||
| 105 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET); | ||
| 106 | |||
| 107 | switch(cmd_buff[0]) { | ||
| 108 | case CMD_HEADER_INIT: | ||
| 109 | NOTICE_LOG(OSHLE, "APT_U::Sync - Initialize"); | ||
| 110 | break; | ||
| 111 | 21 | ||
| 112 | case CMD_HEADER_GET_LOCK_HANDLE: | 22 | const HLE::FunctionDef FunctionTable[] = { |
| 113 | NOTICE_LOG(OSHLE, "APT_U::Sync - GetLockHandle"); | 23 | {0x00010040, GetLockHandle, "GetLockHandle"}, |
| 114 | cmd_buff[5] = GetLockHandle(); | 24 | {0x00020080, Initialize, "Initialize"}, |
| 115 | break; | 25 | {0x00030040, NULL, "Enable"}, |
| 26 | {0x00040040, NULL, "Finalize"}, | ||
| 27 | {0x00050040, NULL, "GetAppletManInfo"}, | ||
| 28 | {0x00060040, NULL, "GetAppletInfo"}, | ||
| 29 | {0x00070000, NULL, "GetLastSignaledAppletId"}, | ||
| 30 | {0x00080000, NULL, "CountRegisteredApplet"}, | ||
| 31 | {0x00090040, NULL, "IsRegistered"}, | ||
| 32 | {0x000A0040, NULL, "GetAttribute"}, | ||
| 33 | {0x000B0040, NULL, "InquireNotification"}, | ||
| 34 | {0x000C0104, NULL, "SendParameter"}, | ||
| 35 | {0x000D0080, NULL, "ReceiveParameter"}, | ||
| 36 | {0x000E0080, NULL, "GlanceParameter"}, | ||
| 37 | {0x000F0100, NULL, "CancelParameter"}, | ||
| 38 | {0x001000C2, NULL, "DebugFunc"}, | ||
| 39 | {0x001100C0, NULL, "MapProgramIdForDebug"}, | ||
| 40 | {0x00120040, NULL, "SetHomeMenuAppletIdForDebug"}, | ||
| 41 | {0x00130000, NULL, "GetPreparationState"}, | ||
| 42 | {0x00140040, NULL, "SetPreparationState"}, | ||
| 43 | {0x00150140, NULL, "PrepareToStartApplication"}, | ||
| 44 | {0x00160040, NULL, "PreloadLibraryApplet"}, | ||
| 45 | {0x00170040, NULL, "FinishPreloadingLibraryApplet"}, | ||
| 46 | {0x00180040, NULL, "PrepareToStartLibraryApplet"}, | ||
| 47 | {0x00190040, NULL, "PrepareToStartSystemApplet"}, | ||
| 48 | {0x001A0000, NULL, "PrepareToStartNewestHomeMenu"}, | ||
| 49 | {0x001B00C4, NULL, "StartApplication"}, | ||
| 50 | {0x001C0000, NULL, "WakeupApplication"}, | ||
| 51 | {0x001D0000, NULL, "CancelApplication"}, | ||
| 52 | {0x001E0084, NULL, "StartLibraryApplet"}, | ||
| 53 | {0x001F0084, NULL, "StartSystemApplet"}, | ||
| 54 | {0x00200044, NULL, "StartNewestHomeMenu"}, | ||
| 55 | {0x00210000, NULL, "OrderToCloseApplication"}, | ||
| 56 | {0x00220040, NULL, "PrepareToCloseApplication"}, | ||
| 57 | {0x00230040, NULL, "PrepareToJumpToApplication"}, | ||
| 58 | {0x00240044, NULL, "JumpToApplication"}, | ||
| 59 | {0x002500C0, NULL, "PrepareToCloseLibraryApplet"}, | ||
| 60 | {0x00260000, NULL, "PrepareToCloseSystemApplet"}, | ||
| 61 | {0x00270044, NULL, "CloseApplication"}, | ||
| 62 | {0x00280044, NULL, "CloseLibraryApplet"}, | ||
| 63 | {0x00290044, NULL, "CloseSystemApplet"}, | ||
| 64 | {0x002A0000, NULL, "OrderToCloseSystemApplet"}, | ||
| 65 | {0x002B0000, NULL, "PrepareToJumpToHomeMenu"}, | ||
| 66 | {0x002C0044, NULL, "JumpToHomeMenu"}, | ||
| 67 | {0x002D0000, NULL, "PrepareToLeaveHomeMenu"}, | ||
| 68 | {0x002E0044, NULL, "LeaveHomeMenu"}, | ||
| 69 | {0x002F0040, NULL, "PrepareToLeaveResidentApplet"}, | ||
| 70 | {0x00300044, NULL, "LeaveResidentApplet"}, | ||
| 71 | {0x00310100, NULL, "PrepareToDoApplicationJump"}, | ||
| 72 | {0x00320084, NULL, "DoApplicationJump"}, | ||
| 73 | {0x00330000, NULL, "GetProgramIdOnApplicationJump"}, | ||
| 74 | {0x00340084, NULL, "SendDeliverArg"}, | ||
| 75 | {0x00350080, NULL, "ReceiveDeliverArg"}, | ||
| 76 | {0x00360040, NULL, "LoadSysMenuArg"}, | ||
| 77 | {0x00370042, NULL, "StoreSysMenuArg"}, | ||
| 78 | {0x00380040, NULL, "PreloadResidentApplet"}, | ||
| 79 | {0x00390040, NULL, "PrepareToStartResidentApplet"}, | ||
| 80 | {0x003A0044, NULL, "StartResidentApplet"}, | ||
| 81 | {0x003B0040, NULL, "CancelLibraryApplet"}, | ||
| 82 | {0x003C0042, NULL, "SendDspSleep"}, | ||
| 83 | {0x003D0042, NULL, "SendDspWakeUp"}, | ||
| 84 | {0x003E0080, NULL, "ReplySleepQuery"}, | ||
| 85 | {0x003F0040, NULL, "ReplySleepNotificationComplete"}, | ||
| 86 | {0x00400042, NULL, "SendCaptureBufferInfo"}, | ||
| 87 | {0x00410040, NULL, "ReceiveCaptureBufferInfo"}, | ||
| 88 | {0x00420080, NULL, "SleepSystem"}, | ||
| 89 | {0x00430040, NULL, "NotifyToWait"}, | ||
| 90 | {0x00440000, NULL, "GetSharedFont"}, | ||
| 91 | {0x00450040, NULL, "GetWirelessRebootInfo"}, | ||
| 92 | {0x00460104, NULL, "Wrap"}, | ||
| 93 | {0x00470104, NULL, "Unwrap"}, | ||
| 94 | {0x00480100, NULL, "GetProgramInfo"}, | ||
| 95 | {0x00490180, NULL, "Reboot"}, | ||
| 96 | {0x004A0040, NULL, "GetCaptureInfo"}, | ||
| 97 | {0x004B00C2, NULL, "AppletUtility"}, | ||
| 98 | {0x004C0000, NULL, "SetFatalErrDispMode"}, | ||
| 99 | {0x004D0080, NULL, "GetAppletProgramInfo"}, | ||
| 100 | {0x004E0000, NULL, "HardwareResetAsync"}, | ||
| 101 | }; | ||
| 116 | 102 | ||
| 117 | default: | 103 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 118 | ERROR_LOG(OSHLE, "APT_U::Sync - Unknown command 0x%08X", cmd_buff[0]); | 104 | // Interface class |
| 119 | res = -1; | ||
| 120 | break; | ||
| 121 | } | ||
| 122 | 105 | ||
| 123 | return res; | 106 | Interface::Interface() { |
| 107 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||
| 124 | } | 108 | } |
| 125 | 109 | ||
| 126 | 110 | Interface::~Interface() { | |
| 127 | } | 111 | } |
| 112 | |||
| 113 | } // namespace | ||
diff --git a/src/core/hle/service/apt.h b/src/core/hle/service/apt.h index 2be5a7e15..9f0245cc8 100644 --- a/src/core/hle/service/apt.h +++ b/src/core/hle/service/apt.h | |||
| @@ -20,29 +20,9 @@ namespace APT_U { | |||
| 20 | class Interface : public Service::Interface { | 20 | class Interface : public Service::Interface { |
| 21 | public: | 21 | public: |
| 22 | 22 | ||
| 23 | Interface() { | 23 | Interface(); |
| 24 | } | ||
| 25 | |||
| 26 | ~Interface() { | ||
| 27 | } | ||
| 28 | |||
| 29 | enum { | ||
| 30 | CMD_OFFSET = 0x00000080, | ||
| 31 | 24 | ||
| 32 | CMD_HEADER_INIT = 0x00020080, ///< Initialize service | 25 | ~Interface(); |
| 33 | CMD_HEADER_GET_LOCK_HANDLE = 0x00010040, ///< Get service Mutex | ||
| 34 | CMD_HEADER_ENABLE = 0x00030040, ///< Enable service | ||
| 35 | CMD_HEADER_INQUIRE_NOTIFICATION = 0x000B0040, ///< Inquire notification | ||
| 36 | CMD_HEADER_PREPARE_TO_JUMP_TO_HOME_MENU = 0x002B0000, ///< Prepare to jump to home menu | ||
| 37 | CMD_HEADER_JUMP_TO_HOME_MENU = 0x002C0044, ///< Jump to home menu | ||
| 38 | CMD_HEADER_NOTIFY_TO_WAIT = 0x00430040, ///< Notify to wait | ||
| 39 | CMD_HEADER_APPLET_UTILITY = 0x004B00C2, ///< Applet utility | ||
| 40 | CMD_HEADER_GLANCE_PARAMETER = 0x000E0080, ///< Glance parameter | ||
| 41 | CMD_HEADER_RECEIVE_PARAMETER = 0x000D0080, ///< Receive parameter | ||
| 42 | CMD_HEADER_REPLY_SLEEP_QUERY = 0x003E0080, ///< Reply sleep query | ||
| 43 | CMD_HEADER_PREPARE_TO_CLOSE_APP = 0x00220040, ///< Prepare to close application | ||
| 44 | CMD_HEADER_CLOSE_APP = 0x00270044, ///< Close application | ||
| 45 | }; | ||
| 46 | 26 | ||
| 47 | /** | 27 | /** |
| 48 | * Gets the string port name used by CTROS for the APT service | 28 | * Gets the string port name used by CTROS for the APT service |
| @@ -52,12 +32,6 @@ public: | |||
| 52 | return "APT:U"; | 32 | return "APT:U"; |
| 53 | } | 33 | } |
| 54 | 34 | ||
| 55 | /** | ||
| 56 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand | ||
| 57 | * @return Return result of svcSendSyncRequest passed back to user app | ||
| 58 | */ | ||
| 59 | Syscall::Result Sync(); | ||
| 60 | |||
| 61 | private: | 35 | private: |
| 62 | 36 | ||
| 63 | Syscall::Result GetLockHandle(); | 37 | Syscall::Result GetLockHandle(); |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 9368a9f0f..3b256aa3e 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -17,7 +17,9 @@ | |||
| 17 | 17 | ||
| 18 | namespace Service { | 18 | namespace Service { |
| 19 | 19 | ||
| 20 | typedef s32 NativeUID; ///< Native handle for a service | 20 | typedef s32 NativeUID; ///< Native handle for a service |
| 21 | |||
| 22 | static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header | ||
| 21 | 23 | ||
| 22 | class Manager; | 24 | class Manager; |
| 23 | 25 | ||
| @@ -26,6 +28,9 @@ class Interface { | |||
| 26 | friend class Manager; | 28 | friend class Manager; |
| 27 | public: | 29 | public: |
| 28 | 30 | ||
| 31 | Interface() { | ||
| 32 | } | ||
| 33 | |||
| 29 | virtual ~Interface() { | 34 | virtual ~Interface() { |
| 30 | } | 35 | } |
| 31 | 36 | ||
| @@ -49,7 +54,24 @@ public: | |||
| 49 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand | 54 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand |
| 50 | * @return Return result of svcSendSyncRequest passed back to user app | 55 | * @return Return result of svcSendSyncRequest passed back to user app |
| 51 | */ | 56 | */ |
| 52 | virtual Syscall::Result Sync() = 0; | 57 | Syscall::Result Sync() { |
| 58 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + kCommandHeaderOffset); | ||
| 59 | auto itr = m_functions.find(cmd_buff[0]); | ||
| 60 | |||
| 61 | if (itr == m_functions.end()) { | ||
| 62 | ERROR_LOG(OSHLE, "Unknown/unimplemented function: port=%s, command=0x%08X!", | ||
| 63 | GetPortName().c_str(), cmd_buff[0]); | ||
| 64 | return -1; | ||
| 65 | } | ||
| 66 | if (itr->second.func == NULL) { | ||
| 67 | ERROR_LOG(OSHLE, "Unimplemented function: port=%s, name=%s!", | ||
| 68 | GetPortName().c_str(), itr->second.name.c_str()); | ||
| 69 | } | ||
| 70 | |||
| 71 | itr->second.func(); | ||
| 72 | |||
| 73 | return 0; // TODO: Implement return from actual function | ||
| 74 | } | ||
| 53 | 75 | ||
| 54 | protected: | 76 | protected: |
| 55 | /** | 77 | /** |
| @@ -64,6 +86,8 @@ protected: | |||
| 64 | private: | 86 | private: |
| 65 | u32 m_uid; | 87 | u32 m_uid; |
| 66 | std::map<u32, HLE::FunctionDef> m_functions; | 88 | std::map<u32, HLE::FunctionDef> m_functions; |
| 89 | |||
| 90 | DISALLOW_COPY_AND_ASSIGN(Interface); | ||
| 67 | }; | 91 | }; |
| 68 | 92 | ||
| 69 | /// Simple class to manage accessing services from ports and UID handles | 93 | /// Simple class to manage accessing services from ports and UID handles |
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp new file mode 100644 index 000000000..bb6c08b78 --- /dev/null +++ b/src/core/hle/service/srv.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/hle.h" | ||
| 6 | #include "core/hle/service/srv.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | |||
| 10 | namespace SRV { | ||
| 11 | |||
| 12 | void Initialize() { | ||
| 13 | NOTICE_LOG(OSHLE, "SRV::Sync - Initialize"); | ||
| 14 | } | ||
| 15 | |||
| 16 | void GetServiceHandle() { | ||
| 17 | Syscall::Result res = 0; | ||
| 18 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); | ||
| 19 | |||
| 20 | const char* port_name = (const char*)&cmd_buff[1]; | ||
| 21 | Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); | ||
| 22 | |||
| 23 | NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name, | ||
| 24 | service->GetUID()); | ||
| 25 | |||
| 26 | if (NULL != service) { | ||
| 27 | cmd_buff[3] = service->GetUID(); | ||
| 28 | } else { | ||
| 29 | ERROR_LOG(OSHLE, "Service %s does not exist", port_name); | ||
| 30 | res = -1; | ||
| 31 | } | ||
| 32 | cmd_buff[1] = res; | ||
| 33 | |||
| 34 | //return res; | ||
| 35 | } | ||
| 36 | |||
| 37 | const HLE::FunctionDef FunctionTable[] = { | ||
| 38 | {0x00010002, Initialize, "Initialize"}, | ||
| 39 | {0x00020000, NULL, "GetProcSemaphore"}, | ||
| 40 | {0x00030100, NULL, "RegisterService"}, | ||
| 41 | {0x000400C0, NULL, "UnregisterService"}, | ||
| 42 | {0x00050100, GetServiceHandle, "GetServiceHandle"}, | ||
| 43 | }; | ||
| 44 | |||
| 45 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 46 | // Interface class | ||
| 47 | |||
| 48 | Interface::Interface() { | ||
| 49 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||
| 50 | } | ||
| 51 | |||
| 52 | Interface::~Interface() { | ||
| 53 | } | ||
| 54 | |||
| 55 | } // namespace | ||
diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h new file mode 100644 index 000000000..b4c5a0c17 --- /dev/null +++ b/src/core/hle/service/srv.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/service.h" | ||
| 6 | |||
| 7 | namespace SRV { | ||
| 8 | |||
| 9 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 10 | // Interface to "SRV" service | ||
| 11 | |||
| 12 | class Interface : public Service::Interface { | ||
| 13 | |||
| 14 | public: | ||
| 15 | |||
| 16 | Interface(); | ||
| 17 | |||
| 18 | ~Interface(); | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Gets the string name used by CTROS for a service | ||
| 22 | * @return Port name of service | ||
| 23 | */ | ||
| 24 | std::string GetPortName() const { | ||
| 25 | return "srv:"; | ||
| 26 | } | ||
| 27 | |||
| 28 | /** | ||
| 29 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand | ||
| 30 | * @return Return result of svcSendSyncRequest passed back to user app | ||
| 31 | */ | ||
| 32 | Syscall::Result Sync(); | ||
| 33 | |||
| 34 | private: | ||
| 35 | |||
| 36 | DISALLOW_COPY_AND_ASSIGN(Interface); | ||
| 37 | }; | ||
| 38 | |||
| 39 | } // namespace | ||