#include "controller.h"

void Ctrl_Init()
{
    PAD_Init();
    #if defined(HW_RVL)
    WPAD_Init();
    #endif
}
void Ctrl_ScanPads()
{
    PAD_ScanPads();
    #if defined(HW_RVL)
    WPAD_ScanPads();
    #endif
}

u32 Ctrl_ButtonsDown(int pad)
{
    u32 buttons=PAD_ButtonsDown(pad);
    #if defined(HW_RVL)
    u32 wbuttons = WPAD_ButtonsDown(pad);
    if(wbuttons & WPAD_BUTTON_A) buttons |= PAD_BUTTON_A;
    if(wbuttons & WPAD_BUTTON_B) buttons |= PAD_BUTTON_B;
    if(wbuttons & WPAD_BUTTON_1) buttons |= PAD_BUTTON_X;
    if(wbuttons & WPAD_BUTTON_2) buttons |= PAD_BUTTON_Y;
    if(wbuttons & WPAD_BUTTON_HOME) buttons |= PAD_BUTTON_START;
    if(wbuttons & WPAD_BUTTON_DOWN) buttons |= PAD_BUTTON_DOWN;
    if(wbuttons & WPAD_BUTTON_UP) buttons |= PAD_BUTTON_UP;
    if(wbuttons & WPAD_BUTTON_LEFT) buttons |= PAD_BUTTON_LEFT;
    if(wbuttons & WPAD_BUTTON_RIGHT) buttons |= PAD_BUTTON_RIGHT;
    
    #endif
    return buttons;
}