mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04: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
1 changed files with 6 additions and 5 deletions
|
@ -1031,26 +1031,27 @@ u32 sceIoDread(int id, u32 dirent_addr) {
|
||||||
u32 error;
|
u32 error;
|
||||||
DirListing *dir = kernelObjects.Get<DirListing>(id, error);
|
DirListing *dir = kernelObjects.Get<DirListing>(id, error);
|
||||||
if (dir) {
|
if (dir) {
|
||||||
|
SceIoDirEnt *entry = (SceIoDirEnt*) Memory::GetPointer(dirent_addr);
|
||||||
|
|
||||||
if (dir->index == (int) dir->listing.size()) {
|
if (dir->index == (int) dir->listing.size()) {
|
||||||
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) - end of the line", id, dirent_addr);
|
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) - end of the line", id, dirent_addr);
|
||||||
|
entry->d_name[0] = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSPFileInfo &info = dir->listing[dir->index];
|
PSPFileInfo &info = dir->listing[dir->index];
|
||||||
|
|
||||||
SceIoDirEnt *entry = (SceIoDirEnt*) Memory::GetPointer(dirent_addr);
|
|
||||||
|
|
||||||
__IoGetStat(&entry->d_stat, info);
|
__IoGetStat(&entry->d_stat, info);
|
||||||
|
|
||||||
strncpy(entry->d_name, info.name.c_str(), 256);
|
strncpy(entry->d_name, info.name.c_str(), 256);
|
||||||
|
entry->d_name[255] = '\0';
|
||||||
entry->d_private = 0xC0DEBABE;
|
entry->d_private = 0xC0DEBABE;
|
||||||
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) = %s", id, dirent_addr, entry->d_name);
|
DEBUG_LOG(HLE, "sceIoDread( %d %08x ) = %s", id, dirent_addr, entry->d_name);
|
||||||
|
|
||||||
dir->index++;
|
dir->index++;
|
||||||
return (u32)(dir->listing.size() - dir->index + 1);
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_LOG(HLE, "sceIoDread - invalid listing %i, error %08x", id, error);
|
DEBUG_LOG(HLE, "sceIoDread - invalid listing %i, error %08x", id, error);
|
||||||
return -1; // TODO
|
return SCE_KERNEL_ERROR_BADF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue