add jump to section

This commit is contained in:
silverweed 2024-07-12 10:07:27 +02:00
parent cc157c235c
commit db4d0c64f6
3 changed files with 31 additions and 7 deletions

View file

@ -8,7 +8,7 @@ Size=1152,1414
[Window][main] [Window][main]
Pos=0,0 Pos=0,0
Size=3440,1440 Size=1143,1388
[Window][Hex View] [Window][Hex View]
Pos=91,62 Pos=91,62

View file

@ -37,6 +37,8 @@ u32 mem_edit_bg_color_fn(const u8 *, u64 off, const void *user_data)
const RNTuple_Info &rinfo = app->rntinfo; const RNTuple_Info &rinfo = app->rntinfo;
u64 rblob_sz = rinfo.rblob_header_size; u64 rblob_sz = rinfo.rblob_header_size;
off += app->vsettings.base_display_addr;
#define COL(c) (ImColor((c)[0], (c)[1], (c)[2])) #define COL(c) (ImColor((c)[0], (c)[1], (c)[2]))
if (off <= rinfo.root_file_header_size) return COL(app->vsettings.col_tfile); if (off <= rinfo.root_file_header_size) return COL(app->vsettings.col_tfile);
if (rinfo.rng_anchor_key.start <= off && off <= rinfo.rng_anchor_key.end()) return COL(app->vsettings.col_key); if (rinfo.rng_anchor_key.start <= off && off <= rinfo.rng_anchor_key.end()) return COL(app->vsettings.col_key);
@ -128,14 +130,34 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
ImGui::BeginTable("Hex View", 2); ImGui::BeginTable("Hex View", 2);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
mem_edit.DrawContents(app.inspected_fmem, app.inspected_file_size);
assert(app.vsettings.base_display_addr < app.inspected_file_size);
void *content = app.inspected_fmem + app.vsettings.base_display_addr;
u64 content_size = app.inspected_file_size - app.vsettings.base_display_addr;
mem_edit.DrawContents(content, content_size, app.vsettings.base_display_addr);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::ColorEdit3("TFile", app.vsettings.col_tfile, ImGuiColorEditFlags_NoInputs); ImGuiColorEditFlags flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoLabel;
ImGui::ColorEdit3("RNTuple Anchor", app.vsettings.col_anchor, ImGuiColorEditFlags_NoInputs);
ImGui::ColorEdit3("RNTuple Header", app.vsettings.col_header, ImGuiColorEditFlags_NoInputs); ImGui::ColorEdit3("_TFile", app.vsettings.col_tfile, flags);
ImGui::ColorEdit3("RNTuple Footer", app.vsettings.col_footer, ImGuiColorEditFlags_NoInputs); ImGui::SameLine();
ImGui::ColorEdit3("TKey Header", app.vsettings.col_key, ImGuiColorEditFlags_NoInputs); if (ImGui::Button("TFile")) app.vsettings.base_display_addr = 0;
ImGui::ColorEdit3("_RNTuple Anchor", app.vsettings.col_anchor, flags);
ImGui::SameLine();
if (ImGui::Button("RNTuple Anchor")) app.vsettings.base_display_addr = app.rntinfo.rng_anchor.start;
ImGui::ColorEdit3("_RNTuple Header", app.vsettings.col_header, flags);
ImGui::SameLine();
if (ImGui::Button("RNTuple Header")) app.vsettings.base_display_addr = app.rntinfo.rng_header.start;
ImGui::ColorEdit3("_RNTuple Footer", app.vsettings.col_footer, flags);
ImGui::SameLine();
if (ImGui::Button("RNTuple Footer")) app.vsettings.base_display_addr = app.rntinfo.rng_footer.start;
ImGui::ColorEdit3("_TKey Header", app.vsettings.col_key, flags);
ImGui::SameLine();
if (ImGui::Button("TKey Header")) {} // TODO app.vsettings.base_display_addr = app.rntinfo.rng_footer.start;
ImGui::EndTable(); ImGui::EndTable();
} }

View file

@ -4,6 +4,8 @@ struct Viewer_Settings {
float col_footer[3]; float col_footer[3];
float col_key[3]; float col_key[3];
float col_tfile[3]; float col_tfile[3];
u64 base_display_addr;
}; };
struct Edit_Bg_Color_Data { struct Edit_Bg_Color_Data {