1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-01-17 21:09:00 +01:00

PSV collect files list for fast content access

This commit is contained in:
XProger 2021-02-15 17:46:32 +03:00
parent a523ed83c6
commit be3632bd7f
2 changed files with 35 additions and 12 deletions

View File

@ -1,19 +1,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "debugScreen.h"
#include <psp2/rtc.h>
#include <psp2/ctrl.h>
#include <psp2/audioout.h>
#include <psp2/kernel/sysmem.h>
#include <psp2/kernel/threadmgr.h>
#include <psp2/power.h>
#include <psp2/touch.h>
#include <psp2/apputil.h>
#include <psp2/system_param.h>
#include <malloc.h>
#include <vitasdk.h>
#include "game.h"
@ -250,6 +241,8 @@ int main()
strcpy(saveDir, "ux0:data/OpenLara/");
strcpy(contentDir, "ux0:data/OpenLara/");
Stream::init();
Core::defLang = checkLanguage();
sndInit();

View File

@ -1938,7 +1938,7 @@ public:
if (f) fclose(f);
}
#ifdef _OS_3DS
#if _OS_3DS
static void readDirectory(const FS_Archive &archive, const char* path) {
char buf[255];
strcpy(buf, contentDir + 5); // 5 to skip "sdmc:"
@ -1990,6 +1990,36 @@ public:
FSUSER_CloseArchive(sdmc);
}
#elif _OS_PSV
static void readDirectory(char* path) {
SceUID dd = sceIoDopen(path);
size_t len = strlen(path);
SceIoDirent entry;
while (sceIoDread(dd, &entry) > 0)
{
strcat(path, entry.d_name);
if (SCE_S_ISDIR(entry.d_stat.st_mode))
{
strcat(path, "/");
readDirectory(path);
} else {
fileList.push(StrUtils::copy(path + strlen(contentDir)));
}
path[len] = 0;
}
sceIoClose(dd);
}
static void readFileList() {
char path[255];
strcpy(path, contentDir);
readDirectory(path);
}
#else
static void readFileList() {};
#endif