diff options
| -rw-r--r-- | src/core/core.vcxproj | 2 | ||||
| -rw-r--r-- | src/core/core.vcxproj.filters | 6 | ||||
| -rw-r--r-- | src/core/hle/hle.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/apt.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/service/apt.h | 71 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 29 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 1 |
7 files changed, 126 insertions, 5 deletions
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index b10ae8684..be750b24f 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj | |||
| @@ -153,6 +153,7 @@ | |||
| 153 | <ClCompile Include="file_sys\directory_file_system.cpp" /> | 153 | <ClCompile Include="file_sys\directory_file_system.cpp" /> |
| 154 | <ClCompile Include="file_sys\meta_file_system.cpp" /> | 154 | <ClCompile Include="file_sys\meta_file_system.cpp" /> |
| 155 | <ClCompile Include="hle\hle.cpp" /> | 155 | <ClCompile Include="hle\hle.cpp" /> |
| 156 | <ClCompile Include="hle\service\apt.cpp" /> | ||
| 156 | <ClCompile Include="hle\service\service.cpp" /> | 157 | <ClCompile Include="hle\service\service.cpp" /> |
| 157 | <ClCompile Include="hle\syscall.cpp" /> | 158 | <ClCompile Include="hle\syscall.cpp" /> |
| 158 | <ClCompile Include="hw\hw.cpp" /> | 159 | <ClCompile Include="hw\hw.cpp" /> |
| @@ -187,6 +188,7 @@ | |||
| 187 | <ClInclude Include="file_sys\meta_file_system.h" /> | 188 | <ClInclude Include="file_sys\meta_file_system.h" /> |
| 188 | <ClInclude Include="hle\function_wrappers.h" /> | 189 | <ClInclude Include="hle\function_wrappers.h" /> |
| 189 | <ClInclude Include="hle\hle.h" /> | 190 | <ClInclude Include="hle\hle.h" /> |
| 191 | <ClInclude Include="hle\service\apt.h" /> | ||
| 190 | <ClInclude Include="hle\service\service.h" /> | 192 | <ClInclude Include="hle\service\service.h" /> |
| 191 | <ClInclude Include="hle\syscall.h" /> | 193 | <ClInclude Include="hle\syscall.h" /> |
| 192 | <ClInclude Include="hw\hw.h" /> | 194 | <ClInclude Include="hw\hw.h" /> |
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index 4844e78b8..29d680935 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters | |||
| @@ -90,6 +90,9 @@ | |||
| 90 | <ClCompile Include="hle\service\service.cpp"> | 90 | <ClCompile Include="hle\service\service.cpp"> |
| 91 | <Filter>hle\service</Filter> | 91 | <Filter>hle\service</Filter> |
| 92 | </ClCompile> | 92 | </ClCompile> |
| 93 | <ClCompile Include="hle\service\apt.cpp"> | ||
| 94 | <Filter>hle\service</Filter> | ||
| 95 | </ClCompile> | ||
| 93 | </ItemGroup> | 96 | </ItemGroup> |
| 94 | <ItemGroup> | 97 | <ItemGroup> |
| 95 | <ClInclude Include="arm\disassembler\arm_disasm.h"> | 98 | <ClInclude Include="arm\disassembler\arm_disasm.h"> |
| @@ -175,6 +178,9 @@ | |||
| 175 | <ClInclude Include="hle\syscall.h"> | 178 | <ClInclude Include="hle\syscall.h"> |
| 176 | <Filter>hle</Filter> | 179 | <Filter>hle</Filter> |
| 177 | </ClInclude> | 180 | </ClInclude> |
| 181 | <ClInclude Include="hle\service\apt.h"> | ||
| 182 | <Filter>hle\service</Filter> | ||
| 183 | </ClInclude> | ||
| 178 | </ItemGroup> | 184 | </ItemGroup> |
| 179 | <ItemGroup> | 185 | <ItemGroup> |
| 180 | <Text Include="CMakeLists.txt" /> | 186 | <Text Include="CMakeLists.txt" /> |
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index a4ab61c0c..c173b82de 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp | |||
| @@ -42,6 +42,7 @@ u8 *GetPointer(const u32 addr) { | |||
| 42 | return g_command_buffer + (addr & CMD_BUFFER_MASK); | 42 | return g_command_buffer + (addr & CMD_BUFFER_MASK); |
| 43 | } else { | 43 | } else { |
| 44 | ERROR_LOG(HLE, "unknown pointer from address %08X", addr); | 44 | ERROR_LOG(HLE, "unknown pointer from address %08X", addr); |
| 45 | return 0; | ||
| 45 | } | 46 | } |
| 46 | } | 47 | } |
| 47 | 48 | ||
diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp new file mode 100644 index 000000000..9ab5a361c --- /dev/null +++ b/src/core/hle/service/apt.cpp | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | |||
| 6 | #include "common/log.h" | ||
| 7 | #include "core/hle/service/apt.h" | ||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | |||
| 12 | namespace Service { | ||
| 13 | |||
| 14 | |||
| 15 | Syscall::Result APT::Sync() { | ||
| 16 | NOTICE_LOG(HLE, "APT::Sync - Initialize"); | ||
| 17 | return 0; | ||
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | } | ||
diff --git a/src/core/hle/service/apt.h b/src/core/hle/service/apt.h new file mode 100644 index 000000000..05c544378 --- /dev/null +++ b/src/core/hle/service/apt.h | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 10 | // Namespace Service | ||
| 11 | |||
| 12 | namespace Service { | ||
| 13 | |||
| 14 | // Application and title launching service. These services handle signaling for home/power button as | ||
| 15 | // well. Only one session for either APT service can be open at a time, normally processes close the | ||
| 16 | // service handle immediately once finished using the service. The commands for APT:U and APT:S are | ||
| 17 | // exactly the same, however certain commands are only accessible with APT:S(NS module will call | ||
| 18 | // svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services. | ||
| 19 | |||
| 20 | class APT : public Interface { | ||
| 21 | public: | ||
| 22 | |||
| 23 | APT() { | ||
| 24 | } | ||
| 25 | |||
| 26 | ~APT() { | ||
| 27 | } | ||
| 28 | |||
| 29 | enum { | ||
| 30 | CMD_OFFSET = 0x00000080, | ||
| 31 | |||
| 32 | CMD_HEADER_INIT = 0x00020080, ///< Initialize service | ||
| 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 | |||
| 47 | /** | ||
| 48 | * Gets the string name used by CTROS for the APT service | ||
| 49 | * @return String name of service | ||
| 50 | */ | ||
| 51 | std::string GetName() const { | ||
| 52 | return "APT"; | ||
| 53 | } | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Gets the string port name used by CTROS for the APT service | ||
| 57 | * @return Port name of service | ||
| 58 | */ | ||
| 59 | std::string GetPortName() const { | ||
| 60 | return "APT:U"; | ||
| 61 | } | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Called when svcSendSyncRequest is called, loads command buffer and executes comand | ||
| 65 | * @return Return result of svcSendSyncRequest passed back to user app | ||
| 66 | */ | ||
| 67 | virtual Syscall::Result Sync(); | ||
| 68 | |||
| 69 | }; | ||
| 70 | |||
| 71 | } // namespace | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index b0b2b7b35..b2470d814 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "core/hle/hle.h" | 8 | #include "core/hle/hle.h" |
| 9 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 10 | #include "core/hle/service/apt.h" | ||
| 10 | 11 | ||
| 11 | namespace Service { | 12 | namespace Service { |
| 12 | 13 | ||
| @@ -104,19 +105,36 @@ public: | |||
| 104 | */ | 105 | */ |
| 105 | Syscall::Result Sync() { | 106 | Syscall::Result Sync() { |
| 106 | u32 header = 0; | 107 | u32 header = 0; |
| 107 | HLE::Read<u32>(header, (HLE::CMD_BUFFER_ADDR + CMD_OFFSET)); | 108 | Syscall::Result res = 0; |
| 109 | |||
| 110 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET); | ||
| 111 | |||
| 112 | switch (cmd_buff[0]) { | ||
| 108 | 113 | ||
| 109 | switch (header) { | ||
| 110 | case CMD_HEADER_INIT: | 114 | case CMD_HEADER_INIT: |
| 111 | NOTICE_LOG(HLE, "SRV::Sync - Initialize"); | 115 | NOTICE_LOG(OSHLE, "SRV::Sync - Initialize"); |
| 112 | break; | 116 | break; |
| 113 | 117 | ||
| 114 | case CMD_HEADER_GET_HANDLE: | 118 | case CMD_HEADER_GET_HANDLE: |
| 115 | NOTICE_LOG(HLE, "SRV::Sync - GetHandle, port: %s", HLE::GetCharPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET + 4)); | 119 | const char* port_name = (const char*)&cmd_buff[1]; |
| 120 | Interface* service = g_manager->FetchFromPortName(port_name); | ||
| 121 | |||
| 122 | NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name, | ||
| 123 | service->GetUID()); | ||
| 124 | |||
| 125 | if (NULL != service) { | ||
| 126 | cmd_buff[3] = service->GetUID(); | ||
| 127 | } else { | ||
| 128 | ERROR_LOG(OSHLE, "Service %s does not exist", port_name); | ||
| 129 | res = -1; | ||
| 130 | } | ||
| 131 | |||
| 116 | break; | 132 | break; |
| 117 | } | 133 | } |
| 118 | 134 | ||
| 119 | return 0; | 135 | cmd_buff[1] = res; |
| 136 | |||
| 137 | return res; | ||
| 120 | } | 138 | } |
| 121 | 139 | ||
| 122 | }; | 140 | }; |
| @@ -128,6 +146,7 @@ public: | |||
| 128 | void Init() { | 146 | void Init() { |
| 129 | g_manager = new Manager; | 147 | g_manager = new Manager; |
| 130 | g_manager->AddService(new SRV); | 148 | g_manager->AddService(new SRV); |
| 149 | g_manager->AddService(new APT); | ||
| 131 | NOTICE_LOG(HLE, "Services initialized OK"); | 150 | NOTICE_LOG(HLE, "Services initialized OK"); |
| 132 | } | 151 | } |
| 133 | 152 | ||
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 3cad6c642..365583ed2 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <map> | 8 | #include <map> |
| 9 | #include <string> | 9 | #include <string> |
| 10 | 10 | ||
| 11 | #include "common/common.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | #include "core/hle/syscall.h" | 13 | #include "core/hle/syscall.h" |
| 13 | 14 | ||