Set client SDK version to Service APIs

This commit is contained in:
mailwl 2016-05-19 12:46:21 +03:00
parent c106f71beb
commit 29bbe81dfb
9 changed files with 74 additions and 12 deletions

View File

@ -43,6 +43,7 @@ namespace Log {
SUB(Service, AM) \ SUB(Service, AM) \
SUB(Service, PTM) \ SUB(Service, PTM) \
SUB(Service, LDR) \ SUB(Service, LDR) \
SUB(Service, MIC) \
SUB(Service, NDM) \ SUB(Service, NDM) \
SUB(Service, NIM) \ SUB(Service, NIM) \
SUB(Service, NWM) \ SUB(Service, NWM) \

View File

@ -58,6 +58,7 @@ enum class Class : ClassType {
Service_AM, ///< The AM (Application manager) service Service_AM, ///< The AM (Application manager) service
Service_PTM, ///< The PTM (Power status & misc.) service Service_PTM, ///< The PTM (Power status & misc.) service
Service_LDR, ///< The LDR (3ds dll loader) service Service_LDR, ///< The LDR (3ds dll loader) service
Service_MIC, ///< The MIC (Microphone) service
Service_NDM, ///< The NDM (Network daemon manager) service Service_NDM, ///< The NDM (Network daemon manager) service
Service_NIM, ///< The NIM (Network interface manager) service Service_NIM, ///< The NIM (Network interface manager) service
Service_NWM, ///< The NWM (Network wlan manager) service Service_NWM, ///< The NWM (Network wlan manager) service

View File

@ -67,6 +67,23 @@ static void IsConnected(Service::Interface* self) {
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
} }
/**
* AC_U::SetClientVersion service function
* Inputs:
* 1 : Used SDK Version
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
static void SetClientVersion(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
self->SetVersion(cmd_buff[1]);
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_AC, "(STUBBED) called");
}
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00010000, nullptr, "CreateDefaultConfig"}, {0x00010000, nullptr, "CreateDefaultConfig"},
{0x00040006, nullptr, "ConnectAsync"}, {0x00040006, nullptr, "ConnectAsync"},
@ -84,7 +101,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00300004, nullptr, "RegisterDisconnectEvent"}, {0x00300004, nullptr, "RegisterDisconnectEvent"},
{0x003C0042, nullptr, "GetAPSSIDList"}, {0x003C0042, nullptr, "GetAPSSIDList"},
{0x003E0042, IsConnected, "IsConnected"}, {0x003E0042, IsConnected, "IsConnected"},
{0x00400042, nullptr, "SetClientVersion"}, {0x00400042, SetClientVersion, "SetClientVersion"},
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -101,6 +101,16 @@ void GetMyScreenName(Service::Interface* self) {
LOG_WARNING(Service_FRD, "(STUBBED) called"); LOG_WARNING(Service_FRD, "(STUBBED) called");
} }
void SetClientSdkVersion(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
self->SetVersion(cmd_buff[1]);
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_AC, "(STUBBED) called");
}
void Init() { void Init() {
using namespace Kernel; using namespace Kernel;

View File

@ -95,6 +95,15 @@ void GetMyFriendKey(Service::Interface* self);
*/ */
void GetMyScreenName(Service::Interface* self); void GetMyScreenName(Service::Interface* self);
/**
* FRD::SetClientSdkVersion service function
* Inputs:
* 1 : Used SDK Version
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void SetClientSdkVersion(Service::Interface* self);
/// Initialize FRD service(s) /// Initialize FRD service(s)
void Init(); void Init();

View File

@ -58,7 +58,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x002F0040, nullptr, "AllowHalfAwake"}, {0x002F0040, nullptr, "AllowHalfAwake"},
{0x00300000, nullptr, "GetServerTypes"}, {0x00300000, nullptr, "GetServerTypes"},
{0x00310082, nullptr, "GetFriendComment"}, {0x00310082, nullptr, "GetFriendComment"},
{0x00320042, nullptr, "SetClientSdkVersion"}, {0x00320042, SetClientSdkVersion, "SetClientSdkVersion"},
{0x00330000, nullptr, "GetMyApproachContext"}, {0x00330000, nullptr, "GetMyApproachContext"},
{0x00340046, nullptr, "AddFriendWithApproach"}, {0x00340046, nullptr, "AddFriendWithApproach"},
{0x00350082, nullptr, "DecryptApproachContext"}, {0x00350082, nullptr, "DecryptApproachContext"},

View File

@ -674,24 +674,19 @@ static void CreateSystemSaveData(Service::Interface* self) {
/** /**
* FS_User::InitializeWithSdkVersion service function. * FS_User::InitializeWithSdkVersion service function.
* Inputs: * Inputs:
* 0 : 0x08610042 * 1 : Used SDK Version
* 1 : Unknown * 2 : ProcessId Header (must be 0x20)
* 2 : Unknown
* 3 : Unknown
* Outputs: * Outputs:
* 1 : Result of function, 0 on success, otherwise error code * 1 : Result of function, 0 on success, otherwise error code
*/ */
static void InitializeWithSdkVersion(Service::Interface* self) { static void InitializeWithSdkVersion(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
u32 unk1 = cmd_buff[1]; self->SetVersion(cmd_buff[1]);
u32 unk2 = cmd_buff[2];
u32 unk3 = cmd_buff[3];
cmd_buff[1] = RESULT_SUCCESS.raw; cmd_buff[1] = RESULT_SUCCESS.raw;
LOG_WARNING(Service_FS, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, unk3=0x%08X", LOG_WARNING(Service_FS, "(STUBBED) called");
unk1, unk2, unk3);
} }
/** /**

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/service/mic_u.h" #include "core/hle/service/mic_u.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -9,6 +11,24 @@
namespace MIC_U { namespace MIC_U {
/**
* MIC_U::SetClientVersion service function
* Inputs:
* 1 : Used SDK Version
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
static void SetClientVersion(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
self->SetVersion(cmd_buff[1]);
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_MIC, "(STUBBED) called");
}
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00010042, nullptr, "MapSharedMem"}, {0x00010042, nullptr, "MapSharedMem"},
{0x00020000, nullptr, "UnmapSharedMem"}, {0x00020000, nullptr, "UnmapSharedMem"},
@ -25,7 +45,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000D0040, nullptr, "SetClamp"}, {0x000D0040, nullptr, "SetClamp"},
{0x000E0000, nullptr, "GetClamp"}, {0x000E0000, nullptr, "GetClamp"},
{0x000F0040, nullptr, "SetAllowShellClosed"}, {0x000F0040, nullptr, "SetAllowShellClosed"},
{0x00100040, nullptr, "unknown_input2"}, {0x00100040, SetClientVersion, "SetClientVersion"},
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -29,6 +29,7 @@ class Interface : public Kernel::Session {
// processes. // processes.
public: public:
std::string GetName() const override { return GetPortName(); } std::string GetName() const override { return GetPortName(); }
virtual void SetVersion(u32 raw_version) { version.raw = raw_version; }
typedef void (*Function)(Interface*); typedef void (*Function)(Interface*);
@ -60,6 +61,14 @@ protected:
void Register(const FunctionInfo* functions, size_t n); void Register(const FunctionInfo* functions, size_t n);
union {
u32 raw;
BitField< 0, 8, u32> major;
BitField< 8, 8, u32> minor;
BitField<16, 8, u32> build;
BitField<24, 8, u32> revision;
} version = {};
private: private:
boost::container::flat_map<u32, FunctionInfo> m_functions; boost::container::flat_map<u32, FunctionInfo> m_functions;