<commit_before>// controllers.c

#include "../include/simple2d.h"


/*
 * Detect controllers and joysticks
 */
void S2D_DetectControllers() {
  
  if (SDL_NumJoysticks() > 0) {
    sprintf(S2D_msg, "Controllers detected: %i", SDL_NumJoysticks());
    S2D_Log(S2D_msg, S2D_INFO);
  }
  
  // Variables for controllers and joysticks
  SDL_GameController *controller = NULL;
  SDL_Joystick *joy = NULL;
  
  // Enumerate joysticks
  for (int i = 0; i < SDL_NumJoysticks(); ++i) {
    
    // Check to see if joystick supports SDL's game controller interface
    if (SDL_IsGameController(i)) {
      controller = SDL_GameControllerOpen(i);
      if (controller) {
        sprintf(S2D_msg, "Controller #%i: %s\n", i, SDL_GameControllerName(controller));
        S2D_Log(S2D_msg, S2D_INFO);
      } else {
        sprintf(S2D_msg, "Could not open controller #%i: %s\n", i, SDL_GetError());
        S2D_Log(S2D_msg, S2D_ERROR);
      }
      <commit_msg>Minor controller output formatting<commit_after>// controllers.c

#include "../include/simple2d.h"


/*
 * Detect controllers and joysticks
 */
void S2D_DetectControllers() {
  
  if (SDL_NumJoysticks() > 0) {
    sprintf(S2D_msg, "Controllers detected: %i", SDL_NumJoysticks());
    S2D_Log(S2D_msg, S2D_INFO);
  }
  
  // Variables for controllers and joysticks
  SDL_GameController *controller = NULL;
  SDL_Joystick *joy = NULL;
  
  // Enumerate joysticks
  for (int i = 0; i < SDL_NumJoysticks(); ++i) {
    
    // Check to see if joystick supports SDL's game controller interface
    if (SDL_IsGameController(i)) {
      controller = SDL_GameControllerOpen(i);
      if (controller) {
        sprintf(S2D_msg, "Controller #%i: %s", i, SDL_GameControllerName(controller));
        S2D_Log(S2D_msg, S2D_INFO);
      } else {
        sprintf(S2D_msg, "Could not open controller #%i: %s", i, SDL_GetError());
        S2D_Log(S2D_msg, S2D_ERROR);
      }
      
{'fraction_non_alphanumeric': 0.12558869701726844, 'fraction_numerical': 0.01674515960230246, 'mean_word_length': 3.211453744493392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5171146', 'n_tokens_mistral': 726, 'n_tokens_neox': 692, 'n_words': 155}