2014-04-16 17:58:36 -07:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
|
|
|
#include "core/hle/hle.h"
|
2014-08-07 17:27:56 -07:00
|
|
|
#include "core/hle/kernel/event.h"
|
|
|
|
#include "core/hle/kernel/shared_memory.h"
|
2014-04-16 17:58:36 -07:00
|
|
|
#include "core/hle/service/hid.h"
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Namespace HID_User
|
|
|
|
|
|
|
|
namespace HID_User {
|
|
|
|
|
2014-08-07 17:27:56 -07:00
|
|
|
Handle g_shared_mem = 0; ///< Handle to shared memory region designated to HID_User service
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HID_User::GetIPCHandles service function
|
|
|
|
* Inputs:
|
|
|
|
* None
|
|
|
|
* Outputs:
|
|
|
|
* 1 : Result of function, 0 on success, otherwise error code
|
|
|
|
* 2 : Unused
|
|
|
|
* 3 : Handle to HID_User shared memory
|
|
|
|
* 4 : Event signaled by HID_User
|
|
|
|
* 5 : Event signaled by HID_User
|
|
|
|
* 6 : Event signaled by HID_User
|
|
|
|
* 7 : Gyroscope event
|
|
|
|
* 8 : Event signaled by HID_User
|
|
|
|
*/
|
|
|
|
void GetIPCHandles(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Service::GetCommandBuffer();
|
|
|
|
|
|
|
|
cmd_buff[1] = 0; // No error
|
|
|
|
cmd_buff[3] = g_shared_mem;
|
|
|
|
cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventA");
|
|
|
|
cmd_buff[5] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventB");
|
|
|
|
cmd_buff[6] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventC");
|
|
|
|
cmd_buff[7] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventGyroscope");
|
|
|
|
cmd_buff[8] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventD");
|
|
|
|
|
|
|
|
DEBUG_LOG(KERNEL, "called");
|
|
|
|
}
|
|
|
|
|
2014-04-24 19:16:54 -07:00
|
|
|
const Interface::FunctionInfo FunctionTable[] = {
|
2014-08-07 17:27:56 -07:00
|
|
|
{0x000A0000, GetIPCHandles, "GetIPCHandles"},
|
2014-08-07 17:33:59 -07:00
|
|
|
{0x000B0000, nullptr, "StartAnalogStickCalibration"},
|
|
|
|
{0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},
|
2014-08-07 17:27:56 -07:00
|
|
|
{0x00110000, nullptr, "EnableAccelerometer"},
|
2014-08-07 17:33:59 -07:00
|
|
|
{0x00120000, nullptr, "DisableAccelerometer"},
|
2014-08-07 17:27:56 -07:00
|
|
|
{0x00130000, nullptr, "EnableGyroscopeLow"},
|
2014-08-07 17:33:59 -07:00
|
|
|
{0x00140000, nullptr, "DisableGyroscopeLow"},
|
2014-08-07 17:27:56 -07:00
|
|
|
{0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
|
|
|
|
{0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
|
2014-08-07 17:33:59 -07:00
|
|
|
{0x00170000, nullptr, "GetSoundVolume"},
|
2014-04-16 17:58:36 -07:00
|
|
|
};
|
|
|
|
|
2014-09-02 22:24:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-16 17:58:36 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Interface class
|
|
|
|
|
|
|
|
Interface::Interface() {
|
2014-08-07 17:27:56 -07:00
|
|
|
g_shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object
|
|
|
|
|
2014-04-16 17:58:36 -07:00
|
|
|
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
|
|
|
|
}
|
|
|
|
|
|
|
|
Interface::~Interface() {
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|