mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-24 06:04:06 +01:00
Ubi SB: Added more versions
Myst IV: Revelation (PC) Splinter Cell: Chaos Theory (PS2)
This commit is contained in:
parent
7af4314261
commit
f52ffd24e1
@ -1109,7 +1109,7 @@ static VGMSTREAM* init_vgmstream_ubi_sb_base(ubi_sb_header* sb, STREAMFILE* sf_h
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Ubi XMA1 (raw or fmt) is a bit strange, FFmpeg decodes some frames slightly wrong
|
// TODO: Ubi XMA1 (raw or fmt) is a bit strange, FFmpeg decodes some frames slightly wrong
|
||||||
// XMA1 normally has a frame counter in the first nibble but Ubi's is always set to 0.
|
// XMA1 normally has a frame counter in the first nibble but Ubi's is always set to 0.
|
||||||
// Probably a beta/custom encoder that creates some buggy frames, that a real X360 handles ok, but trips FFmpeg
|
// Probably a beta/custom encoder that creates some buggy frames, that a real X360 handles ok, but trips FFmpeg
|
||||||
// xmaencode decodes correctly if counters are fixed (otherwise has clicks on every frame).
|
// xmaencode decodes correctly if counters are fixed (otherwise has clicks on every frame).
|
||||||
@ -1900,7 +1900,7 @@ static int parse_type_audio(ubi_sb_header* sb, off_t offset, STREAMFILE* sf) {
|
|||||||
if (sb->cfg.audio_stream_name) {
|
if (sb->cfg.audio_stream_name) {
|
||||||
if (sb->is_dat && !sb->is_external) {
|
if (sb->is_dat && !sb->is_external) {
|
||||||
sb->subbank_index = read_8bit(offset + sb->cfg.audio_stream_name + 0x01, sf);
|
sb->subbank_index = read_8bit(offset + sb->cfg.audio_stream_name + 0x01, sf);
|
||||||
} else {
|
} else if (sb->is_external || sb->cfg.audio_has_internal_names) {
|
||||||
read_string(sb->resource_name, sb->cfg.resource_name_size, offset + sb->cfg.audio_stream_name, sf);
|
read_string(sb->resource_name, sb->cfg.resource_name_size, offset + sb->cfg.audio_stream_name, sf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2656,30 +2656,6 @@ static void config_sb_audio_fb(ubi_sb_header* sb, off_t flag_bits, int streamed_
|
|||||||
sb->cfg.audio_subblock_and = subblock_and;
|
sb->cfg.audio_subblock_and = subblock_and;
|
||||||
sb->cfg.audio_loop_and = loop_and;
|
sb->cfg.audio_loop_and = loop_and;
|
||||||
}
|
}
|
||||||
static void config_sb_audio_ps2_bnm(ubi_sb_header *sb, off_t flag_bits, int streamed_and, int cd_streamed_and, int loop_and, off_t channels, off_t sample_rate) {
|
|
||||||
/* bit flags, channels and sample rate */
|
|
||||||
sb->cfg.audio_streamed_flag = flag_bits;
|
|
||||||
sb->cfg.audio_cd_streamed_flag = flag_bits;
|
|
||||||
sb->cfg.audio_loop_flag = flag_bits;
|
|
||||||
sb->cfg.audio_streamed_and = streamed_and;
|
|
||||||
sb->cfg.audio_cd_streamed_and = cd_streamed_and;
|
|
||||||
sb->cfg.audio_loop_and = loop_and;
|
|
||||||
sb->cfg.audio_channels = channels;
|
|
||||||
sb->cfg.audio_sample_rate = sample_rate;
|
|
||||||
}
|
|
||||||
static void config_sb_audio_ps2_old(ubi_sb_header* sb, off_t flag_bits, int streamed_and, int loop_and, int loc_and, int stereo_and, off_t pitch, off_t sample_rate) {
|
|
||||||
/* bit flags, sample rate only */
|
|
||||||
sb->cfg.audio_streamed_flag = flag_bits;
|
|
||||||
sb->cfg.audio_loop_flag = flag_bits;
|
|
||||||
sb->cfg.audio_loc_flag = flag_bits;
|
|
||||||
sb->cfg.audio_stereo_flag = flag_bits;
|
|
||||||
sb->cfg.audio_streamed_and = streamed_and;
|
|
||||||
sb->cfg.audio_loop_and = loop_and;
|
|
||||||
sb->cfg.audio_loc_and = loc_and;
|
|
||||||
sb->cfg.audio_stereo_and = stereo_and;
|
|
||||||
sb->cfg.audio_pitch = pitch;
|
|
||||||
sb->cfg.audio_sample_rate = sample_rate;
|
|
||||||
}
|
|
||||||
static void config_sb_audio_hs(ubi_sb_header* sb, off_t channels, off_t sample_rate, off_t num_samples, off_t num_samples2, off_t stream_name, off_t stream_type) {
|
static void config_sb_audio_hs(ubi_sb_header* sb, off_t channels, off_t sample_rate, off_t num_samples, off_t num_samples2, off_t stream_name, off_t stream_type) {
|
||||||
/* audio header with stream name */
|
/* audio header with stream name */
|
||||||
sb->cfg.audio_channels = channels;
|
sb->cfg.audio_channels = channels;
|
||||||
@ -2698,6 +2674,30 @@ static void config_sb_audio_he(ubi_sb_header* sb, off_t channels, off_t sample_r
|
|||||||
sb->cfg.audio_extra_name = extra_name;
|
sb->cfg.audio_extra_name = extra_name;
|
||||||
sb->cfg.audio_stream_type = stream_type;
|
sb->cfg.audio_stream_type = stream_type;
|
||||||
}
|
}
|
||||||
|
static void config_sb_audio_ps2_bnm(ubi_sb_header *sb, off_t flag_bits, int streamed_and, int cd_streamed_and, int loop_and, off_t channels, off_t sample_rate) {
|
||||||
|
/* bit flags, channels and sample rate */
|
||||||
|
sb->cfg.audio_streamed_flag = flag_bits;
|
||||||
|
sb->cfg.audio_cd_streamed_flag = flag_bits;
|
||||||
|
sb->cfg.audio_loop_flag = flag_bits;
|
||||||
|
sb->cfg.audio_streamed_and = streamed_and;
|
||||||
|
sb->cfg.audio_cd_streamed_and = cd_streamed_and;
|
||||||
|
sb->cfg.audio_loop_and = loop_and;
|
||||||
|
sb->cfg.audio_channels = channels;
|
||||||
|
sb->cfg.audio_sample_rate = sample_rate;
|
||||||
|
}
|
||||||
|
static void config_sb_audio_ps2_old(ubi_sb_header *sb, off_t flag_bits, int streamed_and, int loop_and, int loc_and, int stereo_and, off_t pitch, off_t sample_rate) {
|
||||||
|
/* bit flags, sample rate only */
|
||||||
|
sb->cfg.audio_streamed_flag = flag_bits;
|
||||||
|
sb->cfg.audio_loop_flag = flag_bits;
|
||||||
|
sb->cfg.audio_loc_flag = flag_bits;
|
||||||
|
sb->cfg.audio_stereo_flag = flag_bits;
|
||||||
|
sb->cfg.audio_streamed_and = streamed_and;
|
||||||
|
sb->cfg.audio_loop_and = loop_and;
|
||||||
|
sb->cfg.audio_loc_and = loc_and;
|
||||||
|
sb->cfg.audio_stereo_and = stereo_and;
|
||||||
|
sb->cfg.audio_pitch = pitch;
|
||||||
|
sb->cfg.audio_sample_rate = sample_rate;
|
||||||
|
}
|
||||||
static void config_sb_sequence(ubi_sb_header* sb, off_t sequence_count, off_t entry_size) {
|
static void config_sb_sequence(ubi_sb_header* sb, off_t sequence_count, off_t entry_size) {
|
||||||
/* sequence header and chain table */
|
/* sequence header and chain table */
|
||||||
sb->cfg.sequence_sequence_loop = sequence_count - 0x10;
|
sb->cfg.sequence_sequence_loop = sequence_count - 0x10;
|
||||||
@ -2781,6 +2781,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
int is_bia_ps2 = 0, is_biadd_psp = 0;
|
int is_bia_ps2 = 0, is_biadd_psp = 0;
|
||||||
int is_sc2_ps2_gc = 0;
|
int is_sc2_ps2_gc = 0;
|
||||||
int is_sc4_pc_online = 0;
|
int is_sc4_pc_online = 0;
|
||||||
|
int is_myst4_pc = 0;
|
||||||
|
|
||||||
/* Most of the format varies with almost every game + platform (struct serialization?).
|
/* Most of the format varies with almost every game + platform (struct serialization?).
|
||||||
* Support is configured case-by-case as offsets/order/fields only change slightly,
|
* Support is configured case-by-case as offsets/order/fields only change slightly,
|
||||||
@ -3441,7 +3442,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Myst IV (Demo)(2004)(PC)-bank */
|
/* Myst IV: Revelation (Demo)(2004)(PC)-bank */
|
||||||
if (sb->version == 0x00100000 && sb->platform == UBI_PC) {
|
if (sb->version == 0x00100000 && sb->platform == UBI_PC) {
|
||||||
config_sb_entry(sb, 0x68, 0xa4);
|
config_sb_entry(sb, 0x68, 0xa4);
|
||||||
|
|
||||||
@ -3451,11 +3452,21 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* two configs with same id; use project file as identifier */
|
||||||
|
if (sb->version == 0x00120006 && sb->platform == UBI_PC) {
|
||||||
|
if (check_project_file(sf, "gamesnd_myst4.sp0", 1)) {
|
||||||
|
is_myst4_pc = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Myst IV: Revelation (2004)(PC)-bank 0x00120006 */
|
||||||
/* Prince of Persia: Warrior Within (Demo)(2004)(PC)-bank 0x00120006 */
|
/* Prince of Persia: Warrior Within (Demo)(2004)(PC)-bank 0x00120006 */
|
||||||
/* Prince of Persia: Warrior Within (2004)(PC)-bank 0x00120009 */
|
/* Prince of Persia: Warrior Within (2004)(PC)-bank 0x00120009 */
|
||||||
if ((sb->version == 0x00120006 && sb->platform == UBI_PC) ||
|
if ((sb->version == 0x00120006 && sb->platform == UBI_PC) ||
|
||||||
(sb->version == 0x00120009 && sb->platform == UBI_PC)) {
|
(sb->version == 0x00120009 && sb->platform == UBI_PC)) {
|
||||||
config_sb_entry(sb, 0x6c, 0x84);
|
config_sb_entry(sb, 0x6c, 0x84);
|
||||||
|
if (is_myst4_pc)
|
||||||
|
config_sb_entry(sb, 0x6c, 0xa4);
|
||||||
|
|
||||||
config_sb_audio_fs(sb, 0x24, 0x2c, 0x28);
|
config_sb_audio_fs(sb, 0x24, 0x2c, 0x28);
|
||||||
config_sb_audio_hs(sb, 0x4c, 0x44, 0x30, 0x38, 0x54, 0x50);
|
config_sb_audio_hs(sb, 0x4c, 0x44, 0x30, 0x38, 0x54, 0x50);
|
||||||
@ -3501,6 +3512,8 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
/* Beowulf: The Game (2007)(PSP)-map */
|
/* Beowulf: The Game (2007)(PSP)-map */
|
||||||
if (sb->version == 0x0012000C && sb->platform == UBI_PSP && !is_biadd_psp) {
|
if (sb->version == 0x0012000C && sb->platform == UBI_PSP && !is_biadd_psp) {
|
||||||
config_sb_entry(sb, 0x68, 0x84);
|
config_sb_entry(sb, 0x68, 0x84);
|
||||||
|
if (is_biadd_psp)
|
||||||
|
config_sb_entry(sb, 0x80, 0x94);
|
||||||
|
|
||||||
config_sb_audio_fs(sb, 0x24, 0x2c, 0x28);
|
config_sb_audio_fs(sb, 0x24, 0x2c, 0x28);
|
||||||
config_sb_audio_hs(sb, 0x4c, 0x44, 0x30, 0x38, 0x54, 0x50);
|
config_sb_audio_hs(sb, 0x4c, 0x44, 0x30, 0x38, 0x54, 0x50);
|
||||||
@ -3510,17 +3523,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
|
|
||||||
config_sb_layer_hs(sb, 0x1c, 0x60, 0x64, 0x30);
|
config_sb_layer_hs(sb, 0x1c, 0x60, 0x64, 0x30);
|
||||||
config_sb_layer_sh(sb, 0x18, 0x00, 0x08, 0x0c, 0x14);
|
config_sb_layer_sh(sb, 0x18, 0x00, 0x08, 0x0c, 0x14);
|
||||||
return 1;
|
//todo some .sbX in BiA:DD have bad external stream offsets, but not all (ex. offset 0xE3641 but should be 0x0A26)
|
||||||
}
|
|
||||||
|
|
||||||
//todo some .sbX have bad external stream offsets, but not all (ex. offset 0xE3641 but should be 0x0A26)
|
|
||||||
/* Brothers in Arms: D-Day (2006)(PSP)-bank */
|
|
||||||
if (sb->version == 0x0012000C && sb->platform == UBI_PSP && is_biadd_psp) {
|
|
||||||
config_sb_entry(sb, 0x80, 0x94);
|
|
||||||
|
|
||||||
config_sb_audio_fs(sb, 0x24, 0x2c, 0x28);
|
|
||||||
config_sb_audio_hs(sb, 0x4c, 0x44, 0x30, 0x38, 0x54, 0x50);
|
|
||||||
sb->cfg.audio_has_internal_names = 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3535,7 +3538,7 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Myst IV: Revelation (2005)(PC)-bank */
|
/* Myst IV: Revelation (2005)(Xbox)-bank */
|
||||||
/* Splinter Cell: Chaos Theory (2005)(Xbox)-map */
|
/* Splinter Cell: Chaos Theory (2005)(Xbox)-map */
|
||||||
if (sb->version == 0x00120012 && sb->platform == UBI_XBOX) {
|
if (sb->version == 0x00120012 && sb->platform == UBI_XBOX) {
|
||||||
config_sb_entry(sb, 0x48, 0x4c);
|
config_sb_entry(sb, 0x48, 0x4c);
|
||||||
@ -3547,6 +3550,20 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Splinter Cell: Chaos Theory (2005)(PS2)-map */
|
||||||
|
if (sb->version == 0x00130001 && sb->platform == UBI_PS2) {
|
||||||
|
config_sb_entry(sb, 0x48, 0x4c);
|
||||||
|
|
||||||
|
config_sb_audio_fb(sb, 0x18, (1 << 2), (1 << 3), (1 << 4));
|
||||||
|
config_sb_audio_he(sb, 0x20, 0x24, 0x30, 0x38, 0x40, 0x44);
|
||||||
|
|
||||||
|
config_sb_sequence(sb, 0x28, 0x10);
|
||||||
|
|
||||||
|
//config_sb_layer_he(sb, 0x1c, 0x28, 0x30, 0x34);
|
||||||
|
//config_sb_layer_sh(sb, 0x18, 0x00, 0x08, 0x0c, 0x14);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Splinter Cell: Chaos Theory (2005)(GC)-map */
|
/* Splinter Cell: Chaos Theory (2005)(GC)-map */
|
||||||
if (sb->version == 0x00130001 && sb->platform == UBI_GC) {
|
if (sb->version == 0x00130001 && sb->platform == UBI_GC) {
|
||||||
config_sb_entry(sb, 0x68, 0x54);
|
config_sb_entry(sb, 0x68, 0x54);
|
||||||
@ -3761,23 +3778,11 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Splinter Cell: Double Agent (2006)(PC)-map (offline) */
|
/* Splinter Cell: Double Agent (2006)(PC)-map */
|
||||||
if (sb->version == 0x00180006 && sb->platform == UBI_PC && !is_sc4_pc_online) {
|
if (sb->version == 0x00180006 && sb->platform == UBI_PC) {
|
||||||
config_sb_entry(sb, 0x68, 0x7c);
|
config_sb_entry(sb, 0x68, 0x7c);
|
||||||
|
if (is_sc4_pc_online)
|
||||||
config_sb_audio_fs(sb, 0x2c, 0x34, 0x30);
|
config_sb_entry(sb, 0x68, 0x78);
|
||||||
config_sb_audio_he(sb, 0x5c, 0x54, 0x40, 0x48, 0x64, 0x60);
|
|
||||||
|
|
||||||
config_sb_sequence(sb, 0x2c, 0x14);
|
|
||||||
|
|
||||||
config_sb_layer_he(sb, 0x20, 0x38, 0x3c, 0x44);
|
|
||||||
config_sb_layer_sh(sb, 0x34, 0x00, 0x08, 0x0c, 0x14);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Splinter Cell: Double Agent (2006)(PC)-map (online) */
|
|
||||||
if (sb->version == 0x00180006 && sb->platform == UBI_PC && is_sc4_pc_online) {
|
|
||||||
config_sb_entry(sb, 0x68, 0x78);
|
|
||||||
|
|
||||||
config_sb_audio_fs(sb, 0x2c, 0x34, 0x30);
|
config_sb_audio_fs(sb, 0x2c, 0x34, 0x30);
|
||||||
config_sb_audio_he(sb, 0x5c, 0x54, 0x40, 0x48, 0x64, 0x60);
|
config_sb_audio_he(sb, 0x5c, 0x54, 0x40, 0x48, 0x64, 0x60);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user