basic tkey walking

This commit is contained in:
silverweed 2024-10-29 15:16:06 +01:00
parent cd5ae62c13
commit fe5458874e
2 changed files with 28 additions and 0 deletions

View file

@ -395,6 +395,7 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
if (hovered_off)
{
ImGui::TextColored(ImColor(0.f, 0.65f, 0.f), "Offset: 0x%" PRIX64, hovered_off - 1);
Section hovered_section = find_section(app, hovered_off - 1);
b8 hover_display_grouped = !(app.user_input.key_state[KEY_ALT] & KEY_STATE_IS_DOWN);
Sec_Hover_Info hover_info = get_section_hover_info(scratch.arena, hovered_section, hovered_off - 1,

View file

@ -131,6 +131,31 @@ const char *get_column_type_name_from_ondisk_type(u16 type)
}
}
internal
void walk_tkeys(const u8 *data, u64 data_len)
{
u64 cur = 8; // offset of fBEGIN
if (data_len < cur)
return;
u32 begin_be;
memcpy(&begin_be, data + cur, sizeof(begin_be));
cur = bswap(begin_be);
while (cur < data_len) {
u32 n_bytes_be;
memcpy(&n_bytes_be, data + cur, sizeof(n_bytes_be));
u32 n_bytes = bswap(n_bytes_be);
if (!n_bytes) {
fprintf(stderr, "Error: found key or obj with len 0. Bailing out...\n");
return;
}
cur += n_bytes;
}
}
internal
void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTuple_File_Info &info, RNTuple_Data &rndata)
{
@ -499,6 +524,8 @@ RNTuple_Data get_rntuple_data(Arena *arena, const Inspected_File &file, String8
gather_ntuple_metadata(arena, file_reader, file_info, rndata);
if (extended_info)
rndata.tot_page_uncomp_size = calc_page_uncomp_size(file.mem, rndata.pages);
walk_tkeys(file.mem, file.size);
}
return rndata;