mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
ubisoft .sns (Red Steel 2)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@755 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
75fab282ba
commit
1eb20e259f
@ -403,6 +403,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
if(!stricmp_utf8(p_extension,"smp")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"snd")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"sng")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"sns")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"spd")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"sps")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"spsd")) return 1;
|
||||
@ -659,6 +660,7 @@ DECLARE_MULTIPLE_FILE_TYPE("SLI Audio File (*.SLI)", sli);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SMP Audio File (*.SMP)", smp);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SND Audio File (*.SND)", snd);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SNG Audio File (*.SNG)", sng);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SNS Audio File (*.SNS)", sns);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SPD Audio File (*.SPD)", spd);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SPS Audio File (*.SPS)", sps);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("SPSD Audio File (*.SPSD)", spsd);
|
||||
|
@ -127,6 +127,7 @@ GC/Wii DSP ADPCM:
|
||||
- .pdt
|
||||
- .sdt
|
||||
- .smp
|
||||
- .sns
|
||||
- .spt+.spd
|
||||
- .ssm
|
||||
- .stm/.dsp
|
||||
|
@ -111,15 +111,20 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
off_t mwv_pflt_offset = -1;
|
||||
off_t mwv_ctrl_offset = -1;
|
||||
|
||||
/* Ubisoft sns */
|
||||
int sns = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("wav",filename_extension(filename)) &&
|
||||
strcasecmp("lwav",filename_extension(filename)))
|
||||
{
|
||||
if (strcasecmp("mwv",filename_extension(filename)))
|
||||
goto fail;
|
||||
else
|
||||
if (!strcasecmp("mwv",filename_extension(filename)))
|
||||
mwv = 1;
|
||||
else if (!strcasecmp("sns",filename_extension(filename)))
|
||||
sns = 1;
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* check header */
|
||||
@ -189,6 +194,11 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
coding_type = coding_L5_555;
|
||||
interleave = 0x12;
|
||||
break;
|
||||
case 0x5050: /* Ubisoft .sns uses this for DSP */
|
||||
if (!sns) goto fail;
|
||||
coding_type = coding_NGC_DSP;
|
||||
interleave = 8;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
@ -244,7 +254,8 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
mwv_ctrl_offset = current_chunk;
|
||||
break;
|
||||
case 0x66616374: /* fact */
|
||||
if (chunk_size != 4) break;
|
||||
if (chunk_size != 4
|
||||
&& (!(sns && chunk_size == 0x10))) break;
|
||||
fact_sample_count = read_32bitLE(current_chunk+8, streamFile);
|
||||
break;
|
||||
default:
|
||||
@ -274,6 +285,13 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* .sns uses fact chunk */
|
||||
if (sns)
|
||||
{
|
||||
if (-1 == fact_sample_count) goto fail;
|
||||
sample_count = fact_sample_count;
|
||||
}
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
@ -346,6 +364,25 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_MWV;
|
||||
}
|
||||
|
||||
if (sns)
|
||||
{
|
||||
int c;
|
||||
/* common codebook? */
|
||||
static const int16_t coef[16] =
|
||||
{0x04ab,0xfced,0x0789,0xfedf,0x09a2,0xfae5,0x0c90,0xfac1,
|
||||
0x084d,0xfaa4,0x0982,0xfdf7,0x0af6,0xfafa,0x0be6,0xfbf5};
|
||||
|
||||
for (c = 0; c < channel_count; c++)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
vgmstream->ch[c].adpcm_coef[i] = coef[i];
|
||||
}
|
||||
}
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_SNS;
|
||||
}
|
||||
|
||||
/* open the file, set up each channel */
|
||||
{
|
||||
int i;
|
||||
|
@ -2261,6 +2261,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_RIFF_WAVE_MWV:
|
||||
snprintf(temp,TEMPSIZE,"RIFF WAVE header with .mwv flavoring");
|
||||
break;
|
||||
case meta_RIFF_WAVE_SNS:
|
||||
snprintf(temp,TEMPSIZE,"RIFF WAVE header with .sns flavoring");
|
||||
break;
|
||||
case meta_FFCC_STR:
|
||||
snprintf(temp,TEMPSIZE,"Final Fantasy: Crystal Chronicles STR header");
|
||||
break;
|
||||
|
@ -388,6 +388,7 @@ typedef enum {
|
||||
meta_RIFF_WAVE_labl_Marker, /* RIFF w/ loop Markers in LIST-adtl-labl */
|
||||
meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */
|
||||
meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */
|
||||
meta_RIFF_WAVE_SNS, /* .sns RIFF */
|
||||
meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */
|
||||
meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */
|
||||
meta_PC_MXST, /* Lego Island MxSt */
|
||||
|
@ -163,6 +163,7 @@ gchar *vgmstream_exts [] = {
|
||||
"smp",
|
||||
"snd",
|
||||
"sng",
|
||||
"sns",
|
||||
"spd",
|
||||
"sps",
|
||||
"spsd",
|
||||
|
@ -231,6 +231,7 @@ char * extension_list[] = {
|
||||
"smp\0SMP Audio File (*.SMP)\0",
|
||||
"snd\0SND Audio File (*.SND)\0",
|
||||
"sng\0SNG Audio File (*.SNG)\0",
|
||||
"sns\0SNS Audio File (*.SNS)\0",
|
||||
"spd\0SPD Audio File (*.SPD)\0",
|
||||
"sps\0SPS Audio File (*.SPS)\0",
|
||||
"spsd\0SPSD Audio File (*.SPSD)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user