mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Implement a few HID Functions + Fix FAB handler
This commit is contained in:
parent
4970e58999
commit
157c54f918
@ -10,12 +10,15 @@ using namespace skyline::input;
|
||||
namespace skyline::service::hid {
|
||||
IHidServer::IHidServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IHidServer::CreateAppletResource)},
|
||||
{0x1, SFUNC(IHidServer::ActivateDebugPad)},
|
||||
{0xB, SFUNC(IHidServer::ActivateTouchScreen)},
|
||||
{0x64, SFUNC(IHidServer::SetSupportedNpadStyleSet)},
|
||||
{0x64, SFUNC(IHidServer::GetSupportedNpadStyleSet)},
|
||||
{0x65, SFUNC(IHidServer::GetSupportedNpadStyleSet)},
|
||||
{0x66, SFUNC(IHidServer::SetSupportedNpadIdType)},
|
||||
{0x67, SFUNC(IHidServer::ActivateNpad)},
|
||||
{0x68, SFUNC(IHidServer::DeactivateNpad)},
|
||||
{0x6A, SFUNC(IHidServer::AcquireNpadStyleSetUpdateEventHandle)},
|
||||
{0x6C, SFUNC(IHidServer::GetPlayerLedPattern)},
|
||||
{0x6D, SFUNC(IHidServer::ActivateNpadWithRevision)},
|
||||
{0x78, SFUNC(IHidServer::SetNpadJoyHoldType)},
|
||||
{0x79, SFUNC(IHidServer::GetNpadJoyHoldType)},
|
||||
@ -31,6 +34,15 @@ namespace skyline::service::hid {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IHidServer::ActivateDebugPad(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IHidServer::ActivateTouchScreen(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.input->touch.Activate();
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IHidServer::SetSupportedNpadStyleSet(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto styleSet = request.Pop<NpadStyleSet>();
|
||||
std::lock_guard lock(state.input->npad.mutex);
|
||||
@ -80,6 +92,33 @@ namespace skyline::service::hid {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IHidServer::GetPlayerLedPattern(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto id = request.Pop<NpadId>();
|
||||
response.Push<u64>([id] {
|
||||
switch (id) {
|
||||
case NpadId::Player1:
|
||||
return 0b0001;
|
||||
case NpadId::Player2:
|
||||
return 0b0011;
|
||||
case NpadId::Player3:
|
||||
return 0b0111;
|
||||
case NpadId::Player4:
|
||||
return 0b1111;
|
||||
case NpadId::Player5:
|
||||
return 0b1001;
|
||||
case NpadId::Player6:
|
||||
return 0b0101;
|
||||
case NpadId::Player7:
|
||||
return 0b1101;
|
||||
case NpadId::Player8:
|
||||
return 0b0110;
|
||||
default:
|
||||
return 0b0000;
|
||||
}
|
||||
}());
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IHidServer::ActivateNpadWithRevision(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.input->npad.Activate();
|
||||
return {};
|
||||
|
@ -20,6 +20,16 @@ namespace skyline::service::hid {
|
||||
*/
|
||||
Result CreateAppletResource(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This would activate the debug pad (if hid:dbg was used) on a development device
|
||||
*/
|
||||
Result ActivateDebugPad(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This activates the touch screen (if it's disabled, it is enabled by default)
|
||||
*/
|
||||
Result ActivateTouchScreen(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This sets the style of controllers supported (https://switchbrew.org/wiki/HID_services#SetSupportedNpadStyleSet)
|
||||
*/
|
||||
@ -50,6 +60,11 @@ namespace skyline::service::hid {
|
||||
*/
|
||||
Result AcquireNpadStyleSetUpdateEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This requests the LED pattern which represents a particular Player
|
||||
*/
|
||||
Result GetPlayerLedPattern(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This requests the activation of controllers with a specific HID revision (https://switchbrew.org/wiki/HID_services#ActivateNpadWithRevision)
|
||||
*/
|
||||
|
@ -173,15 +173,15 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
settings_fab.setOnClickListener { startActivityForResult(Intent(this, SettingsActivity::class.java), 3) }
|
||||
|
||||
open_fab.setOnClickListener { startActivity(Intent(this, LogActivity::class.java)) }
|
||||
|
||||
log_fab.setOnClickListener {
|
||||
open_fab.setOnClickListener {
|
||||
startActivityForResult(Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = "*/*"
|
||||
}, 2)
|
||||
}
|
||||
|
||||
log_fab.setOnClickListener { startActivity(Intent(this, LogActivity::class.java)) }
|
||||
|
||||
setupAppList()
|
||||
|
||||
app_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
|
Loading…
Reference in New Issue
Block a user