Force set the FS_STAT_FILE flag if the filesize is > 0

This commit is contained in:
Maschell 2022-05-14 19:49:55 +02:00
parent 41a318cac5
commit 153d10acf9

View File

@ -496,6 +496,12 @@ int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, FSDirectoryEntry *out_data) {
int result = *(int *) result_vec; int result = *(int *) result_vec;
memcpy(out_data, result_vec + 4, sizeof(FSDirectoryEntry)); memcpy(out_data, result_vec + 4, sizeof(FSDirectoryEntry));
// Force FS_STAT_FILE when a size is set.
if ((out_data->info.flags & FS_STAT_DIRECTORY) != FS_STAT_DIRECTORY && out_data->info.size > 0) {
out_data->info.flags |= FS_STAT_FILE;
}
free(io_buf); free(io_buf);
free(result_vec); free(result_vec);
return result; return result;
@ -720,6 +726,11 @@ int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, FSStat *out_data) {
int result = out_buffer[0]; int result = out_buffer[0];
memcpy(out_data, out_buffer + 1, sizeof(FSStat)); memcpy(out_data, out_buffer + 1, sizeof(FSStat));
// Force FS_STAT_FILE when a size is set.
if ((out_data->flags & FS_STAT_DIRECTORY) != FS_STAT_DIRECTORY && out_data->size > 0) {
out_data->flags |= FS_STAT_FILE;
}
free(io_buf); free(io_buf);
free(out_buffer); free(out_buffer);
return result; return result;
@ -813,6 +824,11 @@ int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, FSStat *out_data) {
int result = out_buffer[0]; int result = out_buffer[0];
memcpy(out_data, out_buffer + 1, sizeof(FSStat)); memcpy(out_data, out_buffer + 1, sizeof(FSStat));
// Force FS_STAT_FILE when a size is set.
if ((out_data->flags & FS_STAT_DIRECTORY) != FS_STAT_DIRECTORY && out_data->size > 0) {
out_data->flags |= FS_STAT_FILE;
}
free(io_buf); free(io_buf);
free(out_buffer); free(out_buffer);
return result; return result;