mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
commit
caa82fc350
@ -57,6 +57,7 @@ class Cli(object):
|
||||
p.add_argument('-fss', dest='min_subsongs', help="Filter min subsongs\n(1 filters formats incapable of subsongs)", type=int)
|
||||
p.add_argument('-fni', dest='include_regex', help="Filter by REGEX including matches of subsong name")
|
||||
p.add_argument('-fne', dest='exclude_regex', help="Filter by REGEX excluding matches of subsong name")
|
||||
p.add_argument('-nsc',dest='no_semicolon', help="Remove semicolon names (for songs with multinames)", action='store_true')
|
||||
p.add_argument('-v', dest='log_level', help="Verbose log level (off|debug|info, default: info)", default='info')
|
||||
return p.parse_args()
|
||||
|
||||
@ -136,7 +137,7 @@ class Cr32Helper(object):
|
||||
# Makes .txtp (usually 1 but may do N) from a CLI output + subsong
|
||||
class TxtpMaker(object):
|
||||
|
||||
def __init__(self, cfg, output_b):
|
||||
def __init__(self, cfg, output_b, rename_map):
|
||||
self.cfg = cfg
|
||||
|
||||
self.output = str(output_b).replace("\\r","").replace("\\n","\n")
|
||||
@ -145,25 +146,31 @@ class TxtpMaker(object):
|
||||
self.num_samples = self._get_value("stream total samples: ")
|
||||
self.stream_count = self._get_value("stream count: ")
|
||||
self.stream_index = self._get_value("stream index: ")
|
||||
self.stream_name = self._get_string("stream name: ")
|
||||
self.stream_name = self._get_text("stream name: ")
|
||||
|
||||
if self.channels <= 0 or self.sample_rate <= 0:
|
||||
raise ValueError('Incorrect command result')
|
||||
|
||||
self.stream_seconds = self.num_samples / self.sample_rate
|
||||
self.ignorable = self._is_ignorable(cfg)
|
||||
self.rename_map = {}
|
||||
self.rename_map = rename_map
|
||||
|
||||
def __str__(self):
|
||||
return str(self.__dict__)
|
||||
|
||||
def _get_string(self, str):
|
||||
def _get_string(self, str, full=False):
|
||||
find_pos = self.output.find(str)
|
||||
if (find_pos == -1):
|
||||
return None
|
||||
cut_pos = find_pos + len(str)
|
||||
str_cut = self.output[cut_pos:]
|
||||
return str_cut.split()[0]
|
||||
if full:
|
||||
return str_cut.split("\n")[0].strip()
|
||||
else:
|
||||
return str_cut.split()[0].strip()
|
||||
|
||||
def _get_text(self, str):
|
||||
return self._get_string(str, full=True)
|
||||
|
||||
def _get_value(self, str):
|
||||
res = self._get_string(str)
|
||||
@ -232,6 +239,12 @@ class TxtpMaker(object):
|
||||
pos = txt.rfind(".")
|
||||
if pos >= 0:
|
||||
txt = txt[:pos]
|
||||
|
||||
if self.cfg.no_semicolon:
|
||||
pos = txt.find(";")
|
||||
if pos >= 0:
|
||||
txt = txt[:pos].strip()
|
||||
|
||||
return txt
|
||||
|
||||
def _write(self, outname, line):
|
||||
@ -244,7 +257,7 @@ class TxtpMaker(object):
|
||||
else:
|
||||
rename_count = 0
|
||||
self.rename_map[outname] = rename_count + 1
|
||||
outname = outname.replace(".txtp", "_%s.txtp" % (rename_count))
|
||||
outname = outname.replace(".txtp", "_%08i.txtp" % (rename_count))
|
||||
|
||||
if not cfg.overwrite and os.path.exists(outname):
|
||||
raise ValueError('TXTP exists in path: ' + outname)
|
||||
@ -434,6 +447,8 @@ class App(object):
|
||||
filenames_in += self._find_files('.', filename)
|
||||
|
||||
|
||||
rename_map = {}
|
||||
|
||||
total_created = 0
|
||||
total_dupes = 0
|
||||
total_errors = 0
|
||||
@ -466,7 +481,7 @@ class App(object):
|
||||
if target_subsong == 1:
|
||||
log.debug("processing %s...", filename_in_clean)
|
||||
|
||||
maker = TxtpMaker(self.cfg, output_b)
|
||||
maker = TxtpMaker(self.cfg, output_b, rename_map)
|
||||
|
||||
if not maker.is_ignorable():
|
||||
self.crc32.update(filename_out)
|
||||
|
@ -612,6 +612,7 @@ Loop anchors have priority over `loop_start_segment`, and are ignored in layered
|
||||
Manually setting values gets old, so TXTP supports a bunch of simple macros. They automate some of the above commands (analyzing the file), and may be combined, so order still matters.
|
||||
- `volume N (channels)`: sets volume V to selected channels. N.N = percent or NdB = decibels.
|
||||
- `1.0` or `0dB` = base volume, `2.0` or `6dB` = double volume, `0.5` or `-6dB` = half volume
|
||||
- `#v N` also works
|
||||
- `track (channels)`: makes a file of selected channels
|
||||
- `layer-v N (channels)`: mixes selected channels to N channels with default volume (for layered vocals). If N is 0 (or ommited), automatically sets highest channel count among all layers.
|
||||
- `layer-b N (channels)`: same, but adjusts volume depending on layers (for layered bgm)
|
||||
|
@ -606,6 +606,7 @@ size_t atrac3plus_bytes_to_samples(size_t bytes, int full_block_align);
|
||||
size_t ac3_bytes_to_samples(size_t bytes, int full_block_align, int channels);
|
||||
size_t aac_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes);
|
||||
size_t mpeg_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes);
|
||||
int32_t mpeg_get_samples_clean(STREAMFILE* sf, off_t start, size_t size, size_t* p_loop_start, size_t* p_loop_end, int is_vbr);
|
||||
|
||||
|
||||
/* helper to pass a wrapped, clamped, fake extension-ed, SF to another meta */
|
||||
|
@ -3,12 +3,12 @@
|
||||
#ifdef VGM_USE_MPEG
|
||||
|
||||
/* init config and validate per type */
|
||||
int mpeg_custom_setup_init_default(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type) {
|
||||
int mpeg_custom_setup_init_default(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type) {
|
||||
mpeg_frame_info info;
|
||||
|
||||
|
||||
/* get frame info at offset */
|
||||
if ( !mpeg_get_frame_info(streamFile, start_offset, &info))
|
||||
if ( !mpeg_get_frame_info(sf, start_offset, &info))
|
||||
goto fail;
|
||||
switch(info.layer) {
|
||||
case 1: *coding_type = coding_MPEG_layer1; break;
|
||||
@ -113,7 +113,7 @@ fail:
|
||||
|
||||
|
||||
/* writes data to the buffer and moves offsets */
|
||||
int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream) {
|
||||
int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream) {
|
||||
mpeg_custom_stream *ms = data->streams[num_stream];
|
||||
mpeg_frame_info info;
|
||||
size_t current_data_size = 0;
|
||||
@ -242,7 +242,7 @@ fail:
|
||||
* Gets info from a MPEG frame header at offset. Normally you would use mpg123_info but somehow
|
||||
* it's wrong at times (maybe because we use an ancient version) so here we do our thing.
|
||||
*/
|
||||
static int mpeg_get_frame_info_h(uint32_t header, mpeg_frame_info *info) {
|
||||
static int mpeg_get_frame_info_h(uint32_t header, mpeg_frame_info* info) {
|
||||
/* index tables */
|
||||
static const int versions[4] = { /* MPEG 2.5 */ 3, /* reserved */ -1, /* MPEG 2 */ 2, /* MPEG 1 */ 1 };
|
||||
static const int layers[4] = { -1,3,2,1 };
|
||||
@ -313,12 +313,12 @@ static int mpeg_get_frame_info_h(uint32_t header, mpeg_frame_info *info) {
|
||||
fail:
|
||||
return 0;
|
||||
}
|
||||
int mpeg_get_frame_info(STREAMFILE *sf, off_t offset, mpeg_frame_info *info) {
|
||||
int mpeg_get_frame_info(STREAMFILE* sf, off_t offset, mpeg_frame_info* info) {
|
||||
uint32_t header = read_u32be(offset, sf);
|
||||
return mpeg_get_frame_info_h(header, info);
|
||||
}
|
||||
|
||||
size_t mpeg_get_samples(STREAMFILE *sf, off_t start_offset, size_t bytes) {
|
||||
size_t mpeg_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes) {
|
||||
off_t offset = start_offset;
|
||||
off_t max_offset = start_offset + bytes;
|
||||
int frames = 0, samples = 0, encoder_delay = 0, encoder_padding = 0;
|
||||
@ -428,4 +428,48 @@ size_t mpeg_get_samples(STREAMFILE *sf, off_t start_offset, size_t bytes) {
|
||||
return samples;
|
||||
}
|
||||
|
||||
|
||||
/* variation of the above, for clean streams = no ID3/VBR headers
|
||||
* (maybe should be fused in a single thing with config, API is kinda messy too) */
|
||||
int32_t mpeg_get_samples_clean(STREAMFILE *sf, off_t start, size_t size, size_t* p_loop_start, size_t* p_loop_end, int is_vbr) {
|
||||
mpeg_frame_info info;
|
||||
off_t offset = start;
|
||||
int32_t num_samples = 0, loop_start = 0, loop_end = 0;
|
||||
|
||||
if (!is_vbr) {
|
||||
/* CBR = quick calcs */
|
||||
if (!mpeg_get_frame_info(sf, offset, &info))
|
||||
goto fail;
|
||||
|
||||
num_samples = size / info.frame_size * info.frame_samples;
|
||||
loop_start = *p_loop_start / info.frame_size * info.frame_samples;
|
||||
loop_end = *p_loop_end / info.frame_size * info.frame_samples;
|
||||
}
|
||||
else {
|
||||
/* VBR (or unknown) = count frames */
|
||||
while (offset < start + size) {
|
||||
if (!mpeg_get_frame_info(sf, offset, &info))
|
||||
goto fail;
|
||||
|
||||
if (*p_loop_start + start == offset)
|
||||
loop_start = num_samples;
|
||||
|
||||
num_samples += info.frame_samples;
|
||||
offset += info.frame_size;
|
||||
|
||||
if (*p_loop_end + start == offset)
|
||||
loop_end = num_samples;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*p_loop_start = loop_start;
|
||||
*p_loop_end = loop_end;
|
||||
|
||||
return num_samples;
|
||||
fail:
|
||||
VGM_LOG("MPEG: sample reader failed at %lx\n", offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,157 +1,160 @@
|
||||
#ifndef _FSB_KEYS_H_
|
||||
#define _FSB_KEYS_H_
|
||||
|
||||
typedef struct {
|
||||
int is_fsb5; /* FSB5 or FSB4/3*/
|
||||
int is_alt; /* alt XOR mode (seemingly not tied to FSB version or anything) */
|
||||
size_t fsbkey_size;
|
||||
const uint8_t *fsbkey;
|
||||
} fsbkey_info;
|
||||
|
||||
/**
|
||||
* List of known keys, found in aluigi's site (http://aluigi.altervista.org), forums, guessfsb.exe or manually.
|
||||
*/
|
||||
|
||||
/* DJ Hero 2 (X360) */ //"nos71RiT"
|
||||
static const uint8_t key_dj2[] = { 0x6E,0x6F,0x73,0x37,0x31,0x52,0x69,0x54 };
|
||||
|
||||
/* Double Fine Productions: Brutal Legend, Massive Chalice, etc (multi) */ //"DFm3t4lFTW"
|
||||
static const uint8_t key_dfp[] = { 0x44,0x46,0x6D,0x33,0x74,0x34,0x6C,0x46,0x54,0x57 };
|
||||
|
||||
/* N++ (PC?) */ //"H$#FJa%7gRZZOlxLiN50&g5Q"
|
||||
static const uint8_t key_npp[] = { 0x48,0x24,0x23,0x46,0x4A,0x61,0x25,0x37,0x67,0x52,0x5A,0x5A,0x4F,0x6C,0x78,0x4C,0x69,0x4E,0x35,0x30,0x26,0x67,0x35,0x51 };
|
||||
|
||||
/* Slightly Mad Studios: Project CARS (PC?), World of Speed (PC) */ //"sTOoeJXI2LjK8jBMOk8h5IDRNZl3jq3I"
|
||||
static const uint8_t key_sms[] = { 0x73,0x54,0x4F,0x6F,0x65,0x4A,0x58,0x49,0x32,0x4C,0x6A,0x4B,0x38,0x6A,0x42,0x4D,0x4F,0x6B,0x38,0x68,0x35,0x49,0x44,0x52,0x4E,0x5A,0x6C,0x33,0x6A,0x71,0x33,0x49 };
|
||||
|
||||
/* Ghost in the Shell: First Assault (PC) */ //"%lAn2{Pi*Lhw3T}@7*!kV=?qS$@iNlJ"
|
||||
static const uint8_t key_gfs[] = { 0x25,0x6C,0x41,0x6E,0x32,0x7B,0x50,0x69,0x2A,0x4C,0x68,0x77,0x33,0x54,0x7D,0x40,0x37,0x2A,0x21,0x6B,0x56,0x3D,0x3F,0x71,0x53,0x24,0x40,0x69,0x4E,0x6C,0x4A };
|
||||
|
||||
/* RevHeadz Engine Sounds (Mobile) */ //"1^7%82#&5$~/8sz"
|
||||
static const uint8_t key_rev[] = { 0x31,0x5E,0x37,0x25,0x38,0x32,0x23,0x26,0x35,0x24,0x7E,0x2F,0x38,0x73,0x7A };
|
||||
|
||||
/* Dark Souls 3 (PC) */ //"FDPrVuT4fAFvdHJYAgyMzRF4EcBAnKg"
|
||||
static const uint8_t key_ds3[] = { 0x46,0x44,0x50,0x72,0x56,0x75,0x54,0x34,0x66,0x41,0x46,0x76,0x64,0x48,0x4A,0x59,0x41,0x67,0x79,0x4D,0x7A,0x52,0x46,0x34,0x45,0x63,0x42,0x41,0x6E,0x4B,0x67 };
|
||||
|
||||
/* Mortal Kombat X */
|
||||
static const uint8_t key_mkx[] = { 0x99,0x61,0x64,0xB5,0xFC,0x0F,0x40,0x29,0x83,0xF6,0x1F,0x22,0x0B,0xB5,0x1D,0xC6 };
|
||||
|
||||
/* Xian Xia Chuan (PC) */ //"gat@tcqs2010"
|
||||
static const uint8_t key_xxc[] = { 0x67,0x61,0x74,0x40,0x74,0x63,0x71,0x73,0x32,0x30,0x31,0x30 };
|
||||
|
||||
/* Mirror War Reincarnation of Holiness (PC) */ //"logicsounddesignmwsdev"
|
||||
static const uint8_t key_mwr[] = { 0x6C,0x6F,0x67,0x69,0x63,0x73,0x6F,0x75,0x6E,0x64,0x64,0x65,0x73,0x69,0x67,0x6E,0x6D,0x77,0x73,0x64,0x65,0x76 };
|
||||
|
||||
/* Need for Speed Shift 2 Unleashed (PC demo?) */ //"p&oACY^c4LK5C2v^x5nIO6kg5vNH$tlj"
|
||||
static const uint8_t key_n2u[] = { 0x70,0x26,0x6F,0x41,0x43,0x59,0x5E,0x63,0x34,0x4C,0x4B,0x35,0x43,0x32,0x76,0x5E,0x78,0x35,0x6E,0x49,0x4F,0x36,0x6B,0x67,0x35,0x76,0x4E,0x48,0x24,0x74,0x6C,0x6A };
|
||||
|
||||
/* Critter Crunch, Superbrothers: Sword & Sworcery */ //"j1$Mk0Libg3#apEr42mo"
|
||||
static const uint8_t key_ccr[] = { 0x6A,0x31,0x24,0x4D,0x6B,0x30,0x4C,0x69,0x62,0x67,0x33,0x23,0x61,0x70,0x45,0x72,0x34,0x32,0x6D,0x6F };
|
||||
|
||||
/* Cyphers */ //"@kdj43nKDN^k*kj3ndf02hd95nsl(NJG"
|
||||
static const uint8_t key_cyp[] = { 0x40,0x6B,0x64,0x6A,0x34,0x33,0x6E,0x4B,0x44,0x4E,0x5E,0x6B,0x2A,0x6B,0x6A,0x33,0x6E,0x64,0x66,0x30,0x32,0x68,0x64,0x39,0x35,0x6E,0x73,0x6C,0x28,0x4E,0x4A,0x47 };
|
||||
|
||||
/* Xuan Dou Zhi Wang / King of Combat */ //"Xiayuwu69252.Sonicli81223#$*@*0"
|
||||
static const uint8_t key_xdz[] = { 0x58,0x69,0x61,0x79,0x75,0x77,0x75,0x36,0x39,0x32,0x35,0x32,0x2E,0x53,0x6F,0x6E,0x69,0x63,0x6C,0x69,0x38,0x31,0x32,0x32,0x33,0x23,0x24,0x2A,0x40,0x2A,0x30 };
|
||||
|
||||
/* Ji Feng Zhi Ren / Kritika Online */ //"kri_tika_5050_"
|
||||
static const uint8_t key_jzz[] = { 0x6B,0x72,0x69,0x5F,0x74,0x69,0x6B,0x61,0x5F,0x35,0x30,0x35,0x30,0x5F };
|
||||
|
||||
/* Invisible Inc. */ //"mint78run52"
|
||||
static const uint8_t key_inv[] = { 0x6D,0x69,0x6E,0x74,0x37,0x38,0x72,0x75,0x6E,0x35,0x32 };
|
||||
|
||||
/* Guitar Hero 3 */ //"5atu6w4zaw"
|
||||
static const uint8_t key_gh3[] = { 0x35,0x61,0x74,0x75,0x36,0x77,0x34,0x7A,0x61,0x77 };
|
||||
|
||||
/* Supreme Commander 2 */ //"B2A7BB00"
|
||||
static const uint8_t key_sc2[] = { 0x42,0x32,0x41,0x37,0x42,0x42,0x30,0x30 };
|
||||
|
||||
/* Cookie Run: Ovenbreak */ //"ghfxhslrghfxhslr"
|
||||
static const uint8_t key_cro[] = { 0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72,0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72 };
|
||||
|
||||
/* Monster Jam (PS2) */ //"truck/impact/carbody"
|
||||
static const uint8_t key_mtj[] = { 0x74,0x72,0x75,0x63,0x6B,0x2F,0x69,0x6D,0x70,0x61,0x63,0x74,0x2F,0x63,0x61,0x72,0x62,0x6F,0x64,0x79 };
|
||||
|
||||
/* Guitar Hero 5 (X360) */
|
||||
static const uint8_t key_gh5[] = { 0xFC,0xF9,0xE4,0xB3,0xF5,0x57,0x5C,0xA5,0xAC,0x13,0xEC,0x4A,0x43,0x19,0x58,0xEB,0x4E,0xF3,0x84,0x0B,0x8B,0x78,0xFA,0xFD,0xBB,0x18,0x46,0x7E,0x31,0xFB,0xD0 };
|
||||
|
||||
/* Sekiro: Shadows Die Twice (PC) */ //"G0KTrWjS9syqF7vVD6RaVXlFD91gMgkC"
|
||||
static const uint8_t key_sek[] = { 0x47,0x30,0x4B,0x54,0x72,0x57,0x6A,0x53,0x39,0x73,0x79,0x71,0x46,0x37,0x76,0x56,0x44,0x36,0x52,0x61,0x56,0x58,0x6C,0x46,0x44,0x39,0x31,0x67,0x4D,0x67,0x6B,0x43 };
|
||||
|
||||
/* SCP: Unity (PC) */ //"BasicEncryptionKey"
|
||||
static const uint8_t key_scp[] = { 0x42,0x61,0x73,0x69,0x63,0x45,0x6E,0x63,0x72,0x79,0x70,0x74,0x69,0x6F,0x6E,0x4B,0x65,0x79 };
|
||||
|
||||
/* Guitar Hero: Metallica (X360) */
|
||||
static const uint8_t key_ghm[] = { 0x8C,0xFA,0xF3,0x14,0xB1,0x53,0xDA,0xAB,0x2B,0x82,0x6B,0xD5,0x55,0x16,0xCF,0x01,0x90,0x20,0x28,0x14,0xB1,0x53,0xD8 };
|
||||
|
||||
// Unknown:
|
||||
// - Battle: Los Angeles
|
||||
// - Guitar Hero: Warriors of Rock, DJ hero FSB
|
||||
// - Longmenkezhan
|
||||
// - Gas Guzzlers: Combat Carnage (PC?) "C5FA83EA64B34EC2BFE" hex or text? [FSB5]
|
||||
|
||||
static const fsbkey_info fsbkey_list[] = {
|
||||
{ 0,0, sizeof(key_dj2),key_dj2 },
|
||||
{ 0,0, sizeof(key_dfp),key_dfp },//FSB4
|
||||
{ 1,0, sizeof(key_dfp),key_dfp },//untested
|
||||
{ 1,1, sizeof(key_dfp),key_dfp },//untested
|
||||
{ 1,0, sizeof(key_npp),key_npp },//FSB5
|
||||
{ 1,0, sizeof(key_sms),key_sms },//FSB5
|
||||
{ 1,0, sizeof(key_gfs),key_gfs },//FSB5
|
||||
{ 1,0, sizeof(key_rev),key_rev },//FSB5
|
||||
{ 1,0, sizeof(key_ds3),key_ds3 },//untested
|
||||
{ 1,1, sizeof(key_ds3),key_ds3 },
|
||||
{ 1,0, sizeof(key_mkx),key_mkx },//untested
|
||||
{ 1,1, sizeof(key_mkx),key_mkx },//untested
|
||||
{ 0,0, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 0,1, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 1,0, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 1,1, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 0,0, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 0,1, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 1,0, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 1,1, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 0,0, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 0,1, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 1,0, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 1,1, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 0,0, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 0,1, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 1,0, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 1,1, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 0,0, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 0,1, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 1,0, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 1,1, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 0,0, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 0,1, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 1,0, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 1,1, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 0,0, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 0,1, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 1,0, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 1,1, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 0,0, sizeof(key_inv),key_inv },//untested
|
||||
{ 0,1, sizeof(key_inv),key_inv },//untested
|
||||
{ 1,0, sizeof(key_inv),key_inv },//untested
|
||||
{ 1,1, sizeof(key_inv),key_inv },//untested
|
||||
{ 0,0, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 0,1, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 1,0, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 1,1, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 0,0, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 0,1, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,0, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,1, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,0, sizeof(key_cro),key_cro },
|
||||
{ 0,1, sizeof(key_mtj),key_mtj },// FSB3
|
||||
{ 0,1, sizeof(key_gh5),key_gh5 },// FSB4
|
||||
{ 1,0, sizeof(key_sek),key_sek },// FSB5
|
||||
{ 1,0, sizeof(key_scp),key_scp },// FSB5
|
||||
{ 0,1, sizeof(key_ghm),key_ghm },// FSB4
|
||||
|
||||
};
|
||||
static const int fsbkey_list_count = sizeof(fsbkey_list) / sizeof(fsbkey_list[0]);
|
||||
|
||||
|
||||
#endif /* _FSB_KEYS_H_ */
|
||||
#ifndef _FSB_KEYS_H_
|
||||
#define _FSB_KEYS_H_
|
||||
|
||||
/**
|
||||
* List of known keys, found in aluigi's site (http://aluigi.altervista.org), forums, guessfsb.exe or manually.
|
||||
*/
|
||||
|
||||
/* DJ Hero 2 (X360) */ //"nos71RiT"
|
||||
static const uint8_t key_dj2[] = { 0x6E,0x6F,0x73,0x37,0x31,0x52,0x69,0x54 };
|
||||
|
||||
/* Double Fine Productions: Brutal Legend, Massive Chalice, etc (multi) */ //"DFm3t4lFTW"
|
||||
static const uint8_t key_dfp[] = { 0x44,0x46,0x6D,0x33,0x74,0x34,0x6C,0x46,0x54,0x57 };
|
||||
|
||||
/* N++ (PC?) */ //"H$#FJa%7gRZZOlxLiN50&g5Q"
|
||||
static const uint8_t key_npp[] = { 0x48,0x24,0x23,0x46,0x4A,0x61,0x25,0x37,0x67,0x52,0x5A,0x5A,0x4F,0x6C,0x78,0x4C,0x69,0x4E,0x35,0x30,0x26,0x67,0x35,0x51 };
|
||||
|
||||
/* Slightly Mad Studios: Project CARS (PC?), World of Speed (PC) */ //"sTOoeJXI2LjK8jBMOk8h5IDRNZl3jq3I"
|
||||
static const uint8_t key_sms[] = { 0x73,0x54,0x4F,0x6F,0x65,0x4A,0x58,0x49,0x32,0x4C,0x6A,0x4B,0x38,0x6A,0x42,0x4D,0x4F,0x6B,0x38,0x68,0x35,0x49,0x44,0x52,0x4E,0x5A,0x6C,0x33,0x6A,0x71,0x33,0x49 };
|
||||
|
||||
/* Ghost in the Shell: First Assault (PC) */ //"%lAn2{Pi*Lhw3T}@7*!kV=?qS$@iNlJ"
|
||||
static const uint8_t key_gfs[] = { 0x25,0x6C,0x41,0x6E,0x32,0x7B,0x50,0x69,0x2A,0x4C,0x68,0x77,0x33,0x54,0x7D,0x40,0x37,0x2A,0x21,0x6B,0x56,0x3D,0x3F,0x71,0x53,0x24,0x40,0x69,0x4E,0x6C,0x4A };
|
||||
|
||||
/* RevHeadz Engine Sounds (Mobile) */ //"1^7%82#&5$~/8sz"
|
||||
static const uint8_t key_rev[] = { 0x31,0x5E,0x37,0x25,0x38,0x32,0x23,0x26,0x35,0x24,0x7E,0x2F,0x38,0x73,0x7A };
|
||||
|
||||
/* Dark Souls 3 (PC) */ //"FDPrVuT4fAFvdHJYAgyMzRF4EcBAnKg"
|
||||
static const uint8_t key_ds3[] = { 0x46,0x44,0x50,0x72,0x56,0x75,0x54,0x34,0x66,0x41,0x46,0x76,0x64,0x48,0x4A,0x59,0x41,0x67,0x79,0x4D,0x7A,0x52,0x46,0x34,0x45,0x63,0x42,0x41,0x6E,0x4B,0x67 };
|
||||
|
||||
/* Mortal Kombat X */
|
||||
static const uint8_t key_mkx[] = { 0x99,0x61,0x64,0xB5,0xFC,0x0F,0x40,0x29,0x83,0xF6,0x1F,0x22,0x0B,0xB5,0x1D,0xC6 };
|
||||
|
||||
/* Xian Xia Chuan (PC) */ //"gat@tcqs2010"
|
||||
static const uint8_t key_xxc[] = { 0x67,0x61,0x74,0x40,0x74,0x63,0x71,0x73,0x32,0x30,0x31,0x30 };
|
||||
|
||||
/* Mirror War Reincarnation of Holiness (PC) */ //"logicsounddesignmwsdev"
|
||||
static const uint8_t key_mwr[] = { 0x6C,0x6F,0x67,0x69,0x63,0x73,0x6F,0x75,0x6E,0x64,0x64,0x65,0x73,0x69,0x67,0x6E,0x6D,0x77,0x73,0x64,0x65,0x76 };
|
||||
|
||||
/* Need for Speed Shift 2 Unleashed (PC demo?) */ //"p&oACY^c4LK5C2v^x5nIO6kg5vNH$tlj"
|
||||
static const uint8_t key_n2u[] = { 0x70,0x26,0x6F,0x41,0x43,0x59,0x5E,0x63,0x34,0x4C,0x4B,0x35,0x43,0x32,0x76,0x5E,0x78,0x35,0x6E,0x49,0x4F,0x36,0x6B,0x67,0x35,0x76,0x4E,0x48,0x24,0x74,0x6C,0x6A };
|
||||
|
||||
/* Critter Crunch, Superbrothers: Sword & Sworcery */ //"j1$Mk0Libg3#apEr42mo"
|
||||
static const uint8_t key_ccr[] = { 0x6A,0x31,0x24,0x4D,0x6B,0x30,0x4C,0x69,0x62,0x67,0x33,0x23,0x61,0x70,0x45,0x72,0x34,0x32,0x6D,0x6F };
|
||||
|
||||
/* Cyphers */ //"@kdj43nKDN^k*kj3ndf02hd95nsl(NJG"
|
||||
static const uint8_t key_cyp[] = { 0x40,0x6B,0x64,0x6A,0x34,0x33,0x6E,0x4B,0x44,0x4E,0x5E,0x6B,0x2A,0x6B,0x6A,0x33,0x6E,0x64,0x66,0x30,0x32,0x68,0x64,0x39,0x35,0x6E,0x73,0x6C,0x28,0x4E,0x4A,0x47 };
|
||||
|
||||
/* Xuan Dou Zhi Wang / King of Combat */ //"Xiayuwu69252.Sonicli81223#$*@*0"
|
||||
static const uint8_t key_xdz[] = { 0x58,0x69,0x61,0x79,0x75,0x77,0x75,0x36,0x39,0x32,0x35,0x32,0x2E,0x53,0x6F,0x6E,0x69,0x63,0x6C,0x69,0x38,0x31,0x32,0x32,0x33,0x23,0x24,0x2A,0x40,0x2A,0x30 };
|
||||
|
||||
/* Ji Feng Zhi Ren / Kritika Online */ //"kri_tika_5050_"
|
||||
static const uint8_t key_jzz[] = { 0x6B,0x72,0x69,0x5F,0x74,0x69,0x6B,0x61,0x5F,0x35,0x30,0x35,0x30,0x5F };
|
||||
|
||||
/* Invisible Inc. */ //"mint78run52"
|
||||
static const uint8_t key_inv[] = { 0x6D,0x69,0x6E,0x74,0x37,0x38,0x72,0x75,0x6E,0x35,0x32 };
|
||||
|
||||
/* Guitar Hero 3 */ //"5atu6w4zaw"
|
||||
static const uint8_t key_gh3[] = { 0x35,0x61,0x74,0x75,0x36,0x77,0x34,0x7A,0x61,0x77 };
|
||||
|
||||
/* Supreme Commander 2 */ //"B2A7BB00"
|
||||
static const uint8_t key_sc2[] = { 0x42,0x32,0x41,0x37,0x42,0x42,0x30,0x30 };
|
||||
|
||||
/* Cookie Run: Ovenbreak */ //"ghfxhslrghfxhslr"
|
||||
static const uint8_t key_cro[] = { 0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72,0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72 };
|
||||
|
||||
/* Monster Jam (PS2) */ //"truck/impact/carbody"
|
||||
static const uint8_t key_mtj[] = { 0x74,0x72,0x75,0x63,0x6B,0x2F,0x69,0x6D,0x70,0x61,0x63,0x74,0x2F,0x63,0x61,0x72,0x62,0x6F,0x64,0x79 };
|
||||
|
||||
/* Guitar Hero 5 (X360) */
|
||||
static const uint8_t key_gh5[] = { 0xFC,0xF9,0xE4,0xB3,0xF5,0x57,0x5C,0xA5,0xAC,0x13,0xEC,0x4A,0x43,0x19,0x58,0xEB,0x4E,0xF3,0x84,0x0B,0x8B,0x78,0xFA,0xFD,0xBB,0x18,0x46,0x7E,0x31,0xFB,0xD0 };
|
||||
|
||||
/* Sekiro: Shadows Die Twice (PC) */ //"G0KTrWjS9syqF7vVD6RaVXlFD91gMgkC"
|
||||
static const uint8_t key_sek[] = { 0x47,0x30,0x4B,0x54,0x72,0x57,0x6A,0x53,0x39,0x73,0x79,0x71,0x46,0x37,0x76,0x56,0x44,0x36,0x52,0x61,0x56,0x58,0x6C,0x46,0x44,0x39,0x31,0x67,0x4D,0x67,0x6B,0x43 };
|
||||
|
||||
/* SCP: Unity (PC) */ //"BasicEncryptionKey"
|
||||
static const uint8_t key_scp[] = { 0x42,0x61,0x73,0x69,0x63,0x45,0x6E,0x63,0x72,0x79,0x70,0x74,0x69,0x6F,0x6E,0x4B,0x65,0x79 };
|
||||
|
||||
/* Guitar Hero: Metallica (X360) */
|
||||
static const uint8_t key_ghm[] = { 0x8C,0xFA,0xF3,0x14,0xB1,0x53,0xDA,0xAB,0x2B,0x82,0x6B,0xD5,0x55,0x16,0xCF,0x01,0x90,0x20,0x28,0x14,0xB1,0x53,0xD8 };
|
||||
|
||||
/* Worms Rumble Beta (PC) */ //"FXnTffGJ9LS855Gc"
|
||||
static const uint8_t key_wrb[] = { 0x46,0x58,0x6E,0x54,0x66,0x66,0x47,0x4A,0x39,0x4C,0x53,0x38,0x35,0x35,0x47,0x63 };
|
||||
|
||||
// Unknown:
|
||||
// - Battle: Los Angeles
|
||||
// - Guitar Hero: Warriors of Rock, DJ hero FSB
|
||||
// - Longmenkezhan
|
||||
// - Gas Guzzlers: Combat Carnage (PC?) "C5FA83EA64B34EC2BFE" hex or text? [FSB5]
|
||||
|
||||
typedef struct {
|
||||
int is_fsb5; /* FSB5 or FSB4/3*/
|
||||
int is_alt; /* alt XOR mode (seemingly not tied to FSB version or anything) */
|
||||
size_t fsbkey_size;
|
||||
const uint8_t *fsbkey;
|
||||
} fsbkey_info;
|
||||
|
||||
static const fsbkey_info fsbkey_list[] = {
|
||||
{ 0,0, sizeof(key_dj2),key_dj2 },
|
||||
{ 0,0, sizeof(key_dfp),key_dfp },//FSB4
|
||||
{ 1,0, sizeof(key_dfp),key_dfp },//untested
|
||||
{ 1,1, sizeof(key_dfp),key_dfp },//untested
|
||||
{ 1,0, sizeof(key_npp),key_npp },//FSB5
|
||||
{ 1,0, sizeof(key_sms),key_sms },//FSB5
|
||||
{ 1,0, sizeof(key_gfs),key_gfs },//FSB5
|
||||
{ 1,0, sizeof(key_rev),key_rev },//FSB5
|
||||
{ 1,0, sizeof(key_ds3),key_ds3 },//untested
|
||||
{ 1,1, sizeof(key_ds3),key_ds3 },
|
||||
{ 1,0, sizeof(key_mkx),key_mkx },//untested
|
||||
{ 1,1, sizeof(key_mkx),key_mkx },//untested
|
||||
{ 0,0, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 0,1, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 1,0, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 1,1, sizeof(key_xxc),key_xxc },//untested
|
||||
{ 0,0, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 0,1, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 1,0, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 1,1, sizeof(key_mwr),key_mwr },//untested
|
||||
{ 0,0, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 0,1, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 1,0, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 1,1, sizeof(key_n2u),key_n2u },//untested
|
||||
{ 0,0, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 0,1, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 1,0, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 1,1, sizeof(key_ccr),key_ccr },//untested
|
||||
{ 0,0, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 0,1, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 1,0, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 1,1, sizeof(key_cyp),key_cyp },//untested
|
||||
{ 0,0, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 0,1, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 1,0, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 1,1, sizeof(key_xdz),key_xdz },//untested
|
||||
{ 0,0, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 0,1, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 1,0, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 1,1, sizeof(key_jzz),key_jzz },//untested
|
||||
{ 0,0, sizeof(key_inv),key_inv },//untested
|
||||
{ 0,1, sizeof(key_inv),key_inv },//untested
|
||||
{ 1,0, sizeof(key_inv),key_inv },//untested
|
||||
{ 1,1, sizeof(key_inv),key_inv },//untested
|
||||
{ 0,0, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 0,1, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 1,0, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 1,1, sizeof(key_gh3),key_gh3 },//untested
|
||||
{ 0,0, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 0,1, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,0, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,1, sizeof(key_sc2),key_sc2 },//untested
|
||||
{ 1,0, sizeof(key_cro),key_cro },
|
||||
{ 0,1, sizeof(key_mtj),key_mtj },// FSB3
|
||||
{ 0,1, sizeof(key_gh5),key_gh5 },// FSB4
|
||||
{ 1,0, sizeof(key_sek),key_sek },// FSB5
|
||||
{ 1,0, sizeof(key_scp),key_scp },// FSB5
|
||||
{ 0,1, sizeof(key_ghm),key_ghm },// FSB4
|
||||
{ 1,0, sizeof(key_wrb),key_wrb },// FSB5
|
||||
};
|
||||
static const int fsbkey_list_count = sizeof(fsbkey_list) / sizeof(fsbkey_list[0]);
|
||||
|
||||
|
||||
#endif /* _FSB_KEYS_H_ */
|
||||
|
@ -7,7 +7,7 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
off_t start_offset;
|
||||
uint32_t data_size, loop_start = 0, loop_end = 0;
|
||||
uint32_t codec, flags;
|
||||
int loop_flag, channel_count, sample_rate;
|
||||
int loop_flag, channels, sample_rate;
|
||||
|
||||
|
||||
/* checks */
|
||||
@ -19,14 +19,14 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
goto fail;
|
||||
|
||||
/* check header "MSF" + version-char, usually:
|
||||
* 0x01, 0x02, 0x30 ("0"), 0x35 ("5"), 0x43 ("C") (last/most common version) */
|
||||
* 0x01, 0x02, 0x30="0", 0x35="5", 0x43="C" (last/most common version) */
|
||||
if ((read_u32be(0x00,sf) & 0xffffff00) != 0x4D534600) /* "MSF\0" */
|
||||
goto fail;
|
||||
|
||||
start_offset = 0x40;
|
||||
|
||||
codec = read_u32be(0x04,sf);
|
||||
channel_count = read_s32be(0x08,sf);
|
||||
channels = read_s32be(0x08,sf);
|
||||
data_size = read_u32be(0x0C,sf); /* without header */
|
||||
if (data_size == 0xFFFFFFFF) /* unneeded? */
|
||||
data_size = get_streamfile_size(sf) - start_offset;
|
||||
@ -35,26 +35,26 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
/* byte flags, not in MSFv1 or v2
|
||||
* 0x01/02/04/08: loop marker 0/1/2/3
|
||||
* 0x10: resample options (force 44/48khz)
|
||||
* 0x20: VBR MP3 source (changed into simplified 0x1a1 CBR)
|
||||
* 0x20: VBR MP3 source (encoded with min/max quality options, may end up being CBR)
|
||||
* 0x40: joint stereo MP3 (apparently interleaved stereo for other formats)
|
||||
* 0x80+: (none/reserved) */
|
||||
flags = read_u32be(0x14,sf);
|
||||
/* sometimes loop_start/end is set with flag 0x10, but from tests it only loops if 0x01/02 is set
|
||||
* 0x10 often goes with 0x01 but not always (Castlevania HoD); Malicious PS3 uses flag 0x2 instead */
|
||||
loop_flag = flags != 0xffffffff && ((flags & 0x01) || (flags & 0x02));
|
||||
loop_flag = (flags != 0xffffffff) && ((flags & 0x01) || (flags & 0x02));
|
||||
|
||||
/* loop markers (marker N @ 0x18 + N*(4+4), but in practice only marker 0 is used) */
|
||||
if (loop_flag) {
|
||||
loop_start = read_u32be(0x18,sf);
|
||||
loop_end = read_u32be(0x1C,sf); /* loop duration */
|
||||
loop_end = loop_start + loop_end; /* usually equals data_size but not always */
|
||||
if (loop_end > data_size)/* not seen */
|
||||
if (loop_end > data_size) /* not seen */
|
||||
loop_end = data_size;
|
||||
}
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_MSF;
|
||||
@ -63,16 +63,16 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
vgmstream->sample_rate = 48000;
|
||||
|
||||
switch (codec) {
|
||||
case 0x00: /* PCM (Big Endian) */
|
||||
case 0x00: /* PCM (Big Endian) [MSEnc tests] */
|
||||
case 0x01: { /* PCM (Little Endian) [Smash Cars (PS3)] */
|
||||
vgmstream->coding_type = codec==0 ? coding_PCM16BE : coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x02;
|
||||
|
||||
vgmstream->num_samples = pcm_bytes_to_samples(data_size, channel_count,16);
|
||||
vgmstream->num_samples = pcm_bytes_to_samples(data_size, channels, 16);
|
||||
if (loop_flag){
|
||||
vgmstream->loop_start_sample = pcm_bytes_to_samples(loop_start, channel_count,16);
|
||||
vgmstream->loop_end_sample = pcm_bytes_to_samples(loop_end, channel_count,16);
|
||||
vgmstream->loop_start_sample = pcm_bytes_to_samples(loop_start, channels, 16);
|
||||
vgmstream->loop_end_sample = pcm_bytes_to_samples(loop_end, channels, 16);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -87,10 +87,10 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
|
||||
vgmstream->num_samples = ps_bytes_to_samples(data_size, channel_count);
|
||||
vgmstream->num_samples = ps_bytes_to_samples(data_size, channels);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start,channel_count);
|
||||
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end,channel_count);
|
||||
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start,channels);
|
||||
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end,channels);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -127,25 +127,23 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
}
|
||||
#endif
|
||||
#if defined(VGM_USE_MPEG)
|
||||
case 0x07: { /* MPEG (CBR LAME MP3) [Dengeki Bunko Fighting Climax (PS3)] */
|
||||
case 0x07: { /* MPEG (LAME MP3) [Dengeki Bunko Fighting Climax (PS3), Asura's Wrath (PS3)-vbr] */
|
||||
int is_vbr = (flags & 0x20); /* must calc samples/loop offsets manually */
|
||||
|
||||
vgmstream->codec_data = init_mpeg(sf, start_offset, &vgmstream->coding_type, vgmstream->channels);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
vgmstream->num_samples = mpeg_bytes_to_samples(data_size, vgmstream->codec_data);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = mpeg_bytes_to_samples(loop_start, vgmstream->codec_data);
|
||||
vgmstream->loop_end_sample = mpeg_bytes_to_samples(loop_end, vgmstream->codec_data);
|
||||
/* loops are always aligned to CBR frame beginnings */
|
||||
}
|
||||
vgmstream->num_samples = mpeg_get_samples_clean(sf, start_offset, data_size, &loop_start, &loop_end, is_vbr);
|
||||
vgmstream->loop_start_sample = loop_start;
|
||||
vgmstream->loop_end_sample = loop_end;
|
||||
/* MPEG here seems stripped from ID3/Xing headers, loops are frame offsets */
|
||||
|
||||
/* encoder delay varies between 1152 (1f), 528, 576, etc; probably not actually skipped */
|
||||
break;
|
||||
}
|
||||
#elif defined(VGM_USE_FFMPEG)
|
||||
case 0x07:
|
||||
{ /* MPEG (CBR LAME MP3) [Dengeki Bunko Fighting Climax (PS3)] */
|
||||
case 0x07: { /* MPEG (LAME MP3) [Dengeki Bunko Fighting Climax (PS3), Asura's Wrath (PS3)-vbr] */
|
||||
ffmpeg_codec_data *ffmpeg_data = NULL;
|
||||
|
||||
ffmpeg_data = init_ffmpeg_offset(sf, start_offset, sf->get_size(sf));
|
||||
@ -154,14 +152,12 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
//todo use same calcs as above
|
||||
vgmstream->num_samples = (int64_t)data_size * ffmpeg_data->sampleRate * 8 / ffmpeg_data->bitrate;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (int64_t)loop_start * ffmpeg_data->sampleRate * 8 / ffmpeg_data->bitrate;
|
||||
vgmstream->loop_end_sample = (int64_t)loop_end * ffmpeg_data->sampleRate * 8 / ffmpeg_data->bitrate;
|
||||
/* loops are always aligned to CBR frame beginnings */
|
||||
}
|
||||
|
||||
/* encoder delay varies between 1152 (1f), 528, 576, etc; probably not actually skipped */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -171,7 +167,7 @@ VGMSTREAM* init_vgmstream_msf(STREAMFILE* sf) {
|
||||
}
|
||||
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
|
@ -894,13 +894,12 @@ static int get_position(const char* params, double* value_f, char* value_type) {
|
||||
static int get_volume(const char* params, double *value, int *is_set) {
|
||||
int n, m;
|
||||
double temp_f;
|
||||
int temp_i;
|
||||
char temp_c1, temp_c2;
|
||||
|
||||
if (is_set) *is_set = 0;
|
||||
|
||||
/* test if format is NdB (decibels) */
|
||||
m = sscanf(params, " %i%c%c%n", &temp_i, &temp_c1, &temp_c2, &n);
|
||||
m = sscanf(params, " %lf%c%c%n", &temp_f, &temp_c1, &temp_c2, &n);
|
||||
if (m == 3 && temp_c1 == 'd' && (temp_c2 == 'B' || temp_c2 == 'b')) {
|
||||
/* dB 101:
|
||||
* - logaritmic scale
|
||||
@ -916,7 +915,7 @@ static int get_volume(const char* params, double *value, int *is_set) {
|
||||
*/
|
||||
|
||||
if (is_set) *is_set = 1;
|
||||
*value = pow(10, temp_i / 20.0); /* dB to % where 1.0 = max */
|
||||
*value = pow(10, temp_f / 20.0); /* dB to % where 1.0 = max */
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -1466,7 +1465,7 @@ static void parse_params(txtp_entry* entry, char* params) {
|
||||
|
||||
//todo cleanup
|
||||
/* macros */
|
||||
else if (strcmp(command,"@volume") == 0) {
|
||||
else if (is_match(command,"v") || is_match(command,"@volume")) {
|
||||
txtp_mix_data mix = {0};
|
||||
|
||||
nm = get_volume(params, &mix.vol, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user