update makefile

This commit is contained in:
silverweed 2024-08-09 13:43:57 +02:00
parent dcf6e13fa5
commit ef5ad47f61
3 changed files with 21 additions and 14 deletions

View file

@ -15,6 +15,8 @@ LIBS = -lglfw
ROOTFLAGS = -std=c++17 -m64 -I$(ROOTINCDIR)
ROOTLIBS = -L$(ROOTLIBDIR) -lCore -lRIO -lROOTNTuple -lxxhash -pthread -Wl,-rpath,$(ROOTLIBDIR)
IMGUI_FLAGS = -Ithird_party -Ithird_party/imgui
ifeq ($(shell which mold),)
MOLD =
else
@ -27,11 +29,11 @@ ROOT_IFACE_DBG = $(ROOT_IFACE).dbg
all: build/imgui.o $(ROOT_IFACE) ubsan
clean:
rm build/*.o rntviewer $(ROOT_IFACE)
rm -f build/*.o rntviewer $(ROOT_IFACE) $(ROOT_IFACE_DBG)
build/imgui.o: src/imgui_inc.cpp
@mkdir -p $(@D)/build
$(CXX) -O3 -fPIC -c -Ithird_party/imgui $< -o $@
$(CXX) -O3 -fPIC -c $(IMGUI_FLAGS) $< -o $@
$(ROOT_IFACE): src/root/RMicroFileReader.cxx
$(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@
@ -46,6 +48,10 @@ d: $(ROOT_IFACE_DBG) build/imgui.o
# release build
r: $(ROOT_IFACE) build/imgui.o
$(MOLD) $(CXX) -O2 -DNDEBUG $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE) $(LIBS) $(ROOTLIBS)
# debug-release build
dr: $(ROOT_IFACE_DBG) build/imgui.o
$(MOLD) $(CXX) -g -O2 $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
# sanitizers
asan: $(ROOT_IFACE_DBG) build/imgui.o

View file

@ -295,7 +295,8 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
app.viewer.mem_edit.DrawContents(content, content_size, app.base_display_addr);
ImGui::TableNextColumn();
ImGuiColorEditFlags flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoLabel;
const ImGuiColorEditFlags edit_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoLabel;
const ImGuiInputTextFlags input_flags = ImGuiInputTextFlags_EnterReturnsTrue;
// 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) {
@ -304,7 +305,7 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
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], flags);
ImGui::ColorEdit3(col_label.c(), app.viewer.col_section[i], edit_flags);
ImGui::SameLine();
if (ImGui::Button(sec_name.c()))
viewer_jump_to(app, range.start);
@ -313,16 +314,16 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
}
// Repeated sections: allow jumping to the N-th
ImGui::ColorEdit3("_TKey Header", app.viewer.col_key, flags);
ImGui::ColorEdit3("_TKey Header", app.viewer.col_key, edit_flags);
ImGui::SameLine();
if (ImGui::Button("TKey Header")) {} // TODO: jump to next key
ImGui::ColorEdit3("_Page Start", app.viewer.col_page_start, flags);
ImGui::ColorEdit3("_Page Start", app.viewer.col_page_start, edit_flags);
ImGui::SameLine();
if (ImGui::Button("Page Start"))
viewer_jump_to_page(app, 0);
ImGui::ColorEdit3("_Page", app.viewer.col_section[Sec_Page], flags);
ImGui::ColorEdit3("_Page", app.viewer.col_section[Sec_Page], edit_flags);
ImGui::SameLine();
if (ImGui::Button("Page"))
viewer_jump_to_page(app, app.viewer.latest_page_gone_to);
@ -331,18 +332,18 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
const i64 step_fast_i64 = app.rndata.n_pages / 100;
i64 page_to_go_to = app.viewer.latest_page_gone_to;
ImGui::PushItemWidth(100.f);
if (ImGui::InputScalar("##page_viewed", ImGuiDataType_S64, &page_to_go_to, &step_i64, &step_fast_i64, "%u"))
if (ImGui::InputScalar("##page_viewed", ImGuiDataType_S64, &page_to_go_to, &step_i64, &step_fast_i64, "%u", input_flags))
viewer_jump_to_page(app, page_to_go_to);
ImGui::PopItemWidth();
}
ImGui::SameLine();
ImGui::Text("%s", to_pretty_size(scratch.arena, app.rndata.tot_page_comp_size).c());
ImGui::ColorEdit3("_Checksum", app.viewer.col_checksum, flags);
ImGui::ColorEdit3("_Checksum", app.viewer.col_checksum, edit_flags);
ImGui::SameLine();
if (ImGui::Button("Checksum")) {} // TODO jump to next checksum
ImGui::ColorEdit3("_Page List", app.viewer.col_section[Sec_Page_List], flags);
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);
@ -351,7 +352,7 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
{
i64 page_list_to_go_to = app.viewer.latest_page_list_gone_to;
ImGui::PushItemWidth(80.f);
if (ImGui::InputScalar("##page_list_viewed", ImGuiDataType_S64, &page_list_to_go_to, &step_i64, nullptr, "%u"))
if (ImGui::InputScalar("##page_list_viewed", ImGuiDataType_S64, &page_list_to_go_to, &step_i64, nullptr, "%u", input_flags))
viewer_jump_to_page_list(app, page_list_to_go_to);
ImGui::PopItemWidth();
}
@ -378,7 +379,7 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
const i64 step_fast_i64 = app.rndata.n_clusters / 100;
i64 cluster_to_highlight = app.viewer.highlighted_cluster;
ImGui::PushItemWidth(100.f);
if (ImGui::InputScalar("##highlighted_cluster", ImGuiDataType_S64, &cluster_to_highlight, &step_i64, &step_fast_i64, "%u")) {
if (ImGui::InputScalar("##highlighted_cluster", ImGuiDataType_S64, &cluster_to_highlight, &step_i64, &step_fast_i64, "%u", input_flags)) {
viewer_jump_to_cluster(app, cluster_to_highlight);
}
ImGui::PopItemWidth();

View file

@ -1,6 +1,6 @@
struct Byte_Range {
u64 start, len;
u64 end() const { return start + len; }
inline u64 end() const { return start + len; }
};
// Used to store location information about stuff like checksums, page lists, etc
@ -18,7 +18,7 @@ struct Page_Info_Node {
u32 cluster_id;
b8 is_first_in_cluster;
u64 checksum_size() const {
inline u64 checksum_size() const {
return (n_elems < 0) * 8;
}
};