Skip to content

Instantly share code, notes, and snippets.

@piotrek-k
Created January 18, 2017 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotrek-k/2c1a8f2ee13d0445f62cc819d86accd3 to your computer and use it in GitHub Desktop.
Save piotrek-k/2c1a8f2ee13d0445f62cc819d86accd3 to your computer and use it in GitHub Desktop.
This file enables Portal 2 co-op with 1 keyboard + 1 controller on one screen. Paste this file to "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\cfg", run game, press F11 to open console, F9 and F10 to switch Xbox controller to player 2. Then, you could be able to open co-op mode in game.
// This automatically enables console so you don't have to
con_enable 1
// These aliases create an automatic toggle for remapping your controller
alias "togglecontroller" "remap1to2"
alias "remap1to2" "joy_remap_player_for_controller1 2; alias togglecontroller remap2to1; echo Xbox 360 controller 1 remapped to Player 2"
alias "remap2to1" "joy_remap_player_for_controller1 1; alias togglecontroller remap1to2; echo Xbox 360 controller 1 remapped to Player 1"
// These aliases create an automatic toggle for remapping your keyboard
alias "togglekeyboard" "sv_cheats 1; key_remap_keyboard_for_player1"
alias "key_remap_keyboard_for_player1" "in_forceuser 0; alias togglekeyboard key_remap_keyboard_for_player2; echo Keyboard remapped to Player 1"
alias "key_remap_keyboard_for_player2" "in_forceuser 1; alias togglekeyboard key_remap_keyboard_for_player1; echo Keyboard remapped to Player 2"
// Keybindings to togglecontroller, togglekeyboard and toggleconsole
bind "F9" "togglekeyboard"
bind "F10" "togglecontroller"
bind "F11" "toggleconsole"
// The most important part
host_writeconfig
@piotrek-k
Copy link
Author

piotrek-k commented Jan 18, 2017

I've got code from this link: How to play Local Co-op with Controller + Keyboard. Thanks Eetami!

@Chij114
Copy link

Chij114 commented Mar 13, 2023

This isn't changing my keyboard from being player 2.

@Chij114
Copy link

Chij114 commented Mar 13, 2023

I followed the guide posted, but it only lets me change the controller's player.

@Chij114
Copy link

Chij114 commented Mar 13, 2023

Is this meant to be able to switch the keyboard's?

@Chij114
Copy link

Chij114 commented Mar 13, 2023

*player

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment