mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-06 14:44:25 +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) */
|
/* set tag info (metadata tab in file properties) */
|
||||||
|
|
||||||
/* Shows a custom subsong title by default with subsong name, to simplify for average users.
|
/* 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. */
|
* 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);
|
p_info.meta_set("TITLE",temp);
|
||||||
}
|
}
|
||||||
if (get_description_tag(temp,description,"stream count: ")) p_info.meta_set("stream_count",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);
|
const char *p = filename + strlen(filename);
|
||||||
while (*p != '\\' && p >= filename) p--;
|
while (*p != '\\' && p >= filename) p--;
|
||||||
p++;
|
p++;
|
||||||
const char *e = filename + strlen(filename);
|
const char *e = filename + strlen(filename);
|
||||||
while (*e != '.' && e >= filename) e--;
|
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;
|
||||||
if (!disable_subsongs && infostream && infostream->num_streams > 1) {
|
|
||||||
int info_subsong = infostream->stream_index;
|
int info_subsong = infostream->stream_index;
|
||||||
if (info_subsong==0)
|
if (info_subsong == 0)
|
||||||
info_subsong = 1;
|
info_subsong = 1;
|
||||||
|
|
||||||
|
/* show number if file has more than 1 subsong */
|
||||||
|
if (info_streams > 1) {
|
||||||
sprintf(temp,"#%d",info_subsong);
|
sprintf(temp,"#%d",info_subsong);
|
||||||
title += temp;
|
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 *basename;
|
||||||
in_char buffer[PATH_LIMIT];
|
in_char buffer[PATH_LIMIT];
|
||||||
in_char filename[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_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 */
|
basename = (in_char*)filename + wa_strlen(filename); /* find end */
|
||||||
while (*basename != '\\' && basename >= filename) /* and find last "\" */
|
while (*basename != '\\' && basename >= filename) /* and find last "\" */
|
||||||
@ -864,19 +864,30 @@ static void get_title(in_char * dst, int dst_size, const in_char * fn, VGMSTREAM
|
|||||||
basename++;
|
basename++;
|
||||||
wa_strcpy(dst,basename);
|
wa_strcpy(dst,basename);
|
||||||
|
|
||||||
/* show stream subsong number */
|
/* infostream gets added at first with index 0, then once played it re-adds proper numbers */
|
||||||
if (stream_index > 0) {
|
if (infostream) {
|
||||||
wa_snprintf(buffer,PATH_LIMIT, wa_L("#%i"), stream_index);
|
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 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);
|
wa_strcat(dst,buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show name, but not for the base stream */
|
/* show name if file has subsongs (implicitly shows also for TXTP) */
|
||||||
if (infostream && infostream->stream_name[0] != '\0' && stream_index > 0) {
|
if (info_name[0] != '\0' && ((info_streams > 0 && !is_first) || info_streams == 1)) {
|
||||||
in_char stream_name[PATH_LIMIT];
|
in_char stream_name[PATH_LIMIT];
|
||||||
wa_char_to_ichar(stream_name, PATH_LIMIT, infostream->stream_name);
|
wa_char_to_ichar(stream_name, PATH_LIMIT, info_name);
|
||||||
wa_snprintf(buffer,PATH_LIMIT, wa_L(" (%s)"), stream_name);
|
wa_snprintf(buffer,PATH_LIMIT, wa_L(" (%s)"), stream_name);
|
||||||
wa_strcat(dst,buffer);
|
wa_strcat(dst,buffer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_config_defaults(winamp_song_config *current) {
|
static void set_config_defaults(winamp_song_config *current) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user