[Project64] Remove passing directory in FillRomList
This commit is contained in:
parent
98230eb48a
commit
c72e72a073
|
@ -146,7 +146,6 @@ private:
|
|||
void WatchThreadStop(void);
|
||||
|
||||
static void WatchRomDirChanged(CRomBrowser * _this);
|
||||
|
||||
static void AddField(ROMBROWSER_FIELDS_LIST & Fields, const char * Name, int32_t Pos, int32_t ID, int32_t Width, LanguageStringID LangID, bool UseDefault);
|
||||
|
||||
//Callback
|
||||
|
|
|
@ -260,7 +260,7 @@ void CRomBrowser::RomAddedToList(int32_t ListPos)
|
|||
LVITEMW lvItem;
|
||||
memset(&lvItem, 0, sizeof(lvItem));
|
||||
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
lvItem.iItem = ListView_GetItemCount(m_hRomList);
|
||||
lvItem.iItem = CalcSortPosition(ListPos);
|
||||
lvItem.lParam = (LPARAM)ListPos;
|
||||
lvItem.pszText = LPSTR_TEXTCALLBACKW;
|
||||
|
||||
|
@ -283,7 +283,6 @@ void CRomBrowser::RomListReset(void)
|
|||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "1");
|
||||
ListView_DeleteAllItems(m_hRomList);
|
||||
DeallocateBrushs();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "2");
|
||||
InvalidateRect(m_hRomList, NULL, TRUE);
|
||||
Sleep(100);
|
||||
|
@ -335,10 +334,6 @@ void CRomBrowser::HighLightLastRom(void)
|
|||
//Make sure Rom browser is visible
|
||||
if (!RomBrowserVisible()) { return; }
|
||||
|
||||
//Get the string to the last rom
|
||||
stdstr LastRom = UISettingsLoadStringIndex(File_RecentGameFileIndex, 0);
|
||||
LPCSTR lpLastRom = LastRom.c_str();
|
||||
|
||||
LVITEMW lvItem;
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
|
||||
|
@ -362,7 +357,7 @@ void CRomBrowser::HighLightLastRom(void)
|
|||
}
|
||||
|
||||
//if the last rom then highlight the item
|
||||
if (_stricmp(pRomInfo->szFullFileName, lpLastRom) == 0)
|
||||
if (_stricmp(pRomInfo->szFullFileName, m_LastRom.c_str()) == 0)
|
||||
{
|
||||
ListView_SetItemState(m_hRomList, index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
ListView_EnsureVisible(m_hRomList, index, FALSE);
|
||||
|
|
|
@ -29,6 +29,7 @@ static const char* ROM_extensions[] =
|
|||
|
||||
CRomList::CRomList() :
|
||||
m_RefreshThread(NULL),
|
||||
m_GameDir(g_Settings->LoadStringVal(RomList_GameDir).c_str()),
|
||||
m_NotesIniFile(NULL),
|
||||
m_ExtIniFile(NULL),
|
||||
#ifdef _WIN32
|
||||
|
@ -90,20 +91,22 @@ void CRomList::RefreshRomList(void)
|
|||
|
||||
void CRomList::RefreshRomListThread(void)
|
||||
{
|
||||
WriteTrace(TraceRomList, TraceVerbose, "Start");
|
||||
//delete cache
|
||||
CPath(g_Settings->LoadStringVal(RomList_RomListCache)).Delete();
|
||||
WriteTrace(TraceRomList, TraceVerbose, "Cache Deleted");
|
||||
|
||||
//clear all current items
|
||||
RomListReset();
|
||||
m_RomInfo.clear();
|
||||
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "7");
|
||||
stdstr RomDir = g_Settings->LoadStringVal(RomList_GameDir);
|
||||
stdstr LastRom = UISettingsLoadStringIndex(File_RecentGameFileIndex, 0);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "8");
|
||||
|
||||
strlist FileNames;
|
||||
FillRomList(FileNames, CPath(RomDir), "", LastRom.c_str());
|
||||
FillRomList(FileNames, "");
|
||||
RomListLoaded();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "9");
|
||||
SaveRomList(FileNames);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "10");
|
||||
|
@ -126,9 +129,10 @@ void CRomList::AddRomToList(const char * RomLocation)
|
|||
}
|
||||
}
|
||||
|
||||
void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, const char * Directory, const char * lpLastRom)
|
||||
void CRomList::FillRomList(strlist & FileList, const char * Directory)
|
||||
{
|
||||
CPath SearchPath(BaseDirectory, "*");
|
||||
WriteTrace(TraceRomList, TraceDebug, "Start (m_GameDir = %s, Directory: %s)",(const char *)m_GameDir,Directory);
|
||||
CPath SearchPath((const char *)m_GameDir, "*");
|
||||
SearchPath.AppendDirectory(Directory);
|
||||
|
||||
WriteTrace(TraceRomList, TraceVerbose, "SearchPath: %s", (const char *)SearchPath);
|
||||
|
@ -154,7 +158,7 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
|
|||
{
|
||||
CPath CurrentDir(Directory);
|
||||
CurrentDir.AppendDirectory(SearchPath.GetLastDirectory().c_str());
|
||||
FillRomList(FileList, BaseDirectory, CurrentDir, lpLastRom);
|
||||
FillRomList(FileList, CurrentDir);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -632,6 +636,11 @@ MD5 CRomList::RomListHash(strlist & FileList)
|
|||
return md5Hash;
|
||||
}
|
||||
|
||||
void CRomList::RefreshSettings(CRomList * _this)
|
||||
{
|
||||
_this->m_GameDir = g_Settings->LoadStringVal(RomList_GameDir).c_str();
|
||||
}
|
||||
|
||||
void CRomList::AddFileNameToList(strlist & FileList, const stdstr & Directory, CPath & File)
|
||||
{
|
||||
uint8_t i;
|
||||
|
@ -641,18 +650,15 @@ void CRomList::AddFileNameToList(strlist & FileList, const stdstr & Directory, C
|
|||
return;
|
||||
}
|
||||
|
||||
stdstr Drive, Dir, Name, Extension;
|
||||
File.GetComponents(NULL, &Dir, &Name, &Extension);
|
||||
Extension.ToLower();
|
||||
stdstr Extension = stdstr(File.GetExtension()).ToLower();
|
||||
for (i = 0; i < sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); i++)
|
||||
{
|
||||
if (Extension == ROM_extensions[i])
|
||||
{
|
||||
stdstr FileName = Directory + Name + "." + Extension;
|
||||
stdstr FileName = Directory + File.GetNameExtension();
|
||||
FileName.ToLower();
|
||||
FileList.push_back(FileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,34 +51,37 @@ public:
|
|||
CRomList();
|
||||
virtual ~CRomList();
|
||||
|
||||
void RefreshRomList(void);
|
||||
void RefreshRomList(void);
|
||||
void LoadRomList(void);
|
||||
|
||||
protected:
|
||||
typedef std::vector<ROM_INFO> ROMINFO_LIST;
|
||||
|
||||
virtual void RomListReset(void) {}
|
||||
virtual void RomAddedToList(int32_t /*ListPos*/) {}
|
||||
virtual void RomListLoaded(void) {}
|
||||
virtual void RomDirChanged(void) {}
|
||||
|
||||
MD5 RomListHash(strlist & FileList);
|
||||
void AddFileNameToList(strlist & FileList, const stdstr & Directory, CPath & File);
|
||||
void AddFileNameToList(strlist & FileList, const stdstr & Directory, CPath & File);
|
||||
ROMINFO_LIST m_RomInfo;
|
||||
bool m_StopRefresh;
|
||||
|
||||
private:
|
||||
void AddRomToList(const char * RomLocation);
|
||||
void FillRomList(strlist & FileList, const CPath & BaseDirectory, const char * Directory, const char * lpLastRom);
|
||||
void FillRomList(strlist & FileList, const char * Directory);
|
||||
bool FillRomInfo(ROM_INFO * pRomInfo);
|
||||
void FillRomExtensionInfo(ROM_INFO * pRomInfo);
|
||||
bool LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_t DataLen, int32_t * RomSize, FILE_FORMAT & FileFormat);
|
||||
void SaveRomList(strlist & FileList);
|
||||
void RefreshRomListThread(void);
|
||||
void SaveRomList(strlist & FileList);
|
||||
void RefreshRomListThread(void);
|
||||
|
||||
static void RefreshSettings(CRomList *);
|
||||
static void NotificationCB(const char * Status, CRomList * _this);
|
||||
static void RefreshRomListStatic(CRomList * _this);
|
||||
static void ByteSwapRomData(uint8_t * Data, int DataLen);
|
||||
static void ByteSwapRomData(uint8_t * Data, int DataLen);
|
||||
|
||||
CPath m_GameDir;
|
||||
CIniFile * m_NotesIniFile;
|
||||
CIniFile * m_ExtIniFile;
|
||||
CIniFile * m_RomIniFile;
|
||||
|
|
Loading…
Reference in New Issue