diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-13 22:33:45 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-13 22:33:45 +0200 |
commit | 9f4d677cdf1fcc937d2e68cae3f52f53c24582f8 (patch) | |
tree | 8d92dbc0b8e568dd67649511c070b31e7ca5d125 /src | |
parent | renamed class Interface_SRV to SRV (diff) | |
download | yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar.gz yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar.bz2 yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar.lz yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar.xz yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.tar.zst yuzu-9f4d677cdf1fcc937d2e68cae3f52f53c24582f8.zip |
Diffstat (limited to 'src')
-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 @@ <ClCompile Include="file_sys\directory_file_system.cpp" /> <ClCompile Include="file_sys\meta_file_system.cpp" /> <ClCompile Include="hle\hle.cpp" /> + <ClCompile Include="hle\service\apt.cpp" /> <ClCompile Include="hle\service\service.cpp" /> <ClCompile Include="hle\syscall.cpp" /> <ClCompile Include="hw\hw.cpp" /> @@ -187,6 +188,7 @@ <ClInclude Include="file_sys\meta_file_system.h" /> <ClInclude Include="hle\function_wrappers.h" /> <ClInclude Include="hle\hle.h" /> + <ClInclude Include="hle\service\apt.h" /> <ClInclude Include="hle\service\service.h" /> <ClInclude Include="hle\syscall.h" /> <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 @@ <ClCompile Include="hle\service\service.cpp"> <Filter>hle\service</Filter> </ClCompile> + <ClCompile Include="hle\service\apt.cpp"> + <Filter>hle\service</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="arm\disassembler\arm_disasm.h"> @@ -175,6 +178,9 @@ <ClInclude Include="hle\syscall.h"> <Filter>hle</Filter> </ClInclude> + <ClInclude Include="hle\service\apt.h"> + <Filter>hle\service</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <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) { return g_command_buffer + (addr & CMD_BUFFER_MASK); } else { ERROR_LOG(HLE, "unknown pointer from address %08X", addr); + return 0; } } 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 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + + +#include "common/log.h" +#include "core/hle/service/apt.h" + + + + +namespace Service { + + +Syscall::Result APT::Sync() { + NOTICE_LOG(HLE, "APT::Sync - Initialize"); + return 0; +} + + +} 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 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace Service + +namespace Service { + +// Application and title launching service. These services handle signaling for home/power button as +// well. Only one session for either APT service can be open at a time, normally processes close the +// service handle immediately once finished using the service. The commands for APT:U and APT:S are +// exactly the same, however certain commands are only accessible with APT:S(NS module will call +// svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services. + +class APT : public Interface { +public: + + APT() { + } + + ~APT() { + } + + enum { + CMD_OFFSET = 0x00000080, + + CMD_HEADER_INIT = 0x00020080, ///< Initialize service + CMD_HEADER_GET_LOCK_HANDLE = 0x00010040, ///< Get service Mutex + CMD_HEADER_ENABLE = 0x00030040, ///< Enable service + CMD_HEADER_INQUIRE_NOTIFICATION = 0x000B0040, ///< Inquire notification + CMD_HEADER_PREPARE_TO_JUMP_TO_HOME_MENU = 0x002B0000, ///< Prepare to jump to home menu + CMD_HEADER_JUMP_TO_HOME_MENU = 0x002C0044, ///< Jump to home menu + CMD_HEADER_NOTIFY_TO_WAIT = 0x00430040, ///< Notify to wait + CMD_HEADER_APPLET_UTILITY = 0x004B00C2, ///< Applet utility + CMD_HEADER_GLANCE_PARAMETER = 0x000E0080, ///< Glance parameter + CMD_HEADER_RECEIVE_PARAMETER = 0x000D0080, ///< Receive parameter + CMD_HEADER_REPLY_SLEEP_QUERY = 0x003E0080, ///< Reply sleep query + CMD_HEADER_PREPARE_TO_CLOSE_APP = 0x00220040, ///< Prepare to close application + CMD_HEADER_CLOSE_APP = 0x00270044, ///< Close application + }; + + /** + * Gets the string name used by CTROS for the APT service + * @return String name of service + */ + std::string GetName() const { + return "APT"; + } + + /** + * Gets the string port name used by CTROS for the APT service + * @return Port name of service + */ + std::string GetPortName() const { + return "APT:U"; + } + + /** + * Called when svcSendSyncRequest is called, loads command buffer and executes comand + * @return Return result of svcSendSyncRequest passed back to user app + */ + virtual Syscall::Result Sync(); + +}; + +} // 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 @@ #include "core/hle/hle.h" #include "core/hle/service/service.h" +#include "core/hle/service/apt.h" namespace Service { @@ -104,19 +105,36 @@ public: */ Syscall::Result Sync() { u32 header = 0; - HLE::Read<u32>(header, (HLE::CMD_BUFFER_ADDR + CMD_OFFSET)); + Syscall::Result res = 0; + + u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET); + + switch (cmd_buff[0]) { - switch (header) { case CMD_HEADER_INIT: - NOTICE_LOG(HLE, "SRV::Sync - Initialize"); + NOTICE_LOG(OSHLE, "SRV::Sync - Initialize"); break; case CMD_HEADER_GET_HANDLE: - NOTICE_LOG(HLE, "SRV::Sync - GetHandle, port: %s", HLE::GetCharPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET + 4)); + const char* port_name = (const char*)&cmd_buff[1]; + Interface* service = g_manager->FetchFromPortName(port_name); + + NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name, + service->GetUID()); + + if (NULL != service) { + cmd_buff[3] = service->GetUID(); + } else { + ERROR_LOG(OSHLE, "Service %s does not exist", port_name); + res = -1; + } + break; } - return 0; + cmd_buff[1] = res; + + return res; } }; @@ -128,6 +146,7 @@ public: void Init() { g_manager = new Manager; g_manager->AddService(new SRV); + g_manager->AddService(new APT); NOTICE_LOG(HLE, "Services initialized OK"); } 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 @@ #include <map> #include <string> +#include "common/common.h" #include "common/common_types.h" #include "core/hle/syscall.h" |