MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetCustomSoundFiles

Function GetCustomSoundFiles

Descent3/pilot.cpp:2504–2543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2502// *count = filled in with the number of files that were placed into your buffer
2503int GetCustomSoundFiles(char *buffer = NULL, int size = 0, int *count = NULL);
2504int GetCustomSoundFiles(char *buffer, int size, int *count) {
2505 int c = 0;
2506 int isize = 0;
2507 int len, overallsize = 0;
2508 char tempname[_MAX_PATH];
2509 char oldpath[_MAX_PATH];
2510 ddio_GetWorkingDir(oldpath, _MAX_PATH);
2511 ddio_SetWorkingDir(LocalCustomSoundsDir);
2512
2513 if (!buffer)
2514 size = 0;
2515
2516 if (count)
2517 *count = 0;
2518
2519 if (ddio_FindFileStart("*.osf", tempname)) {
2520 len = strlen(tempname);
2521 overallsize += len + 1;
2522 if (isize + len < size) {
2523 strcpy(buffer, tempname);
2524 isize += len + 1;
2525 c++;
2526 }
2527
2528 while (ddio_FindNextFile(tempname)) {
2529 len = strlen(tempname);
2530 overallsize += len + 1;
2531 if (isize + len < size) {
2532 strcpy(&buffer[isize], tempname);
2533 isize += len + 1;
2534 c++;
2535 }
2536 }
2537 }
2538 ddio_FindFileClose();
2539 ddio_SetWorkingDir(oldpath);
2540 if (count)
2541 *count = c;
2542 return overallsize;
2543}
2544
2545// GetStringInList
2546//

Callers 1

UpdateAudioTauntBoxesFunction · 0.85

Calls 5

ddio_GetWorkingDirFunction · 0.50
ddio_SetWorkingDirFunction · 0.50
ddio_FindFileStartFunction · 0.50
ddio_FindNextFileFunction · 0.50
ddio_FindFileCloseFunction · 0.50

Tested by

no test coverage detected