Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bnnm 2016-10-31 00:37:17 +01:00
commit 5cd11594e2
9 changed files with 56 additions and 46 deletions

View File

@ -769,7 +769,7 @@ int clHCA_isOurFile1(const void *data, unsigned int size){
int minsize;
if (size<8)return -1;
minsize = clHCA_isOurFile0(data);
if (minsize < 0 || minsize > size)return -1;
if (minsize < 0 || (unsigned int)minsize > size)return -1;
if (clHCA_CheckSum(data, minsize, 0))return -1;
return 0;
}
@ -793,10 +793,12 @@ void clHCA_DecodeSamples16(clHCA *hca,signed short *samples){
const float scale = 32768.0f;
float f;
signed int s;
int i, j;
unsigned int k, l;
//const float _rva_volume=hca->_rva_volume;
for(int i=0;i<8;i++){
for(int j=0;j<0x80;j++){
for(unsigned int k=0,l=hca->_channelCount;k<l;k++){
for(i=0;i<8;i++){
for(j=0;j<0x80;j++){
for(k=0,l=hca->_channelCount;k<l;k++){
f=hca->_channel[k].wave[i][j]/**_rva_volume*/;
if(f>1){f=1;}else if(f<-1){f=-1;}
s=(signed int)(f*scale);
@ -981,7 +983,7 @@ void clCipher_Init56(clCipher *cipher,unsigned int key1,unsigned int key2){
unsigned char t2[0x10];
unsigned char t3[0x100],t31[0x10],t32[0x10],*t;
int i, v;
int i, j, v;
if(!key1)key2--;
key1--;
@ -1004,10 +1006,11 @@ void clCipher_Init56(clCipher *cipher,unsigned int key1,unsigned int key2){
// テーブル3
t=t3;
clCipher_Init56_CreateTable(t31,t1[0]);
for(int i=0;i<0x10;i++){
for(i=0;i<0x10;i++){
unsigned char v;
clCipher_Init56_CreateTable(t32,t2[i]);
unsigned char v=t31[i]<<4;
for(int j=0;j<0x10;j++){
v=t31[i]<<4;
for(j=0;j<0x10;j++){
*(t++)=v|t32[j];
}
}
@ -1028,8 +1031,9 @@ void clCipher_Init56(clCipher *cipher,unsigned int key1,unsigned int key2){
void clCipher_Init56_CreateTable(unsigned char *r,unsigned char key){
int mul=((key&1)<<3)|5;
int add=(key&0xE)|1;
int i;
key>>=4;
for(int i=0;i<0x10;i++){
for(i=0;i<0x10;i++){
key=(key*mul+add)&0xF;
*(r++)=key;
}
@ -1193,7 +1197,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
// comm
if(size>=5 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='comm'){
void * newmem;
int i;
unsigned int i;
clData_AddBit(&d,32);
hca->_comm_len=clData_GetBit(&d,8);
if(hca->_comm_len>size)return -1;
@ -1673,11 +1677,11 @@ void stChannel_Decode5(stChannel *ch,int index){
for(i=0,count1=0x40,count2=1;i<7;i++,count1>>=1,count2<<=1){
const float *list1Float=(const float *)stChannel_Decode5_list1Int[i];
const float *list2Float=(const float *)stChannel_Decode5_list2Int[i];
float *d1, *d2, *w;
s1=s;
s2=&s1[count2];
float *d1=d;
float *d2=&d1[count2*2-1];
float *w;
d1=d;
d2=&d1[count2*2-1];
for(j=0;j<count1;j++){
for(k=0;k<count2;k++){
float a=*(s1++);
@ -1698,10 +1702,9 @@ void stChannel_Decode5(stChannel *ch,int index){
for(i=0;i<0x80;i++)*(d++)=*(s++);
s=(const float *)stChannel_Decode5_list3Int;d=ch->wave[index];
s1=&ch->wav2[0x40];s2=ch->wav3;
for(int i=0;i<0x40;i++)*(d++)=*(s1++)**(s++)+*(s2++);
for(int i=0;i<0x40;i++)*(d++)=*(s++)**(--s1)-*(s2++);
for(i=0;i<0x40;i++)*(d++)=*(s1++)**(s++)+*(s2++);
for(i=0;i<0x40;i++)*(d++)=*(s++)**(--s1)-*(s2++);
s1=&ch->wav2[0x40-1];d=ch->wav3;
for(int i=0;i<0x40;i++)*(d++)=*(s1--)**(--s);
for(int i=0;i<0x40;i++)*(d++)=*(--s)**(++s1);
for(i=0;i<0x40;i++)*(d++)=*(s1--)**(--s);
for(i=0;i<0x40;i++)*(d++)=*(--s)**(++s1);
}

View File

@ -25,11 +25,11 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -33,15 +33,15 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -77,7 +77,6 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -102,7 +101,6 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -850,6 +850,10 @@
RelativePath=".\meta\ps2_svag.c"
>
</File>
<File
RelativePath=".\meta\ps2_svag_snk.c"
>
</File>
<File
RelativePath=".\meta\ps2_tec.c"
>

View File

@ -28,11 +28,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -66,8 +66,6 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -80,8 +78,6 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
@ -287,6 +283,7 @@
<ClCompile Include="meta\ps2_stm.c" />
<ClCompile Include="meta\ps2_str.c" />
<ClCompile Include="meta\ps2_svag.c" />
<ClCompile Include="meta\ps2_svag_snk.c" />
<ClCompile Include="meta\ps2_tec.c" />
<ClCompile Include="meta\ps2_tk5.c" />
<ClCompile Include="meta\ps2_vag.c" />

View File

@ -508,6 +508,9 @@
<ClCompile Include="meta\ps2_svag.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_svag_snk.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_tec.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -15,6 +15,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
int loop_flag;
int i, ima = 0;
off_t start_offset;
int section_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile, filename, sizeof(filename));
@ -28,7 +29,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
if ((uint16_t)read_16bitLE(4, streamFile) != 0xFEFF)
goto fail;
int section_count = read_16bitLE(0x10, streamFile);
section_count = read_16bitLE(0x10, streamFile);
for (i = 0; i < section_count; i++) {
temp_id = read_16bitLE(0x14 + i * 0xc, streamFile);
switch(temp_id) {

View File

@ -19,6 +19,7 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
off_t start_offset;
int founddata;
off_t tempoffset1;
int section_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile, filename, sizeof(filename));
@ -32,7 +33,7 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
if ((uint16_t)read_16bitBE(4, streamFile) != 0xFEFF)
goto fail;
int section_count = read_16bitBE(0x10, streamFile);
section_count = read_16bitBE(0x10, streamFile);
for (i = 0; i < section_count; i++) {
temp_id = read_16bitBE(0x14 + i * 0xc, streamFile);
switch(temp_id) {
@ -133,9 +134,10 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
}
if (vgmstream->coding_type == coding_NGC_DSP) {
off_t coeff_ptr_table;
VARDECL(off_t, coef_offset);
ALLOC(coef_offset, channel_count, off_t);
off_t coeff_ptr_table = read_32bitBE(info_offset + 0x1c, streamFile) + info_offset + 8; // Getting pointer for coefficient pointer table
coeff_ptr_table = read_32bitBE(info_offset + 0x1c, streamFile) + info_offset + 8; // Getting pointer for coefficient pointer table
for (i = 0; i < channel_count; i++) {
tempoffset1 = read_32bitBE(coeff_ptr_table + 8 + i * 8, streamFile);

View File

@ -11,24 +11,28 @@ VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset = 0x20;
int loop_flag;
int channel_count;
int loop_start_block;
int loop_end_block;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("svag",filename_extension(filename))) goto fail;
/* check SNK SVAG Header ("VAGm") */
if (read_32bitBE(0x00,streamFile) != 0x5641476D)
goto fail;
int sample_rate = read_32bitLE(0x08,streamFile);
int channel_count = read_32bitLE(0x0c,streamFile);
int blocks = read_32bitLE(0x10,streamFile);
/* int unk = read_32bitLE(0x14,streamFile);*/ /* always 0 */
int loop_start_block = read_32bitLE(0x18,streamFile);
int loop_end_block = read_32bitLE(0x1c,streamFile);
channel_count = read_32bitLE(0x0c,streamFile);
int loop_flag = loop_end_block > 0; /* loop_start_black can be 0 */
loop_start_block = read_32bitLE(0x18,streamFile);
loop_end_block = read_32bitLE(0x1c,streamFile);
loop_flag = loop_end_block > 0; /* loop_start_block can be 0 */
/* build the VGMSTREAM */
@ -40,8 +44,8 @@ VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
vgmstream->meta_type = meta_PS2_SVAG_SNK;
vgmstream->channels = channel_count;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = blocks * 28;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->num_samples = read_32bitLE(0x10,streamFile) * 28; /* size in blocks */
if( vgmstream->loop_flag ) {
vgmstream->loop_start_sample = loop_start_block * 28;
vgmstream->loop_end_sample = loop_end_block * 28;
@ -50,7 +54,6 @@ VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
vgmstream->interleave_block_size = 0x10;
int start_offset = 0x20;
/* open the file for reading */
{
int i;
@ -64,7 +67,6 @@ VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
vgmstream->ch[i].channel_start_offset =
vgmstream->ch[i].offset =
start_offset + vgmstream->interleave_block_size*i;
}
}