hedgewars/uInputHandler.pas
branchqmlfrontend
changeset 11403 b894922d58cc
parent 11071 3851ce4f2061
parent 11368 c481d087f653
child 11544 b69f5f22a3ba
equal deleted inserted replaced
11076:fcbdee9cdd74 11403:b894922d58cc
    28 function  KeyNameToCode(name: shortstring): LongInt; inline;
    28 function  KeyNameToCode(name: shortstring): LongInt; inline;
    29 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    29 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    30 //procedure MaskModifier(var code: LongInt; modifier: LongWord);
    30 //procedure MaskModifier(var code: LongInt; modifier: LongWord);
    31 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    31 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    32 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
    32 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
       
    33 procedure ProcessMouseWheel(x, y: LongInt);
    33 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
    34 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
    34 procedure ProcessKey(code: LongInt; KeyDown: boolean);
    35 procedure ProcessKey(code: LongInt; KeyDown: boolean);
    35 
    36 
    36 procedure ResetKbd;
    37 procedure ResetKbd;
    37 procedure FreezeEnterKey;
    38 procedure FreezeEnterKey;
    80 
    81 
    81 function KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    82 function KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    82 var code: LongInt;
    83 var code: LongInt;
    83 begin
    84 begin
    84     name:= LowerCase(name);
    85     name:= LowerCase(name);
    85     code:= cKeyMaxIndex;
    86     code:= 0;
    86     while (code > 0) and (KeyNames[code] <> name) do dec(code);
    87     while (code <= cKeyMaxIndex) and (KeyNames[code] <> name) do inc(code);
    87 
    88 
    88     MaskModifier(Modifier, code);
    89     MaskModifier(Modifier, code);
    89     KeyNameToCode:= code;
    90     KeyNameToCode:= code;
    90 end;
    91 end;
    91 (*
    92 (*
   166         ParseCommand('forcequit', true);
   167         ParseCommand('forcequit', true);
   167     end;
   168     end;
   168 
   169 
   169 if CurrentBinds[code][0] <> #0 then
   170 if CurrentBinds[code][0] <> #0 then
   170     begin
   171     begin
   171     if (code > 3) and KeyDown and (not ((CurrentBinds[code] = 'put')) or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) and (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) then bShowAmmoMenu:= false;
   172     if (code < cKeyMaxIndex - 2) // means not mouse buttons
       
   173         and KeyDown
       
   174         and (not ((CurrentBinds[code] = 'put')) or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) 
       
   175         and (CurrentTeam <> nil) 
       
   176         and (not CurrentTeam^.ExtDriven) 
       
   177         then bShowAmmoMenu:= false;
       
   178 
   172     if KeyDown then
   179     if KeyDown then
   173         begin
   180         begin
   174         Trusted:= Trusted and (not isPaused); //releasing keys during pause should be allowed on the other hand
   181         Trusted:= Trusted and (not isPaused); //releasing keys during pause should be allowed on the other hand
   175 
   182 
   176         if CurrentBinds[code] = 'switch' then
   183         if CurrentBinds[code] = 'switch' then
   201 end;
   208 end;
   202 
   209 
   203 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
   210 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
   204 var code: LongInt;
   211 var code: LongInt;
   205 begin
   212 begin
   206     code:= event.keysym.sym;
   213     // TODO
   207     //MaskModifier(code, event.keysym.modifier);
   214     code:= LongInt(event.keysym.scancode);
       
   215     //writelntoconsole('[KEY] '+inttostr(code)+ ' -> ''' +KeyNames[code] + ''', type = '+inttostr(event.type_));
   208     ProcessKey(code, event.type_ = SDL_KEYDOWN);
   216     ProcessKey(code, event.type_ = SDL_KEYDOWN);
   209 end;
   217 end;
   210 
   218 
   211 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
   219 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
   212 begin
   220 begin
   213 case event.button of
   221     //writelntoconsole('[MOUSE] '+inttostr(event.button));
   214     SDL_BUTTON_LEFT:
   222     case event.button of
   215         ProcessKey(KeyNameToCode('mousel'), ButtonDown);
   223         SDL_BUTTON_LEFT:
   216     SDL_BUTTON_MIDDLE:
   224             ProcessKey(KeyNameToCode('mousel'), ButtonDown);
   217         ProcessKey(KeyNameToCode('mousem'), ButtonDown);
   225         SDL_BUTTON_MIDDLE:
   218     SDL_BUTTON_RIGHT:
   226             ProcessKey(KeyNameToCode('mousem'), ButtonDown);
   219         ProcessKey(KeyNameToCode('mouser'), ButtonDown);
   227         SDL_BUTTON_RIGHT:
   220     SDL_BUTTON_WHEELDOWN:
   228             ProcessKey(KeyNameToCode('mouser'), ButtonDown);
   221         ProcessKey(KeyNameToCode('wheeldown'), ButtonDown);
   229         SDL_BUTTON_WHEELDOWN:
   222     SDL_BUTTON_WHEELUP:
   230             ProcessKey(KeyNameToCode('wheeldown'), ButtonDown);
   223         ProcessKey(KeyNameToCode('wheelup'), ButtonDown);
   231         SDL_BUTTON_WHEELUP:
   224     end;
   232             ProcessKey(KeyNameToCode('wheelup'), ButtonDown);
       
   233         end;
       
   234 end;
       
   235 
       
   236 procedure ProcessMouseWheel(x, y: LongInt);
       
   237 begin
       
   238     //writelntoconsole('[MOUSEWHEEL] '+inttostr(x)+', '+inttostr(y));
       
   239     if y > 0 then
       
   240         ProcessKey(KeyNameToCode('wheelup'), true)
       
   241     else if y < 0 then
       
   242         ProcessKey(KeyNameToCode('wheeldown'), true);
   225 end;
   243 end;
   226 
   244 
   227 procedure ResetKbd;
   245 procedure ResetKbd;
   228 var t: LongInt;
   246 var t: LongInt;
   229 begin
   247 begin
   230 for t:= 0 to cKbdMaxIndex do
   248 for t:= 0 to cKbdMaxIndex do
   231     if tkbd[t] then
   249     if tkbd[t] then
   232         ProcessKey(t, False);
   250         ProcessKey(t, False);
   233 end;
   251 end;
   234 
   252 
       
   253 
       
   254 procedure InitDefaultBinds;
       
   255 var i: Longword;
       
   256 begin
       
   257     DefaultBinds[KeyNameToCode('escape')]:= 'quit';
       
   258     DefaultBinds[KeyNameToCode(_S'`')]:= 'history';
       
   259     DefaultBinds[KeyNameToCode('delete')]:= 'rotmask';
       
   260 
       
   261     //numpad
       
   262     //DefaultBinds[265]:= '+volup';
       
   263     //DefaultBinds[256]:= '+voldown';
       
   264 
       
   265     DefaultBinds[KeyNameToCode(_S'0')]:= '+volup';
       
   266     DefaultBinds[KeyNameToCode(_S'9')]:= '+voldown';
       
   267     DefaultBinds[KeyNameToCode(_S'8')]:= 'mute';
       
   268     DefaultBinds[KeyNameToCode(_S'c')]:= 'capture';
       
   269     DefaultBinds[KeyNameToCode(_S'r')]:= 'record';
       
   270     DefaultBinds[KeyNameToCode(_S'h')]:= 'findhh';
       
   271     DefaultBinds[KeyNameToCode(_S'p')]:= 'pause';
       
   272     DefaultBinds[KeyNameToCode(_S's')]:= '+speedup';
       
   273     DefaultBinds[KeyNameToCode(_S't')]:= 'chat';
       
   274     DefaultBinds[KeyNameToCode(_S'y')]:= 'confirm';
       
   275 
       
   276     DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset';
       
   277     DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomin';
       
   278     DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomout';
       
   279 
       
   280     DefaultBinds[KeyNameToCode('f12')]:= 'fullscr';
       
   281 
       
   282 
       
   283     DefaultBinds[KeyNameToCode('mousel')]:= '/put';
       
   284     DefaultBinds[KeyNameToCode('mouser')]:= 'ammomenu';
       
   285     DefaultBinds[KeyNameToCode('backspace')]:= 'hjump';
       
   286     DefaultBinds[KeyNameToCode('tab')]:= 'switch';
       
   287     DefaultBinds[KeyNameToCode('return')]:= 'ljump';
       
   288     DefaultBinds[KeyNameToCode('space')]:= '+attack';
       
   289     DefaultBinds[KeyNameToCode('up')]:= '+up';
       
   290     DefaultBinds[KeyNameToCode('down')]:= '+down';
       
   291     DefaultBinds[KeyNameToCode('left')]:= '+left';
       
   292     DefaultBinds[KeyNameToCode('right')]:= '+right';
       
   293     DefaultBinds[KeyNameToCode('left_shift')]:= '+precise';
       
   294 
       
   295 
       
   296     DefaultBinds[KeyNameToCode('j0a0u')]:= '+left';
       
   297     DefaultBinds[KeyNameToCode('j0a0d')]:= '+right';
       
   298     DefaultBinds[KeyNameToCode('j0a1u')]:= '+up';
       
   299     DefaultBinds[KeyNameToCode('j0a1d')]:= '+down';
       
   300     for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i);
       
   301     for i:= 1 to 5  do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
       
   302 
       
   303     loadBinds('dbind', cPathz[ptData] + '/settings.ini');
       
   304 end;
       
   305 
       
   306 
   235 procedure InitKbdKeyTable;
   307 procedure InitKbdKeyTable;
   236 var i, j, k, t: LongInt;
   308 var i, j, k, t: LongInt;
   237     s: string[15];
   309     s: string[15];
   238 begin
   310 begin
   239 //TODO in sdl13 this overrides some values (A and B) change indices to some other values at the back perhaps?
   311     KeyNames[cKeyMaxIndex    ]:= 'mousel';
   240 KeyNames[1]:= 'mousel';
   312     KeyNames[cKeyMaxIndex - 1]:= 'mousem';
   241 KeyNames[2]:= 'mousem';
   313     KeyNames[cKeyMaxIndex - 2]:= 'mouser';
   242 KeyNames[3]:= 'mouser';
   314     KeyNames[cKeyMaxIndex - 3]:= 'wheelup';
   243 KeyNames[4]:= 'wheelup';
   315     KeyNames[cKeyMaxIndex - 4]:= 'wheeldown';
   244 KeyNames[5]:= 'wheeldown';
   316 
   245 
   317     for i:= 0 to cKeyMaxIndex - 5 do
   246 for i:= 6 to cKeyMaxIndex do
       
   247     begin
       
   248     s:= shortstring(sdl_getkeyname(i));
       
   249     //WriteLnToConsole('uInputHandler - ' + IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex));
       
   250     if s = 'unknown key' then KeyNames[i]:= ''
       
   251     else
       
   252         begin
   318         begin
       
   319         s:= shortstring(SDL_GetScancodeName(TSDL_Scancode(i)));
       
   320 
   253         for t:= 1 to Length(s) do
   321         for t:= 1 to Length(s) do
   254             if s[t] = ' ' then
   322             if s[t] = ' ' then
   255                 s[t]:= '_';
   323                 s[t]:= '_';
   256         KeyNames[i]:= LowerCase(s)
   324         KeyNames[i]:= LowerCase(s)
   257         end;
   325         end;
   258     end;
   326 
   259 
   327 
   260 
   328     // get the size of keyboard array
   261 // get the size of keyboard array
   329     SDL_GetKeyboardState(@k);
   262 SDL_GetKeyState(@k);
   330 
   263 
   331     // Controller(s)
   264 // Controller(s)
   332     for j:= 0 to Pred(ControllerNumControllers) do
   265 for j:= 0 to Pred(ControllerNumControllers) do
       
   266     begin
       
   267     for i:= 0 to Pred(ControllerNumAxes[j]) do
       
   268         begin
   333         begin
   269         keynames[k + 0]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'u';
   334         for i:= 0 to Pred(ControllerNumAxes[j]) do
   270         keynames[k + 1]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'd';
   335             begin
   271         inc(k, 2);
   336             KeyNames[k + 0]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'u';
       
   337             KeyNames[k + 1]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'd';
       
   338             inc(k, 2);
       
   339             end;
       
   340         for i:= 0 to Pred(ControllerNumHats[j]) do
       
   341             begin
       
   342             KeyNames[k + 0]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'u';
       
   343             KeyNames[k + 1]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'r';
       
   344             KeyNames[k + 2]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'd';
       
   345             KeyNames[k + 3]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'l';
       
   346             inc(k, 4);
       
   347             end;
       
   348         for i:= 0 to Pred(ControllerNumButtons[j]) do
       
   349             begin
       
   350             KeyNames[k]:= 'j' + IntToStr(j) + 'b' + IntToStr(i);
       
   351             inc(k, 1);
       
   352             end;
   272         end;
   353         end;
   273     for i:= 0 to Pred(ControllerNumHats[j]) do
   354 
   274         begin
   355         InitDefaultBinds
   275         keynames[k + 0]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'u';
   356 end;
   276         keynames[k + 1]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'r';
   357 
   277         keynames[k + 2]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'd';
   358 
   278         keynames[k + 3]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'l';
   359 
   279         inc(k, 4);
   360 {$IFNDEF MOBILE}
   280         end;
       
   281     for i:= 0 to Pred(ControllerNumButtons[j]) do
       
   282         begin
       
   283         keynames[k]:= 'j' + IntToStr(j) + 'b' + IntToStr(i);
       
   284         inc(k, 1);
       
   285         end;
       
   286     end;
       
   287 
       
   288 DefaultBinds[KeyNameToCode('escape')]:= 'quit';
       
   289 DefaultBinds[KeyNameToCode(_S'`')]:= 'history';
       
   290 DefaultBinds[KeyNameToCode('delete')]:= 'rotmask';
       
   291 
       
   292 //numpad
       
   293 //DefaultBinds[265]:= '+volup';
       
   294 //DefaultBinds[256]:= '+voldown';
       
   295 
       
   296 DefaultBinds[KeyNameToCode(_S'0')]:= '+volup';
       
   297 DefaultBinds[KeyNameToCode(_S'9')]:= '+voldown';
       
   298 DefaultBinds[KeyNameToCode(_S'8')]:= 'mute';
       
   299 DefaultBinds[KeyNameToCode(_S'c')]:= 'capture';
       
   300 DefaultBinds[KeyNameToCode(_S'r')]:= 'record';
       
   301 DefaultBinds[KeyNameToCode(_S'h')]:= 'findhh';
       
   302 DefaultBinds[KeyNameToCode(_S'p')]:= 'pause';
       
   303 DefaultBinds[KeyNameToCode(_S's')]:= '+speedup';
       
   304 DefaultBinds[KeyNameToCode(_S't')]:= 'chat';
       
   305 DefaultBinds[KeyNameToCode(_S'y')]:= 'confirm';
       
   306 
       
   307 DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset';
       
   308 DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomin';
       
   309 DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomout';
       
   310 
       
   311 DefaultBinds[KeyNameToCode('f12')]:= 'fullscr';
       
   312 
       
   313 
       
   314 DefaultBinds[KeyNameToCode('mousel')]:= '/put';
       
   315 DefaultBinds[KeyNameToCode('mouser')]:= 'ammomenu';
       
   316 DefaultBinds[KeyNameToCode('backspace')]:= 'hjump';
       
   317 DefaultBinds[KeyNameToCode('tab')]:= 'switch';
       
   318 DefaultBinds[KeyNameToCode('return')]:= 'ljump';
       
   319 DefaultBinds[KeyNameToCode('space')]:= '+attack';
       
   320 DefaultBinds[KeyNameToCode('up')]:= '+up';
       
   321 DefaultBinds[KeyNameToCode('down')]:= '+down';
       
   322 DefaultBinds[KeyNameToCode('left')]:= '+left';
       
   323 DefaultBinds[KeyNameToCode('right')]:= '+right';
       
   324 DefaultBinds[KeyNameToCode('left_shift')]:= '+precise';
       
   325 
       
   326 
       
   327 DefaultBinds[KeyNameToCode('j0a0u')]:= '+left';
       
   328 DefaultBinds[KeyNameToCode('j0a0d')]:= '+right';
       
   329 DefaultBinds[KeyNameToCode('j0a1u')]:= '+up';
       
   330 DefaultBinds[KeyNameToCode('j0a1d')]:= '+down';
       
   331 for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+char(i+48);
       
   332 for i:= 1 to 5  do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
       
   333 
       
   334 loadBinds('dbind', cPathz[ptConfig] + '/settings.ini');
       
   335 end;
       
   336 
       
   337 procedure SetBinds(var binds: TBinds);
   361 procedure SetBinds(var binds: TBinds);
   338 {$IFNDEF MOBILE}
       
   339 var
   362 var
   340     t: LongInt;
   363     t: LongInt;
   341 {$ENDIF}
   364 begin
   342 begin
       
   343 {$IFDEF MOBILE}
       
   344     binds:= binds; // avoid hint
       
   345     CurrentBinds:= DefaultBinds;
       
   346 {$ELSE}
       
   347     for t:= 0 to cKbdMaxIndex do
   365     for t:= 0 to cKbdMaxIndex do
   348         if (CurrentBinds[t] <> binds[t]) and tkbd[t] then
   366         if (CurrentBinds[t] <> binds[t]) and tkbd[t] then
   349             ProcessKey(t, False);
   367             ProcessKey(t, False);
   350 
   368 
   351     CurrentBinds:= binds;
   369     CurrentBinds:= binds;
       
   370 end;
       
   371 {$ELSE}
       
   372 procedure SetBinds(var binds: TBinds);
       
   373 begin
       
   374     binds:= binds; // avoid hint
       
   375     CurrentBinds:= DefaultBinds;
       
   376 end;
   352 {$ENDIF}
   377 {$ENDIF}
   353 end;
       
   354 
   378 
   355 procedure SetDefaultBinds;
   379 procedure SetDefaultBinds;
   356 begin
   380 begin
   357     CurrentBinds:= DefaultBinds;
   381     CurrentBinds:= DefaultBinds;
   358 end;
   382 end;
   436 
   460 
   437 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
   461 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
   438 var
   462 var
   439     k: LongInt;
   463     k: LongInt;
   440 begin
   464 begin
   441     SDL_GetKeyState(@k);
   465     SDL_GetKeyboardState(@k);
   442     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   466     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   443     ProcessKey(k +  axis*2, value > 20000);
   467     ProcessKey(k +  axis*2, value > 20000);
   444     ProcessKey(k + (axis*2)+1, value < -20000);
   468     ProcessKey(k + (axis*2)+1, value < -20000);
   445 end;
   469 end;
   446 
   470 
   447 procedure ControllerHatEvent(joy, hat, value: Byte);
   471 procedure ControllerHatEvent(joy, hat, value: Byte);
   448 var
   472 var
   449     k: LongInt;
   473     k: LongInt;
   450 begin
   474 begin
   451     SDL_GetKeyState(@k);
   475     SDL_GetKeyboardState(@k);
   452     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   476     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   453     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 0, (value and SDL_HAT_UP)   <> 0);
   477     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 0, (value and SDL_HAT_UP)   <> 0);
   454     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 1, (value and SDL_HAT_RIGHT)<> 0);
   478     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 1, (value and SDL_HAT_RIGHT)<> 0);
   455     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 2, (value and SDL_HAT_DOWN) <> 0);
   479     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 2, (value and SDL_HAT_DOWN) <> 0);
   456     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 3, (value and SDL_HAT_LEFT) <> 0);
   480     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 3, (value and SDL_HAT_LEFT) <> 0);
   458 
   482 
   459 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
   483 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
   460 var
   484 var
   461     k: LongInt;
   485     k: LongInt;
   462 begin
   486 begin
   463     SDL_GetKeyState(@k);
   487     SDL_GetKeyboardState(@k);
   464     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   488     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
   465     ProcessKey(k +  ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + button, pressed);
   489     ProcessKey(k +  ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + button, pressed);
   466 end;
   490 end;
   467 
   491 
   468 procedure loadBinds(cmd, s: shortstring);
   492 procedure loadBinds(cmd, s: shortstring);