#include <revolution/kpad.h> s32 KPADRead( s32 chan, KPADStatus samplingBufs[], u32 length );
| chan | One of the WPAD_CHANn values. |
|---|---|
| samplingBufs | Pointer to the KPADStatus structure. |
| length | Maximum number of data sets to store. If you use the KPADInit function, this number cannot exceed KPAD_RING_BUFS. If you use the KPADInitEx function, this value cannot exceed the sum of KPAD_RING_BUFS and one-quarter the array length passed to the KPADInitEx function. |
Returns the number of data sets that are stored.
This function reads data in the KPADStatus structure type for each controller channel. We have assumed that this function will be called for each game frame. The buffer specified by the argument stores, from newest to oldest, the data sampled from the previous call's time to the current call's time. (In other words, the newest data is always stored at the beginning of the buffer.) However, in the case of button information only, if the button processing method obtained using the KPADGetButtonProcMode function is KPAD_BUTTON_PROC_MODE_LOOSE, only the most recent values are accessed when the KPADRead or KPADReadEx functions are called, and those values are copied into all the current-frame sampling buffers.
The buffer specified by samplingBufs is sometimes used internally as a work area. Because of this, it is possible for buffer contents to be overwritten even when there was no data.
2008/06/13 Revised the explanation of length. Added explanation of the differences caused by different button processing methods.
2008/06/03 Deleted error codes.
2008/04/17 Revised the description of length. Added error codes.
2006/10/25 Revised the description to match KPAD version 2.
2006/08/xx Added a link under See Also.
2006/03/01 Initial version.
CONFIDENTIAL