Skip to content

Instantly share code, notes, and snippets.

@mattysmith22
Last active January 13, 2022 00:06
Show Gist options
  • Save mattysmith22/d68e7dba75a39e350f50a6d43d67958f to your computer and use it in GitHub Desktop.
Save mattysmith22/d68e7dba75a39e350f50a6d43d67958f to your computer and use it in GitHub Desktop.

The error value in addition of values in configs (my guess due to it being implemented with a float as the data type for computation) increases to a large enough value that the DIK codes cannot be accurately calculated.

Here is an MRE with 3 examples that should resolve to the same key combo, but instead resolve to 3 different ones.

Packed with binarize

image

class CfgPatches
{
class fza_ah64_controls
{
units[] = {};
author = "mattysmith22";
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {A3_Data_F_Oldman_Loadorder};
};
};
class CfgUserActions {
class mbs_mre_float_error_working {
displayName = "Working example"
tooltip = "Working example (manually calculated)";
onActivate = "hint ""button pressed""";
onDeactivate = "";
};
class mbs_mre_float_error_notworking_normal : mbs_mre_float_error_working {
displayName = "Not working example"
tooltip = "Not working example";
};
class mbs_mre_float_error_notworking_eval : mbs_mre_float_error_working {
displayName = "Not working example (using __EVAL)"
tooltip = "Not working example (using __EVAL)";
}
};
class UserActionGroups
{
class mbs_mre_float_error // unique classname for your category
{
name = "MRE - Float error for keybindings";
group[] = {
mbs_mre_float_error_working,
mbs_mre_float_error_notworking_normal,
mbs_mre_float_error_notworking_eval
};
};
};
#define COMBO_LCTRL 0x1D000000
#define INPUT_DEVICE_COMBO_KB 0x00100000 // keyboard button (key)
#define INPUT_DEVICE_MAIN_KB 0x00030000 // keyboard button (key)
class CfgDefaultKeysPresets {
class Arma2 {
class Mappings {
/*
dik[] = 0xaaBBccDD
aa = combo KB key (second key of combo always keyboard)
BB = device type of first key (joy, mouse, KB,...) (or in case of combo, first half secondary combo type, second half main combo type)
cc = offset for joys or double tap info for KB
DD = key/button/axis identification
BBccDD = whole info about first key
ccDD = button info (doubleTap or joyID+btnID)
DD = button local ID
*/
mbs_mre_float_error_working[] = {0x1D130023}; //Ctrl+H
mbs_mre_float_error_notworking_normal[] = {COMBO_LCTRL + INPUT_DEVICE_COMBO_KB + INPUT_DEVICE_MAIN_KB + 0x23}; //Ctrl+H
mbs_mre_float_error_notworking_eval[] = {__EVAL(COMBO_LCTRL + INPUT_DEVICE_COMBO_KB + INPUT_DEVICE_MAIN_KB + 0x23)}; //Ctrl+H
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment