| 319 | } |
| 320 | |
| 321 | pub fn apply_to_linear_view_object( |
| 322 | &self, |
| 323 | object: &LinearViewObject, |
| 324 | prev_object: Option<&LinearViewObject>, |
| 325 | next_object: Option<&LinearViewObject>, |
| 326 | lines: Vec<LinearDisassemblyLine>, |
| 327 | ) -> Vec<LinearDisassemblyLine> { |
| 328 | let mut lines_raw: Vec<_> = lines |
| 329 | .into_iter() |
| 330 | // NOTE: Freed after the core call |
| 331 | .map(LinearDisassemblyLine::into_raw) |
| 332 | .collect(); |
| 333 | |
| 334 | let prev_object_ptr = prev_object |
| 335 | .map(|o| o.handle) |
| 336 | .unwrap_or(std::ptr::null_mut()); |
| 337 | let next_object_ptr = next_object |
| 338 | .map(|o| o.handle) |
| 339 | .unwrap_or(std::ptr::null_mut()); |
| 340 | |
| 341 | let mut new_lines = std::ptr::null_mut(); |
| 342 | let mut new_line_count = 0; |
| 343 | |
| 344 | unsafe { |
| 345 | BNApplyRenderLayerToLinearViewObject( |
| 346 | self.handle.as_ptr(), |
| 347 | object.handle, |
| 348 | prev_object_ptr, |
| 349 | next_object_ptr, |
| 350 | lines_raw.as_mut_ptr(), |
| 351 | lines_raw.len(), |
| 352 | &mut new_lines, |
| 353 | &mut new_line_count, |
| 354 | ) |
| 355 | }; |
| 356 | |
| 357 | for line in lines_raw { |
| 358 | LinearDisassemblyLine::free_raw(line); |
| 359 | } |
| 360 | |
| 361 | let raw: Array<LinearDisassemblyLine> = |
| 362 | unsafe { Array::new(new_lines, new_line_count, ()) }; |
| 363 | raw.to_vec() |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | impl CoreArrayProvider for CoreRenderLayer { |