only supply config defaults when doing user config application

This commit is contained in:
Ryan Fleury
2024-01-14 06:40:41 -08:00
parent 625e197bc1
commit 0c497abba6
3 changed files with 46 additions and 8 deletions
+6 -3
View File
@@ -11534,7 +11534,10 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
}
//- rjf: apply keybindings
df_clear_bindings();
if(src == DF_CfgSrc_User)
{
df_clear_bindings();
}
DF_CfgVal *keybindings = df_cfg_val_from_string(table, str8_lit("keybindings"));
for(DF_CfgNode *keybinding_set = keybindings->first;
keybinding_set != &df_g_nil_cfg_node;
@@ -11649,7 +11652,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
}
//- rjf: if config opened 0 windows, we need to do some sensible default
if(windows->first == &df_g_nil_cfg_node)
if(src == DF_CfgSrc_User && windows->first == &df_g_nil_cfg_node)
{
OS_Handle preferred_monitor = os_primary_monitor();
Vec2F32 monitor_dim = os_dim_from_monitor(preferred_monitor);
@@ -11660,7 +11663,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
}
//- rjf: if config bound 0 keys, we need to do some sensible default
if(df_gfx_state->key_map_total_count == 0)
if(src == DF_CfgSrc_User && df_gfx_state->key_map_total_count == 0)
{
for(U64 idx = 0; idx < ArrayCount(df_g_default_binding_table); idx += 1)
{
+1 -1
View File
@@ -422,7 +422,7 @@
#define RADDBG_VERSION_MAJOR 0
#define RADDBG_VERSION_MINOR 9
#define RADDBG_VERSION_PATCH 1
#define RADDBG_VERSION_PATCH 3
#define RADDBG_VERSION_STRING_LITERAL Stringify(RADDBG_VERSION_MAJOR) "." Stringify(RADDBG_VERSION_MINOR) "." Stringify(RADDBG_VERSION_PATCH)
#if defined(NDEBUG)
# define RADDBG_TITLE_STRING_LITERAL "The RAD Debugger (" RADDBG_VERSION_STRING_LITERAL " ALPHA) - " __DATE__ ""
+39 -4
View File
@@ -1,14 +1,49 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#include <stdlib.h>
// build with:
// cl /Zi /nologo look_at_raddbg.c
#include <windows.h>
#include <stdint.h>
#include "raddbg_format/raddbg_format.h"
#include "raddbg_format/raddbg_format_parse.h"
#include "raddbg_format/raddbg_format.c"
#include "raddbg_format/raddbg_format_parse.c"
typedef struct Foo Foo;
struct Foo
{
int x;
int y;
int z;
};
int main(int argument_count, char **arguments)
{
int *arr = malloc(sizeof(int)*1000);
for(int i = 0; i < 1001; i += 1)
Foo foo = {123, 456, 789};
HANDLE file = CreateFileA(arguments[1], GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
DWORD size_hi32 = 0;
DWORD size_lo32 = GetFileSize(file, &size_hi32);
HANDLE map = CreateFileMappingA(file, 0, PAGE_READONLY, 0, 0, 0);
uint64_t data_size = (size_lo32 | ((uint64_t)size_hi32 << 32));
uint8_t *data = (uint8_t *)MapViewOfFile(map, FILE_MAP_READ, 0, 0, data_size);
RADDBG_Parsed rdbg = {0};
RADDBG_ParseStatus parse_status = raddbg_parse(data, data_size, &rdbg);
uint64_t foo_count = 0;
for(uint64_t idx = 0; idx < rdbg.type_node_count; idx += 1)
{
arr[i] = i;
RADDBG_TypeNode *type_node = &rdbg.type_nodes[idx];
if(RADDBG_TypeKind_FirstUserDefined <= type_node->kind && type_node->kind <= RADDBG_TypeKind_LastUserDefined)
{
uint64_t name_size = 0;
uint8_t *name = raddbg_string_from_idx(&rdbg, type_node->user_defined.name_string_idx, &name_size);
if(name_size == 3 && name[0] == 'f' && name[1] == 'o' && name[2] == 'o')
{
foo_count += 1;
}
}
}
printf("%s -> %I64u foos\n", arguments[1], foo_count);
return 0;
}