mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
aix_layout.c fixed (for compiling in MS VC++)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@540 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
cd5020edf1
commit
3e63969795
@ -10,6 +10,7 @@ void render_vgmstream_aix(sample * buffer, int32_t sample_count, VGMSTREAM * vgm
|
||||
int samples_to_do;
|
||||
int samples_this_block = data->sample_counts[data->current_segment];
|
||||
int current_stream;
|
||||
int channels_sofar = 0;
|
||||
|
||||
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
|
||||
data->current_segment = 1;
|
||||
@ -66,7 +67,6 @@ void render_vgmstream_aix(sample * buffer, int32_t sample_count, VGMSTREAM * vgm
|
||||
samples_to_do = AIX_BUFFER_SIZE/2;
|
||||
}
|
||||
|
||||
int channels_sofar = 0;
|
||||
for (current_stream = 0; current_stream < data->stream_count; current_stream++)
|
||||
{
|
||||
int i,j;
|
||||
|
139
src/meta/emff.c
139
src/meta/emff.c
@ -9,40 +9,40 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) {
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int frequency;
|
||||
int i;
|
||||
int channel_count;
|
||||
int frequency;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("emff",filename_extension(filename))) goto fail;
|
||||
|
||||
/* do some checks on the file, cause we have no magic words to check the header...
|
||||
it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1
|
||||
it has a text section, if both are 1 it's video with a text section included... */
|
||||
if (read_32bitBE(0x800,streamFile) == 0x01000000 || /* "0x01000000" */
|
||||
read_32bitBE(0x804,streamFile) == 0x01000000) /* "0x01000000" */
|
||||
goto fail;
|
||||
it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1
|
||||
it has a text section, if both are 1 it's video with a text section included... */
|
||||
if (read_32bitBE(0x800,streamFile) == 0x01000000 || /* "0x01000000" */
|
||||
read_32bitBE(0x804,streamFile) == 0x01000000) /* "0x01000000" */
|
||||
goto fail;
|
||||
|
||||
frequency = read_32bitLE(0x0,streamFile);
|
||||
channel_count = read_32bitLE(0xC,streamFile);
|
||||
frequency = read_32bitLE(0x0,streamFile);
|
||||
channel_count = read_32bitLE(0xC,streamFile);
|
||||
|
||||
if (frequency > 48000 ||
|
||||
channel_count > 8) {
|
||||
goto fail;
|
||||
}
|
||||
if (frequency > 48000 ||
|
||||
channel_count > 8) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
loop_flag = (read_32bitLE(0x4,streamFile) != 0xFFFFFFFF);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
loop_flag = (read_32bitLE(0x4,streamFile) != 0xFFFFFFFF);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->sample_rate = frequency;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->sample_rate = frequency;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
|
||||
vgmstream->layout_type = layout_emff_ps2_blocked;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
@ -55,13 +55,13 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) {
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Calc num_samples */
|
||||
/* Calc num_samples */
|
||||
emff_ps2_block_update(start_offset,vgmstream);
|
||||
vgmstream->num_samples = read_32bitLE(0x8,streamFile);;
|
||||
if (loop_flag) {
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (read_32bitLE(0x28,streamFile)-start_offset)*28/16/channel_count;
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x8,streamFile);
|
||||
}
|
||||
@ -82,67 +82,66 @@ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) {
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int frequency;
|
||||
int i;
|
||||
int j;
|
||||
off_t coef_table[8];
|
||||
int channel_count;
|
||||
int frequency;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("emff",filename_extension(filename))) goto fail;
|
||||
|
||||
/* do some checks on the file, cause we have no magic words to check the header...
|
||||
it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1
|
||||
it has a text section, if both are 1 it's video with a text section included... */
|
||||
if (read_32bitBE(0x800,streamFile) == 0x00000001 || /* "0x00000001" */
|
||||
read_32bitBE(0x804,streamFile) == 0x00000001) /* "0x00000001" */
|
||||
goto fail;
|
||||
it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1
|
||||
it has a text section, if both are 1 it's video with a text section included... */
|
||||
if (read_32bitBE(0x800,streamFile) == 0x00000001 || /* "0x00000001" */
|
||||
read_32bitBE(0x804,streamFile) == 0x00000001) /* "0x00000001" */
|
||||
goto fail;
|
||||
|
||||
frequency = read_32bitBE(0x0,streamFile);
|
||||
channel_count = read_32bitBE(0xC,streamFile);
|
||||
channel_count = read_32bitBE(0xC,streamFile);
|
||||
|
||||
if (frequency > 48000 ||
|
||||
channel_count > 8) {
|
||||
goto fail;
|
||||
}
|
||||
if (frequency > 48000 ||
|
||||
channel_count > 8) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
loop_flag = (read_32bitBE(0x4,streamFile) != 0xFFFFFFFF);
|
||||
loop_flag = (read_32bitBE(0x4,streamFile) != 0xFFFFFFFF);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->sample_rate = frequency;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->sample_rate = frequency;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
|
||||
/* Retrieving coefs and loops, depending on the file layout... */
|
||||
/* Found in Tomb Raider - Legend for GameCube */
|
||||
/* Retrieving coefs and loops, depending on the file layout... */
|
||||
/* Found in Tomb Raider - Legend for GameCube */
|
||||
if (read_32bitBE(0xC8,streamFile) > 0x0) {
|
||||
off_t coef_table[8] = {0xC8,0xF6,0x124,0x152,0x180,0x1AE,0x1DC,0x20A};
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
/* Found in Tomb Raider - Anniversary for WII */
|
||||
} else if (read_32bitBE(0xCC,streamFile) > 0x0) {
|
||||
} else if (read_32bitBE(0xCC,streamFile) > 0x0) {
|
||||
off_t coef_table[8] = {0xCC,0xFA,0x128,0x156,0x184,0x1B2,0x1E0,0x20E};
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
/* Found in Tomb Raider - Underworld for WII */
|
||||
} else if (read_32bitBE(0x2D0,streamFile) > 0x0) {
|
||||
off_t coef_table[8] = {0x2D0,0x2FE,0x32C,0x35A,0x388,0x3B6,0x3E4,0x412};
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
}
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -160,16 +159,16 @@ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) {
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Calc num_samples */
|
||||
emff_ngc_block_update(start_offset,vgmstream);
|
||||
/* Calc num_samples */
|
||||
emff_ngc_block_update(start_offset,vgmstream);
|
||||
vgmstream->num_samples = read_32bitBE(0x8,streamFile);;
|
||||
if (loop_flag) {
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (read_32bitBE(0x28,streamFile))*14/8/channel_count;
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x8,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user