replace latest_*_gone_to with an array
This commit is contained in:
parent
5481ed0f0e
commit
87c64e452d
4 changed files with 23 additions and 27 deletions
|
@ -214,7 +214,7 @@ Page_Info_Node *viewer_jump_to_page(App_State &app, u64 page_idx)
|
|||
}
|
||||
#endif
|
||||
|
||||
app.viewer.latest_page_gone_to = page_idx;
|
||||
app.viewer.latest_section_gone_to[Sec_Page] = page_idx;
|
||||
viewer_jump_to(app, page->range.start);
|
||||
|
||||
return page;
|
||||
|
@ -229,7 +229,7 @@ void viewer_jump_to_page_list(App_State &app, u64 page_list_idx)
|
|||
|
||||
Cluster_Group_Info &cg_info = app.rndata.cluster_groups[page_list_idx];
|
||||
|
||||
app.viewer.latest_page_list_gone_to = page_list_idx;
|
||||
app.viewer.latest_section_gone_to[Sec_Page_List] = page_list_idx;
|
||||
viewer_jump_to(app, cg_info.rng_page_list.start);
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,7 @@ void viewer_jump_to_free_slot(App_State &app, u64 free_slot_idx)
|
|||
|
||||
Byte_Range free_slot = app.tfile_data.free_slots[idx];
|
||||
|
||||
printf("%lu 0x%lX\n", app.tfile_data.n_free_slots, free_slot.start);
|
||||
app.viewer.latest_free_slot_gone_to = idx;
|
||||
app.viewer.latest_section_gone_to[Sec_Free_Slot] = idx;
|
||||
viewer_jump_to(app, free_slot.start);
|
||||
}
|
||||
|
||||
|
@ -260,7 +259,7 @@ void viewer_jump_to_other_root_obj(App_State &app, u64 obj_idx)
|
|||
for (u64 i = 0; i < obj_idx; ++i)
|
||||
info = info->next;
|
||||
|
||||
app.viewer.latest_root_obj_gone_to = obj_idx;
|
||||
app.viewer.latest_section_gone_to[Sec_Other] = obj_idx;
|
||||
viewer_jump_to(app, info->section.range.start);
|
||||
}
|
||||
|
||||
|
@ -276,7 +275,7 @@ void viewer_jump_to_cluster(App_State &app, u64 cluster_idx)
|
|||
assert(page);
|
||||
|
||||
app.viewer.highlighted_cluster = cluster_idx;
|
||||
app.viewer.latest_page_gone_to = cluster.first_page_idx;
|
||||
app.viewer.latest_section_gone_to[Sec_Page] = cluster.first_page_idx;
|
||||
viewer_jump_to(app, page->range.start);
|
||||
}
|
||||
|
||||
|
@ -309,9 +308,9 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
accum_dt_ms(app.delta_time_accum, delta_time_ms);
|
||||
|
||||
if (app.user_input.key_state[KEY_PLUS] & KEY_STATE_JUST_PRESSED)
|
||||
viewer_jump_to_page(app, app.viewer.latest_page_gone_to + 1);
|
||||
viewer_jump_to_page(app, app.viewer.latest_section_gone_to[Sec_Page] + 1);
|
||||
if (app.user_input.key_state[KEY_MINUS] & KEY_STATE_JUST_PRESSED)
|
||||
viewer_jump_to_page(app, app.viewer.latest_page_gone_to - 1);
|
||||
viewer_jump_to_page(app, app.viewer.latest_section_gone_to[Sec_Page] - 1);
|
||||
|
||||
ImGui::SetNextWindowPos({ 0, 0 });
|
||||
ImGui::SetNextWindowSize({ (f32)app.win_data.width, (f32)app.win_data.height });
|
||||
|
@ -388,14 +387,15 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
|
||||
// Unique sections: just display a button that jumps to the start of it and show their size
|
||||
for (u32 i = 0; i < Sec_COUNT; ++i) {
|
||||
for (Section *sec = app.tfile_data.sections[i].head; sec; sec = sec->next) {
|
||||
u32 sec_idx = 0;
|
||||
for (Section *sec = app.tfile_data.sections[i].head; sec; sec = sec->next, ++sec_idx) {
|
||||
if (!sec->range.len) continue;
|
||||
|
||||
String8 sec_name = section_names[i];
|
||||
String8 col_label = push_str8f(scratch.arena, "_%s", sec_name.c());
|
||||
ImGui::ColorEdit3(col_label.c(), app.viewer.col_section[i], edit_flags);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(sec_name.c()))
|
||||
if (ImGui::Button(push_str8f(scratch.arena, "%s_%u", sec_name.c(), sec_idx).c()))
|
||||
viewer_jump_to(app, sec->range.start);
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", to_pretty_size(scratch.arena, sec->range.len).c());
|
||||
|
@ -416,11 +416,11 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
ImGui::ColorEdit3("_Page", app.viewer.col_section[Sec_Page], edit_flags);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Page"))
|
||||
app.viewer.latest_page = viewer_jump_to_page(app, app.viewer.latest_page_gone_to);
|
||||
app.viewer.latest_page = viewer_jump_to_page(app, app.viewer.latest_section_gone_to[Sec_Page]);
|
||||
ImGui::SameLine();
|
||||
{
|
||||
const i64 step_fast_i64 = app.rndata.n_pages / 100;
|
||||
i64 page_to_go_to = app.viewer.latest_page_gone_to;
|
||||
i64 page_to_go_to = app.viewer.latest_section_gone_to[Sec_Page];
|
||||
ImGui::PushItemWidth(100.f);
|
||||
if (ImGui::InputScalar("##page_viewed", ImGuiDataType_S64, &page_to_go_to, &step_i64, &step_fast_i64, "%u") &&
|
||||
ImGui::IsItemDeactivatedAfterEdit())
|
||||
|
@ -444,11 +444,11 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
ImGui::ColorEdit3("_Page List", app.viewer.col_section[Sec_Page_List], edit_flags);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Page List"))
|
||||
viewer_jump_to_page_list(app, app.viewer.latest_page_list_gone_to);
|
||||
viewer_jump_to_page_list(app, app.viewer.latest_section_gone_to[Sec_Page_List]);
|
||||
|
||||
ImGui::SameLine();
|
||||
{
|
||||
i64 page_list_to_go_to = app.viewer.latest_page_list_gone_to;
|
||||
i64 page_list_to_go_to = app.viewer.latest_section_gone_to[Sec_Page_List];
|
||||
ImGui::PushItemWidth(80.f);
|
||||
if (ImGui::InputScalar("##page_list_viewed", ImGuiDataType_S64, &page_list_to_go_to, &step_i64, nullptr, "%u")
|
||||
&& ImGui::IsItemDeactivatedAfterEdit())
|
||||
|
@ -464,11 +464,11 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
ImGui::ColorEdit3("_Other", app.viewer.col_section[Sec_Other], edit_flags);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Other"))
|
||||
viewer_jump_to_other_root_obj(app, app.viewer.latest_root_obj_gone_to);
|
||||
viewer_jump_to_other_root_obj(app, app.viewer.latest_section_gone_to[Sec_Other]);
|
||||
|
||||
ImGui::SameLine();
|
||||
{
|
||||
i64 other_root_obj_to_go_to = app.viewer.latest_root_obj_gone_to;
|
||||
i64 other_root_obj_to_go_to = app.viewer.latest_section_gone_to[Sec_Other];
|
||||
ImGui::PushItemWidth(80.f);
|
||||
if (ImGui::InputScalar("##other_root_objviewed", ImGuiDataType_S64, &other_root_obj_to_go_to, &step_i64, nullptr, "%u")
|
||||
&& ImGui::IsItemDeactivatedAfterEdit())
|
||||
|
@ -483,10 +483,10 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
ImGui::ColorEdit3("_Free Slot", app.viewer.col_section[Sec_Free_Slot], edit_flags);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Free Slot"))
|
||||
viewer_jump_to_free_slot(app, app.viewer.latest_free_slot_gone_to);
|
||||
viewer_jump_to_free_slot(app, app.viewer.latest_section_gone_to[Sec_Free_Slot]);
|
||||
ImGui::SameLine();
|
||||
{
|
||||
i64 free_slot_to_go_to = app.viewer.latest_free_slot_gone_to;
|
||||
i64 free_slot_to_go_to = app.viewer.latest_section_gone_to[Sec_Free_Slot];
|
||||
ImGui::PushItemWidth(80.f);
|
||||
if (ImGui::InputScalar("##free_slot_viewed", ImGuiDataType_S64, &free_slot_to_go_to, &step_i64, nullptr, "%u")
|
||||
&& ImGui::IsItemDeactivatedAfterEdit())
|
||||
|
|
|
@ -18,12 +18,7 @@ struct Viewer {
|
|||
|
||||
Page_Info_Node *latest_page;
|
||||
|
||||
u64 latest_page_gone_to;
|
||||
u64 latest_key_gone_to;
|
||||
u64 latest_checksum_gone_to;
|
||||
u64 latest_page_list_gone_to;
|
||||
u64 latest_root_obj_gone_to;
|
||||
u64 latest_free_slot_gone_to;
|
||||
u64 latest_section_gone_to[Sec_COUNT];
|
||||
|
||||
Byte_Range hovered_range;
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ RNTuple_Data get_rntuple_data(Arena *arena, const Inspected_File &file, const TF
|
|||
|
||||
/// Load all RNTuple data ///
|
||||
anchor_idx = 0;
|
||||
printf("%p\n", tfile_data.sections[Sec_RNTuple_Anchor].head);
|
||||
for (Section *sec_anchor = tfile_data.sections[Sec_RNTuple_Anchor].head; sec_anchor; sec_anchor = sec_anchor->next, ++anchor_idx) {
|
||||
const ROOT::RNTuple &anchor = *(const ROOT::RNTuple *)sec_anchor->info;
|
||||
if (!anchor.GetNBytesHeader())
|
||||
|
|
|
@ -171,9 +171,9 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!app.ntpl_name.str)
|
||||
fprintf(stderr, "Warning: found no RNTuples in %s\n", args.file_name.c());
|
||||
else if (success)
|
||||
// if (!app.ntpl_name.str)
|
||||
// fprintf(stderr, "Warning: found no RNTuples in %s\n", args.file_name.c());
|
||||
// else if (success)
|
||||
app.rndata = get_rntuple_data(arena, app.inspected_file, app.tfile_data, args.extended_info);
|
||||
|
||||
if (args.print_to_terminal) {
|
||||
|
|
Loading…
Add table
Reference in a new issue