mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Parse hex in TXTP loop install
This commit is contained in:
parent
2b4570395a
commit
650c3847d2
@ -182,7 +182,7 @@ ptp_btl_bgm_voice.sgd#s1#h11050
|
||||
### Install loops
|
||||
**`#I(loop start time) (loop end time)`**: force/override looping values, same as .pos but nicer. Loop end is optional and defaults to total samples.
|
||||
|
||||
Time values can be `M:S(.n)` (minutes and seconds), `S.n` (seconds with dot) or `N` (samples). Beware of the subtle difference between 10.0 (10 seconds) and 10 (10 samples). Wrong loop values (for example loop end being much larger than file's samples) will be ignored, but there is some leeway when using seconds for the loop end.
|
||||
Time values can be `M:S(.n)` (minutes and seconds), `S.n` (seconds with dot), `0xN` (samples in hex format) or `N` (samples). Beware of the subtle difference between 10.0 (ten seconds) and 10 (ten samples). Wrong loop values (for example loop end being much larger than file's samples) will be ignored, but there is some leeway when using seconds for the loop end.
|
||||
|
||||
**Jewels Ocean (PC)**
|
||||
```
|
||||
|
@ -19,6 +19,11 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
||||
int32_t loop_start = 0, loop_end = 0, num_samples = 0;
|
||||
int total_subsongs, target_subsong = streamFile->stream_index;
|
||||
|
||||
/* no checks */
|
||||
//if (!check_extensions(streamFile, "..."))
|
||||
// goto fail;
|
||||
|
||||
|
||||
/* init ffmpeg */
|
||||
ffmpeg_codec_data *data = init_ffmpeg_offset(streamFile, start, size);
|
||||
if (!data) return NULL;
|
||||
@ -41,6 +46,15 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
||||
}
|
||||
}
|
||||
|
||||
if (!num_samples) {
|
||||
num_samples = data->totalSamples;
|
||||
}
|
||||
|
||||
/* hack for AAC files (will return 0 samples if not an actual .aac) */
|
||||
if (!num_samples && check_extensions(streamFile, "aac,laac")) {
|
||||
num_samples = aac_get_samples(streamFile, 0x00, get_streamfile_size(streamFile));
|
||||
}
|
||||
|
||||
|
||||
/* build VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(data->channels, loop_flag);
|
||||
@ -52,11 +66,7 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
||||
vgmstream->codec_data = data;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
if (!num_samples) {
|
||||
num_samples = data->totalSamples;
|
||||
}
|
||||
vgmstream->num_samples = num_samples;
|
||||
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = loop_start;
|
||||
vgmstream->loop_end_sample = loop_end;
|
||||
|
@ -446,6 +446,17 @@ static int get_time(const char * config, double *value_f, int32_t *value_i) {
|
||||
return n;
|
||||
}
|
||||
|
||||
/* test is format is hex samples: 0xN */
|
||||
m = sscanf(config, " 0x%x%n", &temp_i1,&n);
|
||||
if (m == 1) {
|
||||
/* allow negative samples for special meanings */
|
||||
//if (temp_i1 < 0)
|
||||
// return 0;
|
||||
|
||||
*value_i = temp_i1;
|
||||
return n;
|
||||
}
|
||||
|
||||
/* assume format is samples: N */
|
||||
m = sscanf(config, " %i%n", &temp_i1,&n);
|
||||
if (m == 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user