1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 4<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 5<base target="main"> 6<title>KPADOld Function Introduction</title> 7</head> 8 9<body> 10 11 12 13<h1>KPADOld Function Description</h1> 14 15<hr> 16 17<p> 18The KPAD library version from before Revolution SDK 2.3 has changed names to KPADOld library starting with Revolution SDK 2.3. Read the term "KPAD Library" that appears in this manual as "KPADOld Library." 19<p> 20 21<h2>Introduction</h2> 22<p>This manual was written to support <font color="ff0000">UI Tool Version 3</font> and <font color="ff0000">UI Tool Version 4</font>.</p> 23 24<p> 25The <font color="ff0000">KPAD library</font> is a high-level library located in the upper part of the WPAD library. In contrast to using the WPAD library directly, the KPAD library can obtain coordinates where the Wii Remote is pointing more easily. It also provides features such as reducing the effects of hand tremor and adjusting the sensitivity of the Wii Remote. Not only the Wii Remote controller data, but also the controller data from the Nunchuk and the Nintendo GameCube standard controller can be retrieved. 26</p> 27 28<p> 29Samples are provided to test the functionality of the KPAD library in <code>$(REVOLUTION_SDK_ROOT)/build/demos/kpadOlddemo/</code> (for UI Tool Version 4) and in <code>$(REVOLUTION_SDK_ROOT)/build/demos/kpadEmudemo/</code> (for UI Tool Version 3). When using these samples, we recommend placing the Wii Remote and the Sensor Bar at least 1.5 meters apart (the samples may not function well at a distance of 1.0 meter). 30</p> 31 32<p> 33The KPAD library is in the following path. 34<ul> 35<li><CODE>$(REVOLUTION_SDK_ROOT)/RVL[0]/lib/kpadOld[D].a</CODE> (for UI Tool Version 4) 36<li><CODE>$(REVOLUTION_SDK_ROOT)/RVL[0]/lib/kpadEmu[D].a</CODE> (for UI Tool Version 3) 37</ul> 38</p> 39 40<p> 41Function declarations are in the <code>$(REVOLUTION_SDK_ROOT)/include/revolution/kpadOld.h</code> header file. 42</p> 43 44<h3>Using KPADOld Library</h3> 45 46<p> 47The KPADOld library is not linked to the application by default. By default, <code>$(REVOLUTION_SDK_ROOT)/RVL/lib/kpad[D].a</code> will be linked to the application. To avoid this, specify <code>kpadOld[D].a</code> before the library specification <code>$(REVOLUTION_LIBS)</code> in the application <code>makefile</code>. See the kpadsample(KPADOld) sample demo, <code>$(REVOLUTION_SDK_ROOT)/build/demos/kpadOld/makefile</code> for reference. If the CodeWarrior IDE is being used, delete kpad[D].a from the project and add kpadOld[D]. 48</p> 49 50<p> 51After this, check the MAP file that is output by the linker, and make sure "<code>kpad.a</code>" or "<code>kpadD.a</code>" (KPAD version 2) have not been mixed up and linked. 52</p> 53 54<h2>Process Flow</h2> 55<h3>KPAD Initialization</h3> 56<p> 57Initialization of the KPAD library occurs by calling the <a href="./KPADInit.html">KPADInit</a> function. <font color="ff0000">For the KPAD library corresponding to UI Tool Version 4, <a href="../wpad/WPADRegisterAllocator.html">WPADRegisterAllocator</a> must be called to register the allocator function used to allocate and deallocate memory for the WPAD library prior to calling <a href="./KPADInit.html">KPADInit</a>.</font>After the KPAD library is initialized, it uses the WPAD library autosampling feature to obtain data and update its internal buffer. 58</p> 59 60<h3>Obtaining Controller Information</h3> 61<p> 62Using the <a href="./KPADRead.html"><CODE>KPADRead</CODE></a> function, the specified channel's controller information is read into a <a href="./KPADStatus.html"><code>KPADStatus</code></a> structure. When adjusting the Wii Remote reaction and the hand tremor reduction level, use <a href="./KPADSetPosParam.html"><code>KPADSetPosParam</code></a>, <a href="./KPADSetHoriParam.html"><code>KPADSetHoriParam</code></a>, <a href="./KPADSetDistParam.html"><code>KPADSetDistParam</code></a>, or <a href="./KPADSetAccParam.html"><code>KPADSetAccParam</code></a>. These functions can adjust the controller status obtained with <a href="./KPADRead.html"><code>KPADRead</code></a>. 63</p> 64 65<h3>Other</h3> 66<p> 67In some cases, it might be effective to call the <a href="./KPADReset.html"><code>KPADReset</code></a> function, such as during a change in scenes. 68</p> 69 70<h2>Notes</h2> 71<h3>Differences in Coordinate System</h3> 72<p> 73The coordinate system of the coordinates obtained with the KPAD library is different from that used in the WPAD library. For details, see the <a href="./KPADStatus.html"><code>KPADStatus</code></a> and <a href="./KPADStatus.html"><code>KPADEXStatus</code></a> structure pages. 74</p> 75 76<h3>Regarding Data Loss</h3> 77<p> 78The <a href="./KPADRead.html">KPADRead</a> function is designed to be called once per game frame. However, if the interval between <a href="./KPADRead.html">KPADRead</a> function calls becomes too long due to, for example, a process slowdown, the ring buffer in the KPAD library may complete the cycle and result in data loss. These conditions can sometimes be improved by changing the <code>KPAD_RING_BUFS</code> macro value in <code>$(REVOLUTION_SDK_ROOT)/include/revolution/kpadOld.h</code> to increase the ring buffer and by using the rebuilt KPAD library. 79</p> 80 81<h3>Unsupported APIs</h3> 82<p> 83Although functions were provided for the UI Tool Version 3 KPAD library to get and process data from standard Nintendo GameCube controllers, support for these functions is eliminated in the UI Tool Version 4 KPAD library. 84</p> 85 86<H2>Revision History</H2> 87<P> 882006/03/01 Initial version. <br>2006/5/15 Added to Cautions; how to avoid data loss when the interval between the <a href="./KPADRead.html">KPADRead</a> function becomes too long.<BR>2006/06/19 Support for UI Tool Version 4. Changed tentative product name to official name.<BR> 2006/10/25 Changed the name to KPADOld library starting with Revolution SDK 2.3. This is no longer linked by default, so the link procedure is added.<br> 89</P> 90 91<hr> 92<P>CONFIDENTIAL</p> 93</BODY> 94</HTML> 95