feat: add pointer identification column to debug UI inspector
Browse filesThe raw fields grid now has a "Points to" column that uses
identify_pointer() to annotate each DWORD value:
- Static addresses: "→ CTASK_WORM_VTABLE"
- Heap objects with known vtable: "→ DSSound*"
- Fields inside tracked live objects: "→ DDGame.sound"
Pointer labels shown in light blue for visual distinction.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
crates/openwa-debugui/src/app.rs
CHANGED
|
@@ -348,6 +348,7 @@ unsafe fn show_game_task_raw_fields(
|
|
| 348 |
total_size: usize,
|
| 349 |
) {
|
| 350 |
let base = addr as *const u32;
|
|
|
|
| 351 |
|
| 352 |
// Sections: CTask base, CGameTask unknowns, pos/speed, more unknowns, emitter,
|
| 353 |
// then type-specific in 0x80-byte chunks to keep each section manageable.
|
|
@@ -384,11 +385,12 @@ unsafe fn show_game_task_raw_fields(
|
|
| 384 |
.show(ui, |ui| {
|
| 385 |
egui::Grid::new(format!("raw_{}_{}_{:03X}", type_name, addr, start))
|
| 386 |
.striped(true)
|
| 387 |
-
.num_columns(
|
| 388 |
.show(ui, |ui| {
|
| 389 |
ui.strong("Offset");
|
| 390 |
ui.strong("Value");
|
| 391 |
ui.strong("Field");
|
|
|
|
| 392 |
ui.end_row();
|
| 393 |
|
| 394 |
let dwords = (end - start) / 4;
|
|
@@ -400,9 +402,22 @@ unsafe fn show_game_task_raw_fields(
|
|
| 400 |
.unwrap_or("");
|
| 401 |
|
| 402 |
ui.label(format!("+0x{:03X}", off));
|
| 403 |
-
// Show as hex + signed decimal
|
| 404 |
ui.label(format!("{:#010X} ({})", val, val as i32));
|
| 405 |
ui.label(field_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
ui.end_row();
|
| 407 |
}
|
| 408 |
});
|
|
|
|
| 348 |
total_size: usize,
|
| 349 |
) {
|
| 350 |
let base = addr as *const u32;
|
| 351 |
+
let delta = rb(va::IMAGE_BASE).wrapping_sub(va::IMAGE_BASE);
|
| 352 |
|
| 353 |
// Sections: CTask base, CGameTask unknowns, pos/speed, more unknowns, emitter,
|
| 354 |
// then type-specific in 0x80-byte chunks to keep each section manageable.
|
|
|
|
| 385 |
.show(ui, |ui| {
|
| 386 |
egui::Grid::new(format!("raw_{}_{}_{:03X}", type_name, addr, start))
|
| 387 |
.striped(true)
|
| 388 |
+
.num_columns(4)
|
| 389 |
.show(ui, |ui| {
|
| 390 |
ui.strong("Offset");
|
| 391 |
ui.strong("Value");
|
| 392 |
ui.strong("Field");
|
| 393 |
+
ui.strong("Points to");
|
| 394 |
ui.end_row();
|
| 395 |
|
| 396 |
let dwords = (end - start) / 4;
|
|
|
|
| 402 |
.unwrap_or("");
|
| 403 |
|
| 404 |
ui.label(format!("+0x{:03X}", off));
|
|
|
|
| 405 |
ui.label(format!("{:#010X} ({})", val, val as i32));
|
| 406 |
ui.label(field_name);
|
| 407 |
+
|
| 408 |
+
// Pointer identification
|
| 409 |
+
use openwa_core::mem;
|
| 410 |
+
let ptr_label = if val > 0x10000 {
|
| 411 |
+
mem::identify_pointer(val, delta)
|
| 412 |
+
.and_then(|id| id.name)
|
| 413 |
+
} else {
|
| 414 |
+
None
|
| 415 |
+
};
|
| 416 |
+
if let Some(label) = ptr_label {
|
| 417 |
+
ui.colored_label(egui::Color32::LIGHT_BLUE, format!("→ {}", label));
|
| 418 |
+
} else {
|
| 419 |
+
ui.label("");
|
| 420 |
+
}
|
| 421 |
ui.end_row();
|
| 422 |
}
|
| 423 |
});
|