mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 11:24:27 +01:00
commit
8a308fa7a7
1 file changed
+52
-8
+52
-8
@@ -22,37 +22,81 @@
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Core/HLE/sceUsb.h"
|
||||
|
||||
// TODO: Map by driver name
|
||||
bool usbStarted = false;
|
||||
// TODO: Check actual status
|
||||
bool usbConnected = true;
|
||||
// TODO: Activation by product id
|
||||
bool usbActivated = false;
|
||||
|
||||
enum UsbStatus {
|
||||
USB_STATUS_STOPPED = 0x001,
|
||||
USB_STATUS_STARTED = 0x002,
|
||||
USB_STATUS_DISCONNECTED = 0x010,
|
||||
USB_STATUS_CONNECTED = 0x020,
|
||||
USB_STATUS_DEACTIVATED = 0x100,
|
||||
USB_STATUS_ACTIVATED = 0x200,
|
||||
};
|
||||
|
||||
void __UsbInit()
|
||||
{
|
||||
usbStarted = false;
|
||||
usbConnected = true;
|
||||
usbActivated = false;
|
||||
}
|
||||
|
||||
void __UsbDoState(PointerWrap &p)
|
||||
{
|
||||
auto s = p.Section("sceUsb", 1);
|
||||
auto s = p.Section("sceUsb", 1, 2);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
p.Do(usbStarted);
|
||||
p.Do(usbConnected);
|
||||
p.Do(usbActivated);
|
||||
}
|
||||
|
||||
u32 sceUsbActivate() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbActivate");
|
||||
int sceUsbStart(const char* driverName, u32 argsSize, u32 argsPtr) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbStart(%s, %i, %08x)", driverName, argsSize, argsPtr);
|
||||
usbStarted = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceUsbStop(const char* driverName, u32 argsSize, u32 argsPtr) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbStop(%s, %i, %08x)", driverName, argsSize, argsPtr);
|
||||
usbStarted = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceUsbGetState() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbGetState");
|
||||
int state = (usbStarted ? USB_STATUS_STARTED : USB_STATUS_STOPPED)
|
||||
| (usbConnected ? USB_STATUS_CONNECTED : USB_STATUS_DISCONNECTED)
|
||||
| (usbActivated ? USB_STATUS_ACTIVATED : USB_STATUS_DEACTIVATED);
|
||||
return state;
|
||||
}
|
||||
|
||||
int sceUsbActivate(u32 pid) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbActivate(%i)", pid);
|
||||
usbActivated = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceUsbDeactivate(u32 pid) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbDeactivate(%i)", pid);
|
||||
usbActivated = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const HLEFunction sceUsb[] =
|
||||
{
|
||||
{0xae5de6af, 0, "sceUsbStart"},
|
||||
{0xc2464fa0, 0, "sceUsbStop"},
|
||||
{0xc21645a4, 0, "sceUsbGetState"},
|
||||
{0xae5de6af, WrapI_CUU<sceUsbStart>, "sceUsbStart"},
|
||||
{0xc2464fa0, WrapI_CUU<sceUsbStop>, "sceUsbStop"},
|
||||
{0xc21645a4, WrapI_V<sceUsbGetState>, "sceUsbGetState"},
|
||||
{0x4e537366, 0, "sceUsbGetDrvList"},
|
||||
{0x112cc951, 0, "sceUsbGetDrvState"},
|
||||
{0x586db82c, WrapU_V<sceUsbActivate>, "sceUsbActivate"},
|
||||
{0xc572a9c8, 0, "sceUsbDeactivate"},
|
||||
{0x586db82c, WrapI_U<sceUsbActivate>, "sceUsbActivate"},
|
||||
{0xc572a9c8, WrapI_U<sceUsbDeactivate>, "sceUsbDeactivate"},
|
||||
{0x5be0e002, 0, "sceUsbWaitState"},
|
||||
{0x616f2b61, 0, "sceUsbWaitStateCB"},
|
||||
{0x1c360735, 0, "sceUsbWaitCancel"},
|
||||
|
||||
Reference in new issue
Block a user