fallout2-ce/src/select_file_list.cc

36 lines
750 B
C++
Raw Normal View History

2022-05-19 01:51:26 -07:00
#include "select_file_list.h"
#include "db.h"
#include <stdlib.h>
#include <string.h>
// 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) {
return NULL;
}
qsort(fileNameList, fileNameListLength, sizeof(*fileNameList), _compare);
return fileNameList;
}
// 0x4AA2DC
void _freeFileList(char** fileList)
{
fileNameListFree(&fileList, 0);
}