Avm.rpl

From WiiUBrew
Jump to navigation Jump to search

avm.rpl is the Cafe OS library that handles audio and video related functions. Many functions use datatypes and call functions from tve.rpl.

Functions

TV

Name Prototype Description
AVMDebugIsNTSC BOOL AVMDebugIsNTSC(void) Gets the TV video region. Returns TRUE if the video region is set to NTSC, and FALSE if it is set to PAL.
AVMGetTVStereoCapability void AVMGetTVStereoCapability(uint32_t *capability) Stores 0 in capability, returns 1 (Success)
AVMGetCurrentPort BOOL AVMGetCurrentPort(TVEPort *outPort) Gets the TV port. Always returns TRUE. outPort serves as the pointer to write the port to from TVEGetCurrentPort.
AVMGetHDMIState void AVMGetHDMIState(TVEHdmiState *outState) Gets the HDMI state. outState serves as the pointer to write the state to from TVEGetHDMIErrorStat.
AVMGetTVAspectRatio BOOL AVMGetTVAspectRatio(AVMTvAspectRatio *outAspectRatio) Gets the TV aspect ratio. Always returns TRUE. outAspectRatio serves as the pointer to write the aspect ratio to.
AVMGetTvScanMode BOOL AVMGetTVScanMode(AVMTvResolution *outResolution) Gets the TV output resolution. Always returns TRUE. outResolution serves as the pointer to write the resolution to. If the resolution is set to AVM_TV_RESOLUTION_480I_PAL60, this function will instead output AVM_TV_RESOLUTION_480I. If the resolution is set to either AVM_TV_RESOLUTION_720P_50HZ, AVM_TV_RESOLUTION_1080I_50HZ, or AVM_TV_RESOLUTION_1080P_50HZ, then nothing will be stored to outResolution.
AVMGetTVUnderScan int32_t AVMGetTVUnderScan(uint32_t *outUnderScan) Gets the TV under scan. outUnderScan serves as the pointer to write the under scan to. Returns 0 on success or -1 on failure.
AVMIsOutReady BOOL AVMIsAVOutReady(void) Determines whether a TV is currently connected and displaying the Wii U source. Internally checks that either the TVEHdmiState is TVE_HDMI_STATE_DONE or the analogue state is 1, depending on whether the TVEPort port is TVE_PORT_HDMI HDMI or not. Returns TRUE if a TV is connected, FALSE if otherwise.
AVMSetTVAspectRatio BOOL AVMSetTVAspectRatio(AVMTvAspectRatio aspectRatio) Sets the TV aspect ratio. Returns TRUE on success and FALSE on failure.
AVMSetTVEnable BOOL AVMSetTVEnable(BOOL enable) Sets whether to show or hide the TV video out. If enable is set to FALSE then a black image is output (i.e. blanks the screen). The TV still receives a signal as normal and still plays audio. Returns TRUE on success and FALSE on failure.
AVMSetTVOutPort int32_t AVMSetTVOutPort(TVEPort port, AVMTvResolution resolution) Sets the TV port. Returns 0 on success or a negative value on failure.
AVMSetTVScanMode int32_t AVMSetTVScanMode(AVMTvResolution resolution, uint32_t unknown, TVEPort port) Sets the TV resolution and port. Returns 1 on success.
AVMSetTVScanResolution int32_t AVMSetTVScanResolution(AVMTvResolution resolution) Sets the TV resolution. Returns 0 on success or a negative value on failure.
AVMSetTVUnderScan int32_t AVMSetTVUnderScan(uint32_t underScan) Sets the TV under scan. Returns 0 on success or a negative value on failure.
AVMSetTVUnderScanParam int32_t AVMSetTVUnderScanParam(uint32_t underScan) underScan must be less than 0x15. Returns 0 on success or -1 on failure.
AVMSetTVVideoRegion int32_t AVMSetTVVideoRegion(AVMTvVideoRegion videoRegion, TVEPort port, AVMTvResolution resolution) Sets the TV video region. Returns 0 on success or a negative value on failure.
AVMGetTVAudioMode BOOL AVMGetTVAudioMode(uint32_t *mode) Puts TVAudioMode in *mode, returns 1 (Success)
AVMSetTVScale BOOL AVMSetTVScale(int width, int height) Calls DCSetRenderResolution with 0, width, height and 1, width, height. Seems to auto-set to full resolution if it is the "normal" width eg 1280, 1920

DRC

Name Prototype Description
AVMGetSytemAudioMode int AVMGetSystemDRCAudioMode(AVMDrcSystemAudioMode *outAudioMode) Uses AVMGetDRCSystemAudioMode internally. Returns 0 on success or -2 on failure.
AVMGetSystemDRCAudioMode int AVMGetSystemDRCAudioMode(AVMDrcSystemAudioMode *outAudioMode) Gets the current DRC audio mode.
AVMGetDRCVertCount uint32_t AVMGetDRCVertCount()
AVMIsDRCFirstFlippDone BOOL AVMIsDRCFirstFlippDone()
AVMGetDRCScanMode BOOL AVMGetDRCScanMode(AVMDrcScanMode *outScanMode) Gets the DRC scan mode. outScanMode serves as the pointer to write the scan mode to.
AVMGetDrcMode BOOL AVMGetDRCMode(AVMDrcMode *outMode) Gets the current GamePad usage mode set. This represents the number of GamePads currently being used.
AVMProbeDRCNum int AVMProbeDRCNum(void) Called by AVMGetDRCMode, number of Gamepads loaded??
AVMGetDRCMode int AVMGetDRCMode(uint32_t *mode) Stores results of AVMProbeDRCNum in mode, if more than 2 Gamepads loaded(?) just returns 1
AVMProbeDRCNum uint32_t AVMProbeDRCNum(void)
AVMProbeDRCState BOOL AVMProbeDRCState(int drcnum) Returns state (Not/Active) for DRC number (only allows Gamepads 0, 1)
AVMSetDRCEnable BOOL AVMSetDRCEnable(BOOL enable)
AVMSetDRCGamma BOOL AVMSetDRCGamma(float *gamma)
AVMGetDRCChipRevision int AVMGetDRCChipRevision(int drcnum, uint32_t *revision) Returns 0 if successful, calls CCRCDCSysGetInfo, if 0 (no errors), gets chip revision from 0xC in stack. Can return -4 if SysGetInfo fails, or -2 if 100068E0 is 0
AVMGetDRHChipRevision int AVMGetDRHChipRevision(uint32_t *revision) Returns 0 if successful. Can return -2 if 100068E0 is 0

Config

Name Prototype Description
AVMReadSystemAspectRatioConfig int32_t AVMReadSystemAspectRatioConfig(AVMTvAspectRatio *outAspectRatio) Reads the TV aspect ratio set in the system config. outAspectRatio serves as the pointer to write the aspect ratio to. Returns 0 on success or a negative value on failure.
AVMReadSystemPortConfig int32_t AVMReadSystemPortConfig(TVEPort *outPort) Reads the TV port set in the system config. outPort servers as the pointer to write the port to. Returns 0 on success or a negative value on failure.
AVMReadSystemTVUnderScanConfig int32_t AVMReadSystemTVUnderScanConfig(uint32_t *outUnderScan) Reads the TV under scan set in the system config. outUnderScan serves as the pointer to write the under scan to. Returns 0 on success or a negative value on failure.
AVMReadSystemVideoResConfig int32_t AVMReadSystemVideoResConfig(AVMTvResolution *outResolution) Reads the TV resolution set in the system config. outResolution serves as the pointer to write the resolution to. Returns 0 on success or a negative value on failure.
AVMWriteSystemAspectRatioConfig int32_t AVMWriteSystemAspectRatioConfig(AVMTvAspectRatio aspectRatio) Writes a specified TV aspect ratio to the system config. Returns 0 on success or a negative value on failure.
AVMWriteSystemTVUnderScanConfig int32_t AVMWriteSystemTVUnderScanConfig(uint32_t underScan) Writes a specified TV under scan to the system config. Returns 0 on success or a negative value on failure.
AVMWriteSystemVideoOutConfig int32_t AVMWriteSystemVideoOutConfig(TVEPort port, AVMTvResolution resolution) Writes a specified TV port and resolution to the system config. Returns 0 on success or a negative value on failure.
AVMWriteSystemVideoResConfig int32_t AVMWriteSystemVideoResConfig(AVMTvResolution resolution) Writes a specified TV resolution to the system config. Returns 0 on success or a negative value on failure.

CEC

Name Prototype Description
AVMCECInit BOOL AVMCECInit(void) Initialises CEC. Returns TRUE on success
AVMEnableCEC void AVMEnableCEC(void) Enables CEC.
AVMDisableCEC void AVMDisableCEC(void) Disables CEC.
AVMCECSendCommand BOOL AVMCECSendCommand(TVECECLogicalAddress destination, TVECECOpCode opCode, uint8_t *parameters, uint8_t numParameters) Sends a CEC command. The logical address of the device where the command should be sent to is specified by destination. Returns TRUE on success.
AVMCECReceiveCommand BOOL AVMCECReceiveCommand(TVECECLogicalAddress *outInitiator, TVECECOpCode *outOpCode, uint8_t *outParameters, uint8_t *outNumParameters) Gets the last received CEC command. This will return success even if no new command has been received. The caller should check that the parameters were actually written to.


Enums

TV

typedef enum
{
   AVM_TV_ASPECT_RATIO_4_3, // 4:3
   AVM_TV_ASPECT_RATIO_16_9, // 16:9
} AVMTvAspectRatio;
typedef enum
{
   AVM_TV_RESOLUTION_576I       = 1,
   AVM_TV_RESOLUTION_480I       = 2,
   AVM_TV_RESOLUTION_480P       = 3,
   AVM_TV_RESOLUTION_720P       = 4,
   AVM_TV_RESOLUTION_720P_3D    = 5,
   AVM_TV_RESOLUTION_1080I      = 6,
   AVM_TV_RESOLUTION_1080P      = 7,
   AVM_TV_RESOLUTION_480I_PAL60 = 10,
   AVM_TV_RESOLUTION_576P       = 11,
   AVM_TV_RESOLUTION_720P_50HZ  = 12,
   AVM_TV_RESOLUTION_1080I_50HZ = 13,
   AVM_TV_RESOLUTION_1080P_50HZ = 14,
} AVMTvResolution;
typedef enum
{
   AVM_TV_VIDEO_REGION_NTSC = 1,
   AVM_TV_VIDEO_REGION_PAL,
} AVMTvVideoRegion;

DRC

typedef enum {
    TV_AUDIO_MONO = 0, //Monaural in Settings
    TV_AUDIO_STEREO = 1,
    TV_AUDIO_SURROUND = 3 //???
} TVAudioMode;
//Possibly refresh rates?
typedef enum
{
   AVM_DRC_SCAN_MODE_UNKNOWN_0   = 0,
   AVM_DRC_SCAN_MODE_UNKNOWN_1   = 1,
   AVM_DRC_SCAN_MODE_UNKNOWN_3   = 3,
   AVM_DRC_SCAN_MODE_UNKNOWN_255 = 255,
} AVMDrcScanMode;
typedef enum
{
   AVM_DRC_MODE_NONE   = 0,
   AVM_DRC_MODE_SINGLE = 1,
   AVM_DRC_MODE_DOUBLE = 2,
} AVMDrcMode;