fix busted ctrl memory stream, when bad memory & null terminated (#647); do not refresh repeatedly due to loading, if any raddbg window is not focused

This commit is contained in:
Ryan Fleury
2025-10-06 11:38:58 -07:00
parent 811f316ca2
commit 213dc6a6a7
2 changed files with 14 additions and 5 deletions
+3 -3
View File
@@ -6000,14 +6000,14 @@ ctrl_memory_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out)
}
//- rjf: do read
U64 range_size = 0;
U64 range_size = dim_1u64(vaddr_range_clamped);
Arena *range_arena = 0;
void *range_base = 0;
U64 zero_terminated_size = 0;
U64 pre_read_mem_gen = ctrl_mem_gen();
B32 pre_run_state = ins_atomic_u64_eval(&ctrl_state->ctrl_thread_run_state);
if(range_size != 0)
{
range_size = dim_1u64(vaddr_range_clamped);
U64 page_size = os_get_system_info()->page_size; // TODO(rjf): @page_size_from_process
U64 arena_size = AlignPow2(range_size + ARENA_HEADER_SIZE, page_size);
range_arena = arena_alloc(.reserve_size = range_size+ARENA_HEADER_SIZE, .commit_size = range_size+ARENA_HEADER_SIZE);
@@ -6053,7 +6053,7 @@ ctrl_memory_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out)
MemoryZero((U8 *)range_base + bytes_read, range_size-bytes_read);
}
zero_terminated_size = range_size;
if(zero_terminated)
if(zero_terminated && range_base != 0)
{
for(U64 idx = 0; idx < bytes_read; idx += 1)
{
+11 -2
View File
@@ -11435,6 +11435,15 @@ rd_frame(void)
//
if(rd_state->frame_depth == 1)
{
B32 any_window_is_focused = 0;
for(RD_WindowState *w = rd_state->first_window_state; w != &rd_nil_window_state; w = w->order_next)
{
if(os_window_is_focused(w->os))
{
any_window_is_focused = 1;
break;
}
}
F32 slow_rate = 1 - pow_f32(2, (-10.f * rd_state->frame_dt));
F32 fast_rate = 1 - pow_f32(2, (-40.f * rd_state->frame_dt));
for EachIndex(slot_idx, rd_state->view_state_slots_count)
@@ -11449,7 +11458,7 @@ rd_frame(void)
vs->scroll_pos.x.off += scroll_x_diff*rd_state->scrolling_animation_rate;
vs->scroll_pos.y.off += scroll_y_diff*rd_state->scrolling_animation_rate;
vs->loading_t += loading_t_diff * slow_rate;
if(abs_f32(loading_t_diff) > 0.01f ||
if((any_window_is_focused && abs_f32(loading_t_diff) > 0.01f) ||
abs_f32(scroll_x_diff) > 0.01f ||
abs_f32(scroll_y_diff) > 0.01f)
{
@@ -11466,7 +11475,7 @@ rd_frame(void)
RD_Cfg *vcfg = rd_cfg_from_id(vs->cfg_id);
if(rd_cfg_child_from_string(vcfg, str8_lit("selected")) != &rd_nil_cfg)
{
if(vs->loading_t_target > 0.5f)
if(vs->loading_t_target > 0.5f && any_window_is_focused)
{
rd_request_frame();
}