mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-13 00:17:21 +00:00
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:
parent
db3f01044d
commit
5f2ec45203
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user