mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-07 15:01:24 +01:00
Fix some .his [Nancy Drew: Ghost Dogs of ML (PC)]
This commit is contained in:
parent
599326a362
commit
4cbffd0c68
@ -43,6 +43,9 @@ ogg_vorbis_codec_data* init_ogg_vorbis(STREAMFILE* sf, off_t start, off_t size,
|
|||||||
callbacks.close_func = ov_close_func;
|
callbacks.close_func = ov_close_func;
|
||||||
callbacks.tell_func = ov_tell_func;
|
callbacks.tell_func = ov_tell_func;
|
||||||
|
|
||||||
|
if (!size)
|
||||||
|
size = get_streamfile_size(sf) - start;
|
||||||
|
|
||||||
/* test if this is a proper Ogg Vorbis file, with the current (from init_x) STREAMFILE
|
/* test if this is a proper Ogg Vorbis file, with the current (from init_x) STREAMFILE
|
||||||
* (quick test without having to malloc first, though if one invoked this it'll probably success) */
|
* (quick test without having to malloc first, though if one invoked this it'll probably success) */
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
|
|
||||||
/* HIS - Her Interactive games [Nancy Drew series (PC)] */
|
/* HIS - Her Interactive games [Nancy Drew series (PC)] */
|
||||||
VGMSTREAM * init_vgmstream_his(STREAMFILE *sf) {
|
VGMSTREAM* init_vgmstream_his(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
int channels, loop_flag = 0, bps, sample_rate, num_samples, version;
|
int channels, loop_flag = 0, bps, sample_rate, num_samples, version, codec;
|
||||||
off_t start_offset;
|
uint32_t start_offset;
|
||||||
|
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
@ -17,8 +17,10 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE *sf) {
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (is_id32be(0x00,sf, "Her ")) { /* "Her Interactive Sound\x1a" */
|
if (is_id32be(0x00,sf, "Her ")) { /* "Her Interactive Sound\x1a" */
|
||||||
/* Nancy Drew: Secrets Can Kill (PC) */
|
|
||||||
version = 0;
|
version = 0;
|
||||||
|
codec = 1;
|
||||||
|
|
||||||
|
/* Nancy Drew: Secrets Can Kill (PC) */
|
||||||
channels = read_u16le(0x16,sf);
|
channels = read_u16le(0x16,sf);
|
||||||
sample_rate = read_u32le(0x18,sf);
|
sample_rate = read_u32le(0x18,sf);
|
||||||
/* 0x1c: bitrate */
|
/* 0x1c: bitrate */
|
||||||
@ -34,7 +36,7 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE *sf) {
|
|||||||
else if (is_id32be(0x00,sf, "HIS\0")) {
|
else if (is_id32be(0x00,sf, "HIS\0")) {
|
||||||
/* most(?) others */
|
/* most(?) others */
|
||||||
version = read_u32le(0x04,sf);
|
version = read_u32le(0x04,sf);
|
||||||
/* 0x08: codec */
|
/* 0x08: format? (always 1) */
|
||||||
channels = read_u16le(0x0a,sf);
|
channels = read_u16le(0x0a,sf);
|
||||||
sample_rate = read_u32le(0x0c,sf);
|
sample_rate = read_u32le(0x0c,sf);
|
||||||
/* 0x10: bitrate */
|
/* 0x10: bitrate */
|
||||||
@ -42,28 +44,51 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE *sf) {
|
|||||||
bps = read_u16le(0x16,sf);
|
bps = read_u16le(0x16,sf);
|
||||||
|
|
||||||
num_samples = pcm_bytes_to_samples(read_u32le(0x18,sf), channels, bps); /* true even for Ogg */
|
num_samples = pcm_bytes_to_samples(read_u32le(0x18,sf), channels, bps); /* true even for Ogg */
|
||||||
|
if (version >= 2) {
|
||||||
|
codec = read_u16le(0x1c,sf); /* 1:pcm, 2:ogg */
|
||||||
|
/* 0x1e: data or null in later(?) games */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
codec = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* later games use "OggS" */
|
if (version == 1) {
|
||||||
if (version == 1)
|
|
||||||
start_offset = 0x1c; /* Nancy Drew: The Final Scene (PC) */
|
start_offset = 0x1c; /* Nancy Drew: The Final Scene (PC) */
|
||||||
else if (version == 2 && is_id32be(0x1e,sf, "OggS"))
|
}
|
||||||
start_offset = 0x1e; /* Nancy Drew: The Haunted Carousel (PC) */
|
else if (version == 2) {
|
||||||
else if (version == 2 && is_id32be(0x20,sf, "OggS"))
|
if (codec == 1) {
|
||||||
start_offset = 0x20; /* Nancy Drew: The Silent Spy (PC) */
|
uint32_t left_size = get_streamfile_size(sf) - 0x1e;
|
||||||
else
|
if (num_samples == pcm_bytes_to_samples(left_size, channels, bps))
|
||||||
|
start_offset = 0x1e; /* Nancy Drew: Ghost Dogs of Moon Lake (PC) */
|
||||||
|
else
|
||||||
|
start_offset = 0x20; /* assumed */
|
||||||
|
}
|
||||||
|
else if (codec == 2) {
|
||||||
|
if (read_u16le(0x1e, sf) != 0)
|
||||||
|
start_offset = 0x1e; /* Nancy Drew: The Haunted Carousel (PC) */
|
||||||
|
else
|
||||||
|
start_offset = 0x20; /* Nancy Drew: The Silent Spy (PC) */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (version == 2) {
|
if (codec == 2) {
|
||||||
ogg_vorbis_meta_info_t ovmi = {0};
|
ogg_vorbis_meta_info_t ovmi = {0};
|
||||||
|
|
||||||
ovmi.meta_type = meta_HIS;
|
ovmi.meta_type = meta_HIS;
|
||||||
return init_vgmstream_ogg_vorbis_config(sf, start_offset, &ovmi);
|
return init_vgmstream_ogg_vorbis_config(sf, start_offset, &ovmi);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
@ -73,17 +98,32 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE *sf) {
|
|||||||
vgmstream->sample_rate = sample_rate;
|
vgmstream->sample_rate = sample_rate;
|
||||||
vgmstream->num_samples = num_samples;
|
vgmstream->num_samples = num_samples;
|
||||||
|
|
||||||
switch (bps) {
|
switch (codec) {
|
||||||
case 8:
|
case 1:
|
||||||
vgmstream->coding_type = coding_PCM8_U;
|
switch (bps) {
|
||||||
vgmstream->layout_type = layout_interleave;
|
case 8:
|
||||||
vgmstream->interleave_block_size = 0x01;
|
vgmstream->coding_type = coding_PCM8_U;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = 0x01;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
vgmstream->coding_type = coding_PCM16LE;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = 0x02;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
|
||||||
vgmstream->coding_type = coding_PCM16LE;
|
case 2:
|
||||||
vgmstream->layout_type = layout_interleave;
|
#ifdef VGM_USE_VORBIS
|
||||||
vgmstream->interleave_block_size = 0x02;
|
vgmstream->codec_data = init_ogg_vorbis(sf, start_offset, 0, NULL);
|
||||||
|
if (!vgmstream->codec_data) goto fail;
|
||||||
|
vgmstream->coding_type = coding_OGG_VORBIS;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user