Minor doc, organizing

This commit is contained in:
NicknineTheEagle 2020-12-05 23:12:12 +03:00
parent 359e6fc540
commit 2259e163f1

View File

@ -161,14 +161,13 @@ typedef struct {
uint32_t stream_type; /* rough codec value */
uint32_t subblock_id; /* internal id to reference in section3 */
uint8_t subbank_index; /* ID of the entry in DC bank */
int is_localized;
int is_stereo;
int loop_flag; /* stream loops (normally internal sfx, but also external music) */
int loop_start; /* usually 0 */
int num_samples; /* should match manually calculated samples */
int sample_rate;
int channels;
int is_stereo; /* found in old PS2 games */
off_t xma_header_offset; /* some XMA have extra header stuff */
int layer_count; /* number of layers in a layer type */
@ -185,6 +184,7 @@ typedef struct {
int is_streamed; /* sound is streamed from storage */
int is_cd_streamed; /* found in PS2 BNM */
int is_external; /* sound is in an external file */
int is_localized; /* found in old PS2 games, determines which file the sound is in */
char resource_name[0x28]; /* filename to the external stream, or internal stream info for some games */
char readable_name[255]; /* final subsong name */
@ -995,10 +995,12 @@ static VGMSTREAM* init_vgmstream_ubi_sb_base(ubi_sb_header* sb, STREAMFILE* sf_h
case UBI_ADPCM:
/* custom Ubi 4/6-bit ADPCM used in early games:
* - Splinter Cell (PC): 4-bit w/ 2ch (music), 6-bit w/ 1ch (sfx)
* - Batman: Vengeance (PC): 4-bit w/ 2ch (music), 6-bit w/ 1ch (sfx)
* - Myst IV (PC/Xbox): 4bit-1ch (amb), some files only (ex. sfx_si_puzzle_stream.sb2)
* - possibly others */
* - Splinter Cell (PC): 4-bit w/ 1ch/2ch (all streams + menu music)
* - Batman: Vengeance (PC): 4-bit w/ 1ch/2ch (all streams)
* - Myst IV (PC/Xbox): 4-bit w/ 1ch (amb), some files only (ex. sfx_si_puzzle_stream.sb2)
* - The Jungle Book: Rhythm n' Groove (PC): 4-bit w/ 2ch (music/amb), 6-bit w/ 1ch (speech)
* - possibly others
* internal extension is .adp, maybe this can be called FMT_ADP */
/* skip extra header (some kind of id?) found in Myst IV */
if (read_32bitBE(start_offset + 0x00, sf_data) != 0x08000000 &&
@ -2213,7 +2215,7 @@ static int parse_stream_codec(ubi_sb_header* sb) {
sb->codec = FMT_APM;
break;
case 0x06: /* The Jungle Book (internal extension is .adp, maybe Ubi ADPCM can be considered FMT_ADP) */
case 0x06:
sb->codec = UBI_ADPCM;
break;
#if 0
@ -2647,17 +2649,19 @@ static void config_sb_audio_fb(ubi_sb_header* sb, off_t flag_bits, int streamed_
sb->cfg.audio_subblock_and = subblock_and;
sb->cfg.audio_loop_and = loop_and;
}
static void config_sb_audio_fb_ps2_bnm(ubi_sb_header *sb, off_t flag_bits, int streamed_and, int cd_streamed_and, int loop_and) {
/* audio header with standard flags */
static void config_sb_audio_ps2_bnm(ubi_sb_header *sb, off_t flag_bits, int streamed_and, int cd_streamed_and, int loop_and, off_t channels, off_t sample_rate) {
/* bit flags, channels and sample rate */
sb->cfg.audio_streamed_flag = flag_bits;
sb->cfg.audio_cd_streamed_flag = flag_bits;
sb->cfg.audio_loop_flag = flag_bits;
sb->cfg.audio_streamed_and = streamed_and;
sb->cfg.audio_cd_streamed_and = cd_streamed_and;
sb->cfg.audio_loop_and = loop_and;
sb->cfg.audio_channels = channels;
sb->cfg.audio_sample_rate = sample_rate;
}
static void config_sb_audio_ps2_old(ubi_sb_header* sb, off_t flag_bits, int streamed_and, int loop_and, int loc_and, int stereo_and, off_t pitch, off_t sample_rate) {
/* sample rate only, bit flags */
/* bit flags, sample rate only */
sb->cfg.audio_streamed_flag = flag_bits;
sb->cfg.audio_loop_flag = flag_bits;
sb->cfg.audio_loc_flag = flag_bits;
@ -3061,7 +3065,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
config_sb_audio_fs(sb, 0x2c, 0x00, 0x30);
config_sb_audio_hs(sb, 0x42, 0x3c, 0x34, 0x34, 0x48, 0x44);
/* has internal names but they're partially overwritten by sound index */
/* has internal names but they're partially overwritten by subbank index */
config_sb_sequence(sb, 0x24, 0x18);
@ -3078,8 +3082,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
sb->version = 0x00000000; /* for convenience */
config_sb_entry(sb, 0x1c, 0x44);
config_sb_audio_fb_ps2_bnm(sb, 0x18, (1 << 5), (1 << 6), (1 << 7));
config_sb_audio_hs(sb, 0x20, 0x22, 0x00, 0x00, 0x00, 0x1c);
config_sb_audio_ps2_bnm(sb, 0x18, (1 << 5), (1 << 6), (1 << 7), 0x20, 0x22);
sb->cfg.audio_interleave = 0x400;
config_sb_sequence(sb, 0x24, 0x14);