2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-04-18 07:19:08 +00:00
|
|
|
#include <Project64-core/RomList/RomList.h>
|
2022-09-26 02:31:54 +00:00
|
|
|
#include <Project64/Settings/UISettings.h>
|
|
|
|
#include <vector>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
class CMainGui;
|
|
|
|
class CPlugins;
|
|
|
|
|
|
|
|
class ROMBROWSER_FIELDS
|
|
|
|
{
|
|
|
|
stdstr m_Name;
|
|
|
|
size_t m_Pos, m_DefaultPos;
|
2022-09-26 02:31:54 +00:00
|
|
|
int m_ID;
|
|
|
|
uint32_t m_ColWidth;
|
|
|
|
LanguageStringID m_LangID;
|
|
|
|
bool m_PosChanged;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ROMBROWSER_FIELDS(const char * Name, int Pos, int ID, int ColWidth, LanguageStringID LangID, bool UseDefault) :
|
|
|
|
m_Name(Name),
|
|
|
|
m_Pos(Pos),
|
|
|
|
m_DefaultPos(Pos),
|
|
|
|
m_ID(ID),
|
|
|
|
m_ColWidth(ColWidth),
|
|
|
|
m_LangID(LangID),
|
|
|
|
m_PosChanged(false)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (!UseDefault)
|
|
|
|
{
|
2016-04-13 07:34:19 +00:00
|
|
|
m_PosChanged = UISettingsLoadDwordIndex(RomBrowser_PosIndex, m_ID, (uint32_t &)m_Pos);
|
|
|
|
UISettingsLoadDwordIndex(RomBrowser_WidthIndex, m_ID, m_ColWidth);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-26 02:31:54 +00:00
|
|
|
inline LPCSTR Name(void) const
|
|
|
|
{
|
|
|
|
return m_Name.c_str();
|
|
|
|
}
|
|
|
|
inline size_t Pos(void) const
|
|
|
|
{
|
|
|
|
return m_Pos;
|
|
|
|
}
|
|
|
|
inline bool PosChanged(void) const
|
|
|
|
{
|
|
|
|
return m_PosChanged;
|
|
|
|
}
|
|
|
|
inline int ID(void) const
|
|
|
|
{
|
|
|
|
return m_ID;
|
|
|
|
}
|
|
|
|
inline int ColWidth(void) const
|
|
|
|
{
|
|
|
|
return m_ColWidth;
|
|
|
|
}
|
|
|
|
inline LanguageStringID LangID(void) const
|
|
|
|
{
|
|
|
|
return m_LangID;
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
void SetColWidth(int ColWidth)
|
|
|
|
{
|
|
|
|
m_ColWidth = ColWidth;
|
2016-04-13 07:34:19 +00:00
|
|
|
UISettingsSaveDwordIndex(RomBrowser_WidthIndex, m_ID, m_ColWidth);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
void SetColPos(int Pos)
|
|
|
|
{
|
|
|
|
m_Pos = Pos;
|
2016-04-13 07:34:19 +00:00
|
|
|
UISettingsSaveDwordIndex(RomBrowser_PosIndex, m_ID, m_Pos);
|
2016-01-27 09:11:59 +00:00
|
|
|
m_PosChanged = true;
|
|
|
|
}
|
|
|
|
void ResetPos(void)
|
|
|
|
{
|
|
|
|
m_Pos = m_DefaultPos;
|
2016-04-13 07:34:19 +00:00
|
|
|
UISettingsDeleteSettingIndex(RomBrowser_PosIndex, m_ID);
|
2016-01-27 09:11:59 +00:00
|
|
|
m_PosChanged = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
typedef std::vector<ROMBROWSER_FIELDS> ROMBROWSER_FIELDS_LIST;
|
|
|
|
typedef std::vector<int> FIELD_TYPE_LIST;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
class CRomBrowser;
|
|
|
|
struct SORT_FIELD
|
|
|
|
{
|
|
|
|
CRomBrowser * _this;
|
2022-09-26 02:31:54 +00:00
|
|
|
int Key;
|
|
|
|
bool KeyAscend;
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class C7zip;
|
2016-04-14 09:35:08 +00:00
|
|
|
class CRomBrowser :
|
|
|
|
public CRomList
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-04-13 07:34:19 +00:00
|
|
|
public:
|
|
|
|
CRomBrowser(HWND & hMainWindow, HWND & StatusWindow);
|
|
|
|
~CRomBrowser(void);
|
2022-09-26 02:31:54 +00:00
|
|
|
void HighLightLastRom(void);
|
|
|
|
void HideRomList(void);
|
|
|
|
void ResetRomBrowserColomuns(void);
|
|
|
|
void ResizeRomList(WORD nWidth, WORD nHeight);
|
|
|
|
void RomBrowserToTop(void);
|
|
|
|
void RomBrowserMaximize(bool Mazimize);
|
|
|
|
bool RomBrowserVisible(void);
|
|
|
|
bool RomListDrawItem(int idCtrl, uint32_t lParam);
|
|
|
|
bool RomListNotify(int idCtrl, uint32_t pnmh);
|
|
|
|
void SaveRomListColoumnInfo(void);
|
|
|
|
void SelectRomDir(void);
|
|
|
|
void ShowRomList(void);
|
|
|
|
bool ShowingRomBrowser(void)
|
|
|
|
{
|
|
|
|
return m_ShowingRomBrowser;
|
|
|
|
}
|
|
|
|
const char * CurrentedSelectedRom(void)
|
|
|
|
{
|
|
|
|
return m_SelectedRom.c_str();
|
|
|
|
}
|
2016-04-13 07:34:19 +00:00
|
|
|
|
|
|
|
static void GetFieldInfo(ROMBROWSER_FIELDS_LIST & Fields, bool UseDefault = false);
|
|
|
|
|
|
|
|
private:
|
2016-01-27 09:11:59 +00:00
|
|
|
enum
|
|
|
|
{
|
2022-09-26 02:31:54 +00:00
|
|
|
IDC_ROMLIST = 223
|
|
|
|
};
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RB_FileName = 0,
|
|
|
|
RB_InternalName = 1,
|
|
|
|
RB_GoodName = 2,
|
|
|
|
RB_Name = 3,
|
|
|
|
RB_Status = 4,
|
|
|
|
RB_RomSize = 5,
|
|
|
|
RB_CoreNotes = 6,
|
|
|
|
RB_PluginNotes = 7,
|
|
|
|
RB_UserNotes = 8,
|
|
|
|
RB_CartridgeID = 9,
|
|
|
|
RB_Media = 10,
|
|
|
|
RB_Country = 11,
|
|
|
|
RB_Developer = 12,
|
|
|
|
RB_Crc1 = 13,
|
|
|
|
RB_Crc2 = 14,
|
|
|
|
RB_CICChip = 15,
|
|
|
|
RB_ReleaseDate = 16,
|
|
|
|
RB_Genre = 17,
|
|
|
|
RB_Players = 18,
|
|
|
|
RB_ForceFeedback = 19,
|
|
|
|
RB_FileFormat = 20,
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
NoOfSortKeys = 3
|
|
|
|
};
|
|
|
|
|
2016-04-14 22:26:02 +00:00
|
|
|
typedef std::map<int32_t, HBRUSH> HBRUSH_MAP;
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
void RomListReset(void);
|
|
|
|
void RomListLoaded(void);
|
|
|
|
void RomAddedToList(int32_t ListPos);
|
|
|
|
int CalcSortPosition(uint32_t lParam);
|
|
|
|
void CreateRomListControl(void);
|
|
|
|
void DeallocateBrushs(void);
|
|
|
|
void FixRomListWindow(void);
|
|
|
|
void MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Title, char * ShortCut);
|
|
|
|
void RomList_ColoumnSortList(uint32_t pnmh);
|
|
|
|
void RomList_GetDispInfo(uint32_t pnmh);
|
|
|
|
void RomList_OpenRom(uint32_t pnmh);
|
|
|
|
void RomList_PopupMenu(uint32_t pnmh);
|
|
|
|
void RomList_SortList(void);
|
2016-04-14 09:35:08 +00:00
|
|
|
|
2016-04-15 20:58:31 +00:00
|
|
|
bool RomDirNeedsRefresh(void); // Called from watch thread
|
2016-04-14 09:35:08 +00:00
|
|
|
void RomDirChanged(void);
|
2016-04-15 20:58:31 +00:00
|
|
|
bool GetRomFileNames(strlist & FileList, const CPath & BaseDirectory, const std::string & Directory, bool InWatchThread);
|
|
|
|
void WatchThreadStart(void);
|
|
|
|
void WatchThreadStop(void);
|
2016-04-14 09:35:08 +00:00
|
|
|
|
2016-04-15 20:58:31 +00:00
|
|
|
static void WatchRomDirChanged(CRomBrowser * _this);
|
2016-01-27 09:11:59 +00:00
|
|
|
static void AddField(ROMBROWSER_FIELDS_LIST & Fields, const char * Name, int32_t Pos, int32_t ID, int32_t Width, LanguageStringID LangID, bool UseDefault);
|
|
|
|
|
2021-03-17 08:32:23 +00:00
|
|
|
// Callback
|
2016-01-27 09:11:59 +00:00
|
|
|
static int CALLBACK SelectRomDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t lp, uint32_t lpData);
|
|
|
|
static int CALLBACK RomList_CompareItems(uint32_t lParam1, uint32_t lParam2, uint32_t lParamSort);
|
2022-09-26 02:31:54 +00:00
|
|
|
|
2021-03-17 08:32:23 +00:00
|
|
|
// Watch directory changed function
|
2016-04-15 20:58:31 +00:00
|
|
|
HANDLE m_WatchThread, m_WatchStopEvent;
|
2022-09-26 02:31:54 +00:00
|
|
|
DWORD m_WatchThreadID;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-04-13 08:06:11 +00:00
|
|
|
HWND & m_MainWindow;
|
|
|
|
HWND & m_StatusWindow;
|
|
|
|
HWND m_hRomList;
|
2016-04-13 07:34:19 +00:00
|
|
|
ROMBROWSER_FIELDS_LIST m_Fields;
|
2016-04-13 08:06:11 +00:00
|
|
|
FIELD_TYPE_LIST m_FieldType;
|
|
|
|
std::string m_SelectedRom;
|
|
|
|
bool m_Visible;
|
|
|
|
bool m_ShowingRomBrowser;
|
|
|
|
bool m_AllowSelectionLastRom;
|
2016-04-16 09:55:32 +00:00
|
|
|
static std::string m_UnknownGoodName;
|
2016-04-14 22:26:02 +00:00
|
|
|
HBRUSH_MAP m_Brushes;
|
2016-04-14 09:35:08 +00:00
|
|
|
std::string m_LastRom;
|
2016-04-15 20:58:31 +00:00
|
|
|
stdstr m_WatchRomDir;
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|