1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
// For licensing and usage information, read docs/winui_license.txt
//****************************************************************************
// NOTE: ifdef MESS doesn't work here
#ifndef TREEVIEW_H
#define TREEVIEW_H
/* corrections for commctrl.h */
#if defined(__GNUC__)
/* fix warning: cast does not match function type */
#undef TreeView_InsertItem
#define TreeView_InsertItem(w,i) (HTREEITEM)(LRESULT)(int)SendMessage((w),TVM_INSERTITEM,0,(LPARAM)(LPTV_INSERTSTRUCT)(i))
#undef TreeView_SetImageList
#define TreeView_SetImageList(w,h,i) (HIMAGELIST)(LRESULT)(int)SendMessage((w),TVM_SETIMAGELIST,i,(LPARAM)(HIMAGELIST)(h))
#undef TreeView_GetNextItem
#define TreeView_GetNextItem(w,i,c) (HTREEITEM)(LRESULT)(int)SendMessage((w),TVM_GETNEXTITEM,c,(LPARAM)(HTREEITEM)(i))
#undef TreeView_HitTest
#define TreeView_HitTest(hwnd, lpht) \
(HTREEITEM)(LRESULT)(int)SNDMSG((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
/* fix wrong return type */
#undef TreeView_Select
#define TreeView_Select(w,i,c) (BOOL)(int)SendMessage((w),TVM_SELECTITEM,c,(LPARAM)(HTREEITEM)(i))
#undef TreeView_EditLabel
#define TreeView_EditLabel(w, i) \
SNDMSG(w,TVM_EDITLABEL,0,(LPARAM)(i))
#endif /* defined(__GNUC__) */
#include "bitmask.h"
#include <stdint.h>
/***************************************************************************
Folder And Filter Definitions
***************************************************************************/
typedef struct
{
const char *m_lpTitle; // Folder Title
const char *short_name; // for saving in the .ini
UINT m_nFolderId; // ID
UINT m_nIconId; // if >= 0, resource id of icon (IDI_xxx), otherwise index in image list
DWORD m_dwUnset; // Excluded filters
DWORD m_dwSet; // Implied filters
BOOL m_process; // 1 = process only if rebuilding the cache
void (*m_pfnCreateFolders)(int parent_index); // Constructor for special folders
BOOL (*m_pfnQuery)(uint32_t nDriver); // Query function
BOOL m_bExpectedResult; // Expected query result
} FOLDERDATA, *LPFOLDERDATA;
typedef const FOLDERDATA *LPCFOLDERDATA;
typedef struct
{
DWORD m_dwFilterType; /* Filter value */
DWORD m_dwCtrlID; /* Control ID that represents it */
BOOL (*m_pfnQuery)(uint32_t nDriver); /* Query function */
BOOL m_bExpectedResult; /* Expected query result */
} FILTER_ITEM, *LPFILTER_ITEM;
typedef const FILTER_ITEM *LPCFILTER_ITEM;
/***************************************************************************
Functions to build builtin folder lists
***************************************************************************/
void CreateManufacturerFolders(int parent_index);
void CreateYearFolders(int parent_index);
void CreateSourceFolders(int parent_index);
void CreateScreenFolders(int parent_index);
void CreateResolutionFolders(int parent_index);
void CreateFPSFolders(int parent_index);
void CreateBIOSFolders(int parent_index);
void CreateCPUFolders(int parent_index);
void CreateSoundFolders(int parent_index);
void CreateOrientationFolders(int parent_index);
void CreateDeficiencyFolders(int parent_index);
void CreateDumpingFolders(int parent_index);
/***************************************************************************/
#define MAX_EXTRA_FOLDERS 256
#define MAX_EXTRA_SUBFOLDERS 256
/* TreeView structures */
enum
{
FOLDER_NONE = 0,
FOLDER_ALLGAMES,
FOLDER_AVAILABLE,
FOLDER_BIOS,
FOLDER_CLONES,
FOLDER_COMPUTER,
FOLDER_CONSOLE,
FOLDER_CPU,
FOLDER_DEFICIENCY,
FOLDER_DUMPING,
FOLDER_FPS,
FOLDER_HARDDISK,
FOLDER_HORIZONTAL,
FOLDER_LIGHTGUN,
FOLDER_MANUFACTURER,
FOLDER_MECHANICAL,
FOLDER_MODIFIED,
FOLDER_MOUSE,
FOLDER_NONMECHANICAL,
FOLDER_NONWORKING,
FOLDER_ORIGINAL,
FOLDER_RASTER,
FOLDER_RESOLUTION,
FOLDER_SAMPLES,
FOLDER_SAVESTATE,
FOLDER_SCREENS,
FOLDER_SND,
FOLDER_SOURCE,
FOLDER_STEREO,
FOLDER_TRACKBALL,
FOLDER_UNAVAILABLE,
FOLDER_VECTOR,
FOLDER_VERTICAL,
FOLDER_WORKING,
FOLDER_YEAR,
MAX_FOLDERS,
};
typedef enum
{
F_CLONES = 0x00000001,
F_NONWORKING = 0x00000002,
F_UNAVAILABLE = 0x00000004,
F_VECTOR = 0x00000008,
F_RASTER = 0x00000010,
F_ORIGINALS = 0x00000020,
F_WORKING = 0x00000040,
F_AVAILABLE = 0x00000080,
F_HORIZONTAL = 0x00000100,
F_VERTICAL = 0x00000200,
F_MECHANICAL = 0x00000400,
F_ARCADE = 0x00000800,
F_MESS = 0x00001000,
F_COMPUTER = 0x00002000,
F_CONSOLE = 0x00004000,
F_MODIFIED = 0x00008000,
F_MASK = 0x0000FFFF,
F_INIEDIT = 0x00010000, // There is an .ini that can be edited. MSH 20070811
F_CUSTOM = 0x01000000 // for current .ini custom folders
} FOLDERFLAG;
typedef struct
{
LPSTR m_lpTitle; // String contains the folder name
LPTSTR m_lptTitle; // String contains the folder name as TCHAR*
UINT m_nFolderId; // Index / Folder ID number
int m_nParent; // Parent folder index in treeFolders[]
int m_nIconId; // negative icon index into the ImageList, or IDI_xxx resource id
DWORD m_dwFlags; // Misc flags
LPBITS m_lpGameBits; // Game bits, represent game indices
} TREEFOLDER, *LPTREEFOLDER;
typedef struct
{
char m_szTitle[64]; // Folder Title
UINT m_nFolderId; // ID
int m_nParent; // Parent Folder index in treeFolders[]
DWORD m_dwFlags; // Flags - Customisable and Filters
int m_nIconId; // negative icon index into the ImageList, or IDI_xxx resource id
int m_nSubIconId; // negative icon index into the ImageList, or IDI_xxx resource id
} EXFOLDERDATA, *LPEXFOLDERDATA;
void FreeFolders(void);
void ResetFilters(void);
void InitTree(LPCFOLDERDATA lpFolderData, LPCFILTER_ITEM lpFilterList);
void SetCurrentFolder(LPTREEFOLDER lpFolder);
UINT GetCurrentFolderID(void);
LPTREEFOLDER GetCurrentFolder(void);
int GetNumFolders(void);
LPTREEFOLDER GetFolder(UINT nFolder);
LPTREEFOLDER GetFolderByID(UINT nID);
LPTREEFOLDER GetFolderByName(int nParentId, const char *pszFolderName);
void AddGame(LPTREEFOLDER lpFolder, UINT nGame);
void RemoveGame(LPTREEFOLDER lpFolder, UINT nGame);
int FindGame(LPTREEFOLDER lpFolder, int nGame);
void ResetWhichGamesInFolders(void);
LPCFOLDERDATA FindFilter(DWORD folderID);
BOOL GameFiltered(int nGame, DWORD dwFlags);
BOOL GetParentFound(int nGame);
LPCFILTER_ITEM GetFilterList(void);
void SetTreeIconSize(HWND hWnd, BOOL bLarge);
BOOL GetTreeIconSize(void);
void GetFolders(TREEFOLDER ***folders,int *num_folders);
BOOL TryRenameCustomFolder(LPTREEFOLDER lpFolder,const char *new_name);
void AddToCustomFolder(LPTREEFOLDER lpFolder,int driver_index);
void RemoveFromCustomFolder(LPTREEFOLDER lpFolder,int driver_index);
HIMAGELIST GetTreeViewIconList(void);
int GetTreeViewIconIndex(int icon_id);
void ResetTreeViewFolders(void);
void SelectTreeViewFolder(int folder_id);
#endif /* TREEVIEW_H */
|