#include "gsa_input.h"
#include "gamepad.h"

struct gsa_input input;

void _gsa_input_tick() {
	u8 gamepad = 0;

	input.pressed.dpad_down =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_DPAD_DOWN];
	input.pressed.dpad_up =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_DPAD_UP];
	input.pressed.dpad_left =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_DPAD_LEFT];
	input.pressed.dpad_right =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_DPAD_RIGHT];
	input.pressed.face_down =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_FACE_DOWN];
	input.pressed.face_up =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_FACE_UP];
	input.pressed.face_left =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_FACE_LEFT];
	input.pressed.face_right =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_FACE_RIGHT];
	input.pressed.l =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_LEFT_SHOULDER];
	input.pressed.r =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_RIGHT_SHOULDER];
	input.pressed.select =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_BACK];
	input.pressed.start =
	    sw_gamepads[gamepad].button_pressed[SW_GAMEPAD_BUTTON_START];

	input.down.dpad_down =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_DPAD_DOWN];
	input.down.dpad_up =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_DPAD_UP];
	input.down.dpad_left =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_DPAD_LEFT];
	input.down.dpad_right =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_DPAD_RIGHT];
	input.down.face_down =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_FACE_DOWN];
	input.down.face_up =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_FACE_UP];
	input.down.face_left =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_FACE_LEFT];
	input.down.face_right =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_FACE_RIGHT];
	input.down.l =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_LEFT_SHOULDER];
	input.down.r =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_RIGHT_SHOULDER];
	input.down.select =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_BACK];
	input.down.start =
	    sw_gamepads[gamepad].button_down[SW_GAMEPAD_BUTTON_START];
}
