瀏覽代碼

Update joystick config binding

Fix off-by-one error.
master
TheoryOfNekomata 1 年之前
父節點
當前提交
a1d3052ab5
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      src/packages/game/input/IZ_joystick.c

+ 4
- 3
src/packages/game/input/IZ_joystick.c 查看文件

@@ -1,6 +1,6 @@
#include "IZ_joystick.h"

static INI_ConfigItem joystick_config_items[IZ_PLAYERS * (IZ_CONTROLS - 4 + 2) + 1];
static INI_ConfigItem joystick_config_items[IZ_PLAYERS * (IZ_CONTROLS - 4 + 3) + 1];

bool IZ_JoystickIsValidAxisThreshold(u16 value) {
return (4000 <= value && value <= 12000);
@@ -202,7 +202,8 @@ void IZ_JoystickInitializeConfigItems(INI_ConfigItem config_items[]) {
for (player_index = 0; player_index < IZ_PLAYERS; player_index += 1) {
main_section_name = IZ_calloc(64, sizeof(char));
sprintf(main_section_name, "Joystick.%d", player_index);
u8 base_index = (player_index * (IZ_CONTROLS - 4 + 2));
// The `+ 3` corresponds to the first three config items. Add as appropriate.
u8 base_index = (player_index * (IZ_CONTROLS - 4 + 3));
config_items[base_index] = (INI_ConfigItem) {
INI_CONFIG_TYPE_I32,
main_section_name,
@@ -254,7 +255,7 @@ void IZ_JoystickInitializeConfigItems(INI_ConfigItem config_items[]) {
}
}

config_items[IZ_PLAYERS * (IZ_CONTROLS - 4 + 2) + 1] = INI_CONFIG_ITEM_NULL;
config_items[IZ_PLAYERS * (IZ_CONTROLS - 4 + 3)] = INI_CONFIG_ITEM_NULL;
}

IZ_ProcedureResult IZ_JoystickInitializeConfig(IZ_JoystickState(* state)[IZ_PLAYERS], const char* config_path, u8 argc, const char* argv[]) {


Loading…
取消
儲存