Merge pull request #1304 from bnnm/xse-etc

- Fix EA SWVR loops [Rumble Racing (PS2)]
- Fix some .xse [Mindjack (PS3/X360)]
This commit is contained in:
bnnm 2023-02-02 00:33:12 +01:00 committed by GitHub
commit 408cada5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 224 additions and 117 deletions

54
.github/changelog.py vendored
View File

@ -3,10 +3,10 @@
import subprocess, urllib.request, json, datetime
USE_GIT = True
GIT_MAX_MERGES = 10 #maybe should use max date
GIT_MAX_MERGES = 10
JSON_MAX_MERGES = 10
JSON_LOCAL = True
MAKE_SHORT_CHANGELOG = False
def convert_git(stdout):
lines = stdout.split('\n')
@ -46,7 +46,15 @@ def convert_git(stdout):
def load_git():
if not USE_GIT:
raise ValueError("git disabled")
args = ['git','--no-pager','log', '--merges', '--max-count', str(GIT_MAX_MERGES), '--date=format:"%Y-%m-%d %H:%M:%S"']
args = ['git', 'describe', '--tags', '--abbrev=0']
proc = subprocess.run(args, capture_output=True)
if proc.returncode != 0:
raise ValueError("git exception")
latest_tag = proc.stdout.decode('utf-8').strip()
#args = ['git','--no-pager','log', '--merges', '--date=format:"%Y-%m-%d %H:%M:%S"', '--max-count', str(GIT_MAX_MERGES) ]
args = ['git','--no-pager','log', '--merges', '--date=format:"%Y-%m-%d %H:%M:%S"', '%s..HEAD' % (latest_tag)]
proc = subprocess.run(args, capture_output=True)
if proc.returncode != 0:
raise ValueError("git exception")
@ -97,17 +105,25 @@ def load_json():
return convert_json(data)
def convert_items(items, lines):
def convert_items(items, lines, short_log):
for item in items:
message = item['message']
date = item['date']
header = "#### %s" % (date.replace('T',' ').replace('Z',''))
msg_from = None
ignore = False
subs = []
msg_lines = iter([msg.strip() for msg in message.split('\n')])
for msg in msg_lines:
if msg.lower().startswith('merge'):
if ' into ' in msg: #Merge branch ... into ...
ignore = True
break
try:
pos = msg.index(' from ')
msg_from = msg[pos + 6:].strip()
except:
pass
continue
if not msg: #always first?
continue
@ -118,42 +134,56 @@ def convert_items(items, lines):
msg = '- %s' % (msg[2:])
subs.append(msg)
if ignore:
continue
if not subs:
subs.append('- (not described)')
if short_log:
lines.extend(subs)
else:
header = "#### %s" % (date.replace('T',' ').replace('Z',''))
if msg_from:
header += ' (%s)' % (msg_from)
lines.append(header)
lines.extend(subs)
lines.append('')
def write(lines):
with open('changelog.txt', 'w', encoding="utf-8") as f:
f.write('\n'.join(lines))
def get_lines():
def get_lines(short_log=False):
if short_log:
lines = []
else:
curr_date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
lines = [
'### CHANGELOG',
'(latest main changes on %s, skips smaller commits)' % (curr_date),
'(latest changes from previous release, generated on %s)' % (curr_date),
'',
]
try:
try:
items = load_git()
except Exception as e:
print("error when generating git, using json:", e)
items = load_json()
convert_items(items, lines)
convert_items(items, lines, short_log)
except Exception as e:
print("err", e)
lines.append("(couldn't generate changelog)")
return lines
def main():
lines = get_lines()
def main(short_changelog=False):
lines = get_lines(short_changelog)
write(lines)
return lines
if __name__ == "__main__":
main()
main(MAKE_SHORT_CHANGELOG)

View File

@ -1,25 +1,22 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
/* SWVR - from EA games, demuxed from .av/trk/mis/etc [Future Cop L.A.P.D. (PS/PC), Freekstyle (PS2/GC), EA Sports Supercross (PS)] */
VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL;
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int loop_flag = 0, channels, sample_rate, big_endian;
int loop_flag = 0, channels, sample_rate, big_endian, loop_block = 0;
coding_t coding;
uint32_t block_id;
int32_t (*read_32bit)(off_t,STREAMFILE*) = NULL;
int16_t (*read_16bit)(off_t,STREAMFILE*) = NULL;
read_u32_t read_u32 = NULL;
read_u16_t read_u16 = NULL;
int total_subsongs, target_subsong = sf->stream_index;
/* checks */
/* .stream: common (found inside files)
* .str: shortened, probably unnecessary */
if (!check_extensions(sf,"stream,str"))
goto fail;
/* Files have no actual audio headers, so we inspect the first block for known values.
* Freekstyle uses multiblocks/subsongs (though some subsongs may be clones?) */
@ -27,40 +24,48 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
/* blocks ids are in machine endianness */
if (read_u32be(0x00,sf) == get_id32be("RVWS")) { /* PS1/PS2/PC */
big_endian = 0;
read_32bit = read_32bitLE;
read_16bit = read_16bitLE;
start_offset = read_32bit(0x04, sf);
read_u32 = read_u32le;
read_u16 = read_u16le;
start_offset = read_u32(0x04, sf);
/* 0x08: null */
loop_block = read_u32(0x0c, sf); /* uncommon [NASCAR Racing (PS1), Rumble Racing (PS2)] */
}
else if (read_u32be(0x00,sf) == get_id32be("SWVR")) { /* GC */
big_endian = 1;
read_32bit = read_32bitBE;
read_16bit = read_16bitBE;
start_offset = read_32bit(0x04, sf);
read_u32 = read_u32be;
read_u16 = read_u16be;
start_offset = read_u32(0x04, sf);
}
else if (read_u32be(0x00,sf) == get_id32be("MGAV")) { /* Freekstyle (PS2) raw movies */
big_endian = 0;
read_32bit = read_32bitLE;
read_16bit = read_16bitLE;
read_u32 = read_u32le;
read_u16 = read_u16le;
start_offset = 0x00;
}
else if (read_u32be(0x00,sf) == get_id32be("DSPM")) { /* Freekstyle (GC) raw movies */
big_endian = 1;
read_32bit = read_32bitBE;
read_16bit = read_16bitBE;
read_u32 = read_u32be;
read_u16 = read_u16be;
start_offset = 0x00;
}
else {
goto fail;
}
if (read_32bit(start_offset+0x00, sf) == get_id32be("PADD")) /* Freekstyle */
start_offset += read_32bit(start_offset+0x04, sf);
/* .stream: common (found inside files)
* .str: shortened, probably unnecessary */
if (!check_extensions(sf,"stream,str"))
goto fail;
if (read_32bit(start_offset+0x00, sf) == get_id32be("FILL")) /* Freekstyle */
start_offset += read_32bit(start_offset+0x04, sf);
if (read_u32(start_offset+0x00, sf) == get_id32be("PADD")) /* Freekstyle */
start_offset += read_u32(start_offset+0x04, sf);
if (read_u32(start_offset+0x00, sf) == get_id32be("FILL")) /* Freekstyle */
start_offset += read_u32(start_offset+0x04, sf);
total_subsongs = 1;
block_id = read_32bit(start_offset, sf);
block_id = read_u32(start_offset, sf);
/* value after block id (usually at 0x38) is number of blocks of 0x6000 (results in file size, including FILLs) */
/* intended sample rate for PSX music (verified in emus) should be 14260, but is found in ELF as pitch value
@ -69,8 +74,8 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
switch(block_id) {
case 0x5641474D: /* "VAGM" (stereo music) */
coding = coding_PSX;
if (read_16bit(start_offset+0x1a, sf) == 0x0024) {
total_subsongs = read_32bit(start_offset+0x0c, sf)+1;
if (read_u16(start_offset+0x1a, sf) == 0x0024) {
total_subsongs = read_u32(start_offset+0x0c, sf)+1;
sample_rate = 22050; /* Freekstyle (PS2) */
}
else {
@ -80,7 +85,7 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
break;
case 0x56414742: /* "VAGB" (mono sfx/voices)*/
coding = coding_PSX;
if (read_16bit(start_offset+0x1a, sf) == 0x6400) {
if (read_u16(start_offset+0x1a, sf) == 0x6400) {
sample_rate = 22050; /* Freekstyle (PS2) */
}
else {
@ -91,7 +96,7 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
break;
case 0x4453504D: /* "DSPM" (stereo music) */
coding = coding_NGC_DSP;
total_subsongs = read_32bit(start_offset+0x0c, sf)+1;
total_subsongs = read_u32(start_offset+0x0c, sf)+1;
sample_rate = 22050; /* Freekstyle (GC) */
channels = 2;
break;
@ -106,7 +111,7 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
sample_rate = 14291; /* assumed, by comparing vs PSX output [Future Cop (PC)] */
break;
case 0x53484F43: /* "SHOC" (a generic block but hopefully has PC sounds) */
if (read_32bit(start_offset+0x10, sf) == get_id32be("SHDR")) { /* Future Cop (PC) */
if (read_u32(start_offset+0x10, sf) == get_id32be("SHDR")) { /* Future Cop (PC) */
/* there is a mini header? after SHDR
* 0x00: 5
* 0x04: "snds"
@ -118,7 +123,7 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
* 0x1c: 1
* 0x20: 1
* 0x24: 0x4F430000 */
if (read_32bit(start_offset+0x18, sf) != get_id32be("snds"))
if (read_u32(start_offset+0x18, sf) != get_id32be("snds"))
goto fail;
coding = coding_PCM8_U_int;
channels = 1;
@ -139,7 +144,7 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
loop_flag = 0;//(channels > 1); /* some Future Cop LAPD tracks repeat but other games have fadeouts */
loop_flag = (loop_block > 0);//(channels > 1); /* some Future Cop LAPD tracks repeat but other games have fadeouts */
/* build the VGMSTREAM */
@ -162,9 +167,11 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
/* calc num_samples manually */
{
int num_samples;
int block, num_samples;
vgmstream->stream_index = target_subsong; /* needed to skip other subsong-blocks */
vgmstream->next_block_offset = start_offset;
block = 0;
do {
block_update(vgmstream->next_block_offset,vgmstream);
switch(vgmstream->coding_type) {
@ -174,15 +181,19 @@ VGMSTREAM* init_vgmstream_ea_swvr(STREAMFILE* sf) {
default: num_samples = 0; break;
}
vgmstream->num_samples += num_samples;
/* check loop on data blocks */
if (num_samples) {
block++;
if (loop_block == block) /* 1=first */
vgmstream->loop_start_sample = vgmstream->num_samples;
}
}
while (vgmstream->next_block_offset < get_streamfile_size(sf));
block_update(start_offset, vgmstream);
}
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
return vgmstream;

View File

@ -3,13 +3,12 @@
#include "../coding/coding.h"
/* SDRH - banks for newer feelplus-related games [Mindjack (PS3/X360)] */
/* SDRH - banks for newer feelplus-related ("FeelEngine") games [Mindjack (PS3/X360), Moon Diver (PS3/X360)] */
VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset, data_size, stream_size;
uint32_t start_offset, stream_size;
int loop_flag = 0, channels, codec, sample_rate, seek_count;
int32_t num_samples, loop_start, loop_end;
off_t offset;
int total_subsongs, target_subsong = sf->stream_index;
@ -22,19 +21,19 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
/* similar to older version but BE and a bit less complex */
/* 0x04: version/config?
* 0x08: data size
* 0x30: file name in some strange encoding/compression?
* others: ? (change in old/new)
* 0x30: file name in a custom 40-char (RADIX style) encoding
* others: ?
*/
/* parse section */
{
uint32_t offset, base_size, stream_offset, data_size = 0, entry_size = 0;
int i;
int tables = read_u16be(0x1C,sf);
off_t base_size, stream_offset;
int entries;
offset = 0;
/* read sections (FE=cues?, WV=mini-headers?, XW=waves) */
/* read sections: FE=cues? (same in platforms), WV=header position + sample rate?, FT=? (same in platforms), XW=waves */
for (i = 0; i < tables; i++) {
uint16_t id = read_u16be(0x40 + 0x10 * i + 0x00,sf);
/* 0x02: offset in 0x40s */
@ -48,7 +47,7 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
}
/* section header (other sections have a similar header) */
/* 0x00: section size */
/* 0x00: section size (including data) */
base_size = read_u16be(offset + 0x04,sf);
entries = read_u16be(offset + 0x06,sf);
/* 0x08: null */
@ -62,8 +61,7 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
/* find stream header (entries can be variable-sized) */
for (i = 0; i < entries; i++) {
size_t seek_size = read_u16be(offset + 0x0a,sf) * 0x04;
size_t entry_size = align_size_to_block(0x30 + seek_size, 0x10);
entry_size = read_u16be(offset + 0x04,sf) * 0x10;
if (i + 1 == target_subsong)
break;
@ -71,25 +69,34 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
}
/* parse target header (similar to xwav) */
stream_size = read_u32be(offset + 0x00,sf);
/* 0x04: codec? (16=PS3, 03=X360) */
data_size = read_u32be(offset + 0x00,sf) - entry_size;
/* 0x00: data/entry size */
/* 0x04: entry size */
codec = read_u8(offset + 0x06,sf); /* assumed */
loop_flag = read_u8(offset + 0x07,sf); /* assumed */
/* 0x08: bps? */
/* 0x08: bps? flags? */
channels = read_u8(offset + 0x09,sf);
seek_count = read_u16be(offset + 0x0a,sf);
num_samples = read_u32be(offset + 0x0c,sf);
sample_rate = read_u32be(offset + 0x10,sf);
loop_start = read_u32be(offset + 0x14,sf);
loop_end = read_u32be(offset + 0x18,sf);
/* 0x1c: ? */
stream_offset = read_u32be(offset + 0x20,sf); /* within data */
/* 0x24: ? */
/* 0x26 seek entries */
/* 0x28: ? */
/* 0x2c: null? */
/* 0x1c: flags? */
stream_offset = read_u32be(offset + 0x20,sf);
/* Mindjack uses full offsets here (aligned to 0x800), while Moon Diver points to a sub-offset
* (offsets also aren't ordered) */
if ((stream_offset & 0x000007FF) != 0) {
stream_offset = read_u16be(offset + stream_offset, sf) * 0x800;
//TODO some files that loop have wrong size/num_samples? (ex.MJ system.xse #23 #138)
}
/* other values change per game (seek table, etc) */
start_offset += stream_offset;
stream_size = data_size;
}
@ -105,23 +112,26 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
vgmstream->num_streams = total_subsongs;
switch(codec) {
case 2: /* Mindjack (PS3) */
case 2: /* Mindjack (PS3), Moon Diver (PS3) */
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
/* seen in a few Mindjack files */
if (loop_end > num_samples && loop_end - 8 <= num_samples)
loop_end = num_samples;
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
break;
#ifdef VGM_USE_FFMPEG
case 1: { /* Mindjack (X360) */
case 1: { /* Mindjack (X360), Moon Diver (X360) */
int block_size = 0x10000; /* XWAV new default */
int block_count = seek_count;
data_size = get_streamfile_size(sf) - start_offset;
vgmstream->codec_data = init_ffmpeg_xma2_raw(sf, start_offset, data_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, block_size, block_count);
vgmstream->codec_data = init_ffmpeg_xma2_raw(sf, start_offset, stream_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, block_size, block_count);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
@ -129,9 +139,26 @@ VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) {
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
//todo fix loops/samples vs ATRAC3
//TODO fix loops/samples vs ATRAC3
/* may be only applying end_skip to num_samples? */
xma_fix_raw_samples(vgmstream, sf, start_offset,data_size, 0, 0,0);
xma_fix_raw_samples(vgmstream, sf, start_offset, stream_size, 0, 0,0);
break;
}
case 7: { /* Mindjack (PS3) */
int block_align, encoder_delay;
block_align = 0x98 * vgmstream->channels;
encoder_delay = 1024 + 69*2; /* observed default, but seems files run out of space */
vgmstream->codec_data = init_ffmpeg_atrac3_raw(sf, start_offset, stream_size, vgmstream->num_samples, vgmstream->channels,vgmstream->sample_rate, block_align, encoder_delay);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
/* set offset samples (offset 0 jumps to sample 0 > pre-applied delay, and offset end loops after sample end > adjusted delay) */
vgmstream->loop_start_sample = atrac3_bytes_to_samples(loop_start, block_align); //- encoder_delay
vgmstream->loop_end_sample = atrac3_bytes_to_samples(loop_end, block_align) - encoder_delay;
break;
}
#endif
@ -153,10 +180,9 @@ fail:
/* SDRH - banks for older feelplus-related games [Lost Odyssey (X360), Lost Odyssey Demo (X360)] */
VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset, data_size, stream_size;
int loop_flag = 0, channels, codec, sample_rate, seek_count;
uint32_t start_offset, stream_size;
int loop_flag = 0, channels = 0, codec, sample_rate, seek_count;
int32_t num_samples, loop_start, loop_end;
off_t offset;
int total_subsongs, target_subsong = sf->stream_index;
@ -171,19 +197,19 @@ VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
/* similar to older version but LE and a bit more complex */
/* 0x04: version/config?
* 0x08: data size
* 0x30: file name in some strange encoding/compression?
* 0x30: file name in a custom 40-char (RADIX style) encoding
* others: ? (change in old/new)
*/
/* parse section */
{
uint32_t offset, base_size, stream_offset, data_size = 0, entry_size = 0;
int i;
int tables = read_u8(0x15,sf);
off_t base_size, stream_offset;
int entries;
offset = 0x40;
/* read sections (FE=cues?, WV=mini-headers?, FT=?, FQ=?, XW=waves) */
/* read sections (FE=cues?, WV=mini-headers + XW offset, FT=?, FQ=?, XW=waves) */
for (i = 0; i < tables; i++) {
uint16_t id = read_u16be(0x40 + 0x08 * i + 0x00,sf);
/* 0x02: null? */
@ -195,7 +221,7 @@ VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
}
/* section header (other sections have a similar header) */
/* 0x00: section size */
/* 0x00: section size (including data) */
base_size = read_u16le(offset + 0x04,sf);
/* 0x06: ? */
entries = read_u16le(offset + 0x08,sf);
@ -210,39 +236,47 @@ VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
/* find stream header */
stream_offset = 0;
for (i = 0; i < entries; i++) {
size_t data_size = read_u32le(offset + 0x00,sf) - 0x30;
size_t seek_size = 0; //read_u16be(offset + 0x0a,sf) * 0x04; /* not seen */
size_t entry_size = align_size_to_block(0x30 + seek_size, 0x10);
data_size = read_u32le(offset + 0x00,sf);
entry_size = read_u16le(offset + 0x04,sf) * 0x10;
data_size -= entry_size;
if (i + 1 == target_subsong)
break;
offset += entry_size;
stream_offset += data_size; /* no offset? */
stream_offset += data_size; /* no offset */
}
/* parse target header (similar to xwav) */
stream_size = read_u32le(offset + 0x00,sf) - 0x30; /* adds entry size */
/* 0x04: codec? (16=PS3, 03=X360) */
/* 0x00: data size + entry size */
/* 0x04: entry size */
codec = read_u8(offset + 0x06,sf); /* assumed */
/* 0x07: flag? */
/* 0x08: bps? */
/* 0x09: codec? */
/* 0x0a: null */
num_samples = read_u32le(offset + 0x0c,sf);
seek_count = read_u16le(offset + 0x10,sf);
sample_rate = read_u32le(offset + 0x14,sf);
/* 0x0a: null (seek size?) */
num_samples = read_u32le(offset + 0x0c,sf); /* XMA1: loop start/end info */
seek_count = read_u16le(offset + 0x10,sf); /* XMA1: loop start/end bytes? */
sample_rate = read_u16le(offset + 0x14,sf);
if (entry_size == 0x20) {
channels = read_u8(offset + 0x17,sf);
}
loop_start = 0; //read_u32le(offset + 0x18,sf); /* ? */
loop_end = 0; //read_u32le(offset + 0x1c,sf); /* ? */
if (entry_size >= 0x30) {
/* 0x20: null */
/* 0x24: ? */
/* 0x26: channel layout */
channels = read_u8(offset + 0x27,sf);
/* 0x28: ? */
/* 0x2c: null? */
}
loop_flag = loop_end > 0;
start_offset += stream_offset;
stream_size = data_size;
}
@ -260,13 +294,8 @@ VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
switch(codec) {
#ifdef VGM_USE_FFMPEG
case 4: { /* Lost Odyssey (X360) */
int block_size = 0x8000; /* XWAV old default */
int block_count = seek_count;
data_size = get_streamfile_size(sf) - start_offset;
vgmstream->codec_data = init_ffmpeg_xma2_raw(sf, start_offset, data_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, block_size, block_count);
case 1: { /* Lost Odyssey Demo (X360) */
vgmstream->codec_data = init_ffmpeg_xma1_raw(sf, start_offset, stream_size, vgmstream->channels, vgmstream->sample_rate, 0);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
@ -274,7 +303,44 @@ VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) {
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
xma_fix_raw_samples(vgmstream, sf, start_offset, data_size, 0, 0, 1);
{
ms_sample_data msd = {0};
msd.xma_version = 1;
msd.channels = channels;
msd.data_offset = start_offset;
msd.data_size = stream_size;
msd.loop_flag = loop_flag;
msd.loop_start_b= 0; //loop_start_b;
msd.loop_end_b = 0; //loop_end_b;
msd.loop_start_subframe = 0; //loop_subframe & 0xF; /* lower 4b: subframe where the loop starts, 0..4 */
msd.loop_end_subframe = 0; //loop_subframe >> 4; /* upper 4b: subframe where the loop ends, 0..3 */
msd.chunk_offset = 0;
xma_get_samples(&msd, sf);
vgmstream->num_samples = msd.num_samples;
//loop_start_sample = msd.loop_start_sample;
//loop_end_sample = msd.loop_end_sample;
}
xma_fix_raw_samples(vgmstream, sf, start_offset, stream_size, 0, 0, 1);
break;
}
case 4: { /* Lost Odyssey (X360) */
int block_size = 0x8000; /* XWAV old default */
int block_count = seek_count;
vgmstream->codec_data = init_ffmpeg_xma2_raw(sf, start_offset, stream_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, block_size, block_count);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
xma_fix_raw_samples(vgmstream, sf, start_offset, stream_size, 0, 0, 1);
break;
}
#endif

View File

@ -30,7 +30,7 @@ VGMSTREAM* init_vgmstream_xwav_new(STREAMFILE* sf) {
* 0x16: file number
* 0x18: null
* 0x1c: null
* 0x20: file name in some strange encoding/compression?
* 0x20: file name in a custom 40-char (RADIX style) encoding
*/
start_offset = 0x800;