This commit is contained in:
2024-05-11 23:24:13 +02:00
commit e66c5afde0
130 changed files with 17039 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
package udcd
import "core:c"
import sce "../common"
foreign import udcd "system:SceUdcd_stub"
@(link_prefix = "sceUdcd")
foreign udcd {
/**
* Get device state
*
* @param[out] state - Device state
*
* @return 0 on success, < 0 on error.
*/
GetDeviceState :: proc(state: ^SceUdcdDeviceState) -> c.int ---
/**
* Get device information
*
* @param[out] devInfo - Device information
*
* @return 0 on success, < 0 on error.
*/
GetDeviceInfo :: proc(devInfo: ^SceUdcdDeviceInfo) -> c.int ---
/**
* Get state of a specific USB driver
*
* @param driverName - name of USB driver to get status from
*
* @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped
*/
GetDrvState :: proc(driverName: cstring) -> c.int ---
/**
* Register callback
*
* @param[in] cbid - Callback UID
* @param[in] state - State
*
* @return 0 on success, < 0 on error.
*/
RegisterCallback :: proc(cbid: sce.UID, state: c.int) -> c.int ---
/**
* Unregister callback
*
* @param[in] cbid - Callback UID
*
* @return 0 on success, < 0 on error.
*/
UnregisterCallback :: proc(cbid: sce.UID) -> c.int ---
/**
* Wait for state
*
* @param[in] waitParam - Wait parameter
* @param[in] timeout - Timeout
*
* @return 0 on success, < 0 on error.
*/
WaitState :: proc(waitParam: ^SceUdcdWaitParam, timeout: c.uint) -> c.int ---
}
+48
View File
@@ -0,0 +1,48 @@
package udcd
import "core:c"
import sce "../common"
SceUdcdStatus :: enum c.int {
CONNECTION_NEW = 0x0001,
CONNECTION_ESTABLISHED = 0x0002,
CONNECTION_SUSPENDED = 0x0004,
CABLE_DISCONNECTED = 0x0010,
CABLE_CONNECTED = 0x0020,
DEACTIVATED = 0x0100,
ACTIVATED = 0x0200,
IS_CHARGING = 0x0400,
USE_USB_CHARGING = 0x0800,
UNKNOWN_1000 = 0x1000,
UNKNOWN_2000 = 0x2000
}
SceUdcdStatusDriver :: enum c.int {
STARTED = 0x01,
REGISTERED = 0x02,
}
SceUdcdDeviceInfo :: struct {
info: [64]c.uchar,
}
#assert(size_of(SceUdcdDeviceInfo) == 0x40)
SceUdcdWaitParam :: struct {
unk_00: c.int,
status: c.int,
unk_08: c.int,
unk_0C: c.int,
unk_10: c.int,
driverName: cstring,
}
SceUdcdDeviceState :: struct {
unk_00: c.int,
state: c.int,
cable: c.int,
connection: c.int,
use_usb_charging: c.int,
unk_14: c.int,
}
#assert(size_of(SceUdcdDeviceState) == 0x18)