fix base_display_addr

This commit is contained in:
silverweed 2024-07-26 16:05:04 +02:00
parent bc1efe5056
commit e22133d3f8
3 changed files with 6 additions and 8 deletions

View file

@ -31,7 +31,7 @@ internal
u32 mem_edit_bg_color_fn(const u8 *, u64 off, void *user_data)
{
App_State *app = reinterpret_cast<App_State *>(user_data);
off += app->viewer.base_display_addr;
off += app->base_display_addr;
i64 hilite_cluster = app->viewer.highlight_cluster ? app->viewer.highlighted_cluster : -1;
Section section = find_section(*app, off, hilite_cluster);
@ -194,11 +194,11 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
ImGui::TableNextColumn();
assert(app.viewer.base_display_addr < app.inspected_file.size);
void *content = app.inspected_file.mem + app.viewer.base_display_addr;
u64 content_size = app.inspected_file.size - app.viewer.base_display_addr;
assert(app.base_display_addr < app.inspected_file.size);
void *content = app.inspected_file.mem + app.base_display_addr;
u64 content_size = app.inspected_file.size - app.base_display_addr;
app.last_pinfo = &invalid_pinfo;
app.viewer.mem_edit.DrawContents(content, content_size, app.viewer.base_display_addr);
app.viewer.mem_edit.DrawContents(content, content_size, app.base_display_addr);
ImGui::TableNextColumn();
ImGuiColorEditFlags flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoLabel;

View file

@ -10,8 +10,6 @@ struct Viewer {
f32 col_highlight[3];
f32 col_page_start[3];
u64 base_display_addr;
b8 highlight_cluster;
u64 highlighted_cluster;

View file

@ -115,6 +115,7 @@ int main(int argc, char **argv)
}
app.ntpl_name = args.ntpl_name;
app.base_display_addr = args.start_addr;
app.tfile_data = get_tfile_data(app.inspected_file);
app.rndata = get_rntuple_data(arena, app.inspected_file, app.ntpl_name);
@ -142,7 +143,6 @@ int main(int argc, char **argv)
}
make_viewer(app, args.n_cols);
app.viewer.base_display_addr = args.start_addr;
// Start main loop
run_main_loop(window, arena, app);