|
@@ -164,7 +164,6 @@ void IZ_GameControllerBindStateToConfig(IZ_GameControllerState(* state)[IZ_PLAYE |
|
|
u8 player_index; |
|
|
u8 player_index; |
|
|
u8 control_index; |
|
|
u8 control_index; |
|
|
for (player_index = 0; player_index < IZ_PLAYERS; player_index += 1) { |
|
|
for (player_index = 0; player_index < IZ_PLAYERS; player_index += 1) { |
|
|
// The `+ 3` corresponds to the first three config items. Add as appropriate. |
|
|
|
|
|
u8 base_index = (player_index * (IZ_CONTROLS + IZ_GAME_CONTROLLER_DEFAULT_CONFIGS)); |
|
|
u8 base_index = (player_index * (IZ_CONTROLS + IZ_GAME_CONTROLLER_DEFAULT_CONFIGS)); |
|
|
config_items[base_index + 0].dest = &((*state)[player_index].config.axis_threshold); |
|
|
config_items[base_index + 0].dest = &((*state)[player_index].config.axis_threshold); |
|
|
config_items[base_index + 1].dest = &((*state)[player_index].config.guid); |
|
|
config_items[base_index + 1].dest = &((*state)[player_index].config.guid); |
|
@@ -187,7 +186,6 @@ void IZ_GameControllerInitializeConfigItems(INI_ConfigItem config_items[]) { |
|
|
for (player_index = 0; player_index < IZ_PLAYERS; player_index += 1) { |
|
|
for (player_index = 0; player_index < IZ_PLAYERS; player_index += 1) { |
|
|
main_section_name = IZ_calloc(64, sizeof(char)); |
|
|
main_section_name = IZ_calloc(64, sizeof(char)); |
|
|
sprintf(main_section_name, "GameController.%d", player_index); |
|
|
sprintf(main_section_name, "GameController.%d", player_index); |
|
|
// The `+ 3` corresponds to the first three config items. Add as appropriate. |
|
|
|
|
|
u8 base_index = (player_index * (IZ_CONTROLS + IZ_GAME_CONTROLLER_DEFAULT_CONFIGS)); |
|
|
u8 base_index = (player_index * (IZ_CONTROLS + IZ_GAME_CONTROLLER_DEFAULT_CONFIGS)); |
|
|
config_items[base_index + 0] = (INI_ConfigItem) { |
|
|
config_items[base_index + 0] = (INI_ConfigItem) { |
|
|
INI_CONFIG_TYPE_U16, |
|
|
INI_CONFIG_TYPE_U16, |
|
@@ -243,6 +241,8 @@ IZ_ProcedureResult IZ_GameControllerInitialize(IZ_GameControllerState(* state)[I |
|
|
IZ_memcpy(state, sizeof(IZ_GameControllerState) * IZ_PLAYERS, &IZ_GAME_CONTROLLER_DEFAULT_STATE, sizeof(IZ_GameControllerState) * IZ_PLAYERS); |
|
|
IZ_memcpy(state, sizeof(IZ_GameControllerState) * IZ_PLAYERS, &IZ_GAME_CONTROLLER_DEFAULT_STATE, sizeof(IZ_GameControllerState) * IZ_PLAYERS); |
|
|
|
|
|
|
|
|
// TODO query this file from the internet? |
|
|
// TODO query this file from the internet? |
|
|
|
|
|
// Download from https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt |
|
|
|
|
|
// Add the subproject |
|
|
IZ_LogInfo(IZ_LOG_CATEGORY_GENERIC, "input", "Loading game controller mappings file: %s", "assets/gamecontrollerdb.txt"); |
|
|
IZ_LogInfo(IZ_LOG_CATEGORY_GENERIC, "input", "Loading game controller mappings file: %s", "assets/gamecontrollerdb.txt"); |
|
|
const i16 loaded_mappings = SDL_GameControllerAddMappingsFromFile("assets/gamecontrollerdb.txt"); |
|
|
const i16 loaded_mappings = SDL_GameControllerAddMappingsFromFile("assets/gamecontrollerdb.txt"); |
|
|
if (loaded_mappings <= 0) { |
|
|
if (loaded_mappings <= 0) { |
|
|