mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-05 07:59:24 +02:00
hiddbg: Add hiddbgIsHdlsVirtualDeviceAttached (#345)
This commit is contained in:
parent
5a7f14409e
commit
d4c5fbdf0f
@ -182,6 +182,9 @@ Result hiddbgAttachHdlsWorkBuffer(void);
|
||||
/// Exit Hdls, must be called at some point prior to hiddbgExit. Only available with [7.0.0+].
|
||||
Result hiddbgReleaseHdlsWorkBuffer(void);
|
||||
|
||||
/// Checks if the given HdlsHandle is still attached, where the result is written to isAttached. Only available with [7.0.0+].
|
||||
Result hiddbgIsHdlsVirtualDeviceAttached(u64 HdlsHandle, bool *isAttached);
|
||||
|
||||
/// Gets state for \ref HiddbgHdlsNpadAssignment. Only available with [7.0.0+].
|
||||
Result hiddbgDumpHdlsNpadAssignmentState(HiddbgHdlsNpadAssignment *state);
|
||||
|
||||
|
@ -392,6 +392,41 @@ Result hiddbgReleaseHdlsWorkBuffer(void) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hiddbgIsHdlsVirtualDeviceAttached(u64 HdlsHandle, bool *isAttached) {
|
||||
Result rc = 0;
|
||||
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
if (!g_hiddbgHdlsInitialized)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
rc = _hiddbgCmdNoIO(327);
|
||||
if (R_FAILED(rc)) return rc;
|
||||
if (isAttached) {
|
||||
*isAttached = false;
|
||||
if (hosversionBefore(9,0,0)) {
|
||||
HiddbgHdlsStateListV7 *stateList = (HiddbgHdlsStateListV7*)(g_hiddbgHdlsTmem.src_addr);
|
||||
for (s32 i=0; i<stateList->total_entries; i++) {
|
||||
if (stateList->entries[i].HdlsHandle == HdlsHandle) {
|
||||
*isAttached = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
HiddbgHdlsStateList *stateList = (HiddbgHdlsStateList*)(g_hiddbgHdlsTmem.src_addr);
|
||||
for (s32 i=0; i<stateList->total_entries; i++) {
|
||||
if (stateList->entries[i].HdlsHandle == HdlsHandle) {
|
||||
*isAttached = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hiddbgDumpHdlsNpadAssignmentState(HiddbgHdlsNpadAssignment *state) {
|
||||
Result rc=0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user