Skip to content

Commit

Permalink
Updated VGMStream to r1050-3706-gdcdc1950
Browse files Browse the repository at this point in the history
  • Loading branch information
kode54 committed May 8, 2021
1 parent 5df4035 commit 383d27f
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 164 deletions.
197 changes: 99 additions & 98 deletions Frameworks/vgmstream/vgmstream/src/coding/coding_utils.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Frameworks/vgmstream/vgmstream/src/formats.c
Expand Up @@ -595,6 +595,7 @@ static const char* extension_list[] = {
"wvx",

"x",
"x360audio", //fake extension for Unreal Engine 3 XMA (real extension unknown)
"xa",
"xa2",
"xa30",
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/vgmstream/vgmstream/src/meta/ea_schl.c
Expand Up @@ -23,7 +23,7 @@
#define EA_PLATFORM_X360 0x09
#define EA_PLATFORM_PSP 0x0A
#define EA_PLATFORM_PS3 0x0E /* very rare [Need for Speed: Carbon (PS3)] */
#define EA_PLATFORM_WII 0x10
#define EA_PLATFORM_WII 0x10 /* not seen so far */
#define EA_PLATFORM_3DS 0x14

/* codec constants (undefined are probably reserved, ie.- sx.exe encodes PCM24/DVI but no platform decodes them) */
Expand Down
29 changes: 17 additions & 12 deletions Frameworks/vgmstream/vgmstream/src/meta/hca_keys.h
Expand Up @@ -394,10 +394,13 @@ static const hcakey_info hcakey_list[] = {

/* Fantasia Re: Build (Android) */
{8430978314079461325}, // 7500DA1B7FBA5FCD
/* SaGa Frontier Remastered */

/* SaGa Frontier Remastered (multi) */
{5935495141785029458}, // 525F1D6244274B52

/* Mushoku Tensei: Game ni Nattemo Honki Dasu (Android) */
{12281329554827291428u}, // AA700C292CFCAB24

/* D4DJ Groovy Mix (Android) [base files] */
{393410674916959300}, // 0575ACECA945A444
/* D4DJ Groovy Mix (Android) [music_* files, per-song later mixed with subkey] */
Expand Down Expand Up @@ -602,7 +605,6 @@ static const hcakey_info hcakey_list[] = {
{0xa691936caf4d91d0},
{0x94466db0d3c10f4b},
{0x47f52330df2ead11},
{0x33848be13a2884a3},
{0xc9f159f60b065f91},
{0xdd9ca800a7123d6f},
{0xa090c8ebf8463d05},
Expand All @@ -612,15 +614,18 @@ static const hcakey_info hcakey_list[] = {
{0x1980271cfe0da9bd},
{0x945cdb3cf1f29e52},
{0x7f0feac6be7def5b},
{0xc9f159f60b065f91},
{0xdd9ca800a7123d6f},
{0x0a90c8ebf8463d05},
{0xa5c1adeb7919845f},
{0x58d97e6f3d1aee86},
{0x71b5fa3761d6726d},
{0x1980271cfe0da9bd},
{0x945cdb3cf1f29e52},
{0x7f0feac6be7def5b},
{0xe35d52b6d2c094fb},
{0xd45e8ba374b45ff7},
{0x09e68da734cc472f},
{0xfc3fa77fc33460d4},
{0xa2c543b227b8e5e2},
{0xe6d1fd6effa46736},
{0x75859a7a2b1ed37d},
{0x358adfd1bbd3a95e},
{0xc86f8564e0b9078c},
{0x2e107d849959c430},
{0xb96786621e27daf3},
{0x1111d6c10e509824},

/* Dragalia Lost (iOS/Android) */
{2967411924141, subkeys_dgl, sizeof(subkeys_dgl) / sizeof(subkeys_dgl[0]) }, // 000002B2E7889CAD
Expand Down
6 changes: 4 additions & 2 deletions Frameworks/vgmstream/vgmstream/src/meta/maxis_xa.c
Expand Up @@ -12,8 +12,10 @@ VGMSTREAM * init_vgmstream_maxis_xa(STREAMFILE *streamFile) {
goto fail;

/* check header */
if ((read_32bitBE(0x00,streamFile) != 0x58414900) && /* "XAI\0" */
(read_32bitBE(0x00,streamFile) != 0x58414A00)) /* "XAJ\0" (some odd song uses this, no apparent diffs) */
if ((read_32bitBE(0x00,streamFile) != 0x58414900) && /* "XAI\0" (sound/speech) */
(read_32bitBE(0x00,streamFile) != 0x58414A00) && /* "XAJ\0" (music, no apparent diffs) */
(read_32bitBE(0x00,streamFile) != 0x58410000) && /* "XA\0\0" (sound/speech from The Sims 2, no apparent diffs) */
(read_32bitBE(0x00,streamFile) != 0x58411200)) /* "XA\x12\0" (music from The Sims 2, no apparent diffs) */
goto fail;

loop_flag = 0;
Expand Down
4 changes: 2 additions & 2 deletions Frameworks/vgmstream/vgmstream/src/meta/ogg_vorbis.c
Expand Up @@ -472,7 +472,7 @@ VGMSTREAM* init_vgmstream_ogg_vorbis_callbacks(STREAMFILE* sf, ov_callbacks* cal
strstr(comment,"LOOP_BEGIN=") == comment || /* Hatsune Miku: Project Diva F (PS3) */
strstr(comment,"LoopStart=") == comment || /* Devil May Cry 4 (PC) */
strstr(comment,"LOOP=") == comment || /* Duke Nukem 3D: 20th Anniversary World Tour */
strstr(comment,"XIPH_CUE_LOOPSTART=") == comment) { /* Super Mario Run (Android) */
strstr(comment,"XIPH_CUE_LOOPSTART=") == comment) { /* DeNa games [Super Mario Run (Android), FF Record Keeper (Android)] */
loop_start = atol(strrchr(comment,'=')+1);
loop_flag = (loop_start >= 0);
}
Expand Down Expand Up @@ -546,7 +546,7 @@ VGMSTREAM* init_vgmstream_ogg_vorbis_callbacks(STREAMFILE* sf, ov_callbacks* cal
}
else if (strstr(comment,"COMMENT=- loopTime ") == comment || /* Aristear Remain (PC) */
strstr(comment,"COMMENT=-loopTime ") == comment) { /* Hyakki Ryouran no Yakata x Kawarazaki-ke no Ichizoku (PC) */
loop_start = atol(strrchr(comment,'l')) / 1000.0f * sample_rate; /* ms to samples */
loop_start = atol(strrchr(comment,' ')) / 1000.0f * sample_rate; /* ms to samples */
loop_flag = (loop_start >= 0);

/* files have all page granule positions -1 except a few close to loop. This throws off
Expand Down
88 changes: 44 additions & 44 deletions Frameworks/vgmstream/vgmstream/src/meta/raw_int.c
@@ -1,44 +1,44 @@
#include "meta.h"
#include "../coding/coding.h"

/* raw PCM file assumed by extension [PaRappa The Rapper 2 (PS2)? , Amplitude (PS2)?] */
VGMSTREAM * init_vgmstream_raw_int(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int channel_count;

/* checks */
if (!check_extensions(streamFile, "int,wp2"))
goto fail;

if (check_extensions(streamFile, "int"))
channel_count = 2;
else
channel_count = 4;

/* ignore .int PS-ADPCM */
if (ps_check_format(streamFile, 0x00, 0x10000))
goto fail;

start_offset = 0x00;


/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,0);
if (!vgmstream) goto fail;

vgmstream->meta_type = meta_RAW_INT;
vgmstream->sample_rate = 48000;
vgmstream->num_samples = pcm_bytes_to_samples(get_streamfile_size(streamFile), vgmstream->channels, 16);
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x200;

if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;

fail:
close_vgmstream(vgmstream);
return NULL;
}
#include "meta.h"
#include "../coding/coding.h"

/* raw PCM file assumed by extension [PaRappa The Rapper 2 (PS2), Amplitude (PS2), R-Type Final (PS2)] */
VGMSTREAM* init_vgmstream_raw_int(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int channel_count;

/* checks */
if (!check_extensions(sf, "int,wp2"))
goto fail;

if (check_extensions(sf, "wp2"))
channel_count = 4;
else
channel_count = 2;

/* ignore .int PS-ADPCM (some files start with silence so up a bit) */
if (ps_check_format(sf, 0x00, 0x100000))
goto fail;

start_offset = 0x00;


/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, 0);
if (!vgmstream) goto fail;

vgmstream->meta_type = meta_RAW_INT;
vgmstream->sample_rate = 48000;
vgmstream->num_samples = pcm_bytes_to_samples(get_streamfile_size(sf), vgmstream->channels, 16);
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x200;

if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;

fail:
close_vgmstream(vgmstream);
return NULL;
}
6 changes: 4 additions & 2 deletions Frameworks/vgmstream/vgmstream/src/meta/riff.c
Expand Up @@ -537,11 +537,13 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
break;

case 0x63756520: /* "cue " (used in Source Engine for storing loop points) */
if (fmt.coding_type == coding_PCM16LE || fmt.coding_type == coding_MSADPCM) {
if (fmt.coding_type == coding_PCM8_U ||
fmt.coding_type == coding_PCM16LE ||
fmt.coding_type == coding_MSADPCM) {
uint32_t num_cues = read_32bitLE(current_chunk + 0x08, sf);

if (num_cues > 0) {
/* The second cue sets loop end point but it's not actually used by the engine. */
/* the second cue sets loop end point but it's not actually used by the engine */
loop_flag = 1;
loop_start_cue = read_32bitLE(current_chunk + 0x20, sf);
}
Expand Down
3 changes: 2 additions & 1 deletion Frameworks/vgmstream/vgmstream/src/meta/xma_ue3.c
Expand Up @@ -12,7 +12,8 @@ VGMSTREAM* init_vgmstream_xma_ue3(STREAMFILE *sf) {

/* checks */
/* .xma: assumed */
if (!check_extensions(sf, "xma,"))
/* .x360audio: fake produced by UE Viewer */
if (!check_extensions(sf, "xma,x360audio,"))
goto fail;

/* UE3 uses class-like chunks called "SoundNodeWave" to store info and (rarely multi) raw audio data. Other
Expand Down
13 changes: 11 additions & 2 deletions Frameworks/vgmstream/vgmstream/src/meta/xwb.c
Expand Up @@ -241,10 +241,12 @@ VGMSTREAM* init_vgmstream_xwb(STREAMFILE* sf) {
uint32_t entry_info = read_u32(offset+0x00, sf);
if (xwb.version <= XACT1_1_MAX) {
xwb.entry_flags = entry_info;
} else {
}
else {
xwb.entry_flags = (entry_info) & 0xF; /*4b*/
xwb.num_samples = (entry_info >> 4) & 0x0FFFFFFF; /*28b*/
}

xwb.format = read_u32(offset+0x04, sf);
xwb.stream_offset = xwb.data_offset + read_u32(offset+0x08, sf);
xwb.stream_size = read_u32(offset+0x0c, sf);
Expand Down Expand Up @@ -397,7 +399,8 @@ VGMSTREAM* init_vgmstream_xwb(STREAMFILE* sf) {
xwb.loop_start_sample = msadpcm_bytes_to_samples(xwb.loop_start, block_size, xwb.channels);
xwb.loop_end_sample = msadpcm_bytes_to_samples(xwb.loop_start + xwb.loop_end, block_size, xwb.channels);
}
else if (xwb.version <= XACT2_1_MAX && (xwb.codec == XMA1 || xwb.codec == XMA2) && xwb.loop_flag) {
else if ((xwb.version <= XACT2_1_MAX && (xwb.codec == XMA1 || xwb.codec == XMA2) && xwb.loop_flag)
|| (xwb.version == XACT_TECHLAND && xwb.codec == XMA2)) {
/* v38: byte offset, v40+: sample offset, v39: ? */
/* need to manually find sample offsets, thanks to Microsoft's dumb headers */
ms_sample_data msd = {0};
Expand All @@ -421,6 +424,12 @@ VGMSTREAM* init_vgmstream_xwb(STREAMFILE* sf) {
xwb.fix_xma_loop_samples = 1;
xwb.fix_xma_num_samples = 0;

/* Techland's XMA in tool_version 0x2a (not 0x2c?) seems to use (entry_info >> 1) num_samples
* for music banks, but not sfx [Nail'd (X360)-0x2a, Dead Island (X360)-0x2c] */
if (xwb.version == XACT_TECHLAND) {
xwb.num_samples = 0;
}

/* for XWB v22 (and below?) this seems normal [Project Gotham Racing (X360)] */
if (xwb.num_samples == 0) {
xwb.num_samples = msd.num_samples;
Expand Down

0 comments on commit 383d27f

Please sign in to comment.