4coder » Forums » Trouble getting started with the customization API in 4coder 4.0.25
Thebigfox
2 posts
#15063 Trouble getting started with the customization API in 4coder 4.0.25
1 month ago Edited by on April 24, 2018, 12:12 p.m. Reason: Initial post

Hi! I just bought 4coder this morning and I am trying to get started with some customization. I have checked Allen's youtube channel and the 4coder website, but I can't seem to find anything up to date. Most youtube stuff refers to the 4coder_custom.cpp and .h files, which are not present in the current version. I'm trying to wrap my head around the source code but I can't find a way to rebind keys and add custom functionality.
Can someone point me in the right direction?

Also I remember from Handmade Hero that 4coder used to come with Casey's customization source code, but I can't seem to find any of it in the 4.0.25 folder, is that still the case?
Mr4thDimention
Allen Webster
366 posts
2 projects

Heyo

#15069 Trouble getting started with the customization API in 4coder 4.0.25
1 month ago

1. I'm sorry to admit, it has indeed become quite complicated in the custom layer. Shipping simpler example layers and tutorials for modifying the default one is one of my main objectives before I retire this engine.

2. Under 4coder_generated/remapping.h you will see the default bindings. This used to be in normal easy to read code, but in order to easily support multiple bindings for Mac, and to support the documentation of default bindings, I ended up moving it into generated code. There are two good ways to do your own bindings. The first option is to modify remapping.h. The advantage is that it is easy to get it done quickly and without any boilerplate code, but the downside is that you'll have to redo it with new builds. The second option is to make a "my_bindings.cpp" file, include at the top "4coder_default_include.cpp" then define the procedure:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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);
    // put bindings here
    
    int32_t result = end_bind_helper(context);
    return(result);
}


3. Right now Casey's customization is only available with handmade hero source. I will begin including it in the next build (4.0.26).
Thebigfox
2 posts
#15071 Trouble getting started with the customization API in 4coder 4.0.25
1 month ago

Thanks so much for the help! I'm starting to figure stuff out and I managed to get my keybindings going.
Looking forward to the next updates, keep up the awesome work!