//////////////////////////////////////////////////////////////////////////////
//
// Asura_PS2_USBDevice.cpp
//
// Created by Neil Massey.
//
// Copyright (c) 2002 Rebellion. All rights reserved.
//
// Base class for USB devices on PS2
//
//////////////////////////////////////////////////////////////////////////////

#include "Core/Asura.h"

// This file's header.
#include "Input/Asura_PS2_USBDevice.h"

// Engine independent.
#include "Debugging/Asura_Assert.h"

// Engine dependent
#include "ProjectSettings/Asura_PS2_ProjectControllerDefines.h"
#include "Input/Asura_PS2_Input.h"
#include "Core/Asura_PS2_OS.h"

#if ASURA_PS2_SUPPORT_GUNCON2
#include "Input/Asura_PS2_USBGuncon2.h"
#include "Input/SCE_USB_Guncon2.h"
#endif

#if ASURA_PS2_SUPPORT_MOUSE
#include "Input/Asura_PS2_USBMouse.h"
#endif

#if ASURA_PS2_SUPPORT_KEYBOARD
#include "Input/Asura_PS2_USBKeyboard.h"
#endif

#if ASURA_PS2_SUPPORT_MOUSE || ASURA_PS2_SUPPORT_KEYBOARD
#include "Input/Logitech/liblgkbm.h"
#endif

Asura_PS2_USBDevice::Asura_PS2_USBDevice(int iDeviceNumber)
{
    m_iDeviceNumber = iDeviceNumber;
}

Asura_PS2_USBDevice::~Asura_PS2_USBDevice(void)
{
}


/*************************** S T A T I C   F U N C T I O N S ***************************/

void Asura_PS2_USBDevice::Initialise(void)
{
#if ASURA_PS2_SUPPORT_MOUSE || ASURA_PS2_SUPPORT_KEYBOARD
	// (MH - 04.06.2004) NB. we pass NULL for the timer function to make the library 
	// initialise a millsecond clock using TIMER_0. Therefore TIMER_0 can't be used
	// by our code.
    int iRetVal = lgKbMInit(ASURA_PS2_MAX_KEYBOARDS, ASURA_PS2_MAX_MICE, ASURA_PS2_LGKBM_THREAD_PRIORITY, NULL);
    if(iRetVal != LGKBM_SUCCESS)
    {
        Asura_Assert(0, "Could not initialise Logitech USB library");
    }
#endif

#if ASURA_PS2_SUPPORT_GUNCON2
    int iRetValGcon = nmUsbGunInit();
    if(iRetValGcon != 0)
    {
        Asura_Assert(0, "Could not initialise Guncon2 USB library");
    }
#endif
}
