game selector: save and restore state of the filter nodes

This commit is contained in:
dinkc64 2019-05-11 23:39:51 -04:00
parent 8e867a58f0
commit 1a6f9aa541
5 changed files with 63 additions and 9 deletions

View File

@ -1492,7 +1492,7 @@ struct BurnDriver BurnDrvSidearms = {
"sidearms", NULL, NULL, NULL, "1986",
"Side Arms - Hyper Dyne (World, 861129)\0", NULL, "Capcom", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0,
NULL, sidearmsRomInfo, sidearmsRomName, NULL, NULL, NULL, NULL, SidearmsInputInfo, SidearmsDIPInfo,
SidearmsInit, DrvExit, DrvFrame, SidearmsDraw, DrvScan, &DrvRecalc, 0x800,
384, 224, 4, 3
@ -1545,7 +1545,7 @@ struct BurnDriver BurnDrvSidearmsu = {
"sidearmsu", "sidearms", NULL, NULL, "1986",
"Side Arms - Hyper Dyne (US, 861202)\0", NULL, "Capcom (Romstar license)", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0,
NULL, sidearmsuRomInfo, sidearmsuRomName, NULL, NULL, NULL, NULL, SidearmsInputInfo, SidearmsDIPInfo,
SidearmsInit, DrvExit, DrvFrame, SidearmsDraw, DrvScan, &DrvRecalc, 0x800,
384, 224, 4, 3
@ -1598,7 +1598,7 @@ struct BurnDriver BurnDrvSidearmsur1 = {
"sidearmsur1", "sidearms", NULL, NULL, "1986",
"Side Arms - Hyper Dyne (US, 861128)\0", NULL, "Capcom (Romstar license)", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0,
NULL, sidearmsur1RomInfo, sidearmsur1RomName, NULL, NULL, NULL, NULL, SidearmsInputInfo, SidearmsDIPInfo,
SidearmsInit, DrvExit, DrvFrame, SidearmsDraw, DrvScan, &DrvRecalc, 0x800,
384, 224, 4, 3
@ -1651,7 +1651,7 @@ struct BurnDriver BurnDrvSidearmsj = {
"sidearmsj", "sidearms", NULL, NULL, "1986",
"Side Arms - Hyper Dyne (Japan, 861128)\0", NULL, "Capcom", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0,
NULL, sidearmsjRomInfo, sidearmsjRomName, NULL, NULL, NULL, NULL, SidearmsInputInfo, SidearmsDIPInfo,
SidearmsInit, DrvExit, DrvFrame, SidearmsDraw, DrvScan, &DrvRecalc, 0x800,
384, 224, 4, 3

View File

@ -298,6 +298,7 @@ void MenuRemoveTheme();
// sel.cpp
extern int nLoadMenuShowX;
extern int nLoadMenuShowY;
extern int nLoadMenuExpand;
extern int nLoadMenuBoardTypeFilter;
extern int nLoadMenuGenreFilter;
extern int nLoadMenuFavoritesFilter;

View File

@ -191,6 +191,7 @@ int ConfigAppLoad()
VAR(nSelDlgHeight);
VAR(nLoadMenuShowX);
VAR(nLoadMenuShowY);
VAR(nLoadMenuExpand);
VAR(nLoadMenuBoardTypeFilter);
VAR(nLoadMenuGenreFilter);
VAR(nLoadMenuFavoritesFilter);
@ -562,6 +563,7 @@ int ConfigAppSave()
_ftprintf(h, _T("\n// Load game dialog options\n"));
VAR(nLoadMenuShowX);
VAR(nLoadMenuShowY);
VAR(nLoadMenuExpand);
_ftprintf(h, _T("\n// Load game dialog board type filter options\n"));
VAR(nLoadMenuBoardTypeFilter);

View File

@ -285,6 +285,8 @@ int nLoadMenuGenreFilter = 0;
int nLoadMenuFavoritesFilter = 0;
int nLoadMenuFamilyFilter = 0;
int nLoadMenuExpand = 0; // expanded/collapsed state of filter nodes
struct NODEINFO {
int nBurnDrvNo;
bool bIsParent;
@ -1159,6 +1161,34 @@ static void RebuildEverything()
TreeBuilding = 0;
}
static int TvhFilterToBitmask(HTREEITEM hHandle)
{
if (hHandle == hRoot) return (1 << 0);
if (hHandle == hBoardType) return (1 << 1);
if (hHandle == hFamily) return (1 << 2);
if (hHandle == hGenre) return (1 << 3);
if (hHandle == hHardware) return (1 << 4);
if (hHandle == hFilterCapcomGrp) return (1 << 5);
if (hHandle == hFilterSegaGrp) return (1 << 6);
return 0;
}
static HTREEITEM TvBitTohFilter(int nBit)
{
switch (nBit) {
case (1 << 0): return hRoot;
case (1 << 1): return hBoardType;
case (1 << 2): return hFamily;
case (1 << 3): return hGenre;
case (1 << 4): return hHardware;
case (1 << 5): return hFilterCapcomGrp;
case (1 << 6): return hFilterSegaGrp;
}
return 0;
}
#define _TVCreateFiltersA(a, b, c, d) \
{ \
TvItem.hParent = a; \
@ -1294,9 +1324,14 @@ static void CreateFilters()
_TVCreateFiltersA(hHardware , IDS_SEL_MISCPRE90S , hFilterMiscPre90s , nLoadMenuShowX & MASKMISCPRE90S );
_TVCreateFiltersA(hHardware , IDS_SEL_MISCPOST90S , hFilterMiscPost90s , nLoadMenuShowX & MASKMISCPOST90S );
SendMessage(hFilterList , TVM_EXPAND,TVE_EXPAND, (LPARAM)hRoot);
SendMessage(hFilterList , TVM_EXPAND,TVE_EXPAND, (LPARAM)hHardware);
// restore expanded filter nodes
for (INT32 i = 0; i < 16; i++)
{
if (nLoadMenuExpand & (1 << i))
SendMessage(hFilterList, TVM_EXPAND, TVE_EXPAND, (LPARAM)TvBitTohFilter(1 << i));
}
//SendMessage(hFilterList , TVM_EXPAND,TVE_EXPAND, (LPARAM)hRoot);
//SendMessage(hFilterList , TVM_EXPAND,TVE_EXPAND, (LPARAM)hHardware);
//SendMessage(hFilterList , TVM_EXPAND,TVE_EXPAND, (LPARAM)hFavorites);
TreeView_SelectSetFirstVisible(hFilterList, hFavorites);
}
@ -2173,7 +2208,23 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lP
NMHDR* pNmHdr = (NMHDR*)lParam;
if (Msg == WM_NOTIFY)
{
if ((pNmHdr->code == NM_CLICK) && (pNmHdr->idFrom == IDC_TREE2))
if ((pNmHdr->code == TVN_ITEMEXPANDED) && (pNmHdr->idFrom == IDC_TREE2))
{
// save the expanded state of the filter nodes
NM_TREEVIEW *pnmtv = (NM_TREEVIEW *)lParam;
TV_ITEM curItem = pnmtv->itemNew;
if (pnmtv->action == TVE_COLLAPSE)
{
nLoadMenuExpand &= ~TvhFilterToBitmask(curItem.hItem);
}
else if (pnmtv->action == TVE_EXPAND)
{
nLoadMenuExpand |= TvhFilterToBitmask(curItem.hItem);
}
}
if ((pNmHdr->code == NM_CLICK) && (pNmHdr->idFrom == IDC_TREE2))
{
TVHITTESTINFO thi;
DWORD dwpos = GetMessagePos();

View File

@ -174,7 +174,7 @@ BEGIN
IDS_SEL_NEOGEO "Neo Geo"
IDS_SEL_PGM "PGM"
IDS_SEL_PSIKYO "Psikyo"
IDS_SEL_SEGA "Sega (Other)"
IDS_SEL_SEGA "Sega Arcade"
IDS_SEL_TAITO "Taito"
IDS_SEL_TOAPLAN "Toaplan"
IDS_SEL_MISCPRE90S "Misc (Pre-90s)"