Found at 80011F6C
Summary
Does some unknown audio stuff and enqueues the commands necessary to play an ADPCM file, identified by the caller passed index, in the cdXaStreamingTable.
Behavior
The first part of the function is audio related since the unidentified function called lives in the sound engine section. The bitFlags field of the XA streaming table entry for the STR the caller wants to play are masked with xC to isolate the top two bits of its 1st nibble. This determines which parameter is passed to the unidentified function.
The following two commands are enqueued:
- Mute the CD
- Set filter using the file id and channel number of the streaming table entry the caller selected.
Assign a mode value of x48 to the first args union, then check if the first bit of the bitFlag member is set, if it is set the double speed bit in our mode value as well, this changes the mode value to xC8. Then enqueue the command to set the CD mode.
The last argument that needs to be figured out before enqueuing the remaining commands is the position of the STR in MSF BCD. This is done with a call to CdIntToPos with the LBA position of the file from the streaming table entry. The result is written to the second args union.
The remaining commands are then enqueued which are demute, nop, stream, mute, and pause followed by setting some global variables used by cdlib_xa_manager after the stream starts playing. The values are the index to the entry the caller wants to play and the start LBA of the file.
Notes
- The function only references the XA streaming table not the file lookup table.
- For a reference on what files are played through this function check cdlib_init_lookup_tables.
- The main two categories for plays queued through here are audio for in game cut scenes that are transform streamed and the some audio remarks like what spike says at the beginning of a stage, passing out and the game over taunts.
- The ghidra decomp is a little funky for the following reason:
There are actually two CdArgs union one for mode and one for pos but since they are so close together in memory ghidra thinks its just one union in the shape of our largest size which is CdLdFile hence the decomp artifact of the set mode arg being sector count instead of mode.
Unknowns
- The audio stuff at the beginning of the function.
Function Signature
Parameters: 1
strTableIndex: index to the XA streaming table
Returns:
Always 0