mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
Adjust subsong title description and show for TXTP subsongs
This commit is contained in:
parent
802997b255
commit
46290fe16f
@ -141,9 +141,9 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
|
||||
/* set tag info (metadata tab in file properties) */
|
||||
|
||||
/* Shows a custom subsong title by default with subsong name, to simplify for average users.
|
||||
* This can be overriden and extended and using the exported STREAM_x below and foobar's formatting.
|
||||
* This can be overriden and extended using the exported STREAM_x below and foobar's formatting.
|
||||
* foobar defaults to filename minus extension if there is no meta "title" value. */
|
||||
if (!override_title && get_subsong_count() > 1) {
|
||||
if (!override_title) {
|
||||
p_info.meta_set("TITLE",temp);
|
||||
}
|
||||
if (get_description_tag(temp,description,"stream count: ")) p_info.meta_set("stream_count",temp);
|
||||
@ -478,26 +478,32 @@ void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & ti
|
||||
}
|
||||
}
|
||||
|
||||
if (title) {
|
||||
|
||||
/* infostream gets added with index 0 (other) or 1 (current) */
|
||||
if (infostream && title) {
|
||||
const char *p = filename + strlen(filename);
|
||||
while (*p != '\\' && p >= filename) p--;
|
||||
p++;
|
||||
const char *e = filename + strlen(filename);
|
||||
while (*e != '.' && e >= filename) e--;
|
||||
title.set_string(p, e - p); /* name without ext */
|
||||
|
||||
title.set_string(p, e - p);
|
||||
const char* info_name = infostream->stream_name;
|
||||
int info_streams = infostream->num_streams;
|
||||
int info_subsong = infostream->stream_index;
|
||||
if (info_subsong == 0)
|
||||
info_subsong = 1;
|
||||
|
||||
if (!disable_subsongs && infostream && infostream->num_streams > 1) {
|
||||
int info_subsong = infostream->stream_index;
|
||||
if (info_subsong==0)
|
||||
info_subsong = 1;
|
||||
/* show number if file has more than 1 subsong */
|
||||
if (info_streams > 1) {
|
||||
sprintf(temp,"#%d",info_subsong);
|
||||
title += temp;
|
||||
}
|
||||
|
||||
if (infostream->stream_name[0] != '\0') {
|
||||
sprintf(temp," (%s)",infostream->stream_name);
|
||||
title += temp;
|
||||
}
|
||||
/* show name if file has subsongs (implicitly shows also for TXTP) */
|
||||
if (info_name[0] != '\0' && info_streams > 0) {
|
||||
sprintf(temp," (%s)",info_name);
|
||||
title += temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,10 +853,10 @@ static void get_title(in_char * dst, int dst_size, const in_char * fn, VGMSTREAM
|
||||
in_char *basename;
|
||||
in_char buffer[PATH_LIMIT];
|
||||
in_char filename[PATH_LIMIT];
|
||||
int stream_index = 0;
|
||||
//int stream_index = 0;
|
||||
|
||||
parse_fn_string(fn, NULL, filename,PATH_LIMIT);
|
||||
parse_fn_int(fn, wa_L("$s"), &stream_index);
|
||||
//parse_fn_int(fn, wa_L("$s"), &stream_index);
|
||||
|
||||
basename = (in_char*)filename + wa_strlen(filename); /* find end */
|
||||
while (*basename != '\\' && basename >= filename) /* and find last "\" */
|
||||
@ -864,18 +864,29 @@ static void get_title(in_char * dst, int dst_size, const in_char * fn, VGMSTREAM
|
||||
basename++;
|
||||
wa_strcpy(dst,basename);
|
||||
|
||||
/* show stream subsong number */
|
||||
if (stream_index > 0) {
|
||||
wa_snprintf(buffer,PATH_LIMIT, wa_L("#%i"), stream_index);
|
||||
wa_strcat(dst,buffer);
|
||||
}
|
||||
/* infostream gets added at first with index 0, then once played it re-adds proper numbers */
|
||||
if (infostream) {
|
||||
const char* info_name = infostream->stream_name;
|
||||
int info_streams = infostream->num_streams;
|
||||
int info_subsong = infostream->stream_index;
|
||||
int is_first = infostream->stream_index == 0;
|
||||
|
||||
/* show name, but not for the base stream */
|
||||
if (infostream && infostream->stream_name[0] != '\0' && stream_index > 0) {
|
||||
in_char stream_name[PATH_LIMIT];
|
||||
wa_char_to_ichar(stream_name, PATH_LIMIT, infostream->stream_name);
|
||||
wa_snprintf(buffer,PATH_LIMIT, wa_L(" (%s)"), stream_name);
|
||||
wa_strcat(dst,buffer);
|
||||
/* show number if file has more than 1 subsong */
|
||||
if (info_streams > 1) {
|
||||
if (is_first)
|
||||
wa_snprintf(buffer,PATH_LIMIT, wa_L("#1~%i"), info_streams);
|
||||
else
|
||||
wa_snprintf(buffer,PATH_LIMIT, wa_L("#%i"), info_subsong);
|
||||
wa_strcat(dst,buffer);
|
||||
}
|
||||
|
||||
/* show name if file has subsongs (implicitly shows also for TXTP) */
|
||||
if (info_name[0] != '\0' && ((info_streams > 0 && !is_first) || info_streams == 1)) {
|
||||
in_char stream_name[PATH_LIMIT];
|
||||
wa_char_to_ichar(stream_name, PATH_LIMIT, info_name);
|
||||
wa_snprintf(buffer,PATH_LIMIT, wa_L(" (%s)"), stream_name);
|
||||
wa_strcat(dst,buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user