Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Changed: ctrl & display documentation (see message)
Browse files Browse the repository at this point in the history
* Improve doc by adding links to various elements in `ctrl` & `display`.
  • Loading branch information
GGLinnk committed Apr 21, 2021
1 parent 8bd87f9 commit e0071e3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
102 changes: 51 additions & 51 deletions src/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ pub enum SceCtrlErrorCode {
/// Enumeration for the digital controller buttons.
///
/// Notes :
/// > L1/R1/L3/R3 only can bind using ::sceCtrlPeekBufferPositiveExt2 and ::sceCtrlReadBufferPositiveExt2
/// > L1/R1/L3/R3 only can bind using [sceCtrlPeekBufferPositiveExt2](crate::ctrl::sceCtrlPeekBufferPositiveExt2) and [sceCtrlReadBufferPositiveExt2](crate::ctrl::sceCtrlReadBufferPositiveExt2)
///
/// > Values bigger than 0x00010000 can be intercepted only with shell privileges
///
/// > Vita's L Trigger and R Trigger are mapped to L1 and R1 when using ::sceCtrlPeekBufferPositiveExt2 and ::sceCtrlReadBufferPositiveExt2
/// > Vita's L Trigger and R Trigger are mapped to L1 and R1 when using [sceCtrlPeekBufferPositiveExt2](crate::ctrl::sceCtrlPeekBufferPositiveExt2) and [sceCtrlReadBufferPositiveExt2](crate::ctrl::sceCtrlReadBufferPositiveExt2)
#[repr(C)]
pub enum SceCtrlButtons {
/// Select button.
Expand Down Expand Up @@ -102,7 +102,7 @@ pub enum SceCtrlPadInputMode {
SCE_CTRL_MODE_DIGITAL = 0,
/// Digital buttons + Analog support.
SCE_CTRL_MODE_ANALOG = 1,
/// Same as ::SCE_CTRL_MODE_ANALOG, but with larger range for analog sticks.
/// Same as [SCE_CTRL_MODE_ANALOG](crate::ctrl::SceCtrlPadInputMode::SCE_CTRL_MODE_ANALOG), but with larger range for analog sticks.
SCE_CTRL_MODE_ANALOG_WIDE = 2,
}

Expand All @@ -111,7 +111,7 @@ pub enum SceCtrlPadInputMode {
pub struct SceCtrlData {
/// The current read frame.
pub timeStamp: u64,
/// Bit mask containing zero or more of ::SceCtrlButtons.
/// Bit mask containing zero or more of [SceCtrlButtons].
pub buttons: u32,
/// Left analogue stick, X axis.
pub lx: u8,
Expand Down Expand Up @@ -149,7 +149,7 @@ pub struct SceCtrlData {
_reserved: [u8; 4],
}

/// Structure to pass as argument to ::sceCtrlSetRapidFire
/// Structure to pass as argument to [sceCtrlSetRapidFire]
#[repr(C)]
pub struct SceCtrlRapidFireRule {
pub Mask: u32,
Expand All @@ -160,7 +160,7 @@ pub struct SceCtrlRapidFireRule {
pub Break: u32,
}

/// Structure to pass as argument to ::sceCtrlSetActuator
/// Structure to pass as argument to [sceCtrlSetActuator]
#[repr(C)]
pub struct SceCtrlActuator {
/// Vibration strength of the small motor
Expand All @@ -171,48 +171,48 @@ pub struct SceCtrlActuator {
unk: [u8; 6],
}

/// Structure to pass as argument to ::sceCtrlGetControllerPortInfo
/// Structure to pass as argument to [sceCtrlGetControllerPortInfo]
#[repr(C)]
pub struct SceCtrlPortInfo {
/// Controller type of each port (See ::SceCtrlExternalInputMode)
/// Controller type of each port (See [SceCtrlExternalInputMode])
pub port: [u8; 5],
/// Unknown
unk: [u8; 11],
}

#[cfg_attr(not(feature = "dox"), link(kind = "static", name = "SceCtrl_stub"))]
extern "C" {
/// Set the controller mode.
/// Set the controller mode
///
/// * `mode` - One of ::SceCtrlPadInputMode.
/// * `mode` - One of [SceCtrlPadInputMode].
///
/// Returns he previous mode, < 0 on error.
pub fn sceCtrlSetSamplingMode(
mode: SceCtrlPadInputMode
) -> i32;

/// Set the controller extend mode.
/// Set the controller extend mode
///
/// * `mode` - One of ::SceCtrlPadInputMode.
/// * `mode` - One of [SceCtrlPadInputMode].
///
/// Returns the previous mode, < 0 on error.
pub fn sceCtrlSetSamplingModeExt(
mode: SceCtrlPadInputMode
) -> i32;

/// Get the current controller mode.
/// Get the current controller mode
///
/// * `pMode` (out) - Return value, see ::SceCtrlPadInputMode.
/// * `pMode` (out) - Return value, see [SceCtrlPadInputMode].
///
/// Returns the previous mode, < 0 on error.
pub fn sceCtrlGetSamplingMode(
pMode: *mut SceCtrlPadInputMode
) -> i32;

/// Get the controller state information (polling, positive logic).
/// Get the controller state information (polling, positive logic)
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -222,12 +222,12 @@ extern "C" {
count: i32
) -> i32;

/// Get the controller state information (polling, positive logic).
/// Get the controller state information (polling, positive logic)
///
/// This function will bind L/R trigger value to L1/R1 instead of LTRIGGER/RTRIGGER
/// This function will bind L/R trigger value to L1/R1 instead of LTRIGGER/RTRIGGER.
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -237,10 +237,10 @@ extern "C" {
count: i32
) -> i32;

/// Get the controller state information (polling, negative logic).
/// Get the controller state information (polling, negative logic)
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -250,10 +250,10 @@ extern "C" {
count: i32
) -> i32;

/// Get the controller state information (blocking, positive logic).
/// Get the controller state information (blocking, positive logic)
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -263,12 +263,12 @@ extern "C" {
count: i32
) -> i32;

/// Get the controller extended state information (blocking, positive logic).
/// Get the controller extended state information (blocking, positive logic)
///
/// This function will bind L/R trigger value to L1/R1 instead of LTRIGGER/RTRIGGER
/// This function will bind L/R trigger value to L1/R1 instead of LTRIGGER/RTRIGGER.
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -278,10 +278,10 @@ extern "C" {
count: i32
) -> i32;

/// Get the controller state information (blocking, negative logic).
/// Get the controller state information (blocking, negative logic)
///
/// * `port` - use 0.
/// * `*pad_data` (out) - see ::SceCtrlData.
/// * `*pad_data` (out) - see [SceCtrlData].
/// * `count` - Buffers count. Up to 64 buffers can be requested.
///
/// Returns buffers count, between 1 and 'count'. < 0 on error.
Expand All @@ -291,11 +291,11 @@ extern "C" {
count: i32
) -> i32;

/// Set rules for button rapid fire.
/// Set rules for button rapid fire
///
/// * `port` - use 0.
/// * `idx` - rule index between 0-15
/// * `pRule` - structure ::SceCtrlRapidFireRule.
/// * `idx` - rule index between 0-15.
/// * `pRule` - structure [SceCtrlRapidFireRule].
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlSetRapidFire(
Expand All @@ -304,34 +304,34 @@ extern "C" {
pRule: *const SceCtrlRapidFireRule
);

/// Clear rules for button rapid fire.
/// Clear rules for button rapid fire
///
/// * `port` - use 0.
/// * `idx` - rule index between 0-15
/// * `idx` - rule index between 0-15.
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlClearRapidFire(
port: i32,
idx: i32
) -> i32;

/// Control the actuator (vibrate) on paired controllers.
/// Control the actuator (vibrate) on paired controllers
///
/// * `port` - use 1 for the first paired controller, etc.
/// * `state` - see ::SceCtrlActuator
/// * `state` - see [SceCtrlActuator].
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlSetActuator(
port: i32,
pState: *const SceCtrlActuator
) -> i32;

/// Control the light bar on paired controllers.
/// Control the light bar on paired controllers
///
/// * `port` - use 1 for the first paired controller, etc.
/// * `r` - red intensity
/// * `g` - green intensity
/// * `b` - blue intensity
/// * `r` - red intensity.
/// * `g` - green intensity.
/// * `b` - blue intensity.
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlSetLightBar(
Expand All @@ -343,48 +343,48 @@ extern "C" {

/// Get controller port information.
///
/// * `info` (out) - see ::SceCtrlPortInfo
/// * `info` (out) - see [SceCtrlPortInfo].
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlGetControllerPortInfo(
info: *mut SceCtrlPortInfo
) -> i32;

/// Get controller battery information.
/// Get controller battery information
///
/// * `port` - use 1 for the first paired controller, etc.
/// * `batt` (out) - battery level, between 0-5, 0xEE charging, 0xEF charged
/// * `batt` (out) - battery level, between 0-5, 0xEE charging, 0xEF charged.
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlGetBatteryInfo(
port: i32,
batt: *mut SceUInt8
) -> i32;

/// Sets intercept.
/// Sets intercept
///
/// If true, allows the current thread to intercept controls. The use case
/// might be, for example, a game plugin that wishes to capture input without
/// having the input sent to the game thread.
/// If true, allows the current thread to intercept controls.
/// The use case might be, for example, a game plugin that wishes to
/// capture input without having the input sent to the game thread.
///
/// * `intercept` - Boolean value
/// * `intercept` - Boolean value.
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlSetButtonIntercept(
intercept: i32
) -> i32;

/// Gets intercept.
/// Gets intercept
///
/// * `intercept` (out) - Boolean value
/// * `intercept` (out) - Boolean value.
///
/// Returns 0 on success, < 0 on error.
pub fn sceCtrlGetButtonIntercept(
intercept: *mut i32
) -> i32;

/// Check if multi controller is supported.
/// Check if multi controller is supported
///
/// Returns 1 if yes, 0 if no
/// Returns 1 if yes, 0 if no.
pub fn sceCtrlIsMultiControllerSupported() -> i32;
}
16 changes: 8 additions & 8 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ pub enum SceDisplaySetBufSync {
SCE_DISPLAY_SETBUF_NEXTFRAME = 1,
}

/// Structure used with ::sceDisplaySetFrameBuf to set/update
/// Structure used with [sceDisplaySetFrameBuf] to set/update
/// framebuffer
///
/// Original screen resolution is 960x544, but the following resolutions can also
/// be supplied as width and height : 480x272, 640x368, 720x408
///
/// > Note: This structure is returned by ::sceDisplayGetFrameBuf
/// > Note: This structure is returned by [sceDisplayGetFrameBuf]
#[repr(C)]
pub struct SceDisplayFrameBuf {
/// sizeof(SceDisplayFrameBuf)
/// sizeof([SceDisplayFrameBuf])
pub size: SceSize,
/// Pointer to framebuffer
pub base: *mut crate::void,
/// Pitch pixels
pub pitch: u32,
/// Pixel format (one of ::SceDisplayPixelFormat)
/// Pixel format (one of [SceDisplayPixelFormat])
pub pixelformat: u32,
/// Framebuffer width
pub width: u32,
Expand All @@ -64,9 +64,9 @@ pub struct SceDisplayFrameBuf {
extern "C" {
/// Set/Update framebuffer parameters
///
/// * `pParam` (out) - Pointer to a ::SceDisplayFrameBuf
/// * `pParam` (out) - Pointer to a [SceDisplayFrameBuf]
/// structure
/// * `sync` - One of ::SceDisplaySetBufSync
/// * `sync` - One of [SceDisplaySetBufSync]
///
/// Returns 0 on success, < 0 on error
///
Expand All @@ -78,9 +78,9 @@ extern "C" {

/// Get current framebuffer parameters
///
/// * `pParam` (out) - Pointer to a ::SceDisplayFrameBuf
/// * `pParam` (out) - Pointer to a [SceDisplayFrameBuf]
/// structure which will receive framebuffer parameters
/// * `sync` - One of ::SceDisplaySetBufSync
/// * `sync` - One of [SceDisplaySetBufSync]
///
/// Returns 0 on success, < 0 on error
pub fn sceDisplayGetFrameBuf(
Expand Down

0 comments on commit e0071e3

Please sign in to comment.