Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@piotrek-k piotrek-k commented Jan 18, 2017

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

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