QTfrontend/SDLs.cpp
changeset 5906 ed9676dc8cb4
parent 5747 65006a679352
child 6164 62aa418ed214
equal deleted inserted replaced
5713:190d6bb075c5 5906:ed9676dc8cb4
   102             // Again store the part of the string not changing for multiple uses
   102             // Again store the part of the string not changing for multiple uses
   103             QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1);
   103             QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1);
   104 
   104 
   105             // Entry for "Axis Up"
   105             // Entry for "Axis Up"
   106             sprintf(sdlkeys[i][0], "j%da%du", jid, aid);
   106             sprintf(sdlkeys[i][0], "j%da%du", jid, aid);
   107             sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
   107             sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData());
   108 
   108 
   109             // Entry for "Axis Down"
   109             // Entry for "Axis Down"
   110             sprintf(sdlkeys[i][0], "j%da%dd", jid, aid);
   110             sprintf(sdlkeys[i][0], "j%da%dd", jid, aid);
   111             sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
   111             sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData());
   112         }
   112         }
   113 
   113 
   114         // Register entries for all coolie hats of this joystick/gamepad
   114         // Register entries for all coolie hats of this joystick/gamepad
   115         for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++)
   115         for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++)
   116         {
   116         {
   117             // Again store the part of the string not changing for multiple uses
   117             // Again store the part of the string not changing for multiple uses
   118             QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1));
   118             QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1));
   119 
   119 
   120             // Entry for "Hat Up"
   120             // Entry for "Hat Up"
   121             sprintf(sdlkeys[i][0], "j%dh%du", jid, hid);
   121             sprintf(sdlkeys[i][0], "j%dh%du", jid, hid);
   122             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
   122             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData());
   123 
   123 
   124             // Entry for "Hat Down"
   124             // Entry for "Hat Down"
   125             sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid);
   125             sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid);
   126             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
   126             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData());
   127 
   127 
   128             // Entry for "Hat Left"
   128             // Entry for "Hat Left"
   129             sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid);
   129             sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid);
   130             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toStdString().c_str());
   130             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toUtf8().constData());
   131 
   131 
   132             // Entry for "Hat Right"
   132             // Entry for "Hat Right"
   133             sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid);
   133             sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid);
   134             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toStdString().c_str());
   134             sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toUtf8().constData());
   135         }
   135         }
   136 
   136 
   137         // Register entries for all buttons of this joystick/gamepad
   137         // Register entries for all buttons of this joystick/gamepad
   138         for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++)
   138         for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++)
   139         {
   139         {
   140             // Buttons
   140             // Buttons
   141             sprintf(sdlkeys[i][0], "j%db%d", jid, bid);
   141             sprintf(sdlkeys[i][0], "j%db%d", jid, bid);
   142             sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toStdString().c_str());
   142             sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toUtf8().constData());
   143         }
   143         }
   144         // Close the game controller as we no longer need it
   144         // Close the game controller as we no longer need it
   145         SDL_JoystickClose(joy);
   145         SDL_JoystickClose(joy);
   146     }
   146     }
   147 
   147