mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
strip out unneeded info from df entities; raddbg_markup windows thread names
This commit is contained in:
+13
-57
@@ -1006,7 +1006,7 @@ df_handle_from_entity(DF_Entity *entity)
|
|||||||
if(!df_entity_is_nil(entity))
|
if(!df_entity_is_nil(entity))
|
||||||
{
|
{
|
||||||
handle.u64[0] = df_index_from_entity(entity);
|
handle.u64[0] = df_index_from_entity(entity);
|
||||||
handle.u64[1] = entity->generation;
|
handle.u64[1] = entity->gen;
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -1015,7 +1015,7 @@ internal DF_Entity *
|
|||||||
df_entity_from_handle(DF_Handle handle)
|
df_entity_from_handle(DF_Handle handle)
|
||||||
{
|
{
|
||||||
DF_Entity *result = df_state->entities_base + handle.u64[0];
|
DF_Entity *result = df_state->entities_base + handle.u64[0];
|
||||||
if(handle.u64[0] >= df_state->entities_count || result->generation != handle.u64[1])
|
if(handle.u64[0] >= df_state->entities_count || result->gen != handle.u64[1])
|
||||||
{
|
{
|
||||||
result = &df_g_nil_entity;
|
result = &df_g_nil_entity;
|
||||||
}
|
}
|
||||||
@@ -1567,7 +1567,7 @@ df_entity_alloc(DF_StateDeltaHistory *hist, DF_Entity *parent, DF_EntityKind kin
|
|||||||
df_state_delta_history_push_struct_delta(hist, &entity->first);
|
df_state_delta_history_push_struct_delta(hist, &entity->first);
|
||||||
df_state_delta_history_push_struct_delta(hist, &entity->last);
|
df_state_delta_history_push_struct_delta(hist, &entity->last);
|
||||||
df_state_delta_history_push_struct_delta(hist, &entity->parent);
|
df_state_delta_history_push_struct_delta(hist, &entity->parent);
|
||||||
df_state_delta_history_push_struct_delta(hist, &entity->generation);
|
df_state_delta_history_push_struct_delta(hist, &entity->gen);
|
||||||
df_state_delta_history_push_struct_delta(hist, &entity->id);
|
df_state_delta_history_push_struct_delta(hist, &entity->id);
|
||||||
df_state_delta_history_push_struct_delta(hist, &entity->kind);
|
df_state_delta_history_push_struct_delta(hist, &entity->kind);
|
||||||
if(!df_entity_is_nil(parent))
|
if(!df_entity_is_nil(parent))
|
||||||
@@ -1583,9 +1583,9 @@ df_entity_alloc(DF_StateDeltaHistory *hist, DF_Entity *parent, DF_EntityKind kin
|
|||||||
|
|
||||||
// rjf: zero entity
|
// rjf: zero entity
|
||||||
{
|
{
|
||||||
U64 generation = entity->generation;
|
U64 gen = entity->gen;
|
||||||
MemoryZeroStruct(entity);
|
MemoryZeroStruct(entity);
|
||||||
entity->generation = generation;
|
entity->gen = gen;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: set up alloc'd entity links
|
// rjf: set up alloc'd entity links
|
||||||
@@ -1606,7 +1606,7 @@ df_entity_alloc(DF_StateDeltaHistory *hist, DF_Entity *parent, DF_EntityKind kin
|
|||||||
entity->kind = kind;
|
entity->kind = kind;
|
||||||
df_state->entities_id_gen += 1;
|
df_state->entities_id_gen += 1;
|
||||||
entity->id = df_state->entities_id_gen;
|
entity->id = df_state->entities_id_gen;
|
||||||
entity->generation += 1;
|
entity->gen += 1;
|
||||||
entity->alloc_time_us = os_now_microseconds();
|
entity->alloc_time_us = os_now_microseconds();
|
||||||
|
|
||||||
// rjf: dirtify caches
|
// rjf: dirtify caches
|
||||||
@@ -1681,7 +1681,7 @@ df_entity_release(DF_StateDeltaHistory *hist, DF_Entity *entity)
|
|||||||
SLLStackPush(df_state->entities_free[free_list_idx], task->e);
|
SLLStackPush(df_state->entities_free[free_list_idx], task->e);
|
||||||
df_state->entities_free_count += 1;
|
df_state->entities_free_count += 1;
|
||||||
df_state->entities_active_count -= 1;
|
df_state->entities_active_count -= 1;
|
||||||
task->e->generation += 1;
|
task->e->gen += 1;
|
||||||
if(task->e->name.size != 0)
|
if(task->e->name.size != 0)
|
||||||
{
|
{
|
||||||
df_name_release(hist, task->e->name);
|
df_name_release(hist, task->e->name);
|
||||||
@@ -1751,15 +1751,6 @@ df_entity_equip_txt_pt(DF_Entity *entity, TxtPt point)
|
|||||||
df_entity_notify_mutation(entity);
|
df_entity_notify_mutation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
df_entity_equip_txt_pt_alt(DF_Entity *entity, TxtPt point)
|
|
||||||
{
|
|
||||||
df_require_entity_nonnil(entity, return);
|
|
||||||
entity->text_point_alt = point;
|
|
||||||
entity->flags |= DF_EntityFlag_HasTextPointAlt;
|
|
||||||
df_entity_notify_mutation(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
df_entity_equip_entity_handle(DF_Entity *entity, DF_Handle handle)
|
df_entity_equip_entity_handle(DF_Entity *entity, DF_Handle handle)
|
||||||
{
|
{
|
||||||
@@ -1787,15 +1778,6 @@ df_entity_equip_u64(DF_Entity *entity, U64 u64)
|
|||||||
df_entity_notify_mutation(entity);
|
df_entity_notify_mutation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
df_entity_equip_rng1u64(DF_Entity *entity, Rng1U64 range)
|
|
||||||
{
|
|
||||||
df_require_entity_nonnil(entity, return);
|
|
||||||
entity->rng1u64 = range;
|
|
||||||
entity->flags |= DF_EntityFlag_HasRng1U64;
|
|
||||||
df_entity_notify_mutation(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba)
|
df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba)
|
||||||
{
|
{
|
||||||
@@ -1815,15 +1797,6 @@ df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva)
|
|||||||
df_entity_notify_mutation(entity);
|
df_entity_notify_mutation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
df_entity_equip_death_timer(DF_Entity *entity, F32 seconds_til_death)
|
|
||||||
{
|
|
||||||
df_require_entity_nonnil(entity, return);
|
|
||||||
entity->flags |= DF_EntityFlag_DiesWithTime;
|
|
||||||
entity->life_left = seconds_til_death;
|
|
||||||
df_entity_notify_mutation(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src)
|
df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src)
|
||||||
{
|
{
|
||||||
@@ -1932,7 +1905,6 @@ df_entity_equip_name(DF_StateDeltaHistory *hist, DF_Entity *entity, String8 name
|
|||||||
{
|
{
|
||||||
entity->name = str8_zero();
|
entity->name = str8_zero();
|
||||||
}
|
}
|
||||||
entity->name_generation += 1;
|
|
||||||
df_entity_notify_mutation(entity);
|
df_entity_notify_mutation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7145,12 +7117,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
df_entity_mark_for_deletion(task);
|
df_entity_mark_for_deletion(task);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case DI_EventKind_ConversionFailureUnsupportedFormat:
|
|
||||||
{
|
|
||||||
// DF_Entity *task = df_entity_alloc(df_entity_root(), DF_EntityKind_ConversionFail);
|
|
||||||
// df_entity_equip_name(task, event->string);
|
|
||||||
// df_entity_equip_death_timer(task, 15.f);
|
|
||||||
}break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
@@ -8502,7 +8468,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
case DF_CoreCmdKind_EnableTarget:
|
case DF_CoreCmdKind_EnableTarget:
|
||||||
{
|
{
|
||||||
DF_Entity *entity = df_entity_from_handle(params.entity);
|
DF_Entity *entity = df_entity_from_handle(params.entity);
|
||||||
df_state_delta_history_push_batch(df_state->hist, &entity->generation);
|
df_state_delta_history_push_batch(df_state->hist, &entity->gen);
|
||||||
df_state_delta_history_push_struct_delta(df_state->hist, &entity->b32);
|
df_state_delta_history_push_struct_delta(df_state->hist, &entity->b32);
|
||||||
df_entity_equip_b32(entity, 1);
|
df_entity_equip_b32(entity, 1);
|
||||||
}break;
|
}break;
|
||||||
@@ -8511,7 +8477,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
case DF_CoreCmdKind_DisableTarget:
|
case DF_CoreCmdKind_DisableTarget:
|
||||||
{
|
{
|
||||||
DF_Entity *entity = df_entity_from_handle(params.entity);
|
DF_Entity *entity = df_entity_from_handle(params.entity);
|
||||||
df_state_delta_history_push_batch(df_state->hist, &entity->generation);
|
df_state_delta_history_push_batch(df_state->hist, &entity->gen);
|
||||||
df_state_delta_history_push_struct_delta(df_state->hist, &entity->b32);
|
df_state_delta_history_push_struct_delta(df_state->hist, &entity->b32);
|
||||||
df_entity_equip_b32(entity, 0);
|
df_entity_equip_b32(entity, 0);
|
||||||
}break;
|
}break;
|
||||||
@@ -8543,7 +8509,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
{
|
{
|
||||||
DF_Entity *entity = df_entity_from_handle(params.entity);
|
DF_Entity *entity = df_entity_from_handle(params.entity);
|
||||||
String8 string = params.string;
|
String8 string = params.string;
|
||||||
df_state_delta_history_push_batch(df_state_delta_history(), &entity->generation);
|
df_state_delta_history_push_batch(df_state_delta_history(), &entity->gen);
|
||||||
df_entity_equip_name(df_state_delta_history(), entity, string);
|
df_entity_equip_name(df_state_delta_history(), entity, string);
|
||||||
}break;
|
}break;
|
||||||
case DF_CoreCmdKind_EditEntity:{}break;
|
case DF_CoreCmdKind_EditEntity:{}break;
|
||||||
@@ -8568,10 +8534,8 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
DF_Entity *src_n = task->src_n;
|
DF_Entity *src_n = task->src_n;
|
||||||
DF_Entity *dst_n = df_entity_alloc(df_state_delta_history(), task->dst_parent, task->src_n->kind);
|
DF_Entity *dst_n = df_entity_alloc(df_state_delta_history(), task->dst_parent, task->src_n->kind);
|
||||||
if(src_n->flags & DF_EntityFlag_HasTextPoint) {df_entity_equip_txt_pt(dst_n, src_n->text_point);}
|
if(src_n->flags & DF_EntityFlag_HasTextPoint) {df_entity_equip_txt_pt(dst_n, src_n->text_point);}
|
||||||
if(src_n->flags & DF_EntityFlag_HasTextPointAlt) {df_entity_equip_txt_pt_alt(dst_n, src_n->text_point_alt);}
|
|
||||||
if(src_n->flags & DF_EntityFlag_HasB32) {df_entity_equip_b32(dst_n, src_n->b32);}
|
if(src_n->flags & DF_EntityFlag_HasB32) {df_entity_equip_b32(dst_n, src_n->b32);}
|
||||||
if(src_n->flags & DF_EntityFlag_HasU64) {df_entity_equip_u64(dst_n, src_n->u64);}
|
if(src_n->flags & DF_EntityFlag_HasU64) {df_entity_equip_u64(dst_n, src_n->u64);}
|
||||||
if(src_n->flags & DF_EntityFlag_HasRng1U64) {df_entity_equip_rng1u64(dst_n, src_n->rng1u64);}
|
|
||||||
if(src_n->flags & DF_EntityFlag_HasColor) {df_entity_equip_color_hsva(dst_n, df_hsva_from_entity(src_n));}
|
if(src_n->flags & DF_EntityFlag_HasColor) {df_entity_equip_color_hsva(dst_n, df_hsva_from_entity(src_n));}
|
||||||
if(src_n->flags & DF_EntityFlag_HasVAddrRng) {df_entity_equip_vaddr_rng(dst_n, src_n->vaddr_rng);}
|
if(src_n->flags & DF_EntityFlag_HasVAddrRng) {df_entity_equip_vaddr_rng(dst_n, src_n->vaddr_rng);}
|
||||||
if(src_n->flags & DF_EntityFlag_HasVAddr) {df_entity_equip_vaddr(dst_n, src_n->vaddr);}
|
if(src_n->flags & DF_EntityFlag_HasVAddr) {df_entity_equip_vaddr(dst_n, src_n->vaddr);}
|
||||||
@@ -9010,20 +8974,12 @@ df_core_end_frame(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: eliminate entities that are marked for deletion + kill off entities with a death-timer
|
//- rjf: eliminate entities that are marked for deletion
|
||||||
ProfScope("eliminate deleted/deletion-timer entities")
|
ProfScope("eliminate deleted/deletion-timer entities")
|
||||||
{
|
{
|
||||||
for(DF_Entity *entity = df_entity_root(), *next = 0; !df_entity_is_nil(entity); entity = next)
|
for(DF_Entity *entity = df_entity_root(), *next = 0; !df_entity_is_nil(entity); entity = next)
|
||||||
{
|
{
|
||||||
next = df_entity_rec_df_pre(entity, &df_g_nil_entity).next;
|
next = df_entity_rec_df_pre(entity, &df_g_nil_entity).next;
|
||||||
if(entity->flags & DF_EntityFlag_DiesWithTime)
|
|
||||||
{
|
|
||||||
entity->life_left -= df_dt();
|
|
||||||
if(entity->life_left <= 0.f)
|
|
||||||
{
|
|
||||||
df_entity_mark_for_deletion(entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(entity->flags & DF_EntityFlag_MarkedForDeletion)
|
if(entity->flags & DF_EntityFlag_MarkedForDeletion)
|
||||||
{
|
{
|
||||||
B32 undoable = (df_g_entity_kind_flags_table[entity->kind] & DF_EntityKindFlag_UserDefinedLifetime);
|
B32 undoable = (df_g_entity_kind_flags_table[entity->kind] & DF_EntityKindFlag_UserDefinedLifetime);
|
||||||
@@ -9036,10 +8992,10 @@ df_core_end_frame(void)
|
|||||||
{
|
{
|
||||||
df_state_delta_history_push_batch(df_state->hist, 0);
|
df_state_delta_history_push_batch(df_state->hist, 0);
|
||||||
df_state_delta_history_push_struct_delta(df_state->hist, &entity->deleted);
|
df_state_delta_history_push_struct_delta(df_state->hist, &entity->deleted);
|
||||||
df_state_delta_history_push_struct_delta(df_state->hist, &entity->generation);
|
df_state_delta_history_push_struct_delta(df_state->hist, &entity->gen);
|
||||||
df_state_delta_history_push_struct_delta(df_state->hist, &df_state->kind_alloc_gens[entity->kind]);
|
df_state_delta_history_push_struct_delta(df_state->hist, &df_state->kind_alloc_gens[entity->kind]);
|
||||||
entity->deleted = 1;
|
entity->deleted = 1;
|
||||||
entity->generation += 1;
|
entity->gen += 1;
|
||||||
entity->flags &= ~DF_EntityFlag_MarkedForDeletion;
|
entity->flags &= ~DF_EntityFlag_MarkedForDeletion;
|
||||||
df_state->kind_alloc_gens[entity->kind] += 1;
|
df_state->kind_alloc_gens[entity->kind] += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-18
@@ -51,7 +51,6 @@ struct DF_ExpandNode
|
|||||||
DF_ExpandNode *parent;
|
DF_ExpandNode *parent;
|
||||||
DF_ExpandKey key;
|
DF_ExpandKey key;
|
||||||
B32 expanded;
|
B32 expanded;
|
||||||
F32 expanded_t;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct DF_ExpandSlot DF_ExpandSlot;
|
typedef struct DF_ExpandSlot DF_ExpandSlot;
|
||||||
@@ -324,13 +323,10 @@ enum
|
|||||||
{
|
{
|
||||||
//- rjf: allocationless, simple equipment
|
//- rjf: allocationless, simple equipment
|
||||||
DF_EntityFlag_HasTextPoint = (1<<0),
|
DF_EntityFlag_HasTextPoint = (1<<0),
|
||||||
DF_EntityFlag_HasTextPointAlt = (1<<1),
|
|
||||||
DF_EntityFlag_HasEntityHandle = (1<<2),
|
DF_EntityFlag_HasEntityHandle = (1<<2),
|
||||||
DF_EntityFlag_HasB32 = (1<<3),
|
DF_EntityFlag_HasB32 = (1<<3),
|
||||||
DF_EntityFlag_HasU64 = (1<<4),
|
DF_EntityFlag_HasU64 = (1<<4),
|
||||||
DF_EntityFlag_HasRng1U64 = (1<<5),
|
|
||||||
DF_EntityFlag_HasColor = (1<<6),
|
DF_EntityFlag_HasColor = (1<<6),
|
||||||
DF_EntityFlag_DiesWithTime = (1<<7),
|
|
||||||
DF_EntityFlag_DiesOnRunStop = (1<<8),
|
DF_EntityFlag_DiesOnRunStop = (1<<8),
|
||||||
|
|
||||||
//- rjf: ctrl entity equipment
|
//- rjf: ctrl entity equipment
|
||||||
@@ -346,7 +342,6 @@ enum
|
|||||||
//- rjf: file properties
|
//- rjf: file properties
|
||||||
DF_EntityFlag_IsFolder = (1<<17),
|
DF_EntityFlag_IsFolder = (1<<17),
|
||||||
DF_EntityFlag_IsMissing = (1<<18),
|
DF_EntityFlag_IsMissing = (1<<18),
|
||||||
DF_EntityFlag_Output = (1<<19), // NOTE(rjf): might be missing, but written by us
|
|
||||||
|
|
||||||
//- rjf: deletion
|
//- rjf: deletion
|
||||||
DF_EntityFlag_MarkedForDeletion = (1<<31),
|
DF_EntityFlag_MarkedForDeletion = (1<<31),
|
||||||
@@ -368,23 +363,22 @@ struct DF_Entity
|
|||||||
DF_EntityKind kind;
|
DF_EntityKind kind;
|
||||||
DF_EntityFlags flags;
|
DF_EntityFlags flags;
|
||||||
DF_EntityID id;
|
DF_EntityID id;
|
||||||
U64 generation;
|
U64 gen;
|
||||||
U64 alloc_time_us;
|
U64 alloc_time_us;
|
||||||
B32 deleted;
|
B32 deleted;
|
||||||
F32 alive_t;
|
F32 alive_t;
|
||||||
|
|
||||||
// rjf: allocationless, simple equipment
|
// rjf: basic equipment
|
||||||
TxtPt text_point;
|
TxtPt text_point;
|
||||||
TxtPt text_point_alt;
|
|
||||||
DF_Handle entity_handle;
|
DF_Handle entity_handle;
|
||||||
B32 b32;
|
B32 b32;
|
||||||
U64 u64;
|
U64 u64;
|
||||||
Rng1U64 rng1u64;
|
|
||||||
Vec4F32 color_hsva;
|
Vec4F32 color_hsva;
|
||||||
F32 life_left;
|
F32 life_left;
|
||||||
DF_CfgSrc cfg_src;
|
DF_CfgSrc cfg_src;
|
||||||
|
U64 timestamp;
|
||||||
|
|
||||||
// rjf: ctrl entity equipment
|
// rjf: ctrl equipment
|
||||||
CTRL_MachineID ctrl_machine_id;
|
CTRL_MachineID ctrl_machine_id;
|
||||||
DMN_Handle ctrl_handle;
|
DMN_Handle ctrl_handle;
|
||||||
Architecture arch;
|
Architecture arch;
|
||||||
@@ -396,10 +390,6 @@ struct DF_Entity
|
|||||||
|
|
||||||
// rjf: name equipment
|
// rjf: name equipment
|
||||||
String8 name;
|
String8 name;
|
||||||
U64 name_generation;
|
|
||||||
|
|
||||||
// rjf: timestamp
|
|
||||||
U64 timestamp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct DF_EntityNode DF_EntityNode;
|
typedef struct DF_EntityNode DF_EntityNode;
|
||||||
@@ -1319,7 +1309,6 @@ read_only global DF_Entity df_g_nil_entity =
|
|||||||
|
|
||||||
// rjf: name equipment
|
// rjf: name equipment
|
||||||
{0},
|
{0},
|
||||||
0,
|
|
||||||
|
|
||||||
// rjf: timestamp
|
// rjf: timestamp
|
||||||
0,
|
0,
|
||||||
@@ -1492,14 +1481,11 @@ internal void df_entity_change_parent(DF_StateDeltaHistory *hist, DF_Entity *ent
|
|||||||
|
|
||||||
//- rjf: entity simple equipment
|
//- rjf: entity simple equipment
|
||||||
internal void df_entity_equip_txt_pt(DF_Entity *entity, TxtPt point);
|
internal void df_entity_equip_txt_pt(DF_Entity *entity, TxtPt point);
|
||||||
internal void df_entity_equip_txt_pt_alt(DF_Entity *entity, TxtPt point);
|
|
||||||
internal void df_entity_equip_entity_handle(DF_Entity *entity, DF_Handle handle);
|
internal void df_entity_equip_entity_handle(DF_Entity *entity, DF_Handle handle);
|
||||||
internal void df_entity_equip_b32(DF_Entity *entity, B32 b32);
|
internal void df_entity_equip_b32(DF_Entity *entity, B32 b32);
|
||||||
internal void df_entity_equip_u64(DF_Entity *entity, U64 u64);
|
internal void df_entity_equip_u64(DF_Entity *entity, U64 u64);
|
||||||
internal void df_entity_equip_rng1u64(DF_Entity *entity, Rng1U64 range);
|
|
||||||
internal void df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba);
|
internal void df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba);
|
||||||
internal void df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva);
|
internal void df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva);
|
||||||
internal void df_entity_equip_death_timer(DF_Entity *entity, F32 seconds_til_death);
|
|
||||||
internal void df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src);
|
internal void df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src);
|
||||||
internal void df_entity_equip_timestamp(DF_Entity *entity, U64 timestamp);
|
internal void df_entity_equip_timestamp(DF_Entity *entity, U64 timestamp);
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -14517,17 +14517,7 @@ df_gfx_end_frame(void)
|
|||||||
//- rjf: simulate lag
|
//- rjf: simulate lag
|
||||||
if(DEV_simulate_lag)
|
if(DEV_simulate_lag)
|
||||||
{
|
{
|
||||||
Sleep(300);
|
os_sleep_milliseconds(300);
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: entities with a death timer -> keep animating
|
|
||||||
for(DF_Entity *entity = df_entity_root(), *next = 0; !df_entity_is_nil(entity); entity = next)
|
|
||||||
{
|
|
||||||
next = df_entity_rec_df_pre(entity, &df_g_nil_entity).next;
|
|
||||||
if(entity->flags & DF_EntityFlag_DiesWithTime)
|
|
||||||
{
|
|
||||||
df_gfx_request_frame();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: end drag/drop if needed
|
//- rjf: end drag/drop if needed
|
||||||
|
|||||||
@@ -0,0 +1,244 @@
|
|||||||
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ Win32 Implementations
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
//- types
|
||||||
|
|
||||||
|
typedef int BOOL;
|
||||||
|
typedef long LONG;
|
||||||
|
typedef unsigned long ULONG;
|
||||||
|
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
|
||||||
|
typedef unsigned long DWORD;
|
||||||
|
typedef wchar_t WCHAR;
|
||||||
|
typedef char const *LPCSTR;
|
||||||
|
typedef const WCHAR *LPCWSTR, *PCWSTR;
|
||||||
|
typedef LONG HRESULT;
|
||||||
|
typedef void *HANDLE;
|
||||||
|
struct HINSTANCE__;
|
||||||
|
typedef struct HINSTANCE__ *HMODULE;
|
||||||
|
typedef __int64 INT_PTR;
|
||||||
|
typedef INT_PTR (*FARPROC)();
|
||||||
|
|
||||||
|
//- prototypes
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
__declspec(dllimport) HMODULE LoadLibraryA(LPCSTR name);
|
||||||
|
__declspec(dllimport) FARPROC GetProcAddress(HMODULE module, LPCSTR name);
|
||||||
|
__declspec(dllimport) BOOL FreeLibrary(HMODULE mod);
|
||||||
|
__declspec(dllimport) HANDLE GetCurrentThread(void);
|
||||||
|
__declspec(dllimport) DWORD GetCurrentThreadId(void);
|
||||||
|
__declspec(dllimport) void RaiseException(DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, const ULONG_PTR *lpArguments);
|
||||||
|
long long _InterlockedCompareExchange64(long long volatile*, long long, long long);
|
||||||
|
long long _InterlockedExchangeAdd64(long long volatile*, long long);
|
||||||
|
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||||
|
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//- helpers
|
||||||
|
|
||||||
|
typedef struct RADDBG_MARKUP_UnicodeDecode RADDBG_MARKUP_UnicodeDecode;
|
||||||
|
struct RADDBG_MARKUP_UnicodeDecode
|
||||||
|
{
|
||||||
|
unsigned __int32 inc;
|
||||||
|
unsigned __int32 codepoint;
|
||||||
|
};
|
||||||
|
static __int8 raddbg_utf8_class[32] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,2,2,2,2,3,3,4,5};
|
||||||
|
|
||||||
|
static inline RADDBG_MARKUP_UnicodeDecode
|
||||||
|
raddbg_decode_utf8(char *str, unsigned __int64 max)
|
||||||
|
{
|
||||||
|
RADDBG_MARKUP_UnicodeDecode result = {1, 0xffffffff};
|
||||||
|
unsigned __int8 byte = str[0];
|
||||||
|
unsigned __int8 byte_class = raddbg_utf8_class[byte >> 3];
|
||||||
|
switch(byte_class)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
result.codepoint = byte;
|
||||||
|
}break;
|
||||||
|
case 2:
|
||||||
|
if(2 < max)
|
||||||
|
{
|
||||||
|
char cont_byte = str[1];
|
||||||
|
if(raddbg_utf8_class[cont_byte >> 3] == 0)
|
||||||
|
{
|
||||||
|
result.codepoint = (byte & 0x0000001f) << 6;
|
||||||
|
result.codepoint |= (cont_byte & 0x0000003f);
|
||||||
|
result.inc = 2;
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case 3:
|
||||||
|
if(2 < max)
|
||||||
|
{
|
||||||
|
char cont_byte[2] = {str[1], str[2]};
|
||||||
|
if(raddbg_utf8_class[cont_byte[0] >> 3] == 0 &&
|
||||||
|
raddbg_utf8_class[cont_byte[1] >> 3] == 0)
|
||||||
|
{
|
||||||
|
result.codepoint = (byte & 0x0000000f) << 12;
|
||||||
|
result.codepoint |= ((cont_byte[0] & 0x0000003f) << 6);
|
||||||
|
result.codepoint |= (cont_byte[1] & 0x0000003f);
|
||||||
|
result.inc = 3;
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case 4:
|
||||||
|
if(3 < max)
|
||||||
|
{
|
||||||
|
char cont_byte[3] = {str[1], str[2], str[3]};
|
||||||
|
if(raddbg_utf8_class[cont_byte[0] >> 3] == 0 &&
|
||||||
|
raddbg_utf8_class[cont_byte[1] >> 3] == 0 &&
|
||||||
|
raddbg_utf8_class[cont_byte[2] >> 3] == 0)
|
||||||
|
{
|
||||||
|
result.codepoint = (byte & 0x00000007) << 18;
|
||||||
|
result.codepoint |= ((cont_byte[0] & 0x0000003f) << 12);
|
||||||
|
result.codepoint |= ((cont_byte[1] & 0x0000003f) << 6);
|
||||||
|
result.codepoint |= (cont_byte[2] & 0x0000003f);
|
||||||
|
result.inc = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned __int32
|
||||||
|
raddbg_encode_utf16(wchar_t *str, unsigned __int32 codepoint)
|
||||||
|
{
|
||||||
|
unsigned __int32 inc = 1;
|
||||||
|
if(codepoint == 0xffffffff)
|
||||||
|
{
|
||||||
|
str[0] = (wchar_t)'?';
|
||||||
|
}
|
||||||
|
else if(codepoint < 0x10000)
|
||||||
|
{
|
||||||
|
str[0] = (wchar_t)codepoint;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
U32 v = codepoint - 0x10000;
|
||||||
|
str[0] = (wchar_t)(0xD800 + (v >> 10));
|
||||||
|
str[1] = (wchar_t)(0xDC00 + (v & 0x000003ff));
|
||||||
|
inc = 2;
|
||||||
|
}
|
||||||
|
return inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- implementations
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
raddbg_is_attached__impl(void)
|
||||||
|
{
|
||||||
|
// TODO(rjf)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
raddbg_thread_name__impl(char *fmt, ...)
|
||||||
|
{
|
||||||
|
// rjf: resolve variadic arguments
|
||||||
|
char buffer[512] = {0};
|
||||||
|
char *name = buffer;
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
raddbg_markup_vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: get windows 10 style procedure
|
||||||
|
HRESULT (*SetThreadDescription_function)(HANDLE hThread, PCWSTR lpThreadDescription) = 0;
|
||||||
|
{
|
||||||
|
static HRESULT (*global_SetThreadDescription_function)(HANDLE hThread, PCWSTR lpThreadDescription);
|
||||||
|
static volatile __int64 global_SetThreadDescription_init_started;
|
||||||
|
static volatile __int64 global_SetThreadDescription_init_done;
|
||||||
|
__int64 do_init = !_InterlockedCompareExchange64(&global_SetThreadDescription_init_started, 1, 0);
|
||||||
|
if(do_init)
|
||||||
|
{
|
||||||
|
HMODULE module = LoadLibraryA("kernel32.dll");
|
||||||
|
global_SetThreadDescription_function = (HRESULT (*)(HANDLE, PCWSTR))GetProcAddress(module, "SetThreadDescription");
|
||||||
|
FreeLibrary(module);
|
||||||
|
_InterlockedExchangeAdd64(&global_SetThreadDescription_init_done, 1);
|
||||||
|
}
|
||||||
|
for(;_InterlockedExchangeAdd64(&global_SetThreadDescription_init_done, 0) == 0;)
|
||||||
|
{
|
||||||
|
// NOTE(rjf): busy-loop, until init is done
|
||||||
|
}
|
||||||
|
SetThreadDescription_function = global_SetThreadDescription_function;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: set thread name, windows 10 style
|
||||||
|
if(SetThreadDescription_function)
|
||||||
|
{
|
||||||
|
WCHAR buffer16[1024] = {0};
|
||||||
|
int name_length = 0;
|
||||||
|
for(;name[name_length]; name_length += 1);
|
||||||
|
int write_offset = 0;
|
||||||
|
for(int idx = 0; idx < name_length;)
|
||||||
|
{
|
||||||
|
RADDBG_MARKUP_UnicodeDecode decode = raddbg_decode_utf8(name+idx, name_length-idx);
|
||||||
|
write_offset += raddbg_encode_utf16(buffer16 + write_offset, decode.codepoint);
|
||||||
|
idx += decode.inc;
|
||||||
|
}
|
||||||
|
SetThreadDescription_function(GetCurrentThread(), buffer16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: set thread name, raise-exception style
|
||||||
|
{
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
typedef struct THREADNAME_INFO THREADNAME_INFO;
|
||||||
|
struct THREADNAME_INFO
|
||||||
|
{
|
||||||
|
DWORD dwType;
|
||||||
|
LPCSTR szName;
|
||||||
|
DWORD dwThreadID;
|
||||||
|
DWORD dwFlags;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
THREADNAME_INFO info;
|
||||||
|
info.dwType = 0x1000;
|
||||||
|
info.szName = name;
|
||||||
|
info.dwThreadID = GetCurrentThreadId();
|
||||||
|
info.dwFlags = 0;
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable: 6320 6322)
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(void *), (const ULONG_PTR *)&info);
|
||||||
|
}
|
||||||
|
__except(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#pragma warning(pop)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
raddbg_thread_color__impl(unsigned int hexcode)
|
||||||
|
{
|
||||||
|
// TODO(rjf)
|
||||||
|
}
|
||||||
|
|
||||||
|
#define raddbg_break__impl() (__debugbreak())
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
raddbg_watch__impl(char *fmt, ...)
|
||||||
|
{
|
||||||
|
// TODO(rjf)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
raddbg_log__impl(char *fmt, ...)
|
||||||
|
{
|
||||||
|
// TODO(rjf)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(_WIN32)
|
||||||
@@ -4,6 +4,13 @@
|
|||||||
#ifndef RADDBG_MARKUP_H
|
#ifndef RADDBG_MARKUP_H
|
||||||
#define RADDBG_MARKUP_H
|
#define RADDBG_MARKUP_H
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ Implementation Overrides
|
||||||
|
|
||||||
|
#if !defined(raddbg_markup_vsnprintf)
|
||||||
|
# define raddbg_markup_vsnprintf vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Usage Macros
|
//~ Usage Macros
|
||||||
|
|
||||||
@@ -17,62 +24,4 @@
|
|||||||
#define raddbg_pin(expr, ...) /* NOTE(rjf): inspected by debugger ui - does not change program execution */
|
#define raddbg_pin(expr, ...) /* NOTE(rjf): inspected by debugger ui - does not change program execution */
|
||||||
#define raddbg_log(fmt, ...) raddbg_log__impl((fmt), __VA_ARGS__)
|
#define raddbg_log(fmt, ...) raddbg_log__impl((fmt), __VA_ARGS__)
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ Win32 Implementations
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
|
|
||||||
//- types
|
|
||||||
|
|
||||||
typedef unsigned long DWORD;
|
|
||||||
typedef char const *LPCSTR;
|
|
||||||
|
|
||||||
#pragma pack(push, 8)
|
|
||||||
typedef struct THREADNAME_INFO THREADNAME_INFO;
|
|
||||||
struct THREADNAME_INFO
|
|
||||||
{
|
|
||||||
DWORD dwType;
|
|
||||||
LPCSTR szName;
|
|
||||||
DWORD dwThreadID;
|
|
||||||
DWORD dwFlags;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
//- implementations
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
raddbg_is_attached__impl(void)
|
|
||||||
{
|
|
||||||
// TODO(rjf)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
raddbg_thread_name__impl(char *fmt, ...)
|
|
||||||
{
|
|
||||||
// TODO(rjf)
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
raddbg_thread_color__impl(unsigned int hexcode)
|
|
||||||
{
|
|
||||||
// TODO(rjf)
|
|
||||||
}
|
|
||||||
|
|
||||||
#define raddbg_break__impl() (__debugbreak())
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
raddbg_watch__impl(char *fmt, ...)
|
|
||||||
{
|
|
||||||
// TODO(rjf)
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
raddbg_log__impl(char *fmt, ...)
|
|
||||||
{
|
|
||||||
// TODO(rjf)
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(_WIN32)
|
|
||||||
|
|
||||||
#endif // RADDBG_MARKUP_H
|
#endif // RADDBG_MARKUP_H
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
//- rjf: [lib]
|
//- rjf: [lib]
|
||||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
||||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
||||||
|
#include "lib_raddbg_markup/raddbg_markup.h"
|
||||||
|
#include "lib_raddbg_markup/raddbg_markup.c"
|
||||||
|
|
||||||
//- rjf: [h]
|
//- rjf: [h]
|
||||||
#include "base/base_inc.h"
|
#include "base/base_inc.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user