7#define DTTR_ERROR_UI_WINDOW_W 560
8#define DTTR_ERROR_UI_INITIAL_WINDOW_H 120
9#define DTTR_ERROR_UI_BUTTON_H 28.0f
10#define DTTR_ERROR_UI_TEXT_PADDING_X 18.0f
11#define DTTR_ERROR_UI_TEXT_PADDING_Y 16.0f
12#define DTTR_ERROR_UI_STACK_BOX_H 150.0f
15#define DTTR_VERSION "unknown"
19static const char *
const HEADER_TITLE =
"102 Crashes: Traces to the Rescue!";
23static const char *
const REPORT_MARKER =
"\n\nFeel free to report this error";
41 return (
size_t)(
span.end -
span.text);
62 const char *details = stack;
64 if (crash_details && crash_details < stack) {
65 details = crash_details;
68 const char *details_text = details + 2;
69 const char *report_text = strstr(details_text,
REPORT_MARKER);
72 .summary_end = details,
73 .report_text = report_text,
74 .stack_trace = sdsnewlen(
76 report_text ? (
size_t)(report_text - details_text) : strlen(details_text)
99 igTextLinkOpenURL(label, url);
104 const char *last_separator =
NULL;
105 for (
const char *p = path; *p; p++) {
111 if (!last_separator) {
115 sds url = sdsnew(
"file:///");
116 for (
const char *p = path; url && p < last_separator; p++) {
118 url = sdscatlen(url,
"/", 1);
119 }
else if (*p ==
' ') {
120 url = sdscat(url,
"%20");
122 url = sdscatlen(url, p, 1);
130 const char *newline = memchr(dump_text.
text,
'\n',
span_len(dump_text));
131 if (!newline || newline + 1 >= dump_text.
end) {
138 sdstrim(label,
"\r\n");
142 if (!label || sdslen(label) == 0 || !url) {
156 const char *text = report_text + 2;
157 const char *url = strchr(text,
'\n');
158 if (!url || !url[1]) {
164 text_span url_text =
span(url + 1, url + 1 + strcspn(url + 1,
"\r\n"));
166 if (!url_copy || sdslen(url_copy) == 0) {
177 const char *dump_text = strstr(summary,
DUMP_MARKER);
178 return dump_text && dump_text < message->
summary_end ? dump_text :
NULL;
200 igInputTextMultiline(
206 ){stack_width, DTTR_ImGuiDialog_ScaledFloat(ctx, DTTR_ERROR_UI_STACK_BOX_H)},
207 ImGuiInputTextFlags_ReadOnly,
223 const char *safe_message = message ? message :
"";
244 const ImVec2_c ok_button_size = {
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
void DTTR_ImGuiDialog_End(DTTR_ImGuiDialogContext *ctx)
void DTTR_ImGuiDialog_DrawHeader(const DTTR_ImGuiDialogContext *ctx, const char *title, const char *version)
void DTTR_ImGuiDialog_CenterNextItem(float item_width)
void DTTR_ImGuiDialog_Render(DTTR_ImGuiDialogContext *ctx)
bool DTTR_ImGuiDialog_RefreshScale(DTTR_ImGuiDialogContext *ctx)
bool DTTR_ImGuiDialog_BeginRoot(DTTR_ImGuiDialogContext *ctx, const char *title, ImGuiWindowFlags flags)
float DTTR_ImGuiDialog_ScaledFloat(const DTTR_ImGuiDialogContext *ctx, float value)
void DTTR_ImGuiDialog_OffsetCursorY(const DTTR_ImGuiDialogContext *ctx, float amount)
void DTTR_ImGuiDialog_DrawPaddedText(const DTTR_ImGuiDialogContext *ctx, const char *message, float padding_x, float padding_y)
void DTTR_ImGuiDialog_ProcessEvents(const DTTR_ImGuiDialogContext *ctx, bool *running)
bool DTTR_ImGuiDialog_Button(const DTTR_ImGuiDialogContext *ctx, const char *id, const char *label, ImVec2_c size)
void DTTR_ImGuiDialog_EndRoot()
void DTTR_ImGuiDialog_NewFrame(const DTTR_ImGuiDialogContext *ctx)
void DTTR_ImGuiDialog_FitWindowToContent(DTTR_ImGuiDialogContext *ctx, int width, float padding_y)
#define DTTR_IMGUI_COLOR_STACK_FRAME_BG
bool DTTR_ImGuiDialog_Begin(DTTR_ImGuiDialogContext *ctx, const char *title, int width, int height)
#define DTTR_IMGUI_COLOR_LINK
bool DTTR_Path_IsSeparator(char ch)
static const char * find_summary_dump(const error_message *message, const char *summary)
static void set_text_padding_x(const DTTR_ImGuiDialogContext *ctx)
#define DTTR_ERROR_UI_TEXT_PADDING_X
static size_t span_len(text_span span)
static void draw_clickable_text(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *url)
static const char *const CRASH_DETAILS_MARKER
static error_message parse_error_message(const char *message)
static void draw_copyable_stack_trace(const DTTR_ImGuiDialogContext *ctx, const char *summary, const error_message *message)
static float text_padding_x(const DTTR_ImGuiDialogContext *ctx)
bool DTTR_ImGui_ErrorShow(const char *title, const char *message)
static void draw_report_text(const DTTR_ImGuiDialogContext *ctx, const char *report_text)
static void draw_wrapped_text_span(const DTTR_ImGuiDialogContext *ctx, text_span text)
#define DTTR_ERROR_UI_WINDOW_W
static void draw_wrapped_text(const DTTR_ImGuiDialogContext *ctx, const char *text)
static sds file_url_for_parent_dir(const char *path)
static void draw_dump_text(const DTTR_ImGuiDialogContext *ctx, text_span dump_text)
#define DTTR_ERROR_UI_BUTTON_H
#define DTTR_ERROR_UI_TEXT_PADDING_Y
static const char *const REPORT_MARKER
#define DTTR_ERROR_UI_INITIAL_WINDOW_H
static sds sdsnewspan(text_span span)
static text_span span(const char *text, const char *end)
static const char *const HEADER_TITLE
static const char *const ERROR_TITLE
static const char *const DUMP_MARKER
static const char *const STACK_TRACE_MARKER