102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
imgui_error_ui.c File Reference
#include <dttr_imgui.h>
#include <dttr_path.h>
#include <sds.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  text_span
struct  error_message

Macros

#define DTTR_ERROR_UI_WINDOW_W   560
#define DTTR_ERROR_UI_INITIAL_WINDOW_H   120
#define DTTR_ERROR_UI_BUTTON_H   28.0f
#define DTTR_ERROR_UI_TEXT_PADDING_X   18.0f
#define DTTR_ERROR_UI_TEXT_PADDING_Y   16.0f
#define DTTR_ERROR_UI_STACK_BOX_H   150.0f
#define DTTR_VERSION   "unknown"

Functions

static text_span span (const char *text, const char *end)
static size_t span_len (text_span span)
static sds sdsnewspan (text_span span)
static float text_padding_x (const DTTR_ImGuiDialogContext *ctx)
static void set_text_padding_x (const DTTR_ImGuiDialogContext *ctx)
static error_message parse_error_message (const char *message)
static void draw_wrapped_text_span (const DTTR_ImGuiDialogContext *ctx, text_span text)
static void draw_wrapped_text (const DTTR_ImGuiDialogContext *ctx, const char *text)
static void draw_clickable_text (const DTTR_ImGuiDialogContext *ctx, const char *label, const char *url)
static sds file_url_for_parent_dir (const char *path)
static void draw_dump_text (const DTTR_ImGuiDialogContext *ctx, text_span dump_text)
static void draw_report_text (const DTTR_ImGuiDialogContext *ctx, const char *report_text)
static const char * find_summary_dump (const error_message *message, const char *summary)
static void draw_copyable_stack_trace (const DTTR_ImGuiDialogContext *ctx, const char *summary, const error_message *message)
bool DTTR_ImGui_ErrorShow (const char *title, const char *message)

Variables

static const char *const ERROR_TITLE = "DttR: Error"
static const char *const HEADER_TITLE = "102 Crashes: Traces to the Rescue!"
static const char *const CRASH_DETAILS_MARKER = "\n\nContextFlags="
static const char *const STACK_TRACE_MARKER = "\n\nStack trace:"
static const char *const DUMP_MARKER = "\n\nDump written to:"
static const char *const REPORT_MARKER = "\n\nFeel free to report this error"

Macro Definition Documentation

◆ DTTR_ERROR_UI_BUTTON_H

#define DTTR_ERROR_UI_BUTTON_H   28.0f

Definition at line 9 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow().

◆ DTTR_ERROR_UI_INITIAL_WINDOW_H

#define DTTR_ERROR_UI_INITIAL_WINDOW_H   120

Definition at line 8 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow().

◆ DTTR_ERROR_UI_STACK_BOX_H

#define DTTR_ERROR_UI_STACK_BOX_H   150.0f

Definition at line 12 of file imgui_error_ui.c.

◆ DTTR_ERROR_UI_TEXT_PADDING_X

#define DTTR_ERROR_UI_TEXT_PADDING_X   18.0f

Definition at line 10 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow(), and text_padding_x().

◆ DTTR_ERROR_UI_TEXT_PADDING_Y

#define DTTR_ERROR_UI_TEXT_PADDING_Y   16.0f

Definition at line 11 of file imgui_error_ui.c.

Referenced by draw_copyable_stack_trace(), and DTTR_ImGui_ErrorShow().

◆ DTTR_ERROR_UI_WINDOW_W

#define DTTR_ERROR_UI_WINDOW_W   560

Definition at line 7 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow().

◆ DTTR_VERSION

#define DTTR_VERSION   "unknown"

Function Documentation

◆ draw_clickable_text()

void draw_clickable_text ( const DTTR_ImGuiDialogContext * ctx,
const char * label,
const char * url )
static

Definition at line 92 of file imgui_error_ui.c.

References ctx, DTTR_IMGUI_COLOR_LINK, and set_text_padding_x().

Referenced by draw_dump_text(), and draw_report_text().

◆ draw_copyable_stack_trace()

◆ draw_dump_text()

◆ draw_report_text()

void draw_report_text ( const DTTR_ImGuiDialogContext * ctx,
const char * report_text )
static

◆ draw_wrapped_text()

void draw_wrapped_text ( const DTTR_ImGuiDialogContext * ctx,
const char * text )
static

Definition at line 88 of file imgui_error_ui.c.

References ctx, draw_wrapped_text_span(), and span().

Referenced by draw_report_text().

◆ draw_wrapped_text_span()

void draw_wrapped_text_span ( const DTTR_ImGuiDialogContext * ctx,
text_span text )
static

◆ DTTR_ImGui_ErrorShow()

◆ file_url_for_parent_dir()

sds file_url_for_parent_dir ( const char * path)
static

Definition at line 103 of file imgui_error_ui.c.

References DTTR_Path_IsSeparator(), and NULL.

Referenced by draw_dump_text().

◆ find_summary_dump()

const char * find_summary_dump ( const error_message * message,
const char * summary )
static

Definition at line 176 of file imgui_error_ui.c.

References DUMP_MARKER, NULL, and error_message::summary_end.

Referenced by draw_copyable_stack_trace().

◆ parse_error_message()

error_message parse_error_message ( const char * message)
static

Definition at line 56 of file imgui_error_ui.c.

References CRASH_DETAILS_MARKER, REPORT_MARKER, and STACK_TRACE_MARKER.

Referenced by DTTR_ImGui_ErrorShow().

◆ sdsnewspan()

sds sdsnewspan ( text_span span)
static

Definition at line 44 of file imgui_error_ui.c.

References span(), and span_len().

Referenced by draw_dump_text(), and draw_report_text().

◆ set_text_padding_x()

void set_text_padding_x ( const DTTR_ImGuiDialogContext * ctx)
static

Definition at line 52 of file imgui_error_ui.c.

References ctx, and text_padding_x().

Referenced by draw_clickable_text(), draw_copyable_stack_trace(), and draw_wrapped_text_span().

◆ span()

text_span span ( const char * text,
const char * end )
static

◆ span_len()

size_t span_len ( text_span span)
static

Definition at line 40 of file imgui_error_ui.c.

References span().

Referenced by draw_dump_text(), draw_wrapped_text_span(), and sdsnewspan().

◆ text_padding_x()

Variable Documentation

◆ CRASH_DETAILS_MARKER

const char* const CRASH_DETAILS_MARKER = "\n\nContextFlags="
static

Definition at line 20 of file imgui_error_ui.c.

Referenced by parse_error_message().

◆ DUMP_MARKER

const char* const DUMP_MARKER = "\n\nDump written to:"
static

Definition at line 22 of file imgui_error_ui.c.

Referenced by find_summary_dump().

◆ ERROR_TITLE

const char* const ERROR_TITLE = "DttR: Error"
static

Definition at line 18 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow(), and DTTR_LoaderUI_ShowError().

◆ HEADER_TITLE

const char* const HEADER_TITLE = "102 Crashes: Traces to the Rescue!"
static

Definition at line 19 of file imgui_error_ui.c.

Referenced by DTTR_ImGui_ErrorShow(), and DTTR_LoaderUI_ChooseGameSource().

◆ REPORT_MARKER

const char* const REPORT_MARKER = "\n\nFeel free to report this error"
static

Definition at line 23 of file imgui_error_ui.c.

Referenced by parse_error_message().

◆ STACK_TRACE_MARKER

const char* const STACK_TRACE_MARKER = "\n\nStack trace:"
static

Definition at line 21 of file imgui_error_ui.c.

Referenced by parse_error_message().