sceIoDread() should return 1 when there are more.

Before it was returning > 1 if there were many more, which the PSP
did not do.
This commit is contained in:
Unknown W. Brackets 2013-02-09 20:40:06 -08:00
parent db3f01044d
commit 5f2ec45203

View File

@ -1031,26 +1031,27 @@ u32 sceIoDread(int id, u32 dirent_addr) {
u32 error;
DirListing *dir = kernelObjects.Get<DirListing>(id, error);
if (dir) {
SceIoDirEnt *entry = (SceIoDirEnt*) Memory::GetPointer(dirent_addr);
if (dir->index == (int) dir->listing.size()) {
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) - end of the line", id, dirent_addr);
entry->d_name[0] = '\0';
return 0;
}
PSPFileInfo &info = dir->listing[dir->index];
SceIoDirEnt *entry = (SceIoDirEnt*) Memory::GetPointer(dirent_addr);
__IoGetStat(&entry->d_stat, info);
strncpy(entry->d_name, info.name.c_str(), 256);
entry->d_name[255] = '\0';
entry->d_private = 0xC0DEBABE;
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) = %s", id, dirent_addr, entry->d_name);
dir->index++;
return (u32)(dir->listing.size() - dir->index + 1);
return 1;
} else {
DEBUG_LOG(HLE, "sceIoDread - invalid listing %i, error %08x", id, error);
return -1; // TODO
return SCE_KERNEL_ERROR_BADF;
}
}