@ -50,19 +50,28 @@ impl HandleExt for Handle {
) -> crate ::Result < Vec < u32 > > {
) -> crate ::Result < Vec < u32 > > {
// Copy over the request
// Copy over the request
let cmd_buffer_ptr = unsafe { ctru_sys ::getThreadCommandBuffer ( ) } ;
let cmd_buffer_ptr = unsafe { ctru_sys ::getThreadCommandBuffer ( ) } ;
std ::ptr ::copy_nonoverlapping ( request . as_ptr ( ) , cmd_buffer_ptr , request . len ( ) ) ;
// Send the request
unsafe {
ResultCode ( ctru_sys ::svcSendSyncRequest ( self ) ) ? ;
std ::ptr ::copy_nonoverlapping ( request . as_ptr ( ) , cmd_buffer_ptr , request . len ( ) ) ;
// Send the request
ResultCode ( ctru_sys ::svcSendSyncRequest ( self ) ) ? ;
// Handle the result returned by the service
// Handle the result returned by the service
let result = unsafe { std ::ptr ::read ( cmd_buffer_ptr . add ( 1 ) ) } ;
let result = std ::ptr ::read ( cmd_buffer_ptr . add ( 1 ) ) ;
ResultCode ( result as ctru_sys ::Result ) ? ;
ResultCode ( result as ctru_sys ::Result ) ? ;
}
// Copy back the response
// Copy back the response
request . clear ( ) ;
request . clear ( ) ;
request . resize ( expected_response_len , 0 ) ;
request . resize ( expected_response_len , 0 ) ;
std ::ptr ::copy_nonoverlapping ( cmd_buffer_ptr , request . as_mut_ptr ( ) , expected_response_len ) ;
unsafe {
std ::ptr ::copy_nonoverlapping (
cmd_buffer_ptr ,
request . as_mut_ptr ( ) ,
expected_response_len ,
) ;
}
Ok ( request )
Ok ( request )
}
}