fallout2-ce/src/select_file_list.cc

40 lines
798 B
C++
Raw Normal View History

2022-05-19 01:51:26 -07:00
#include "select_file_list.h"
#include <stdlib.h>
#include <string.h>
2022-09-15 02:38:23 -07:00
#include "db.h"
2022-09-23 05:43:44 -07:00
namespace fallout {
2022-05-19 01:51:26 -07:00
// 0x4AA250
int _compare(const void* a1, const void* a2)
{
const char* v1 = *(const char**)a1;
const char* v2 = *(const char**)a2;
return strcmp(v1, v2);
}
// 0x4AA2A4
char** _getFileList(const char* pattern, int* fileNameListLengthPtr)
{
char** fileNameList;
int fileNameListLength = fileNameListInit(pattern, &fileNameList, 0, 0);
*fileNameListLengthPtr = fileNameListLength;
if (fileNameListLength == 0) {
2024-01-16 07:57:49 -08:00
return nullptr;
2022-05-19 01:51:26 -07:00
}
qsort(fileNameList, fileNameListLength, sizeof(*fileNameList), _compare);
return fileNameList;
}
// 0x4AA2DC
void _freeFileList(char** fileList)
{
fileNameListFree(&fileList, 0);
}
2022-09-23 05:43:44 -07:00
} // namespace fallout