Add PSI file reading in Opus for loops in BlazBlue: Cross Tag Battle (Switch)

This commit is contained in:
bxaimc 2018-05-16 17:58:09 -04:00
parent 6ef7776de3
commit caf3bb871c
2 changed files with 19 additions and 4 deletions

View File

@ -250,6 +250,7 @@ static const char* extension_list[] = {
"pos",
"ps2stm", //fake extension for .stm (to be removed)
"psh", // fake extension for VSV(?) Dawn of Mana needs to be checked again
"psi", // PSI Metadata for Opus - BlazBlue: Cross Tag Battle (Switch), Maybe others?
"psnd",
"psw", //fake extension for .wam

View File

@ -88,6 +88,7 @@ fail:
/* standard Switch Opus, Nintendo header + raw data (generated by opus_test.c?) [Lego City Undercover (Switch)] */
VGMSTREAM * init_vgmstream_opus_std(STREAMFILE *streamFile) {
STREAMFILE * PSIFile = NULL;
off_t offset = 0;
int num_samples = 0, loop_start = 0, loop_end = 0;
@ -95,10 +96,23 @@ VGMSTREAM * init_vgmstream_opus_std(STREAMFILE *streamFile) {
if (!check_extensions(streamFile,"opus,lopus"))
goto fail;
offset = 0x00;
num_samples = 0;
loop_start = 0;
loop_end = 0;
/* BlazBlue: Cross Tag Battle (Switch) PSI Metadata for corresponding Opus */
/* Maybe future Arc System Works games will use this too? */
PSIFile = open_streamfile_by_ext(streamFile, "psi");
offset = 0x00;
if (PSIFile){
num_samples = read_32bitLE(0x8C, PSIFile);
loop_start = read_32bitLE(0x84, PSIFile);
loop_end = read_32bitLE(0x88, PSIFile);
close_streamfile(PSIFile);
}
else {
num_samples = 0;
loop_start = 0;
loop_end = 0;
}
return init_vgmstream_opus(streamFile, meta_OPUS, offset, num_samples,loop_start,loop_end);
fail: