mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hiddbg: modify hiddbgAttachHdlsWorkBuffer to accept a user-supplied buffer and size (#601)
Co-authored-by: ndeadly <24677491+ndeadly@users.noreply.github.com>
This commit is contained in:
parent
174b5066a5
commit
dcebe96e71
@ -402,8 +402,10 @@ Result hiddbgUnsetAllAutoPilotVirtualPadState(void);
|
||||
* @brief Initialize Hdls.
|
||||
* @note Only available with [7.0.0+].
|
||||
* @param[out] session_id [13.0.0+] \ref HiddbgHdlsSessionId
|
||||
* @param[in] buffer An existing buffer to be used as transfer memory.
|
||||
* @param[in] size Size of the supplied buffer.
|
||||
*/
|
||||
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id);
|
||||
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id, void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Exit Hdls, must be called at some point prior to \ref hiddbgExit.
|
||||
|
@ -467,7 +467,7 @@ static Result _hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id, Trans
|
||||
return _hiddbgCmdInTmemOutU64(tmem, &session_id->id, 324);
|
||||
}
|
||||
|
||||
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id) {
|
||||
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id, void *buffer, size_t size) {
|
||||
Result rc=0;
|
||||
|
||||
if (session_id) session_id->id = 0;
|
||||
@ -478,8 +478,7 @@ Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id) {
|
||||
if (g_hiddbgHdlsInitialized)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
|
||||
rc = tmemCreate(&g_hiddbgHdlsTmem, 0x1000, Perm_Rw);
|
||||
rc = tmemCreateFromMemory(&g_hiddbgHdlsTmem, buffer, size, Perm_Rw);
|
||||
if (R_FAILED(rc)) return rc;
|
||||
|
||||
rc = _hiddbgAttachHdlsWorkBuffer(session_id, &g_hiddbgHdlsTmem);
|
||||
|
Loading…
Reference in New Issue
Block a user