-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusb.c
71 lines (53 loc) · 1.53 KB
/
usb.c
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
#include "config.h"
#ifdef ENABLE_USB
#include <pspkernel.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include "usb.h"
extern bool usb_open()
{
sceKernelStartModule(sceKernelLoadModule("flash0:/kd/semawm.prx", 0, NULL), 0, NULL, 0, NULL);
sceKernelStartModule(sceKernelLoadModule("flash0:/kd/usbstor.prx", 0, NULL), 0, NULL, 0, NULL);
sceKernelStartModule(sceKernelLoadModule("flash0:/kd/usbstormgr.prx", 0, NULL), 0, NULL, 0, NULL);
sceKernelStartModule(sceKernelLoadModule("flash0:/kd/usbstorms.prx", 0, NULL), 0, NULL, 0, NULL);
sceKernelStartModule(sceKernelLoadModule("flash0:/kd/usbstorboot", 0, NULL), 0, NULL, 0, NULL);
if (sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0) != 0)
return false;
if (sceUsbStart( PSP_USBSTOR_DRIVERNAME, 0, 0) != 0)
return false;
if (sceUsbstorBootSetCapacity( 0x800000 ) != 0)
return false;
return true;
}
extern void usb_close()
{
if (usb_isactive())
usb_deactivate();
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
}
extern bool usb_activate()
{
if (sceUsbGetState() & PSP_USB_ACTIVATED)
return false;
return (sceUsbActivate(0x1c8) == 0);
}
extern bool usb_deactivate()
{
if (sceUsbGetState() & PSP_USB_ACTIVATED)
return (sceUsbDeactivate(0x1c8) == 0);
return false;
}
extern bool usb_isactive()
{
return (sceUsbGetState() & PSP_USB_ACTIVATED);
}
extern bool usb_cableconnected()
{
return (sceUsbGetState() & PSP_USB_CABLE_CONNECTED);
}
extern bool usb_connectionestablished()
{
return (sceUsbGetState() & PSP_USB_CONNECTION_ESTABLISHED);
}
#endif