This commit is contained in:
bnnm 2021-08-07 20:56:31 +02:00
parent d4e697fdbe
commit d8cd1487ea
7 changed files with 79 additions and 78 deletions

View File

@ -395,7 +395,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM* vgmstream) {
case coding_IMA:
case coding_DVI_IMA:
case coding_SNDS_IMA:
case coding_OTNS_IMA:
case coding_QD_IMA:
case coding_UBI_IMA:
case coding_UBI_SCE_IMA:
case coding_OKI16:
@ -631,7 +631,7 @@ int get_vgmstream_frame_size(VGMSTREAM* vgmstream) {
case coding_RAD_IMA_mono:
return 0x14;
case coding_SNDS_IMA:
case coding_OTNS_IMA:
case coding_QD_IMA:
return 0; //todo: 0x01?
case coding_UBI_IMA: /* variable (PCM then IMA) */
return 0;
@ -1173,7 +1173,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch);
}
break;
case coding_OTNS_IMA:
case coding_QD_IMA:
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_otns_ima(vgmstream, &vgmstream->ch[ch], buffer+ch,
vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch);

View File

@ -747,7 +747,7 @@ static const coding_info coding_info_list[] = {
{coding_DVI_IMA_int, "Intel DVI 4-bit IMA ADPCM (mono/interleave)"},
{coding_3DS_IMA, "3DS IMA 4-bit ADPCM"},
{coding_SNDS_IMA, "Heavy Iron .snds 4-bit IMA ADPCM"},
{coding_OTNS_IMA, "Omikron: The Nomad Soul 4-bit IMA ADPCM"},
{coding_QD_IMA, "Quantic Dream 4-bit IMA ADPCM"},
{coding_WV6_IMA, "Gorilla Systems WV6 4-bit IMA ADPCM"},
{coding_ALP_IMA, "High Voltage ALP 4-bit IMA ADPCM"},
{coding_FFTA2_IMA, "Final Fantasy Tactics A2 4-bit IMA ADPCM"},
@ -1167,7 +1167,7 @@ static const meta_info meta_info_list[] = {
{meta_HYPERSCAN_KVAG, "Mattel Hyperscan KVAG"},
{meta_IOS_PSND, "PSND Header"},
{meta_BOS_ADP, "ADP! header"},
{meta_OTNS_ADP, "Omikron: The Nomad Soul ADP header"},
{meta_QD_ADP, "Quantic Dream .ADP header"},
{meta_EB_SFX, "Excitebots .sfx header"},
{meta_EB_SF0, "assumed Excitebots .sf0 by extension"},
{meta_MTAF, "Konami MTAF header"},

View File

@ -533,9 +533,9 @@ VGMSTREAM * init_vgmstream_hyperscan_kvag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ios_psnd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_pc_adp_bos(STREAMFILE* streamFile);
VGMSTREAM* init_vgmstream_adp_bos(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_pc_adp_otns(STREAMFILE* streamFile);
VGMSTREAM* init_vgmstream_adp_qd(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_eb_sfx(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_eb_sf0(STREAMFILE* streamFile);

View File

@ -1,45 +1,43 @@
#include "meta.h"
/* ADP - from Balls of Steel */
VGMSTREAM * init_vgmstream_pc_adp_bos(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
VGMSTREAM* init_vgmstream_adp_bos(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int loop_flag = 0;
int channel_count;
int channels;
if (!check_extensions(streamFile,"adp")) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x41445021) /* "ADP!" */
/* checks */
if (!check_extensions(sf,"adp"))
goto fail;
loop_flag = (-1 != read_32bitLE(0x08,streamFile));
channel_count = 1;
if (!is_id32be(0x00,sf, "ADP!"))
goto fail;
loop_flag = (-1 != read_s32le(0x08,sf));
channels = 1;
start_offset = 0x18;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x18;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
vgmstream->num_samples = read_32bitLE(0x04,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile);
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->sample_rate = read_s32le(0x0C,sf);
vgmstream->num_samples = read_s32le(0x04,sf);
vgmstream->loop_start_sample = read_s32le(0x08,sf);
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->coding_type = coding_DVI_IMA_int;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_BOS_ADP;
// 0x10, 0x12 - both initial history?
//vgmstream->ch[0].adpcm_history1_32 = read_16bitLE(0x10,streamFile);
//vgmstream->ch[0].adpcm_history1_32 = read_16bitLE(0x10,sf);
// 0x14 - initial step index?
//vgmstream->ch[0].adpcm_step_index = read_32bitLE(0x14,streamFile);
//vgmstream->ch[0].adpcm_step_index = read_32bitLE(0x14,sf);
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;

View File

@ -1,43 +1,46 @@
#include "meta.h"
/* ADP - from Omikron: The Nomad Soul (PC/DC) */
VGMSTREAM * init_vgmstream_pc_adp_otns(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset, datasize;
int loop_flag = 0, channel_count, stereo_flag;
if (!check_extensions(streamFile,"adp")) goto fail;
/* no ID, only a basic 0x10 header with filesize and nulls; do some extra checks */
datasize = read_32bitLE(0x00,streamFile) & 0x00FFFFFF; /*24 bit*/
if (datasize + 0x10 != streamFile->get_size(streamFile)
|| read_32bitLE(0x04,streamFile) != 0
|| read_32bitLE(0x08,streamFile) != 0
|| read_32bitLE(0x0c,streamFile) != 0)
goto fail;
stereo_flag = read_8bit(0x03, streamFile);
if (stereo_flag > 1 || stereo_flag < 0) goto fail;
channel_count = stereo_flag ? 2 : 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
start_offset = 0x10;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 22050;
vgmstream->num_samples = channel_count== 1 ? datasize*2 : datasize;
vgmstream->coding_type = coding_OTNS_IMA;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_OTNS_ADP;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}
#include "meta.h"
/* ADP - from Omikron: The Nomad Soul (PC/DC) */
VGMSTREAM* init_vgmstream_adp_qd(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset, data_size;
int loop_flag = 0, channels, stereo_flag;
/* checks */
if (!check_extensions(sf,"adp"))
goto fail;
/* no ID, only a basic 0x10 header with filesize and nulls; do some extra checks */
data_size = read_u32le(0x00,sf) & 0x00FFFFFF; /*24 bit*/
if (data_size + 0x10 != sf->get_size(sf)
|| read_u32le(0x04,sf) != 0
|| read_u32le(0x08,sf) != 0
|| read_u32le(0x0c,sf) != 0)
goto fail;
stereo_flag = read_u8(0x03, sf);
if (stereo_flag > 1 || stereo_flag < 0) goto fail;
channels = stereo_flag ? 2 : 1;
start_offset = 0x10;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_QD_ADP;
vgmstream->sample_rate = 22050;
vgmstream->num_samples = data_size * 2 / channels;
vgmstream->coding_type = coding_QD_IMA;
vgmstream->layout_type = layout_none;
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -275,8 +275,8 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_ps2_wmus,
init_vgmstream_hyperscan_kvag,
init_vgmstream_ios_psnd,
init_vgmstream_pc_adp_bos,
init_vgmstream_pc_adp_otns,
init_vgmstream_adp_bos,
init_vgmstream_adp_qd,
init_vgmstream_eb_sfx,
init_vgmstream_eb_sf0,
init_vgmstream_mtaf,

View File

@ -106,7 +106,7 @@ typedef enum {
coding_DVI_IMA_int, /* DVI IMA ADPCM (mono/interleave, high nibble first) */
coding_3DS_IMA, /* 3DS IMA ADPCM */
coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */
coding_OTNS_IMA, /* Omikron The Nomad Soul IMA ADPCM */
coding_QD_IMA,
coding_WV6_IMA, /* Gorilla Systems WV6 4-bit IMA ADPCM */
coding_ALP_IMA, /* High Voltage ALP 4-bit IMA ADPCM */
coding_FFTA2_IMA, /* Final Fantasy Tactics A2 4-bit IMA ADPCM */
@ -558,8 +558,8 @@ typedef enum {
meta_PS2_WMUS, /* The Warriors (PS2) */
meta_HYPERSCAN_KVAG, /* Hyperscan KVAG/BVG */
meta_IOS_PSND, /* Crash Bandicoot Nitro Kart 2 (iOS) */
meta_BOS_ADP, /* ADP! (Balls of Steel, PC) */
meta_OTNS_ADP, /* Omikron: The Nomad Soul .adp (PC/DC) */
meta_BOS_ADP,
meta_QD_ADP,
meta_EB_SFX, /* Excitebots .sfx */
meta_EB_SF0, /* Excitebots .sf0 */
meta_MTAF,