소스 검색

Update joystick config binding

Fix off-by-one error.
master
부모
커밋
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[]) {


불러오는 중...
취소
저장