From 7c8b823504e2970ffc8b2f497f3026e02d2ac898 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 1 May 2020 22:30:37 +0200 Subject: [PATCH] Add force subsong title in Winamp --- winamp/in_vgmstream.c | 9 ++++++++- winamp/resource.h | 1 + winamp/resource.rc | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 2be409a0..e856ca41 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -71,6 +71,7 @@ typedef struct { int disable_subsongs; int downmix_channels; int tagfile_disable; + int force_title; int exts_unknown_on; int exts_common_on; @@ -398,6 +399,7 @@ static void cfg_char_to_wchar(TCHAR *wdst, size_t wdstsize, const char *src) { #define INI_DISABLE_SUBSONGS TEXT("disable_subsongs") #define INI_DOWNMIX_CHANNELS TEXT("downmix_channels") #define INI_TAGFILE_DISABLE TEXT("tagfile_disable") +#define INI_FORCE_TITLE TEXT("force_title") #define INI_EXTS_UNKNOWN_ON TEXT("exts_unknown_on") #define INI_EXTS_COMMON_ON TEXT("exts_common_on") #define INI_GAIN_TYPE TEXT("gain_type") @@ -503,6 +505,7 @@ static void load_defaults(winamp_settings_t *defaults) { defaults->disable_subsongs = 0; defaults->downmix_channels = 0; defaults->tagfile_disable = 0; + defaults->force_title = 0; defaults->exts_unknown_on = 0; defaults->exts_common_on = 0; defaults->gain_type = 1; @@ -526,6 +529,7 @@ static void load_config(winamp_settings_t *settings, winamp_settings_t *defaults ini_get_b(inifile, INI_DISABLE_SUBSONGS, defaults->disable_subsongs, &settings->disable_subsongs); ini_get_i(inifile, INI_DOWNMIX_CHANNELS, defaults->downmix_channels, &settings->downmix_channels, 0, 64); ini_get_b(inifile, INI_TAGFILE_DISABLE, defaults->tagfile_disable, &settings->tagfile_disable); + ini_get_b(inifile, INI_FORCE_TITLE, defaults->force_title, &settings->force_title); ini_get_b(inifile, INI_EXTS_UNKNOWN_ON, defaults->exts_unknown_on, &settings->exts_unknown_on); ini_get_b(inifile, INI_EXTS_COMMON_ON, defaults->exts_common_on, &settings->exts_common_on); @@ -553,6 +557,7 @@ static void save_config(winamp_settings_t *settings) { ini_set_b(inifile, INI_DISABLE_SUBSONGS, settings->disable_subsongs); ini_set_i(inifile, INI_DOWNMIX_CHANNELS, settings->downmix_channels); ini_set_b(inifile, INI_TAGFILE_DISABLE, settings->tagfile_disable); + ini_set_b(inifile, INI_FORCE_TITLE, settings->force_title); ini_set_b(inifile, INI_EXTS_UNKNOWN_ON, settings->exts_unknown_on); ini_set_b(inifile, INI_EXTS_COMMON_ON, settings->exts_common_on); @@ -634,6 +639,7 @@ static int dlg_load_form(HWND hDlg, winamp_settings_t *settings) { dlg_check_get(hDlg, IDC_DISABLE_SUBSONGS, &settings->disable_subsongs); dlg_input_get_i(hDlg, IDC_DOWNMIX_CHANNELS, &settings->downmix_channels, TEXT("Downmix must be a positive integer number"), &err); dlg_check_get(hDlg, IDC_TAGFILE_DISABLE, &settings->tagfile_disable); + dlg_check_get(hDlg, IDC_FORCE_TITLE, &settings->force_title); dlg_check_get(hDlg, IDC_EXTS_UNKNOWN_ON, &settings->exts_unknown_on); dlg_check_get(hDlg, IDC_EXTS_COMMON_ON, &settings->exts_common_on); @@ -657,6 +663,7 @@ static void dlg_save_form(HWND hDlg, winamp_settings_t *settings, int reset) { dlg_check_set(hDlg, IDC_DISABLE_SUBSONGS, settings->disable_subsongs); dlg_input_set_i(hDlg, IDC_DOWNMIX_CHANNELS, settings->downmix_channels); dlg_check_set(hDlg, IDC_TAGFILE_DISABLE, settings->tagfile_disable); + dlg_check_set(hDlg, IDC_FORCE_TITLE, settings->force_title); dlg_check_set(hDlg, IDC_EXTS_UNKNOWN_ON, settings->exts_unknown_on); dlg_check_set(hDlg, IDC_EXTS_COMMON_ON, settings->exts_common_on); @@ -918,7 +925,7 @@ static void get_title(in_char * dst, int dst_size, const in_char * fn, VGMSTREAM } /* show name if file has subsongs (implicitly shows also for TXTP) */ - if (info_name[0] != '\0' && ((info_streams > 0 && !is_first) || info_streams == 1)) { + if (info_name[0] != '\0' && ((info_streams > 0 && !is_first) || info_streams == 1 || settings.force_title)) { 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); diff --git a/winamp/resource.h b/winamp/resource.h index 193ed6b2..f9cdea1e 100644 --- a/winamp/resource.h +++ b/winamp/resource.h @@ -15,3 +15,4 @@ #define IDC_CLIP_TYPE 1014 #define IDC_EXTS_UNKNOWN_ON 1015 #define IDC_EXTS_COMMON_ON 1016 +#define IDC_FORCE_TITLE 1017 diff --git a/winamp/resource.rc b/winamp/resource.rc index 60a1a0a7..edecdff5 100644 --- a/winamp/resource.rc +++ b/winamp/resource.rc @@ -43,13 +43,13 @@ BEGIN LTEXT "Downmix",IDC_STATIC,7,115,48,12 EDITTEXT IDC_DOWNMIX_CHANNELS,52,112,37,14,ES_AUTOHSCROLL - + CONTROL "Disable tagfile",IDC_TAGFILE_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,131,87,10 - - //CONTROL "Override title",IDC_OVERRIDE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,147,97,10 - + + CONTROL "Force internal title",IDC_FORCE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,147,87,10 + CONTROL "Enable unknown exts",IDC_EXTS_UNKNOWN_ON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,163,87,10 - + CONTROL "Enable common exts",IDC_EXTS_COMMON_ON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,179,87,10 - + END