In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
576 bytes added ,  01:07, 2 May 2017
VPADBASEGetState + VPADBASEGetHeadphoneStatus
Line 18: Line 18:  
|<syntaxhighlight lang="C">void VPADBASEShutdown();</syntaxhighlight>
 
|<syntaxhighlight lang="C">void VPADBASEShutdown();</syntaxhighlight>
 
|Shuts down the library.
 
|Shuts down the library.
 +
|-
 +
|VPADBASEGetState
 +
|<syntaxhighlight lang="C">int VPADBASEGetState(int channel);</syntaxhighlight>
 +
|Gets the state of the given channel.
 
|-
 
|-
 
|VPADBASEGetCalibrationData
 
|VPADBASEGetCalibrationData
Line 50: Line 54:  
|<syntaxhighlight lang="C">void VPADBASEInitVolumeOverrideSettingSyncTime(int channel);</syntaxhighlight>
 
|<syntaxhighlight lang="C">void VPADBASEInitVolumeOverrideSettingSyncTime(int channel);</syntaxhighlight>
 
|Writes 0x190 to the "volume override sync time". VPADBASESetVolumeOverrideSetting does the same.
 
|Writes 0x190 to the "volume override sync time". VPADBASESetVolumeOverrideSetting does the same.
 +
|-
 +
|VPADBASEGetHeadphoneStatus
 +
|<syntaxhighlight lang="C">int VPADBASEGetHeadphoneStatus(int channel);</syntaxhighlight>
 +
|Returns 1 if headphones are connected, 0 otherwise.
 
|}
 
|}
    
==Internal Data Structure==
 
==Internal Data Structure==
VPADBASE holds data from its Gamepads in the rpl's BSS section. On 5.5.1, the layout indicates room for two Gamepads, each with a dedicated 0x380 byte struct; one at 0x10002740 (not relocated, channel 0) and the other at 0x10002AC0 (not relocated, channel 1). Functions in this library index these structs with their channel number as you'd expect, with the exception of the library's "system mode callback" (see OSRegisterSystemModeCallback), which accesses 0x288 bytes into the first struct in a hard-coded manner.
+
VPADBASE holds data from its Gamepads in the rpl's BSS section. On 5.5.1, the layout indicates room for two Gamepads, each with a dedicated 0x380 byte struct; one at 0x10002740 (not relocated, channel 0) and the other at 0x10002AC0 (not relocated, channel 1). Functions in this library index these structs with their channel number as you'd expect, with the exception of the library's "system mode callback" (see OSRegisterSystemModeCallback), which accesses 0x288 bytes into the first struct in a hard-coded manner. The final version of Cafe OS only allows you to connect one Gamepad - channel 0.
    
===Gamepad Struct===
 
===Gamepad Struct===
 +
Some of the functions use a more complex addressing system rather than simple offsets, so some items are missing from the following struct.
 
<syntaxhighlight lang="C">
 
<syntaxhighlight lang="C">
 
//TODO add padding bytes to make this actually work
 
//TODO add padding bytes to make this actually work
Line 61: Line 70:  
/* +214 */ char calibrationData[0x44]; //VPADBASEGetCalibrationData, actually 0x11 ints
 
/* +214 */ char calibrationData[0x44]; //VPADBASEGetCalibrationData, actually 0x11 ints
 
/* +25C */ char factorySetting[0x1C]; //VPADBASEGetFactorySetting, actually 0xE shorts
 
/* +25C */ char factorySetting[0x1C]; //VPADBASEGetFactorySetting, actually 0xE shorts
 +
/* +284 */ int state; //VPADBASEGetState
 
/* +34C */ int gameControllerMode; //VPADBASE[Set/Get]GameControllerMode
 
/* +34C */ int gameControllerMode; //VPADBASE[Set/Get]GameControllerMode
 
/* +378 */ char volumeOverrideEnable //VPADBASE[Set/Get]VolumeOverride[Status/Setting]
 
/* +378 */ char volumeOverrideEnable //VPADBASE[Set/Get]VolumeOverride[Status/Setting]

Navigation menu