diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index b20a2409..60c79635 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -2314,14 +2314,15 @@ ctrl_thread__attach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg) } } - //- rjf: push request resolution event + //- rjf: record stop { CTRL_EventList evts = {0}; - CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts); - evt->kind = CTRL_EventKind_AttachDone; - evt->machine_id= CTRL_MachineID_Local; - evt->msg_id = msg->msg_id; - evt->entity_id = !!attach_successful * msg->entity_id; + CTRL_Event *event = ctrl_event_list_push(scratch.arena, &evts); + event->kind = CTRL_EventKind_Stopped; + event->cause = CTRL_EventCause_Finished; + event->machine_id = CTRL_MachineID_Local; + event->msg_id = msg->msg_id; + event->entity_id = !!attach_successful * msg->entity_id; ctrl_c2u_push_events(&evts); } @@ -2366,16 +2367,17 @@ ctrl_thread__kill(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg) } } - //- rjf: push request resolution event + //- rjf: record stop { CTRL_EventList evts = {0}; - CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts); - evt->kind = CTRL_EventKind_KillDone; - evt->machine_id= CTRL_MachineID_Local; - evt->msg_id = msg->msg_id; + CTRL_Event *event = ctrl_event_list_push(scratch.arena, &evts); + event->kind = CTRL_EventKind_Stopped; + event->cause = CTRL_EventCause_Finished; + event->machine_id = CTRL_MachineID_Local; + event->msg_id = msg->msg_id; if(kill_worked) { - evt->entity = msg->entity; + event->entity = msg->entity; } ctrl_c2u_push_events(&evts); } @@ -2420,16 +2422,17 @@ ctrl_thread__detach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg) } } - //- rjf: push request resolution event + //- rjf: record stop { CTRL_EventList evts = {0}; - CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts); - evt->kind = CTRL_EventKind_DetachDone; - evt->machine_id= CTRL_MachineID_Local; - evt->msg_id = msg->msg_id; + CTRL_Event *event = ctrl_event_list_push(scratch.arena, &evts); + event->kind = CTRL_EventKind_Stopped; + event->cause = CTRL_EventCause_Finished; + event->machine_id = CTRL_MachineID_Local; + event->msg_id = msg->msg_id; if(detach_worked) { - evt->entity = msg->entity; + event->entity = msg->entity; } ctrl_c2u_push_events(&evts); } diff --git a/src/ctrl/ctrl_core.h b/src/ctrl/ctrl_core.h index 2ceee4c4..afc9f25d 100644 --- a/src/ctrl/ctrl_core.h +++ b/src/ctrl/ctrl_core.h @@ -302,12 +302,6 @@ typedef enum CTRL_EventKind CTRL_EventKind_MemDecommit, CTRL_EventKind_MemRelease, - //- rjf: ctrl requests - CTRL_EventKind_LaunchAndInitDone, - CTRL_EventKind_AttachDone, - CTRL_EventKind_KillDone, - CTRL_EventKind_DetachDone, - CTRL_EventKind_COUNT } CTRL_EventKind; diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index a825534c..f2c84a51 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -6803,11 +6803,28 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) DF_Entity *binary = df_entity_from_path(bin_path, DF_EntityFromPathFlag_All); df_entity_equip_entity_handle(module, df_handle_from_entity(binary)); - // rjf: is first -> attach process color if applicable - if(is_first && parent->flags & DF_EntityFlag_HasColor) + // rjf: is first -> find target, equip process & module & first thread with target color + if(is_first) { - Vec4F32 rgba = df_rgba_from_entity(parent); - df_entity_equip_color_rgba(module, rgba); + DF_EntityList targets = df_query_cached_entity_list_with_kind(DF_EntityKind_Target); + for(DF_EntityNode *n = targets.first; n != 0; n = n->next) + { + DF_Entity *target = n->entity; + DF_Entity *exe = df_entity_child_from_kind(target, DF_EntityKind_Executable); + String8 exe_name = exe->name; + String8 exe_name_normalized = path_normalized_from_string(scratch.arena, exe_name); + String8 module_name_normalized = path_normalized_from_string(scratch.arena, module->name); + if(str8_match(exe_name_normalized, module_name_normalized, StringMatchFlag_CaseInsensitive) && + target->flags & DF_EntityFlag_HasColor) + { + DF_Entity *first_thread = df_entity_child_from_kind(parent, DF_EntityKind_Thread); + Vec4F32 rgba = df_rgba_from_entity(target); + df_entity_equip_color_rgba(parent, rgba); + df_entity_equip_color_rgba(first_thread, rgba); + df_entity_equip_color_rgba(module, rgba); + break; + } + } } }break; @@ -6885,50 +6902,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) case CTRL_EventKind_MemCommit:{}break; case CTRL_EventKind_MemDecommit:{}break; case CTRL_EventKind_MemRelease:{}break; - - //- rjf: ctrl requests - - case CTRL_EventKind_LaunchAndInitDone: - case CTRL_EventKind_AttachDone: - case CTRL_EventKind_KillDone: - case CTRL_EventKind_DetachDone: - { - // rjf: resolve request entities - DF_EntityID id = event->msg_id; - DF_Entity *request_entity = df_entity_from_id(id); - if(!df_entity_is_nil(request_entity)) - { - df_entity_mark_for_deletion(request_entity); - - // TODO(rjf): @launch_and_init_x -#if 0 - switch(request_entity->subkind) - { - case CTRL_MsgKind_LaunchAndInit: - { - DF_Entity *target = df_entity_from_handle(request_entity->entity_handle); - DF_Entity *process = df_entity_from_ctrl_id(event->machine_id, event->entity_id); - DF_Entity *thread = df_entity_child_from_kind(process, DF_EntityKind_Thread); - if(!df_entity_is_nil(target) && !df_entity_is_nil(process) && !df_entity_is_nil(thread)) - { - df_entity_equip_entity_handle(process, df_handle_from_entity(target)); - if(target->flags & DF_EntityFlag_HasColor) - { - Vec4F32 color = df_rgba_from_entity(target); - df_entity_equip_color_rgba(process, color); - df_entity_equip_color_rgba(thread, color); - } - } - }break; - } -#endif - } - - // rjf: collect stop info - arena_clear(df_state->ctrl_stop_arena); - MemoryCopyStruct(&df_state->ctrl_last_stop_event, event); - df_state->ctrl_last_stop_event.string = push_str8_copy(df_state->ctrl_stop_arena, df_state->ctrl_last_stop_event.string); - }break; } } @@ -7145,17 +7118,9 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) } } - // rjf: build corresponding request entity - DF_Entity *request_entity = df_entity_alloc(0, df_entity_root(), DF_EntityKind_CtrlRequest); - { - request_entity->subkind = CTRL_MsgKind_Launch; - request_entity->entity_handle = df_handle_from_entity(target); - } - // rjf: push message to launch { CTRL_Msg msg = {CTRL_MsgKind_Launch}; - msg.msg_id = request_entity->id; msg.path = path; msg.cmd_line_string_list = cmdln_strings; msg.env_inherit = 1; diff --git a/src/df/core/df_core.mdesk b/src/df/core/df_core.mdesk index c34dcd9a..8135ead4 100644 --- a/src/df/core/df_core.mdesk +++ b/src/df/core/df_core.mdesk @@ -61,7 +61,6 @@ DF_EntityKindTable: {Dest dest 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Path" Null "Destination" } //- rjf: control system entities - {CtrlRequest ctrl_request 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Null "Control Request" } {Process process 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Threads "Process" } {Thread thread 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Thread "Thread" } {Module module 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Module "Module" } diff --git a/src/df/core/generated/df_core.meta.c b/src/df/core/generated/df_core.meta.c index 10fde1b9..aeab2adb 100644 --- a/src/df/core/generated/df_core.meta.c +++ b/src/df/core/generated/df_core.meta.c @@ -27,7 +27,7 @@ Rng1U64 df_g_cmd_param_slot_range_table[19] = {OffsetOf(DF_CmdParams, force_confirm), OffsetOf(DF_CmdParams, force_confirm) + sizeof(B32)}, }; -DF_IconKind df_g_entity_kind_icon_kind_table[27] = +DF_IconKind df_g_entity_kind_icon_kind_table[26] = { DF_IconKind_Null, DF_IconKind_Null, @@ -47,7 +47,6 @@ DF_IconKind_Null, DF_IconKind_Null, DF_IconKind_Null, DF_IconKind_Null, -DF_IconKind_Null, DF_IconKind_Threads, DF_IconKind_Thread, DF_IconKind_Module, @@ -58,7 +57,7 @@ DF_IconKind_Null, DF_IconKind_Null, }; -String8 df_g_entity_kind_display_string_table[27] = +String8 df_g_entity_kind_display_string_table[26] = { str8_lit_comp("Nil"), str8_lit_comp("Root"), @@ -78,7 +77,6 @@ str8_lit_comp("Execution Path"), str8_lit_comp("Entry Point Name"), str8_lit_comp("Source"), str8_lit_comp("Destination"), -str8_lit_comp("Control Request"), str8_lit_comp("Process"), str8_lit_comp("Thread"), str8_lit_comp("Module"), @@ -89,7 +87,7 @@ str8_lit_comp("Conversion Failure"), str8_lit_comp("EndedProcess"), }; -String8 df_g_entity_kind_name_label_table[27] = +String8 df_g_entity_kind_name_label_table[26] = { str8_lit_comp("Label"), str8_lit_comp("Label"), @@ -117,10 +115,9 @@ str8_lit_comp("Label"), str8_lit_comp("Label"), str8_lit_comp("Label"), str8_lit_comp("Label"), -str8_lit_comp("Label"), }; -DF_EntityKindFlags df_g_entity_kind_flags_table[27] = +DF_EntityKindFlags df_g_entity_kind_flags_table[26] = { (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), @@ -143,7 +140,6 @@ DF_EntityKindFlags df_g_entity_kind_flags_table[27] = (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), -(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 1*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 1*DF_EntityKindFlag_TreeMutationSoftHalt | 1*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), @@ -151,7 +147,7 @@ DF_EntityKindFlags df_g_entity_kind_flags_table[27] = (0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime), }; -DF_EntityOpFlags df_g_entity_kind_op_flags_table[27] = +DF_EntityOpFlags df_g_entity_kind_op_flags_table[26] = { (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), @@ -171,7 +167,6 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[27] = (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), -(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (1*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (1*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), (0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate), diff --git a/src/df/core/generated/df_core.meta.h b/src/df/core/generated/df_core.meta.h index a2454b39..839d6b19 100644 --- a/src/df/core/generated/df_core.meta.h +++ b/src/df/core/generated/df_core.meta.h @@ -35,7 +35,6 @@ DF_EntityKind_ExecutionPath, DF_EntityKind_EntryPointName, DF_EntityKind_Source, DF_EntityKind_Dest, -DF_EntityKind_CtrlRequest, DF_EntityKind_Process, DF_EntityKind_Thread, DF_EntityKind_Module, @@ -1517,11 +1516,11 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] = }; C_LINKAGE_BEGIN extern Rng1U64 df_g_cmd_param_slot_range_table[19]; -extern DF_IconKind df_g_entity_kind_icon_kind_table[27]; -extern String8 df_g_entity_kind_display_string_table[27]; -extern String8 df_g_entity_kind_name_label_table[27]; -extern DF_EntityKindFlags df_g_entity_kind_flags_table[27]; -extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[27]; +extern DF_IconKind df_g_entity_kind_icon_kind_table[26]; +extern String8 df_g_entity_kind_display_string_table[26]; +extern String8 df_g_entity_kind_name_label_table[26]; +extern DF_EntityKindFlags df_g_entity_kind_flags_table[26]; +extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[26]; extern String8 df_g_cfg_src_string_table[4]; extern DF_CoreCmdKind df_g_cfg_src_load_cmd_kind_table[4]; extern DF_CoreCmdKind df_g_cfg_src_write_cmd_kind_table[4]; diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index 11d9a848..ec29bafd 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -8512,22 +8512,6 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event, }break; } }break; - case CTRL_EventKind_LaunchAndInitDone: - { - explanation = str8_lit("Launched"); - }break; - case CTRL_EventKind_AttachDone: - { - explanation = str8_lit("Attached"); - }break; - case CTRL_EventKind_DetachDone: - { - explanation = str8_lit("Detached"); - }break; - case CTRL_EventKind_KillDone: - { - explanation = str8_lit("Killed"); - }break; } scratch_end(scratch); if(icon_out)