1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#include "gvPS2Audio.h"
#include "gvPS2Spu2.h"
#include "gvPS2Headset.h"
#include "gvPS2Eyetoy.h"
#if !defined(_PS2)
#error This file should only be used with the PlayStation2
#endif
/**************
** FUNCTIONS **
**************/
GVBool gviHardwareStartup(void)
{
// initialize hardware libraries
#if !defined(GV_NO_PS2_SPU2)
if(gviPS2Spu2Startup())
#endif
{
#if !defined(GV_NO_PS2_HEADSET)
if(gviPS2HeadsetStartup())
#endif
{
#if !defined(GV_NO_PS2_EYETOY)
if(gviPS2EyetoyStartup())
#endif
{
return GVTrue;
}
#if !defined(GV_NO_PS2_HEADSET)
gviPS2HeadsetCleanup();
#endif
}
#if !defined(GV_NO_PS2_SPU2)
gviPS2Spu2Cleanup();
#endif
}
return GVFalse;
}
void gviHardwareCleanup(void)
{
// cleanup hardware libraries
#if !defined(GV_NO_PS2_SPU2)
gviPS2Spu2Cleanup();
#endif
#if !defined(GV_NO_PS2_HEADSET)
gviPS2HeadsetCleanup();
#endif
#if !defined(GV_NO_PS2_EYETOY)
gviPS2EyetoyCleanup();
#endif
}
void gviHardwareThink(void)
{
// let hardware libraries that support playback think
#if !defined(GV_NO_PS2_SPU2)
gviPS2Spu2Think();
#endif
#if !defined(GV_NO_PS2_HEADSET)
gviPS2HeadsetThink();
#endif
}
int gviHardwareListDevices(GVDeviceInfo devices[], int maxDevices, GVDeviceType types)
{
int numDevices = 0;
// enumerate hardware devices
#if !defined(GV_NO_PS2_SPU2)
numDevices += gviPS2Spu2ListDevices(devices + numDevices, maxDevices - numDevices, types);
#endif
#if !defined(GV_NO_PS2_HEADSET)
numDevices += gviPS2HeadsetListDevices(devices + numDevices, maxDevices - numDevices, types);
#endif
#if !defined(GV_NO_PS2_EYETOY)
numDevices += gviPS2EyetoyListDevices(devices + numDevices, maxDevices - numDevices, types);
#endif
// return the number of devices we found
return numDevices;
}
GVDevice gviHardwareNewDevice(GVDeviceID deviceID, GVDeviceType type)
{
// check if this is the SPU2 device
#if !defined(GV_NO_PS2_SPU2)
if(deviceID == GVPS2Spu2DeviceID)
return gviPS2Spu2NewDevice(deviceID, type);
#endif
// check if this has the eyetoy bit set
#if !defined(GV_NO_PS2_EYETOY)
if(deviceID & GVI_EYETOY_DEVICEID_BIT)
return gviPS2EyetoyNewDevice(deviceID, type);
#endif
// this is a headset device
#if !defined(GV_NO_PS2_HEADSET)
return gviPS2HeadsetNewDevice(deviceID, type);
#endif
// this didn't match anything
return NULL;
}
|