Extract gamepad code

Extract gamepad code, fix http loading.