From 12c2bd54fc3953357c95e38a0b4476f0dbfbd248 Mon Sep 17 00:00:00 2001 From: oddMLan Date: Fri, 28 Dec 2018 04:26:23 -0700 Subject: [PATCH 1/2] [Rom Browser] Show Filename instead of Internal Name when there is no Good Name --- Source/Project64/UserInterface/RomBrowserClass.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Project64/UserInterface/RomBrowserClass.cpp b/Source/Project64/UserInterface/RomBrowserClass.cpp index ad14c554e..7754571f0 100644 --- a/Source/Project64/UserInterface/RomBrowserClass.cpp +++ b/Source/Project64/UserInterface/RomBrowserClass.cpp @@ -538,7 +538,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam) } 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); @@ -563,7 +563,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam) } 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); @@ -653,8 +653,8 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP const char * Name1 = NULL, *Name2 = NULL; if (SortFieldInfo->Key == RB_Name) { - Name1 = strcmp("#321#", pRomInfo1->Name) != 0 ? pRomInfo1->GoodName : pRomInfo1->InternalName; - Name2 = strcmp("#321#", pRomInfo2->Name) != 0 ? pRomInfo2->GoodName : pRomInfo2->InternalName; + Name1 = strcmp("#321#", pRomInfo1->Name) != 0 ? pRomInfo1->GoodName : pRomInfo1->FileName; + Name2 = strcmp("#321#", pRomInfo2->Name) != 0 ? pRomInfo2->GoodName : pRomInfo2->FileName; } switch (SortFieldInfo->Key) From 578aa012d16d97f1c0580075d8000bcf2f4e9c46 Mon Sep 17 00:00:00 2001 From: oddMLan Date: Fri, 28 Dec 2018 04:47:09 -0700 Subject: [PATCH 2/2] [Rom Browser] Add Show File extensions option and disable it by default --- Source/Project64-core/Multilanguage.h | 1 + Source/Project64-core/Multilanguage/LanguageClass.cpp | 1 + Source/Project64-core/RomList/RomList.cpp | 2 +- Source/Project64-core/Settings.cpp | 1 + Source/Project64-core/Settings/SettingsID.h | 1 + Source/Project64/UserInterface/MainWindow.cpp | 8 +++++--- Source/Project64/UserInterface/MainWindow.h | 2 +- .../UserInterface/Settings/SettingsPage-GameBrowser.cpp | 2 ++ .../UserInterface/Settings/SettingsPage-GameBrowser.h | 1 + Source/Project64/UserInterface/UIResources.rc | 3 ++- Source/Project64/UserInterface/resource.h | 7 ++++--- 11 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Project64-core/Multilanguage.h b/Source/Project64-core/Multilanguage.h index 515c651b2..7609d83cc 100644 --- a/Source/Project64-core/Multilanguage.h +++ b/Source/Project64-core/Multilanguage.h @@ -285,6 +285,7 @@ enum LanguageStringID RB_UP = 490, RB_DOWN = 491, RB_REFRESH = 492, + RB_FILEEXT = 493, //Advanced Options ADVANCE_INFO = 500, diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index e0ff1a3c8..158eea454 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -245,6 +245,7 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(RB_DIRS, "dirs"); DEF_STR(RB_USE, "Use ROM browser"); 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_SHOW_FIELDS, "Order of fields:"); DEF_STR(RB_ADD, "Add ->"); diff --git a/Source/Project64-core/RomList/RomList.cpp b/Source/Project64-core/RomList/RomList.cpp index 5f9b819c8..ee4880927 100644 --- a/Source/Project64-core/RomList/RomList.cpp +++ b/Source/Project64-core/RomList/RomList.cpp @@ -437,7 +437,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo) } 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]; memcpy(InternalName, (void *)(RomData + 0x20), 20); diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index 9cf394fc8..0bc9009e9 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -298,6 +298,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(RomList_GameDirSelected, new CSettingTypeApplication("Game Directory", "Directory", RomList_GameDirInitial)); AddHandler(RomList_GameDirUseSelected, new CSettingTypeApplication("Game Directory", "Use Selected", 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_7zipCacheDefault, new CSettingTypeRelativePath("Config", "Project64.zcache")); diff --git a/Source/Project64-core/Settings/SettingsID.h b/Source/Project64-core/Settings/SettingsID.h index 9654b577a..d07ed3870 100644 --- a/Source/Project64-core/Settings/SettingsID.h +++ b/Source/Project64-core/Settings/SettingsID.h @@ -221,6 +221,7 @@ enum SettingID RomList_GameDirSelected, RomList_GameDirUseSelected, RomList_GameDirRecursive, + RomList_ShowFileExtensions, RomList_7zipCache, RomList_7zipCacheDefault, diff --git a/Source/Project64/UserInterface/MainWindow.cpp b/Source/Project64/UserInterface/MainWindow.cpp index a657b1377..09dc393ac 100644 --- a/Source/Project64/UserInterface/MainWindow.cpp +++ b/Source/Project64/UserInterface/MainWindow.cpp @@ -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_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_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning); 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_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_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning); g_Settings->UnregisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused); @@ -243,7 +245,7 @@ void RomBowserColoumnsChanged(CMainGui * Gui) Gui->ResetRomBrowserColomuns(); } -void RomBrowserRecursiveChanged(CMainGui * Gui) +void RomBrowserListChanged(CMainGui * Gui) { Gui->RefreshRomList(); Gui->HighLightLastRom(); diff --git a/Source/Project64/UserInterface/MainWindow.h b/Source/Project64/UserInterface/MainWindow.h index bef3f93ab..34b483819 100644 --- a/Source/Project64/UserInterface/MainWindow.h +++ b/Source/Project64/UserInterface/MainWindow.h @@ -114,7 +114,7 @@ private: friend void RomBowserEnabledChanged(CMainGui * Gui); friend void RomBowserColoumnsChanged(CMainGui * Gui); - friend void RomBrowserRecursiveChanged(CMainGui * Gui); + friend void RomBrowserListChanged(CMainGui * Gui); static void LoadingInProgressChanged(CMainGui * Gui); static void GameLoaded(CMainGui * Gui); static void GamePaused(CMainGui * Gui); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.cpp index 67a12317c..5456fb248 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.cpp @@ -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_USE_ROMBROWSER, wGS(RB_USE).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_TEXT6, wGS(RB_SHOW_FIELDS).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_RECURSION), RomList_GameDirRecursive); + AddModCheckBox(GetDlgItem(IDC_SHOW_FILE_EXTENSIONS), RomList_ShowFileExtensions); m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE)); m_Using.Attach(GetDlgItem(IDC_USING)); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.h b/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.h index a5a08b4f0..2812d5d44 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.h +++ b/Source/Project64/UserInterface/Settings/SettingsPage-GameBrowser.h @@ -21,6 +21,7 @@ class COptionsGameBrowserPage : COMMAND_HANDLER_EX(IDC_DOWN, BN_CLICKED, MoveFieldDownClicked) COMMAND_ID_HANDLER_EX(IDC_USE_ROMBROWSER, UseRomBrowserChanged) COMMAND_ID_HANDLER_EX(IDC_RECURSION, CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SHOW_FILE_EXTENSIONS, CheckBoxChanged) END_MSG_MAP() enum { IDD = IDD_Settings_RomBrowser }; diff --git a/Source/Project64/UserInterface/UIResources.rc b/Source/Project64/UserInterface/UIResources.rc index 1ca49ff2c..7e2c6e22e 100644 --- a/Source/Project64/UserInterface/UIResources.rc +++ b/Source/Project64/UserInterface/UIResources.rc @@ -134,7 +134,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN 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 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 @@ -144,6 +144,7 @@ BEGIN PUSHBUTTON "Up",IDC_UP,134,131,34,11 PUSHBUTTON "Down",IDC_DOWN,175,131,34,11 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 IDD_Settings_General DIALOGEX 0, 0, 231, 210 diff --git a/Source/Project64/UserInterface/resource.h b/Source/Project64/UserInterface/resource.h index 79e970afe..0ed9b2d44 100644 --- a/Source/Project64/UserInterface/resource.h +++ b/Source/Project64/UserInterface/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by UI Resources.rc +// Used by UIResources.rc // #define IDAPPLY 3 #define IDI_PJ64_Icon 101 @@ -604,6 +604,7 @@ #define IDC_DD48_EDIT 1444 #define IDC_ROM_FIXEDAUDIO 1445 #define IDC_CHK_AUTOREFRESH 1446 +#define IDC_SHOW_FILE_EXTENSIONS 1447 #define ID_POPUP_SHOWINMEMORYVIEWER 40005 #define ID_POPUPMENU_PLAYGAMEWITHDISK 40008 #define ID_POPUPMENU_ADDSYMBOL 40013 @@ -639,9 +640,9 @@ // #ifdef APSTUDIO_INVOKED #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_CONTROL_VALUE 1447 +#define _APS_NEXT_CONTROL_VALUE 1448 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif