2017-06-09 21:34:19 +03:00
|
|
|
int files_mas[2000];
|
|
|
|
dword buf;
|
|
|
|
|
|
|
|
|
|
|
|
void OpenDirectory(dword folder_path)
|
|
|
|
{
|
|
|
|
int cur;
|
|
|
|
char temp_filename[4096];
|
|
|
|
dword j, filesnum, end_pointer;
|
|
|
|
|
|
|
|
list.count = 0;
|
|
|
|
if (buf) free(buf);
|
|
|
|
if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0)
|
|
|
|
if (filesnum==0)
|
|
|
|
{
|
|
|
|
notify("'Error opening folder' -E");
|
|
|
|
}
|
2018-03-20 11:24:20 +03:00
|
|
|
debugval("sizeof(files_mas)", sizeof(files_mas));
|
2017-06-09 21:34:19 +03:00
|
|
|
for (j=0; j<filesnum; j++)
|
|
|
|
{
|
|
|
|
strcpy(#temp_filename, j*304 + buf+72);
|
|
|
|
end_pointer = #temp_filename+strlen(#temp_filename);
|
2018-03-16 02:03:32 +03:00
|
|
|
if (strcmpi(end_pointer-4,".mp3")==0)
|
|
|
|
|| (strcmpi(end_pointer-4,".wav")==0)
|
|
|
|
|| (strcmpi(end_pointer-3,".xm")==0)
|
|
|
|
{
|
|
|
|
cur = list.count;
|
|
|
|
files_mas[cur]=j;
|
2018-03-20 11:24:20 +03:00
|
|
|
list.count++;
|
|
|
|
if (list.count>=sizeof(files_mas)*sizeof(int)) break;
|
2018-03-16 02:03:32 +03:00
|
|
|
}
|
2017-06-09 21:34:19 +03:00
|
|
|
}
|
|
|
|
SortByName(0, list.count-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SortByName(int a, b)
|
|
|
|
{
|
|
|
|
int j, i = a;
|
|
|
|
if (a >= b) return;
|
|
|
|
for (j = a; j <= b; j++)
|
|
|
|
if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j]; i++;}
|
|
|
|
SortByName(a, i-2);
|
|
|
|
SortByName(i, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetOpenedFileFirst(dword in_name)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
dword opened_filename = in_name + strrchr(in_name, '/');
|
|
|
|
for (i=0; i<list.count; i++)
|
|
|
|
{
|
|
|
|
if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dword Getcur_yItemName() {
|
|
|
|
return files_mas[current_playing_file_n]*304 + buf+72;
|
|
|
|
}
|