I was following this tutorial and got a basic file set up:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include "4coder_default_include.cpp" CUSTOM_COMMAND_SIG(hello_world_test) { print_message(app, "Hello World.", sizeof( "Hello World." ) - 1); } void test_keys( Bind_Helper *context) { begin_map(context, mapid_global); { bind(context, 'x', MDFR_ALT, command_lister); bind(context, 'p', MDFR_CTRL, hello_world_test); } end_map(context); } #if !defined(NO_BINDING) extern "C" int32_t get_bindings(void *data, int32_t size){ Bind_Helper context_ = begin_bind_helper(data, size); Bind_Helper *context = &context_; set_all_default_hooks(context); #if defined(__APPLE__) && defined(__MACH__) mac_default_keys(context); #else test_keys(context); #endif int32_t result = end_bind_helper(context); return(result); } #endif //NO_BINDING |
I build with buildsuper.bat and run 4ed.exe and it crashes before a window is created. It's worth noting that the editor works fine if I build the default key bindings.
I did a little investigation and found that it was crashing on a release mode assert in 4coder_default_hooks.cpp. I think this was the line:
1 | Assert(map_id_query == default_lister_ui_map); |
I realised that if I remove the call to set_all_default_hooks(context); in get_bindings, then this code path doesn't get triggered and the editor launches , albeit without any features :p However when I open the command lister (ALT-x in my bindings) it crashes.
I did find this thread with a similar problem to mine but I seem to already have the suggested fix in my code.
So now I'm out of ideas. I feel like I'm doing something stupid. (or stupidly forgetting something!)