mirror of
https://github.com/IllusionMan1212/vitasdk-odin.git
synced 2026-10-24 02:12:38 +00:00
initial
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package hid
|
||||
|
||||
import "core:c"
|
||||
import sce "../common"
|
||||
|
||||
foreign import hid "system:SceHid_stub"
|
||||
|
||||
@(link_prefix = "sceHid")
|
||||
foreign hid {
|
||||
/**
|
||||
* Enumerate hid keyboards.
|
||||
*
|
||||
* @param[out] handle Buffer to receive keyboard hid handles.
|
||||
* @param[int] count Number of keyboards to enumerate
|
||||
*/
|
||||
KeyboardEnumerate :: proc(handle: [^]c.int, count: c.int) -> c.int ---
|
||||
|
||||
|
||||
/**
|
||||
* Get hid keyboard reports (blocking).
|
||||
*
|
||||
* @param[in] handle Hid handle.
|
||||
* @param[in] reports Buffer to receive reports.
|
||||
* @param[in] nReports Number of reports to receive.
|
||||
*/
|
||||
KeyboardRead :: proc(handle: sce.UInt32, reports: []^SceHidKeyboardReport, nReports: c.int) -> c.int ---
|
||||
|
||||
/**
|
||||
* Get hid keyboard reports (non-blocking).
|
||||
*
|
||||
* @param[in] handle Hid handle.
|
||||
* @param[in] reports Buffer to receive reports.
|
||||
* @param[in] nReports Number of reports to receive.
|
||||
*/
|
||||
KeyboardPeek :: proc(handle: sce.UInt32, reports: [^]SceHidKeyboardReport, nReports: c.int) -> c.int ---
|
||||
|
||||
/**
|
||||
* Enumerate hid mice.
|
||||
*
|
||||
* @param[out] handle Buffer to receive mouse hid handles.
|
||||
* @param[int] count Number of mice to enumerate
|
||||
*/
|
||||
MouseEnumerate :: proc(handle: [^]c.int, count: c.int) -> c.int ---
|
||||
|
||||
|
||||
/**
|
||||
* Get hid mouse reports.
|
||||
*
|
||||
* @param[in] handle Hid handle.
|
||||
* @param[in] reports Buffer to receive reports.
|
||||
* @param[in] nReports Number of reports to receive.
|
||||
*/
|
||||
MouseRead :: proc(handle: sce.UInt32, reports: []^SceHidMouseReport, nReports: c.int) -> c.int ---
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package hid
|
||||
|
||||
import "core:c"
|
||||
import sce "../common"
|
||||
|
||||
SCE_HID_MAX_REPORT :: 16
|
||||
SCE_HID_MAX_DEVICE_COUNT :: 8
|
||||
|
||||
SceHidKeyboardReport :: struct {
|
||||
reserved: sce.UInt8,
|
||||
modifiers: [2]sce.UInt8, //modifiers[0] Standard modifiers Ctrl Shift Alt, modifiers[1] Caps Lock, ..?
|
||||
keycodes: [6]sce.UInt8,
|
||||
reserved2: [7]sce.UInt8,
|
||||
timestamp: sce.UInt64, // microseconds
|
||||
}
|
||||
#assert(size_of(SceHidKeyboardReport) == 0x18)
|
||||
|
||||
SceHidMouseReport :: struct {
|
||||
buttons: sce.UInt8,
|
||||
reserved: sce.UInt8,
|
||||
rel_x: sce.Int16,
|
||||
rel_y: sce.Int16,
|
||||
wheel: sce.Int8,
|
||||
tilt: sce.Int8,
|
||||
timestamp: sce.UInt64, // microseconds
|
||||
}
|
||||
#assert(size_of(SceHidMouseReport) == 0x10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user