Merge pull request #1535 from oddMLan/rombrowser-use-filenames

[Rom Browser] Name column - Use Filename in absence of Good Name & hide file extensions
This commit is contained in:
zilmar 2018-12-29 16:57:17 +10:30 committed by GitHub
commit 2d5a907637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 13 deletions

View File

@ -285,6 +285,7 @@ enum LanguageStringID
RB_UP = 490, RB_UP = 490,
RB_DOWN = 491, RB_DOWN = 491,
RB_REFRESH = 492, RB_REFRESH = 492,
RB_FILEEXT = 493,
//Advanced Options //Advanced Options
ADVANCE_INFO = 500, ADVANCE_INFO = 500,

View File

@ -245,6 +245,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(RB_DIRS, "dirs"); DEF_STR(RB_DIRS, "dirs");
DEF_STR(RB_USE, "Use ROM browser"); DEF_STR(RB_USE, "Use ROM browser");
DEF_STR(RB_DIR_RECURSION, "Use directory recursion"); DEF_STR(RB_DIR_RECURSION, "Use directory recursion");
DEF_STR(RB_FILEEXT, "Show file extensions");
DEF_STR(RB_AVALIABLE_FIELDS, "Available fields:"); DEF_STR(RB_AVALIABLE_FIELDS, "Available fields:");
DEF_STR(RB_SHOW_FIELDS, "Order of fields:"); DEF_STR(RB_SHOW_FIELDS, "Order of fields:");
DEF_STR(RB_ADD, "Add ->"); DEF_STR(RB_ADD, "Add ->");

View File

@ -437,7 +437,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
} }
else else
{ {
strncpy(pRomInfo->FileName, CPath(pRomInfo->szFullFileName).GetNameExtension().c_str(), sizeof(pRomInfo->FileName) / sizeof(pRomInfo->FileName[0])); strncpy(pRomInfo->FileName, g_Settings->LoadBool(RomList_ShowFileExtensions) ? CPath(pRomInfo->szFullFileName).GetNameExtension().c_str() : CPath(pRomInfo->szFullFileName).GetName().c_str(), sizeof(pRomInfo->FileName) / sizeof(pRomInfo->FileName[0]));
} }
char InternalName[22]; char InternalName[22];
memcpy(InternalName, (void *)(RomData + 0x20), 20); memcpy(InternalName, (void *)(RomData + 0x20), 20);

View File

@ -298,6 +298,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(RomList_GameDirSelected, new CSettingTypeApplication("Game Directory", "Directory", RomList_GameDirInitial)); AddHandler(RomList_GameDirSelected, new CSettingTypeApplication("Game Directory", "Directory", RomList_GameDirInitial));
AddHandler(RomList_GameDirUseSelected, new CSettingTypeApplication("Game Directory", "Use Selected", false)); AddHandler(RomList_GameDirUseSelected, new CSettingTypeApplication("Game Directory", "Use Selected", false));
AddHandler(RomList_GameDirRecursive, new CSettingTypeApplication("Game Directory", "Recursive", false)); AddHandler(RomList_GameDirRecursive, new CSettingTypeApplication("Game Directory", "Recursive", false));
AddHandler(RomList_ShowFileExtensions, new CSettingTypeApplication("Game Directory", "File Extensions", false));
AddHandler(RomList_7zipCache, new CSettingTypeApplicationPath("Settings", "7zipCache", RomList_7zipCacheDefault)); AddHandler(RomList_7zipCache, new CSettingTypeApplicationPath("Settings", "7zipCache", RomList_7zipCacheDefault));
AddHandler(RomList_7zipCacheDefault, new CSettingTypeRelativePath("Config", "Project64.zcache")); AddHandler(RomList_7zipCacheDefault, new CSettingTypeRelativePath("Config", "Project64.zcache"));

View File

@ -221,6 +221,7 @@ enum SettingID
RomList_GameDirSelected, RomList_GameDirSelected,
RomList_GameDirUseSelected, RomList_GameDirUseSelected,
RomList_GameDirRecursive, RomList_GameDirRecursive,
RomList_ShowFileExtensions,
RomList_7zipCache, RomList_7zipCache,
RomList_7zipCacheDefault, RomList_7zipCacheDefault,

View File

@ -49,7 +49,8 @@ CMainGui::CMainGui(bool bMainWindow, const char * WindowTitle) :
{ {
g_Settings->RegisterChangeCB((SettingID)(FirstUISettings + RomBrowser_Enabled), this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->RegisterChangeCB((SettingID)(FirstUISettings + RomBrowser_Enabled), this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged);
g_Settings->RegisterChangeCB((SettingID)(FirstUISettings + RomBrowser_ColoumnsChanged), this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->RegisterChangeCB((SettingID)(FirstUISettings + RomBrowser_ColoumnsChanged), this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
g_Settings->RegisterChangeCB(RomList_GameDirRecursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); g_Settings->RegisterChangeCB(RomList_GameDirRecursive, this, (CSettings::SettingChangedFunc)RomBrowserListChanged);
g_Settings->RegisterChangeCB(RomList_ShowFileExtensions, this, (CSettings::SettingChangedFunc)RomBrowserListChanged);
g_Settings->RegisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged); g_Settings->RegisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged);
g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning); g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning);
g_Settings->RegisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused); g_Settings->RegisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused);
@ -68,7 +69,8 @@ CMainGui::~CMainGui(void)
{ {
g_Settings->UnregisterChangeCB((SettingID)(FirstUISettings + RomBrowser_Enabled), this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->UnregisterChangeCB((SettingID)(FirstUISettings + RomBrowser_Enabled), this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged);
g_Settings->UnregisterChangeCB((SettingID)(FirstUISettings + RomBrowser_ColoumnsChanged), this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged); g_Settings->UnregisterChangeCB((SettingID)(FirstUISettings + RomBrowser_ColoumnsChanged), this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
g_Settings->UnregisterChangeCB(RomList_GameDirRecursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); g_Settings->UnregisterChangeCB(RomList_GameDirRecursive, this, (CSettings::SettingChangedFunc)RomBrowserListChanged);
g_Settings->UnregisterChangeCB(RomList_ShowFileExtensions, this, (CSettings::SettingChangedFunc)RomBrowserListChanged);
g_Settings->UnregisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged); g_Settings->UnregisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged);
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning); g_Settings->UnregisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning);
g_Settings->UnregisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused); g_Settings->UnregisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused);
@ -243,7 +245,7 @@ void RomBowserColoumnsChanged(CMainGui * Gui)
Gui->ResetRomBrowserColomuns(); Gui->ResetRomBrowserColomuns();
} }
void RomBrowserRecursiveChanged(CMainGui * Gui) void RomBrowserListChanged(CMainGui * Gui)
{ {
Gui->RefreshRomList(); Gui->RefreshRomList();
Gui->HighLightLastRom(); Gui->HighLightLastRom();

View File

@ -114,7 +114,7 @@ private:
friend void RomBowserEnabledChanged(CMainGui * Gui); friend void RomBowserEnabledChanged(CMainGui * Gui);
friend void RomBowserColoumnsChanged(CMainGui * Gui); friend void RomBowserColoumnsChanged(CMainGui * Gui);
friend void RomBrowserRecursiveChanged(CMainGui * Gui); friend void RomBrowserListChanged(CMainGui * Gui);
static void LoadingInProgressChanged(CMainGui * Gui); static void LoadingInProgressChanged(CMainGui * Gui);
static void GameLoaded(CMainGui * Gui); static void GameLoaded(CMainGui * Gui);
static void GamePaused(CMainGui * Gui); static void GamePaused(CMainGui * Gui);

View File

@ -538,7 +538,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
} }
if (wcscmp(L"#321#", text.c_str()) == 0) if (wcscmp(L"#321#", text.c_str()) == 0)
{ {
text = stdstr(pRomInfo->InternalName).ToUTF16(); text = stdstr(pRomInfo->FileName).ToUTF16();
} }
DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS); DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
@ -563,7 +563,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
} }
if (wcscmp(L"#321#", text.c_str()) == 0) if (wcscmp(L"#321#", text.c_str()) == 0)
{ {
text = stdstr(pRomInfo->InternalName).ToUTF16(); text = stdstr(pRomInfo->FileName).ToUTF16();
} }
DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS); DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
@ -653,8 +653,8 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP
const char * Name1 = NULL, *Name2 = NULL; const char * Name1 = NULL, *Name2 = NULL;
if (SortFieldInfo->Key == RB_Name) if (SortFieldInfo->Key == RB_Name)
{ {
Name1 = strcmp("#321#", pRomInfo1->Name) != 0 ? pRomInfo1->GoodName : pRomInfo1->InternalName; Name1 = strcmp("#321#", pRomInfo1->Name) != 0 ? pRomInfo1->GoodName : pRomInfo1->FileName;
Name2 = strcmp("#321#", pRomInfo2->Name) != 0 ? pRomInfo2->GoodName : pRomInfo2->InternalName; Name2 = strcmp("#321#", pRomInfo2->Name) != 0 ? pRomInfo2->GoodName : pRomInfo2->FileName;
} }
switch (SortFieldInfo->Key) switch (SortFieldInfo->Key)

View File

@ -25,6 +25,7 @@ COptionsGameBrowserPage::COptionsGameBrowserPage(HWND hParent, const RECT & rcDi
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER, wGS(RB_USE).c_str()); SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER, wGS(RB_USE).c_str());
SetDlgItemTextW(m_hWnd, IDC_RECURSION, wGS(RB_DIR_RECURSION).c_str()); SetDlgItemTextW(m_hWnd, IDC_RECURSION, wGS(RB_DIR_RECURSION).c_str());
SetDlgItemTextW(m_hWnd, IDC_SHOW_FILE_EXTENSIONS, wGS(RB_FILEEXT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5, wGS(RB_AVALIABLE_FIELDS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5, wGS(RB_AVALIABLE_FIELDS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6, wGS(RB_SHOW_FIELDS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6, wGS(RB_SHOW_FIELDS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ADD, wGS(RB_ADD).c_str()); SetDlgItemTextW(m_hWnd, IDC_ADD, wGS(RB_ADD).c_str());
@ -34,6 +35,7 @@ COptionsGameBrowserPage::COptionsGameBrowserPage(HWND hParent, const RECT & rcDi
AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled); AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled);
AddModCheckBox(GetDlgItem(IDC_RECURSION), RomList_GameDirRecursive); AddModCheckBox(GetDlgItem(IDC_RECURSION), RomList_GameDirRecursive);
AddModCheckBox(GetDlgItem(IDC_SHOW_FILE_EXTENSIONS), RomList_ShowFileExtensions);
m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE)); m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE));
m_Using.Attach(GetDlgItem(IDC_USING)); m_Using.Attach(GetDlgItem(IDC_USING));

View File

@ -21,6 +21,7 @@ class COptionsGameBrowserPage :
COMMAND_HANDLER_EX(IDC_DOWN, BN_CLICKED, MoveFieldDownClicked) COMMAND_HANDLER_EX(IDC_DOWN, BN_CLICKED, MoveFieldDownClicked)
COMMAND_ID_HANDLER_EX(IDC_USE_ROMBROWSER, UseRomBrowserChanged) COMMAND_ID_HANDLER_EX(IDC_USE_ROMBROWSER, UseRomBrowserChanged)
COMMAND_ID_HANDLER_EX(IDC_RECURSION, CheckBoxChanged) COMMAND_ID_HANDLER_EX(IDC_RECURSION, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SHOW_FILE_EXTENSIONS, CheckBoxChanged)
END_MSG_MAP() END_MSG_MAP()
enum { IDD = IDD_Settings_RomBrowser }; enum { IDD = IDD_Settings_RomBrowser };

View File

@ -134,7 +134,7 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "Use Rom Browser",IDC_USE_ROMBROWSER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,7,206,10 CONTROL "Use Rom Browser",IDC_USE_ROMBROWSER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,7,206,10
CONTROL "Use Directory recursion",IDC_RECURSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,148,202,10 CONTROL "Use Directory recursion",IDC_RECURSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,148,107,10
LTEXT "Available fields",IDC_ROMSEL_TEXT5,6,26,77,10 LTEXT "Available fields",IDC_ROMSEL_TEXT5,6,26,77,10
LISTBOX IDC_AVALIABLE,6,38,76,104,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LISTBOX IDC_AVALIABLE,6,38,76,104,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "Show fields in this order:",IDC_ROMSEL_TEXT6,135,26,81,10 LTEXT "Show fields in this order:",IDC_ROMSEL_TEXT6,135,26,81,10
@ -144,6 +144,7 @@ BEGIN
PUSHBUTTON "Up",IDC_UP,134,131,34,11 PUSHBUTTON "Up",IDC_UP,134,131,34,11
PUSHBUTTON "Down",IDC_DOWN,175,131,34,11 PUSHBUTTON "Down",IDC_DOWN,175,131,34,11
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,19,208,1 CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,19,208,1
CONTROL "Show File extensions",IDC_SHOW_FILE_EXTENSIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,148,96,10
END END
IDD_Settings_General DIALOGEX 0, 0, 231, 210 IDD_Settings_General DIALOGEX 0, 0, 231, 210

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by UI Resources.rc // Used by UIResources.rc
// //
#define IDAPPLY 3 #define IDAPPLY 3
#define IDI_PJ64_Icon 101 #define IDI_PJ64_Icon 101
@ -604,6 +604,7 @@
#define IDC_DD48_EDIT 1444 #define IDC_DD48_EDIT 1444
#define IDC_ROM_FIXEDAUDIO 1445 #define IDC_ROM_FIXEDAUDIO 1445
#define IDC_CHK_AUTOREFRESH 1446 #define IDC_CHK_AUTOREFRESH 1446
#define IDC_SHOW_FILE_EXTENSIONS 1447
#define ID_POPUP_SHOWINMEMORYVIEWER 40005 #define ID_POPUP_SHOWINMEMORYVIEWER 40005
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008 #define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
#define ID_POPUPMENU_ADDSYMBOL 40013 #define ID_POPUPMENU_ADDSYMBOL 40013
@ -639,9 +640,9 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 197 #define _APS_NEXT_RESOURCE_VALUE 198
#define _APS_NEXT_COMMAND_VALUE 40043 #define _APS_NEXT_COMMAND_VALUE 40043
#define _APS_NEXT_CONTROL_VALUE 1447 #define _APS_NEXT_CONTROL_VALUE 1448
#define _APS_NEXT_SYMED_VALUE 102 #define _APS_NEXT_SYMED_VALUE 102
#endif #endif
#endif #endif