mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 04:48:40 +00:00
float cfg from engine -> frontend; more elimination of dead code in engine
This commit is contained in:
@@ -3396,12 +3396,6 @@ d_eval_string_from_file_path(Arena *arena, String8 string)
|
|||||||
|
|
||||||
//- rjf: frame data
|
//- rjf: frame data
|
||||||
|
|
||||||
internal F32
|
|
||||||
d_dt(void)
|
|
||||||
{
|
|
||||||
return d_state->dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
d_frame_index(void)
|
d_frame_index(void)
|
||||||
{
|
{
|
||||||
@@ -3414,12 +3408,6 @@ d_frame_arena(void)
|
|||||||
return d_state->frame_arenas[d_state->frame_index%ArrayCount(d_state->frame_arenas)];
|
return d_state->frame_arenas[d_state->frame_index%ArrayCount(d_state->frame_arenas)];
|
||||||
}
|
}
|
||||||
|
|
||||||
internal F64
|
|
||||||
d_time_in_seconds(void)
|
|
||||||
{
|
|
||||||
return d_state->time_in_seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: interaction registers
|
//- rjf: interaction registers
|
||||||
|
|
||||||
internal D_Regs *
|
internal D_Regs *
|
||||||
@@ -3478,22 +3466,6 @@ d_ctrl_targets_running(void)
|
|||||||
return d_state->ctrl_is_running;
|
return d_state->ctrl_is_running;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: config paths
|
|
||||||
|
|
||||||
internal String8
|
|
||||||
d_cfg_path_from_src(D_CfgSrc src)
|
|
||||||
{
|
|
||||||
return d_state->cfg_paths[src];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: config state
|
|
||||||
|
|
||||||
internal D_CfgTable *
|
|
||||||
d_cfg_table(void)
|
|
||||||
{
|
|
||||||
return &d_state->cfg_table;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: config serialization
|
//- rjf: config serialization
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
@@ -4156,7 +4128,7 @@ d_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal CTRL_EventList
|
internal CTRL_EventList
|
||||||
d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, DI_Scope *di_scope, F32 dt)
|
d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints)
|
||||||
{
|
{
|
||||||
ProfBeginFunction();
|
ProfBeginFunction();
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
@@ -4164,8 +4136,6 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, DI_
|
|||||||
d_state->frame_index += 1;
|
d_state->frame_index += 1;
|
||||||
arena_clear(d_frame_arena());
|
arena_clear(d_frame_arena());
|
||||||
d_state->frame_eval_memread_endt_us = os_now_microseconds() + 5000;
|
d_state->frame_eval_memread_endt_us = os_now_microseconds() + 5000;
|
||||||
d_state->dt = dt;
|
|
||||||
d_state->time_in_seconds += dt;
|
|
||||||
d_state->top_regs = &d_state->base_regs;
|
d_state->top_regs = &d_state->base_regs;
|
||||||
d_regs_copy_contents(d_frame_arena(), &d_state->top_regs->v, &d_state->top_regs->v);
|
d_regs_copy_contents(d_frame_arena(), &d_state->top_regs->v, &d_state->top_regs->v);
|
||||||
|
|
||||||
|
|||||||
@@ -101,45 +101,6 @@ struct D_LineListArray
|
|||||||
DI_KeyList dbgi_keys;
|
DI_KeyList dbgi_keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: Sparse Tree Expansion State Data Structure
|
|
||||||
|
|
||||||
typedef struct D_ExpandKey D_ExpandKey;
|
|
||||||
struct D_ExpandKey
|
|
||||||
{
|
|
||||||
U64 parent_hash;
|
|
||||||
U64 child_num;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct D_ExpandNode D_ExpandNode;
|
|
||||||
struct D_ExpandNode
|
|
||||||
{
|
|
||||||
D_ExpandNode *hash_next;
|
|
||||||
D_ExpandNode *hash_prev;
|
|
||||||
D_ExpandNode *first;
|
|
||||||
D_ExpandNode *last;
|
|
||||||
D_ExpandNode *next;
|
|
||||||
D_ExpandNode *prev;
|
|
||||||
D_ExpandNode *parent;
|
|
||||||
D_ExpandKey key;
|
|
||||||
B32 expanded;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct D_ExpandSlot D_ExpandSlot;
|
|
||||||
struct D_ExpandSlot
|
|
||||||
{
|
|
||||||
D_ExpandNode *first;
|
|
||||||
D_ExpandNode *last;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct D_ExpandTreeTable D_ExpandTreeTable;
|
|
||||||
struct D_ExpandTreeTable
|
|
||||||
{
|
|
||||||
D_ExpandSlot *slots;
|
|
||||||
U64 slots_count;
|
|
||||||
D_ExpandNode *free_node;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Entity Kind Flags
|
//~ rjf: Entity Kind Flags
|
||||||
|
|
||||||
@@ -190,33 +151,6 @@ typedef enum D_RunKind
|
|||||||
}
|
}
|
||||||
D_RunKind;
|
D_RunKind;
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: View Rule Hook Types
|
|
||||||
|
|
||||||
typedef struct D_CfgTree D_CfgTree;
|
|
||||||
typedef struct D_CfgVal D_CfgVal;
|
|
||||||
typedef struct D_CfgTable D_CfgTable;
|
|
||||||
typedef struct D_EvalView D_EvalView;
|
|
||||||
typedef struct D_EvalVizBlockList D_EvalVizBlockList;
|
|
||||||
#define D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(name) E_Expr *name(Arena *arena, E_Expr *expr, MD_Node *params)
|
|
||||||
#define D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(name) d_core_view_rule_expr_resolution__##name
|
|
||||||
#define D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(name) internal D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(name))
|
|
||||||
#define D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, \
|
|
||||||
D_EvalView *eval_view, \
|
|
||||||
D_ExpandKey parent_key, \
|
|
||||||
D_ExpandKey key, \
|
|
||||||
D_ExpandNode *expand_node, \
|
|
||||||
String8 string, \
|
|
||||||
E_Expr *expr, \
|
|
||||||
D_CfgTable *cfg_table, \
|
|
||||||
S32 depth, \
|
|
||||||
MD_Node *params, \
|
|
||||||
struct D_EvalVizBlockList *out)
|
|
||||||
#define D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name) d_core_view_rule_viz_block_prod__##name
|
|
||||||
#define D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(name) internal D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name))
|
|
||||||
typedef D_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(D_CoreViewRuleExprResolutionHookFunctionType);
|
|
||||||
typedef D_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(D_CoreViewRuleVizBlockProdHookFunctionType);
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Generated Code
|
//~ rjf: Generated Code
|
||||||
|
|
||||||
@@ -699,8 +633,6 @@ struct D_State
|
|||||||
Arena *arena;
|
Arena *arena;
|
||||||
U64 frame_index;
|
U64 frame_index;
|
||||||
U64 frame_eval_memread_endt_us;
|
U64 frame_eval_memread_endt_us;
|
||||||
F64 time_in_seconds;
|
|
||||||
F32 dt;
|
|
||||||
|
|
||||||
// rjf: frame info
|
// rjf: frame info
|
||||||
Arena *frame_arenas[2];
|
Arena *frame_arenas[2];
|
||||||
@@ -755,7 +687,7 @@ struct D_State
|
|||||||
U64 view_rule_spec_table_size;
|
U64 view_rule_spec_table_size;
|
||||||
D_ViewRuleSpec **view_rule_spec_table;
|
D_ViewRuleSpec **view_rule_spec_table;
|
||||||
|
|
||||||
// rjf: control thread user -> ctrl driving state
|
// rjf: user -> ctrl driving state
|
||||||
Arena *ctrl_last_run_arena;
|
Arena *ctrl_last_run_arena;
|
||||||
D_RunKind ctrl_last_run_kind;
|
D_RunKind ctrl_last_run_kind;
|
||||||
U64 ctrl_last_run_frame_idx;
|
U64 ctrl_last_run_frame_idx;
|
||||||
@@ -769,17 +701,10 @@ struct D_State
|
|||||||
Arena *ctrl_msg_arena;
|
Arena *ctrl_msg_arena;
|
||||||
CTRL_MsgList ctrl_msgs;
|
CTRL_MsgList ctrl_msgs;
|
||||||
|
|
||||||
// rjf: control thread ctrl -> user reading state
|
// rjf: ctrl -> user reading state
|
||||||
CTRL_EntityStore *ctrl_entity_store;
|
CTRL_EntityStore *ctrl_entity_store;
|
||||||
Arena *ctrl_stop_arena;
|
Arena *ctrl_stop_arena;
|
||||||
CTRL_Event ctrl_last_stop_event;
|
CTRL_Event ctrl_last_stop_event;
|
||||||
|
|
||||||
// rjf: config reading state
|
|
||||||
Arena *cfg_path_arenas[D_CfgSrc_COUNT];
|
|
||||||
String8 cfg_paths[D_CfgSrc_COUNT];
|
|
||||||
U64 cfg_cached_timestamp[D_CfgSrc_COUNT];
|
|
||||||
Arena *cfg_arena;
|
|
||||||
D_CfgTable cfg_table;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@@ -789,7 +714,6 @@ read_only global D_CmdSpec d_nil_cmd_spec = {0};
|
|||||||
read_only global D_ViewRuleSpec d_nil_core_view_rule_spec = {0};
|
read_only global D_ViewRuleSpec d_nil_core_view_rule_spec = {0};
|
||||||
read_only global D_CfgTree d_nil_cfg_tree = {&d_nil_cfg_tree, D_CfgSrc_User, &md_nil_node};
|
read_only global D_CfgTree d_nil_cfg_tree = {&d_nil_cfg_tree, D_CfgSrc_User, &md_nil_node};
|
||||||
read_only global D_CfgVal d_nil_cfg_val = {&d_nil_cfg_val, &d_nil_cfg_val, &d_nil_cfg_tree, &d_nil_cfg_tree};
|
read_only global D_CfgVal d_nil_cfg_val = {&d_nil_cfg_val, &d_nil_cfg_val, &d_nil_cfg_tree, &d_nil_cfg_tree};
|
||||||
read_only global D_CfgTable d_nil_cfg_table = {0, 0, 0, &d_nil_cfg_val, &d_nil_cfg_val};
|
|
||||||
read_only global D_Entity d_nil_entity =
|
read_only global D_Entity d_nil_entity =
|
||||||
{
|
{
|
||||||
&d_nil_entity,
|
&d_nil_entity,
|
||||||
@@ -1084,10 +1008,8 @@ internal String8 d_eval_string_from_file_path(Arena *arena, String8 string);
|
|||||||
//~ rjf: Main State Accessors/Mutators
|
//~ rjf: Main State Accessors/Mutators
|
||||||
|
|
||||||
//- rjf: frame data
|
//- rjf: frame data
|
||||||
internal F32 d_dt(void);
|
|
||||||
internal U64 d_frame_index(void);
|
internal U64 d_frame_index(void);
|
||||||
internal Arena *d_frame_arena(void);
|
internal Arena *d_frame_arena(void);
|
||||||
internal F64 d_time_in_seconds(void);
|
|
||||||
|
|
||||||
//- rjf: registers
|
//- rjf: registers
|
||||||
internal D_Regs *d_regs(void);
|
internal D_Regs *d_regs(void);
|
||||||
@@ -1101,12 +1023,6 @@ internal D_RunKind d_ctrl_last_run_kind(void);
|
|||||||
internal U64 d_ctrl_last_run_frame_idx(void);
|
internal U64 d_ctrl_last_run_frame_idx(void);
|
||||||
internal B32 d_ctrl_targets_running(void);
|
internal B32 d_ctrl_targets_running(void);
|
||||||
|
|
||||||
//- rjf: config paths
|
|
||||||
internal String8 d_cfg_path_from_src(D_CfgSrc src);
|
|
||||||
|
|
||||||
//- rjf: config state
|
|
||||||
internal D_CfgTable *d_cfg_table(void);
|
|
||||||
|
|
||||||
//- rjf: config serialization
|
//- rjf: config serialization
|
||||||
internal String8 d_cfg_escaped_from_raw_string(Arena *arena, String8 string);
|
internal String8 d_cfg_escaped_from_raw_string(Arena *arena, String8 string);
|
||||||
internal String8 d_cfg_raw_from_escaped_string(Arena *arena, String8 string);
|
internal String8 d_cfg_raw_from_escaped_string(Arena *arena, String8 string);
|
||||||
@@ -1148,6 +1064,6 @@ internal B32 d_next_cmd(D_Cmd **cmd);
|
|||||||
//~ rjf: Main Layer Top-Level Calls
|
//~ rjf: Main Layer Top-Level Calls
|
||||||
|
|
||||||
internal void d_init(void);
|
internal void d_init(void);
|
||||||
internal CTRL_EventList d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, DI_Scope *di_scope, F32 dt);
|
internal CTRL_EventList d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints);
|
||||||
|
|
||||||
#endif // DBG_ENGINE_CORE_H
|
#endif // DBG_ENGINE_CORE_H
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ df_view_is_project_filtered(DF_View *view)
|
|||||||
String8 view_project = view->project_path;
|
String8 view_project = view->project_path;
|
||||||
if(view_project.size != 0)
|
if(view_project.size != 0)
|
||||||
{
|
{
|
||||||
String8 current_project = d_cfg_path_from_src(D_CfgSrc_Project);
|
String8 current_project = df_cfg_path_from_src(D_CfgSrc_Project);
|
||||||
result = !path_match_normalized(view_project, current_project);
|
result = !path_match_normalized(view_project, current_project);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -819,7 +819,7 @@ df_view_equip_spec(DF_View *view, DF_ViewSpec *spec, String8 query, MD_Node *par
|
|||||||
if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific)
|
if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific)
|
||||||
{
|
{
|
||||||
arena_clear(view->project_path_arena);
|
arena_clear(view->project_path_arena);
|
||||||
view->project_path = push_str8_copy(view->project_path_arena, d_cfg_path_from_src(D_CfgSrc_Project));
|
view->project_path = push_str8_copy(view->project_path_arena, df_cfg_path_from_src(D_CfgSrc_Project));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -941,7 +941,7 @@ df_transient_view_node_from_ev_key(DF_View *owner_view, EV_Key key)
|
|||||||
if(ev_key_match(n->key, key))
|
if(ev_key_match(n->key, key))
|
||||||
{
|
{
|
||||||
node = n;
|
node = n;
|
||||||
n->last_frame_index_touched = d_frame_index();
|
n->last_frame_index_touched = df_state->frame_index;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -957,7 +957,7 @@ df_transient_view_node_from_ev_key(DF_View *owner_view, EV_Key key)
|
|||||||
node->key = key;
|
node->key = key;
|
||||||
node->view = df_view_alloc();
|
node->view = df_view_alloc();
|
||||||
node->initial_params_arena = arena_alloc();
|
node->initial_params_arena = arena_alloc();
|
||||||
node->first_frame_index_touched = node->last_frame_index_touched = d_frame_index();
|
node->first_frame_index_touched = node->last_frame_index_touched = df_state->frame_index;
|
||||||
DLLPushBack_NPZ(&df_nil_view, owner_view->first_transient, owner_view->last_transient, node->view, order_next, order_prev);
|
DLLPushBack_NPZ(&df_nil_view, owner_view->first_transient, owner_view->last_transient, node->view, order_next, order_prev);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
@@ -1139,7 +1139,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
B32 hover_eval_is_open = (!confirm_open &&
|
B32 hover_eval_is_open = (!confirm_open &&
|
||||||
ws->hover_eval_string.size != 0 &&
|
ws->hover_eval_string.size != 0 &&
|
||||||
ws->hover_eval_first_frame_idx+20 < ws->hover_eval_last_frame_idx &&
|
ws->hover_eval_first_frame_idx+20 < ws->hover_eval_last_frame_idx &&
|
||||||
d_frame_index()-ws->hover_eval_last_frame_idx < 20);
|
df_state->frame_index-ws->hover_eval_last_frame_idx < 20);
|
||||||
if(!window_is_focused || confirm_open)
|
if(!window_is_focused || confirm_open)
|
||||||
{
|
{
|
||||||
ws->menu_bar_key_held = 0;
|
ws->menu_bar_key_held = 0;
|
||||||
@@ -1371,7 +1371,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: begin & push initial stack values
|
// rjf: begin & push initial stack values
|
||||||
ui_begin_build(ws->os, &ws->ui_events, &icon_info, &widget_palette_info, &animation_info, d_dt(), d_dt());
|
ui_begin_build(ws->os, &ws->ui_events, &icon_info, &widget_palette_info, &animation_info, df_state->frame_dt, df_state->frame_dt);
|
||||||
ui_push_font(main_font);
|
ui_push_font(main_font);
|
||||||
ui_push_font_size(main_font_size);
|
ui_push_font_size(main_font_size);
|
||||||
ui_push_text_padding(main_font_size*0.3f);
|
ui_push_text_padding(main_font_size*0.3f);
|
||||||
@@ -1553,7 +1553,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
}
|
}
|
||||||
avg_ui_hash_chain_length = chain_length_sum / chain_count;
|
avg_ui_hash_chain_length = chain_length_sum / chain_count;
|
||||||
}
|
}
|
||||||
ui_labelf("Target Hz: %.2f", 1.f/d_dt());
|
ui_labelf("Target Hz: %.2f", 1.f/df_state->frame_dt);
|
||||||
ui_labelf("Ctrl Run Index: %I64u", ctrl_run_gen());
|
ui_labelf("Ctrl Run Index: %I64u", ctrl_run_gen());
|
||||||
ui_labelf("Ctrl Mem Gen Index: %I64u", ctrl_mem_gen());
|
ui_labelf("Ctrl Mem Gen Index: %I64u", ctrl_mem_gen());
|
||||||
ui_labelf("Window %p", window);
|
ui_labelf("Window %p", window);
|
||||||
@@ -2366,7 +2366,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
//- rjf: build auto-complete lister
|
//- rjf: build auto-complete lister
|
||||||
//
|
//
|
||||||
ProfScope("build autocomplete lister")
|
ProfScope("build autocomplete lister")
|
||||||
if(!ws->autocomp_force_closed && !ui_key_match(ws->autocomp_root_key, ui_key_zero()) && ws->autocomp_last_frame_idx+1 >= d_frame_index())
|
if(!ws->autocomp_force_closed && !ui_key_match(ws->autocomp_root_key, ui_key_zero()) && ws->autocomp_last_frame_idx+1 >= df_state->frame_index)
|
||||||
{
|
{
|
||||||
String8 query = str8(ws->autocomp_lister_query_buffer, ws->autocomp_lister_query_size);
|
String8 query = str8(ws->autocomp_lister_query_buffer, ws->autocomp_lister_query_size);
|
||||||
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
||||||
@@ -2569,7 +2569,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
{
|
{
|
||||||
// rjf: animate target # of rows
|
// rjf: animate target # of rows
|
||||||
{
|
{
|
||||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? (1 - pow_f32(2, (-60.f * d_dt()))) : 1.f;
|
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? (1 - pow_f32(2, (-60.f * df_state->frame_dt))) : 1.f;
|
||||||
F32 target = Min((F32)item_array.count, 16.f);
|
F32 target = Min((F32)item_array.count, 16.f);
|
||||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) > 0.01f)
|
if(abs_f32(target - ws->autocomp_num_visible_rows_t) > 0.01f)
|
||||||
{
|
{
|
||||||
@@ -2584,7 +2584,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
|
|
||||||
// rjf: animate open
|
// rjf: animate open
|
||||||
{
|
{
|
||||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * d_dt())) : 1.f;
|
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_state->frame_dt)) : 1.f;
|
||||||
F32 diff = 1.f-ws->autocomp_open_t;
|
F32 diff = 1.f-ws->autocomp_open_t;
|
||||||
ws->autocomp_open_t += diff*rate;
|
ws->autocomp_open_t += diff*rate;
|
||||||
if(abs_f32(diff) < 0.05f)
|
if(abs_f32(diff) < 0.05f)
|
||||||
@@ -3139,7 +3139,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
D_EntityList processes = d_query_cached_entity_list_with_kind(D_EntityKind_Process);
|
D_EntityList processes = d_query_cached_entity_list_with_kind(D_EntityKind_Process);
|
||||||
B32 have_targets = targets.count != 0;
|
B32 have_targets = targets.count != 0;
|
||||||
B32 can_send_signal = !d_ctrl_targets_running();
|
B32 can_send_signal = !d_ctrl_targets_running();
|
||||||
B32 can_play = (have_targets && (can_send_signal || d_ctrl_last_run_frame_idx()+4 > d_frame_index()));
|
B32 can_play = (have_targets && (can_send_signal || d_ctrl_last_run_frame_idx()+4 > df_state->frame_index));
|
||||||
B32 can_pause = (!can_send_signal);
|
B32 can_pause = (!can_send_signal);
|
||||||
B32 can_stop = (processes.count != 0);
|
B32 can_stop = (processes.count != 0);
|
||||||
B32 can_step = (processes.count != 0 && can_send_signal);
|
B32 can_step = (processes.count != 0 && can_send_signal);
|
||||||
@@ -3396,7 +3396,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
os_window_push_custom_title_bar_client_area(ws->os, user_box->rect);
|
os_window_push_custom_title_bar_client_area(ws->os, user_box->rect);
|
||||||
UI_Parent(user_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center)
|
UI_Parent(user_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center)
|
||||||
{
|
{
|
||||||
String8 user_path = d_cfg_path_from_src(D_CfgSrc_User);
|
String8 user_path = df_cfg_path_from_src(D_CfgSrc_User);
|
||||||
user_path = str8_chop_last_dot(user_path);
|
user_path = str8_chop_last_dot(user_path);
|
||||||
DF_Font(DF_FontSlot_Icons)
|
DF_Font(DF_FontSlot_Icons)
|
||||||
UI_TextRasterFlags(df_raster_flags_from_slot(DF_FontSlot_Icons))
|
UI_TextRasterFlags(df_raster_flags_from_slot(DF_FontSlot_Icons))
|
||||||
@@ -3430,7 +3430,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
os_window_push_custom_title_bar_client_area(ws->os, prof_box->rect);
|
os_window_push_custom_title_bar_client_area(ws->os, prof_box->rect);
|
||||||
UI_Parent(prof_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center)
|
UI_Parent(prof_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center)
|
||||||
{
|
{
|
||||||
String8 prof_path = d_cfg_path_from_src(D_CfgSrc_Project);
|
String8 prof_path = df_cfg_path_from_src(D_CfgSrc_Project);
|
||||||
prof_path = str8_chop_last_dot(prof_path);
|
prof_path = str8_chop_last_dot(prof_path);
|
||||||
DF_Font(DF_FontSlot_Icons)
|
DF_Font(DF_FontSlot_Icons)
|
||||||
ui_label(df_g_icon_kind_text_table[DF_IconKind_Briefcase]);
|
ui_label(df_g_icon_kind_text_table[DF_IconKind_Briefcase]);
|
||||||
@@ -3490,7 +3490,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
//
|
//
|
||||||
ProfScope("build bottom bar")
|
ProfScope("build bottom bar")
|
||||||
{
|
{
|
||||||
B32 is_running = d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < d_frame_index();
|
B32 is_running = d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < df_state->frame_index;
|
||||||
CTRL_Event stop_event = d_ctrl_last_stop_event();
|
CTRL_Event stop_event = d_ctrl_last_stop_event();
|
||||||
UI_Palette *positive_scheme = df_palette_from_code(DF_PaletteCode_PositivePopButton);
|
UI_Palette *positive_scheme = df_palette_from_code(DF_PaletteCode_PositivePopButton);
|
||||||
UI_Palette *running_scheme = df_palette_from_code(DF_PaletteCode_NeutralPopButton);
|
UI_Palette *running_scheme = df_palette_from_code(DF_PaletteCode_NeutralPopButton);
|
||||||
@@ -3535,7 +3535,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
// rjf: developer frame-time indicator
|
// rjf: developer frame-time indicator
|
||||||
if(DEV_updating_indicator)
|
if(DEV_updating_indicator)
|
||||||
{
|
{
|
||||||
F32 animation_t = pow_f32(sin_f32(d_time_in_seconds()/2.f), 2.f);
|
F32 animation_t = pow_f32(sin_f32(df_state->time_in_seconds/2.f), 2.f);
|
||||||
ui_spacer(ui_em(0.3f, 1.f));
|
ui_spacer(ui_em(0.3f, 1.f));
|
||||||
ui_spacer(ui_em(1.5f*animation_t, 1.f));
|
ui_spacer(ui_em(1.5f*animation_t, 1.f));
|
||||||
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("*");
|
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("*");
|
||||||
@@ -3588,7 +3588,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
// rjf: error visualization
|
// rjf: error visualization
|
||||||
else if(ws->error_t >= 0.01f)
|
else if(ws->error_t >= 0.01f)
|
||||||
{
|
{
|
||||||
ws->error_t -= d_dt()/8.f;
|
ws->error_t -= df_state->frame_dt/8.f;
|
||||||
df_request_frame();
|
df_request_frame();
|
||||||
String8 error_string = str8(ws->error_buffer, ws->error_string_size);
|
String8 error_string = str8(ws->error_buffer, ws->error_string_size);
|
||||||
if(error_string.size != 0)
|
if(error_string.size != 0)
|
||||||
@@ -3666,7 +3666,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
//- rjf: animate query info
|
//- rjf: animate query info
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * d_dt())) : 1.f;
|
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_state->frame_dt)) : 1.f;
|
||||||
|
|
||||||
// rjf: animate query view selection transition
|
// rjf: animate query view selection transition
|
||||||
{
|
{
|
||||||
@@ -3878,7 +3878,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
abs_f32(view->scroll_pos.y.off) > 0.01f))
|
abs_f32(view->scroll_pos.y.off) > 0.01f))
|
||||||
{
|
{
|
||||||
build_hover_eval = 0;
|
build_hover_eval = 0;
|
||||||
ws->hover_eval_first_frame_idx = d_frame_index();
|
ws->hover_eval_first_frame_idx = df_state->frame_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3891,7 +3891,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: reset animation, but request frames if we're waiting to open
|
// rjf: reset animation, but request frames if we're waiting to open
|
||||||
if(ws->hover_eval_string.size != 0 && !hover_eval_is_open && ws->hover_eval_last_frame_idx < ws->hover_eval_first_frame_idx+20 && d_frame_index()-ws->hover_eval_last_frame_idx < 50)
|
if(ws->hover_eval_string.size != 0 && !hover_eval_is_open && ws->hover_eval_last_frame_idx < ws->hover_eval_first_frame_idx+20 && df_state->frame_index-ws->hover_eval_last_frame_idx < 50)
|
||||||
{
|
{
|
||||||
df_request_frame();
|
df_request_frame();
|
||||||
ws->hover_eval_num_visible_rows_t = 0;
|
ws->hover_eval_num_visible_rows_t = 0;
|
||||||
@@ -3940,7 +3940,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
{
|
{
|
||||||
// rjf: animate height
|
// rjf: animate height
|
||||||
{
|
{
|
||||||
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * d_dt())) : 1.f;
|
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_state->frame_dt)) : 1.f;
|
||||||
F32 hover_eval_container_height_target = row_height * Min(30, viz_blocks.total_visual_row_count);
|
F32 hover_eval_container_height_target = row_height * Min(30, viz_blocks.total_visual_row_count);
|
||||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
||||||
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
||||||
@@ -3955,7 +3955,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
|
|
||||||
// rjf: animate open
|
// rjf: animate open
|
||||||
{
|
{
|
||||||
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * d_dt())) : 1.f;
|
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_state->frame_dt)) : 1.f;
|
||||||
F32 diff = 1.f - ws->hover_eval_open_t;
|
F32 diff = 1.f - ws->hover_eval_open_t;
|
||||||
ws->hover_eval_open_t += diff*fish_rate;
|
ws->hover_eval_open_t += diff*fish_rate;
|
||||||
if(abs_f32(diff) < 0.01f)
|
if(abs_f32(diff) < 0.01f)
|
||||||
@@ -4181,9 +4181,9 @@ df_window_frame(DF_Window *ws)
|
|||||||
UI_Signal hover_eval_sig = ui_signal_from_box(hover_eval_box);
|
UI_Signal hover_eval_sig = ui_signal_from_box(hover_eval_box);
|
||||||
if(ui_mouse_over(hover_eval_sig))
|
if(ui_mouse_over(hover_eval_sig))
|
||||||
{
|
{
|
||||||
ws->hover_eval_last_frame_idx = d_frame_index();
|
ws->hover_eval_last_frame_idx = df_state->frame_index;
|
||||||
}
|
}
|
||||||
else if(ws->hover_eval_last_frame_idx+2 < d_frame_index())
|
else if(ws->hover_eval_last_frame_idx+2 < df_state->frame_index)
|
||||||
{
|
{
|
||||||
df_request_frame();
|
df_request_frame();
|
||||||
}
|
}
|
||||||
@@ -4483,7 +4483,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
//- rjf: animate panels
|
//- rjf: animate panels
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-50.f * d_dt())) : 1.f;
|
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-50.f * df_state->frame_dt)) : 1.f;
|
||||||
Vec2F32 content_rect_dim = dim_2f32(content_rect);
|
Vec2F32 content_rect_dim = dim_2f32(content_rect);
|
||||||
for(DF_Panel *panel = ws->root_panel; !df_panel_is_nil(panel); panel = df_panel_rec_df_pre(panel).next)
|
for(DF_Panel *panel = ws->root_panel; !df_panel_is_nil(panel); panel = df_panel_rec_df_pre(panel).next)
|
||||||
{
|
{
|
||||||
@@ -5331,8 +5331,8 @@ df_window_frame(DF_Window *ws)
|
|||||||
Task start_task = {0, &df_nil_panel, ws->query_view_stack_top};
|
Task start_task = {0, &df_nil_panel, ws->query_view_stack_top};
|
||||||
Task *first_task = &start_task;
|
Task *first_task = &start_task;
|
||||||
Task *last_task = first_task;
|
Task *last_task = first_task;
|
||||||
F32 rate = 1 - pow_f32(2, (-10.f * d_dt()));
|
F32 rate = 1 - pow_f32(2, (-10.f * df_state->frame_dt));
|
||||||
F32 fast_rate = 1 - pow_f32(2, (-40.f * d_dt()));
|
F32 fast_rate = 1 - pow_f32(2, (-40.f * df_state->frame_dt));
|
||||||
for(DF_Panel *panel = ws->root_panel;
|
for(DF_Panel *panel = ws->root_panel;
|
||||||
!df_panel_is_nil(panel);
|
!df_panel_is_nil(panel);
|
||||||
panel = df_panel_rec_df_pre(panel).next)
|
panel = df_panel_rec_df_pre(panel).next)
|
||||||
@@ -5457,7 +5457,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: attach autocomp box to root, or hide if it has not been renewed
|
//- rjf: attach autocomp box to root, or hide if it has not been renewed
|
||||||
//
|
//
|
||||||
if(!ui_box_is_nil(autocomp_box) && ws->autocomp_last_frame_idx+1 >= d_frame_index()+1)
|
if(!ui_box_is_nil(autocomp_box) && ws->autocomp_last_frame_idx+1 >= df_state->frame_index+1)
|
||||||
{
|
{
|
||||||
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
||||||
if(!ui_box_is_nil(autocomp_root_box))
|
if(!ui_box_is_nil(autocomp_root_box))
|
||||||
@@ -5475,7 +5475,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!ui_box_is_nil(autocomp_box) && ws->autocomp_last_frame_idx+1 < d_frame_index()+1)
|
else if(!ui_box_is_nil(autocomp_box) && ws->autocomp_last_frame_idx+1 < df_state->frame_index+1)
|
||||||
{
|
{
|
||||||
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
UI_Box *autocomp_root_box = ui_box_from_key(ws->autocomp_root_key);
|
||||||
if(!ui_box_is_nil(autocomp_root_box))
|
if(!ui_box_is_nil(autocomp_root_box))
|
||||||
@@ -5948,7 +5948,7 @@ df_window_frame(DF_Window *ws)
|
|||||||
dr_fancy_string_list_push(scratch.arena, &strs, &str3);
|
dr_fancy_string_list_push(scratch.arena, &strs, &str3);
|
||||||
DR_FancyRunList runs = dr_fancy_run_list_from_fancy_string_list(scratch.arena, 0, 0, &strs);
|
DR_FancyRunList runs = dr_fancy_run_list_from_fancy_string_list(scratch.arena, 0, 0, &strs);
|
||||||
FNT_Run trailer_run = fnt_push_run_from_string(scratch.arena, df_font_from_slot(DF_FontSlot_Main), 16.f, 0, 0, 0, str8_lit("..."));
|
FNT_Run trailer_run = fnt_push_run_from_string(scratch.arena, df_font_from_slot(DF_FontSlot_Main), 16.f, 0, 0, 0, str8_lit("..."));
|
||||||
F32 limit = 500.f + sin_f32(d_time_in_seconds()/10.f)*200.f;
|
F32 limit = 500.f + sin_f32(df_state->time_in_seconds/10.f)*200.f;
|
||||||
dr_truncated_fancy_run_list(p, &runs, limit, trailer_run);
|
dr_truncated_fancy_run_list(p, &runs, limit, trailer_run);
|
||||||
dr_rect(r2f32p(p.x+limit, 0, p.x+limit+2.f, 1000), v4f32(1, 0, 0, 1), 0, 0, 0);
|
dr_rect(r2f32p(p.x+limit, 0, p.x+limit+2.f, 1000), v4f32(1, 0, 0, 1), 0, 0, 0);
|
||||||
df_request_frame();
|
df_request_frame();
|
||||||
@@ -6360,7 +6360,7 @@ internal void
|
|||||||
df_set_hover_eval(Vec2F32 pos, String8 file_path, TxtPt pt, U64 vaddr, String8 string)
|
df_set_hover_eval(Vec2F32 pos, String8 file_path, TxtPt pt, U64 vaddr, String8 string)
|
||||||
{
|
{
|
||||||
DF_Window *window = df_window_from_handle(d_regs()->window);
|
DF_Window *window = df_window_from_handle(d_regs()->window);
|
||||||
if(window->hover_eval_last_frame_idx+1 < d_frame_index() &&
|
if(window->hover_eval_last_frame_idx+1 < df_state->frame_index &&
|
||||||
ui_key_match(ui_active_key(UI_MouseButtonKind_Left), ui_key_zero()) &&
|
ui_key_match(ui_active_key(UI_MouseButtonKind_Left), ui_key_zero()) &&
|
||||||
ui_key_match(ui_active_key(UI_MouseButtonKind_Middle), ui_key_zero()) &&
|
ui_key_match(ui_active_key(UI_MouseButtonKind_Middle), ui_key_zero()) &&
|
||||||
ui_key_match(ui_active_key(UI_MouseButtonKind_Right), ui_key_zero()))
|
ui_key_match(ui_active_key(UI_MouseButtonKind_Right), ui_key_zero()))
|
||||||
@@ -6368,7 +6368,7 @@ df_set_hover_eval(Vec2F32 pos, String8 file_path, TxtPt pt, U64 vaddr, String8 s
|
|||||||
B32 is_new_string = !str8_match(window->hover_eval_string, string, 0);
|
B32 is_new_string = !str8_match(window->hover_eval_string, string, 0);
|
||||||
if(is_new_string)
|
if(is_new_string)
|
||||||
{
|
{
|
||||||
window->hover_eval_first_frame_idx = window->hover_eval_last_frame_idx = d_frame_index();
|
window->hover_eval_first_frame_idx = window->hover_eval_last_frame_idx = df_state->frame_index;
|
||||||
arena_clear(window->hover_eval_arena);
|
arena_clear(window->hover_eval_arena);
|
||||||
window->hover_eval_string = push_str8_copy(window->hover_eval_arena, string);
|
window->hover_eval_string = push_str8_copy(window->hover_eval_arena, string);
|
||||||
window->hover_eval_file_path = push_str8_copy(window->hover_eval_arena, file_path);
|
window->hover_eval_file_path = push_str8_copy(window->hover_eval_arena, file_path);
|
||||||
@@ -6377,7 +6377,7 @@ df_set_hover_eval(Vec2F32 pos, String8 file_path, TxtPt pt, U64 vaddr, String8 s
|
|||||||
window->hover_eval_focused = 0;
|
window->hover_eval_focused = 0;
|
||||||
}
|
}
|
||||||
window->hover_eval_spawn_pos = pos;
|
window->hover_eval_spawn_pos = pos;
|
||||||
window->hover_eval_last_frame_idx = d_frame_index();
|
window->hover_eval_last_frame_idx = df_state->frame_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6619,7 +6619,7 @@ df_set_autocomp_lister_query(UI_Key root_key, DF_AutoCompListerParams *params, S
|
|||||||
window->autocomp_num_visible_rows_t = 0;
|
window->autocomp_num_visible_rows_t = 0;
|
||||||
window->autocomp_open_t = 0;
|
window->autocomp_open_t = 0;
|
||||||
}
|
}
|
||||||
if(window->autocomp_last_frame_idx+1 < d_frame_index())
|
if(window->autocomp_last_frame_idx+1 < df_state->frame_index)
|
||||||
{
|
{
|
||||||
window->autocomp_force_closed = 0;
|
window->autocomp_force_closed = 0;
|
||||||
window->autocomp_num_visible_rows_t = 0;
|
window->autocomp_num_visible_rows_t = 0;
|
||||||
@@ -6631,7 +6631,7 @@ df_set_autocomp_lister_query(UI_Key root_key, DF_AutoCompListerParams *params, S
|
|||||||
window->autocomp_lister_params.strings = str8_list_copy(window->autocomp_lister_params_arena, &window->autocomp_lister_params.strings);
|
window->autocomp_lister_params.strings = str8_list_copy(window->autocomp_lister_params_arena, &window->autocomp_lister_params.strings);
|
||||||
window->autocomp_lister_query_size = Min(query.size, sizeof(window->autocomp_lister_query_buffer));
|
window->autocomp_lister_query_size = Min(query.size, sizeof(window->autocomp_lister_query_buffer));
|
||||||
MemoryCopy(window->autocomp_lister_query_buffer, query.str, window->autocomp_lister_query_size);
|
MemoryCopy(window->autocomp_lister_query_buffer, query.str, window->autocomp_lister_query_size);
|
||||||
window->autocomp_last_frame_idx = d_frame_index();
|
window->autocomp_last_frame_idx = df_state->frame_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@@ -7423,12 +7423,30 @@ df_request_frame(void)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Main State Accessors
|
//~ rjf: Main State Accessors
|
||||||
|
|
||||||
|
//- rjf: per-frame arena
|
||||||
|
|
||||||
internal Arena *
|
internal Arena *
|
||||||
df_frame_arena(void)
|
df_frame_arena(void)
|
||||||
{
|
{
|
||||||
return df_state->frame_arenas[df_state->frame_index%ArrayCount(df_state->frame_arenas)];
|
return df_state->frame_arenas[df_state->frame_index%ArrayCount(df_state->frame_arenas)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- rjf: config paths
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
df_cfg_path_from_src(D_CfgSrc src)
|
||||||
|
{
|
||||||
|
return df_state->cfg_paths[src];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: config state
|
||||||
|
|
||||||
|
internal D_CfgTable *
|
||||||
|
df_cfg_table(void)
|
||||||
|
{
|
||||||
|
return &df_state->cfg_table;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Registers
|
//~ rjf: Registers
|
||||||
|
|
||||||
@@ -7628,12 +7646,12 @@ df_init(CmdLine *cmdln)
|
|||||||
String8 cfg_src_paths[D_CfgSrc_COUNT] = {user_cfg_path, project_cfg_path};
|
String8 cfg_src_paths[D_CfgSrc_COUNT] = {user_cfg_path, project_cfg_path};
|
||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
d_state->cfg_path_arenas[src] = arena_alloc();
|
df_state->cfg_path_arenas[src] = arena_alloc();
|
||||||
df_cmd(d_cfg_src_load_cmd_kind_table[src], .file_path = path_normalized_from_string(scratch.arena, cfg_src_paths[src]));
|
df_cmd(d_cfg_src_load_cmd_kind_table[src], .file_path = path_normalized_from_string(scratch.arena, cfg_src_paths[src]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: set up config table arena
|
// rjf: set up config table arena
|
||||||
d_state->cfg_arena = arena_alloc();
|
df_state->cfg_arena = arena_alloc();
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7723,6 +7741,13 @@ df_frame(void)
|
|||||||
DI_Scope *di_scope = di_scope_open();
|
DI_Scope *di_scope = di_scope_open();
|
||||||
local_persist S32 depth = 0;
|
local_persist S32 depth = 0;
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- rjf: do per-frame resets
|
||||||
|
//
|
||||||
|
arena_clear(df_frame_arena());
|
||||||
|
df_state->top_regs = &df_state->base_regs;
|
||||||
|
df_regs_copy_contents(df_frame_arena(), &df_state->top_regs->v, &df_state->top_regs->v);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: get events from the OS
|
//- rjf: get events from the OS
|
||||||
//
|
//
|
||||||
@@ -7773,7 +7798,7 @@ df_frame(void)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: target Hz -> delta time
|
//- rjf: target Hz -> delta time
|
||||||
//
|
//
|
||||||
F32 dt = 1.f/target_hz;
|
df_state->frame_dt = 1.f/target_hz;
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: begin measuring actual per-frame work
|
//- rjf: begin measuring actual per-frame work
|
||||||
@@ -8152,7 +8177,7 @@ df_frame(void)
|
|||||||
//- rjf: autosave if needed
|
//- rjf: autosave if needed
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
df_state->seconds_until_autosave -= dt;
|
df_state->seconds_until_autosave -= df_state->frame_dt;
|
||||||
if(df_state->seconds_until_autosave <= 0.f)
|
if(df_state->seconds_until_autosave <= 0.f)
|
||||||
{
|
{
|
||||||
df_cmd(DF_CmdKind_WriteUserData);
|
df_cmd(DF_CmdKind_WriteUserData);
|
||||||
@@ -8412,8 +8437,8 @@ df_frame(void)
|
|||||||
{
|
{
|
||||||
if(load_cfg[src])
|
if(load_cfg[src])
|
||||||
{
|
{
|
||||||
arena_clear(d_state->cfg_path_arenas[src]);
|
arena_clear(df_state->cfg_path_arenas[src]);
|
||||||
d_state->cfg_paths[src] = push_str8_copy(d_state->cfg_path_arenas[src], new_path);
|
df_state->cfg_paths[src] = push_str8_copy(df_state->cfg_path_arenas[src], new_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8424,7 +8449,7 @@ df_frame(void)
|
|||||||
{
|
{
|
||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
String8 path = d_cfg_path_from_src(src);
|
String8 path = df_cfg_path_from_src(src);
|
||||||
cfg_props[src] = os_properties_from_file_path(path);
|
cfg_props[src] = os_properties_from_file_path(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8436,7 +8461,7 @@ df_frame(void)
|
|||||||
{
|
{
|
||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
String8 path = d_cfg_path_from_src(src);
|
String8 path = df_cfg_path_from_src(src);
|
||||||
OS_Handle file = os_file_open(OS_AccessFlag_ShareRead|OS_AccessFlag_Read, path);
|
OS_Handle file = os_file_open(OS_AccessFlag_ShareRead|OS_AccessFlag_Read, path);
|
||||||
FileProperties props = os_properties_from_file(file);
|
FileProperties props = os_properties_from_file(file);
|
||||||
String8 data = os_string_from_file_range(scratch.arena, file, r1u64(0, props.size));
|
String8 data = os_string_from_file_range(scratch.arena, file, r1u64(0, props.size));
|
||||||
@@ -8466,7 +8491,7 @@ df_frame(void)
|
|||||||
{
|
{
|
||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
cfg_load[src] = (load_cfg[src] && ((cfg_save[src] == 0 && d_state->cfg_cached_timestamp[src] != cfg_timestamps[src]) || cfg_props[src].created == 0));
|
cfg_load[src] = (load_cfg[src] && ((cfg_save[src] == 0 && df_state->cfg_cached_timestamp[src] != cfg_timestamps[src]) || cfg_props[src].created == 0));
|
||||||
cfg_load_any = cfg_load_any || cfg_load[src];
|
cfg_load_any = cfg_load_any || cfg_load[src];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8474,11 +8499,11 @@ df_frame(void)
|
|||||||
//- rjf: load => build new config table
|
//- rjf: load => build new config table
|
||||||
if(cfg_load_any)
|
if(cfg_load_any)
|
||||||
{
|
{
|
||||||
arena_clear(d_state->cfg_arena);
|
arena_clear(df_state->cfg_arena);
|
||||||
MemoryZeroStruct(&d_state->cfg_table);
|
MemoryZeroStruct(&df_state->cfg_table);
|
||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
d_cfg_table_push_unparsed_string(d_state->cfg_arena, &d_state->cfg_table, cfg_data[src], src);
|
d_cfg_table_push_unparsed_string(df_state->cfg_arena, &df_state->cfg_table, cfg_data[src], src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8496,7 +8521,7 @@ df_frame(void)
|
|||||||
D_CmdKind cmd_kind = d_cfg_src_apply_cmd_kind_table[src];
|
D_CmdKind cmd_kind = d_cfg_src_apply_cmd_kind_table[src];
|
||||||
D_CmdParams params = d_cmd_params_zero();
|
D_CmdParams params = d_cmd_params_zero();
|
||||||
df_push_cmd(df_cmd_spec_from_kind(cmd_kind), ¶ms);
|
df_push_cmd(df_cmd_spec_from_kind(cmd_kind), ¶ms);
|
||||||
d_state->cfg_cached_timestamp[src] = cfg_timestamps[src];
|
df_state->cfg_cached_timestamp[src] = cfg_timestamps[src];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8526,7 +8551,7 @@ df_frame(void)
|
|||||||
case DF_CmdKind_ApplyUserData:
|
case DF_CmdKind_ApplyUserData:
|
||||||
case DF_CmdKind_ApplyProjectData:
|
case DF_CmdKind_ApplyProjectData:
|
||||||
{
|
{
|
||||||
D_CfgTable *table = d_cfg_table();
|
D_CfgTable *table = df_cfg_table();
|
||||||
OS_HandleArray monitors = os_push_monitors_array(scratch.arena);
|
OS_HandleArray monitors = os_push_monitors_array(scratch.arena);
|
||||||
|
|
||||||
//- rjf: get config source
|
//- rjf: get config source
|
||||||
@@ -8541,7 +8566,7 @@ df_frame(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: get paths
|
//- rjf: get paths
|
||||||
String8 cfg_path = d_cfg_path_from_src(src);
|
String8 cfg_path = df_cfg_path_from_src(src);
|
||||||
String8 cfg_folder = str8_chop_last_slash(cfg_path);
|
String8 cfg_folder = str8_chop_last_slash(cfg_path);
|
||||||
|
|
||||||
//- rjf: keep track of recent projects
|
//- rjf: keep track of recent projects
|
||||||
@@ -9246,7 +9271,7 @@ df_frame(void)
|
|||||||
try_u64_from_str8_c_rules(hex_string, &hex_val);
|
try_u64_from_str8_c_rules(hex_string, &hex_val);
|
||||||
Vec4F32 color_rgba = rgba_from_u32((U32)hex_val);
|
Vec4F32 color_rgba = rgba_from_u32((U32)hex_val);
|
||||||
df_state->cfg_theme_target.colors[color_code] = color_rgba;
|
df_state->cfg_theme_target.colors[color_code] = color_rgba;
|
||||||
if(d_frame_index() <= 2)
|
if(df_state->frame_index <= 2)
|
||||||
{
|
{
|
||||||
df_state->cfg_theme.colors[color_code] = color_rgba;
|
df_state->cfg_theme.colors[color_code] = color_rgba;
|
||||||
}
|
}
|
||||||
@@ -9404,7 +9429,7 @@ df_frame(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String8 path = d_cfg_path_from_src(src);
|
String8 path = df_cfg_path_from_src(src);
|
||||||
String8List d_strs = d_cfg_strings_from_core(scratch.arena, path, src);
|
String8List d_strs = d_cfg_strings_from_core(scratch.arena, path, src);
|
||||||
String8List df_strs = df_cfg_strings_from_gfx(scratch.arena, path, src);
|
String8List df_strs = df_cfg_strings_from_gfx(scratch.arena, path, src);
|
||||||
String8 header = push_str8f(scratch.arena, "// raddbg %s file\n\n", d_cfg_src_string_table[src].str);
|
String8 header = push_str8f(scratch.arena, "// raddbg %s file\n\n", d_cfg_src_string_table[src].str);
|
||||||
@@ -10492,7 +10517,7 @@ df_frame(void)
|
|||||||
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1))
|
||||||
{
|
{
|
||||||
DF_CmdKind write_cmd = d_cfg_src_write_cmd_kind_table[src];
|
DF_CmdKind write_cmd = d_cfg_src_write_cmd_kind_table[src];
|
||||||
df_cmd(write_cmd, .file_path = d_cfg_path_from_src(src));
|
df_cmd(write_cmd, .file_path = df_cfg_path_from_src(src));
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
@@ -12056,7 +12081,7 @@ df_frame(void)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: tick debug engine
|
//- rjf: tick debug engine
|
||||||
//
|
//
|
||||||
d_tick(scratch.arena, &targets, &breakpoints, di_scope, dt);
|
d_tick(scratch.arena, &targets, &breakpoints);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: apply new rich hover info
|
//- rjf: apply new rich hover info
|
||||||
@@ -12071,7 +12096,7 @@ df_frame(void)
|
|||||||
//- rjf: animate confirmation
|
//- rjf: animate confirmation
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-10.f * d_dt())) : 1.f;
|
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-10.f * df_state->frame_dt)) : 1.f;
|
||||||
B32 confirm_open = df_state->confirm_active;
|
B32 confirm_open = df_state->confirm_active;
|
||||||
df_state->confirm_t += rate * ((F32)!!confirm_open-df_state->confirm_t);
|
df_state->confirm_t += rate * ((F32)!!confirm_open-df_state->confirm_t);
|
||||||
if(abs_f32(df_state->confirm_t - (F32)!!confirm_open) > 0.005f)
|
if(abs_f32(df_state->confirm_t - (F32)!!confirm_open) > 0.005f)
|
||||||
@@ -12086,7 +12111,7 @@ df_frame(void)
|
|||||||
{
|
{
|
||||||
DF_Theme *current = &df_state->cfg_theme;
|
DF_Theme *current = &df_state->cfg_theme;
|
||||||
DF_Theme *target = &df_state->cfg_theme_target;
|
DF_Theme *target = &df_state->cfg_theme_target;
|
||||||
F32 rate = 1 - pow_f32(2, (-50.f * d_dt()));
|
F32 rate = 1 - pow_f32(2, (-50.f * df_state->frame_dt));
|
||||||
for(DF_ThemeColor color = DF_ThemeColor_Null;
|
for(DF_ThemeColor color = DF_ThemeColor_Null;
|
||||||
color < DF_ThemeColor_COUNT;
|
color < DF_ThemeColor_COUNT;
|
||||||
color = (DF_ThemeColor)(color+1))
|
color = (DF_ThemeColor)(color+1))
|
||||||
@@ -12109,7 +12134,7 @@ df_frame(void)
|
|||||||
//- rjf: animate alive-transitions for entities
|
//- rjf: animate alive-transitions for entities
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
F32 rate = 1.f - pow_f32(2.f, -20.f*d_dt());
|
F32 rate = 1.f - pow_f32(2.f, -20.f*df_state->frame_dt);
|
||||||
for(D_Entity *e = d_entity_root(); !d_entity_is_nil(e); e = d_entity_rec_depth_first_pre(e, d_entity_root()).next)
|
for(D_Entity *e = d_entity_root(); !d_entity_is_nil(e); e = d_entity_rec_depth_first_pre(e, d_entity_root()).next)
|
||||||
{
|
{
|
||||||
F32 diff = (1.f - e->alive_t);
|
F32 diff = (1.f - e->alive_t);
|
||||||
@@ -12242,9 +12267,10 @@ df_frame(void)
|
|||||||
df_state->frame_time_us_history[df_state->frame_index%ArrayCount(df_state->frame_time_us_history)] = frame_time_us;
|
df_state->frame_time_us_history[df_state->frame_index%ArrayCount(df_state->frame_time_us_history)] = frame_time_us;
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: bump frame index
|
//- rjf: bump frame time counters
|
||||||
//
|
//
|
||||||
df_state->frame_index += 1;
|
df_state->frame_index += 1;
|
||||||
|
df_state->time_in_seconds += df_state->frame_dt;
|
||||||
|
|
||||||
di_scope_close(di_scope);
|
di_scope_close(di_scope);
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
|
|||||||
@@ -654,8 +654,10 @@ struct DF_State
|
|||||||
// rjf: top-level state
|
// rjf: top-level state
|
||||||
Arena *arena;
|
Arena *arena;
|
||||||
B32 quit;
|
B32 quit;
|
||||||
|
F64 time_in_seconds;
|
||||||
|
|
||||||
// rjf: frame state
|
// rjf: frame state
|
||||||
|
F32 frame_dt;
|
||||||
U64 frame_index;
|
U64 frame_index;
|
||||||
Arena *frame_arenas[2];
|
Arena *frame_arenas[2];
|
||||||
|
|
||||||
@@ -746,6 +748,13 @@ struct DF_State
|
|||||||
DF_RichHoverInfo rich_hover_info_next;
|
DF_RichHoverInfo rich_hover_info_next;
|
||||||
DF_RichHoverInfo rich_hover_info_current;
|
DF_RichHoverInfo rich_hover_info_current;
|
||||||
|
|
||||||
|
// rjf: config reading state
|
||||||
|
Arena *cfg_path_arenas[D_CfgSrc_COUNT];
|
||||||
|
String8 cfg_paths[D_CfgSrc_COUNT];
|
||||||
|
U64 cfg_cached_timestamp[D_CfgSrc_COUNT];
|
||||||
|
Arena *cfg_arena;
|
||||||
|
D_CfgTable cfg_table;
|
||||||
|
|
||||||
// rjf: running theme state
|
// rjf: running theme state
|
||||||
DF_Theme cfg_theme_target;
|
DF_Theme cfg_theme_target;
|
||||||
DF_Theme cfg_theme;
|
DF_Theme cfg_theme;
|
||||||
@@ -1025,8 +1034,15 @@ internal void df_request_frame(void);
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Main State Accessors
|
//~ rjf: Main State Accessors
|
||||||
|
|
||||||
|
//- rjf: per-frame arena
|
||||||
internal Arena *df_frame_arena(void);
|
internal Arena *df_frame_arena(void);
|
||||||
|
|
||||||
|
//- rjf: config paths
|
||||||
|
internal String8 df_cfg_path_from_src(D_CfgSrc src);
|
||||||
|
|
||||||
|
//- rjf: config state
|
||||||
|
internal D_CfgTable *df_cfg_table(void);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Registers
|
//~ rjf: Registers
|
||||||
|
|
||||||
|
|||||||
@@ -8306,8 +8306,8 @@ DF_VIEW_UI_FUNCTION_DEF(geo3d)
|
|||||||
//- rjf: animate camera
|
//- rjf: animate camera
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
F32 fast_rate = 1 - pow_f32(2, (-60.f * d_dt()));
|
F32 fast_rate = 1 - pow_f32(2, (-60.f * df_state->frame_dt));
|
||||||
F32 slow_rate = 1 - pow_f32(2, (-30.f * d_dt()));
|
F32 slow_rate = 1 - pow_f32(2, (-30.f * df_state->frame_dt));
|
||||||
state->zoom += (zoom_target - state->zoom) * slow_rate;
|
state->zoom += (zoom_target - state->zoom) * slow_rate;
|
||||||
state->yaw += (yaw_target - state->yaw) * fast_rate;
|
state->yaw += (yaw_target - state->yaw) * fast_rate;
|
||||||
state->pitch += (pitch_target - state->pitch) * fast_rate;
|
state->pitch += (pitch_target - state->pitch) * fast_rate;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ df_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U64 progress_v_t
|
|||||||
F32 height = ui_top_font_size() * 1.f;
|
F32 height = ui_top_font_size() * 1.f;
|
||||||
F32 min_thickness = ui_top_font_size()/2;
|
F32 min_thickness = ui_top_font_size()/2;
|
||||||
F32 trail = ui_top_font_size() * 4;
|
F32 trail = ui_top_font_size() * 4;
|
||||||
F32 t = pow_f32(sin_f32((F32)d_time_in_seconds() / 1.8f), 2.f);
|
F32 t = pow_f32(sin_f32((F32)df_state->time_in_seconds / 1.8f), 2.f);
|
||||||
F64 v = 1.f - abs_f32(0.5f - t);
|
F64 v = 1.f - abs_f32(0.5f - t);
|
||||||
|
|
||||||
// rjf: colors
|
// rjf: colors
|
||||||
@@ -1073,7 +1073,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
{
|
{
|
||||||
color = d_rgba_from_entity(thread);
|
color = d_rgba_from_entity(thread);
|
||||||
}
|
}
|
||||||
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < d_frame_index())
|
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < df_state->frame_index)
|
||||||
{
|
{
|
||||||
color.w *= 0.5f;
|
color.w *= 0.5f;
|
||||||
}
|
}
|
||||||
@@ -1232,7 +1232,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
{
|
{
|
||||||
color = d_rgba_from_entity(thread);
|
color = d_rgba_from_entity(thread);
|
||||||
}
|
}
|
||||||
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < d_frame_index())
|
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < df_state->frame_index)
|
||||||
{
|
{
|
||||||
color.w *= 0.5f;
|
color.w *= 0.5f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user