From c700264445c5b9a00d3f8234b944ef98ce377077 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 30 Jan 2024 13:11:37 -0800 Subject: [PATCH] use explicit thread name exception thread ID parameter, when not implicit --- src/ctrl/ctrl_core.c | 1 + src/demon/win32/demon_os_win32.c | 4 ++++ src/df/core/df_core.c | 9 ++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 4108349c..f3eb6e0f 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -1770,6 +1770,7 @@ ctrl_thread__next_demon_event(Arena *arena, CTRL_Msg *msg, DEMON_RunCtrls *run_c out_evt->entity = ctrl_handle_from_demon(event->thread); out_evt->parent = ctrl_handle_from_demon(event->process); out_evt->string = event->string; + out_evt->entity_id = event->code; }break; } ctrl_c2u_push_events(&evts); diff --git a/src/demon/win32/demon_os_win32.c b/src/demon/win32/demon_os_win32.c index d55c00b1..5f81258b 100644 --- a/src/demon/win32/demon_os_win32.c +++ b/src/demon/win32/demon_os_win32.c @@ -1124,6 +1124,10 @@ demon_os_run(Arena *arena, DEMON_OS_RunCtrls *ctrls){ } e->kind = DEMON_EventKind_SetThreadName; e->string = str8_list_join(arena, &thread_name_strings, 0); + if(exception->NumberParameters > 2) + { + e->code = exception->ExceptionInformation[2]; + } } }break; diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index 6d6b924f..c9d53065 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -6731,7 +6731,14 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) { String8 string = event->string; DF_Entity *thread = df_entity_from_ctrl_handle(event->machine_id, event->entity); - df_entity_equip_name(0, thread, string); + if(event->entity_id != 0) + { + thread = df_entity_from_ctrl_id(event->machine_id, event->entity_id); + } + if(!df_entity_is_nil(thread)) + { + df_entity_equip_name(0, thread, string); + } }break; //- rjf: memory