mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 08:07:23 +01:00
EA GIN: Added "Octn" header magic
This commit is contained in:
parent
4e2cad5625
commit
147af39293
@ -2,16 +2,17 @@
|
|||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* .gin - EA engine sounds [Need for Speed: Most Wanted (multi)] */
|
/* .gin - EA engine sounds [Need for Speed: Most Wanted (multi)] */
|
||||||
VGMSTREAM * init_vgmstream_gin(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_gin(STREAMFILE *sf) {
|
||||||
VGMSTREAM *vgmstream = NULL;
|
VGMSTREAM *vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag, channel_count, sample_rate, num_samples;
|
int loop_flag, channel_count, sample_rate, num_samples;
|
||||||
|
|
||||||
if (!check_extensions(streamFile, "gin"))
|
if (!check_extensions(sf, "gin"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
if (read_32bitBE(0x00, streamFile) != 0x476E7375) /* "Gnsu" */
|
if (!is_id32be(0x00, sf, "Gnsu") && /* original */
|
||||||
|
!is_id32be(0x00, sf, "Octn")) /* later (2013+) games, looks same as "Gnsu" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* contains mapped values for engine RPM sounds but we'll just play the whole thing */
|
/* contains mapped values for engine RPM sounds but we'll just play the whole thing */
|
||||||
@ -21,11 +22,11 @@ VGMSTREAM * init_vgmstream_gin(STREAMFILE *streamFile) {
|
|||||||
/* 0x14: RPM ??? table size */
|
/* 0x14: RPM ??? table size */
|
||||||
/* always LE even on X360/PS3 */
|
/* always LE even on X360/PS3 */
|
||||||
|
|
||||||
num_samples = read_32bitLE(0x18, streamFile);
|
num_samples = read_u32le(0x18, sf);
|
||||||
sample_rate = read_32bitLE(0x1c, streamFile);
|
sample_rate = read_u32le(0x1c, sf);
|
||||||
start_offset = 0x20 +
|
start_offset = 0x20 +
|
||||||
(read_32bitLE(0x10, streamFile) + 1) * 0x04 +
|
(read_u32le(0x10, sf) + 1) * 0x04 +
|
||||||
(read_32bitLE(0x14, streamFile) + 1) * 0x04;
|
(read_u32le(0x14, sf) + 1) * 0x04;
|
||||||
channel_count = 1;
|
channel_count = 1;
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ VGMSTREAM * init_vgmstream_gin(STREAMFILE *streamFile) {
|
|||||||
/* calculate size for TMX */
|
/* calculate size for TMX */
|
||||||
vgmstream->stream_size = (align_size_to_block(num_samples, 32) / 32) * 0x13;
|
vgmstream->stream_size = (align_size_to_block(num_samples, 32) / 32) * 0x13;
|
||||||
|
|
||||||
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||||
goto fail;
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user