From 153d10acf9c92148a82bcbd72eec3981e3e13532 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 14 May 2022 19:49:55 +0200 Subject: [PATCH] Force set the FS_STAT_FILE flag if the filesize is > 0 --- source/iosuhax.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/iosuhax.c b/source/iosuhax.c index 6e65f80..725e807 100644 --- a/source/iosuhax.c +++ b/source/iosuhax.c @@ -496,6 +496,12 @@ int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, FSDirectoryEntry *out_data) { int result = *(int *) result_vec; 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(result_vec); return result; @@ -720,6 +726,11 @@ int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, FSStat *out_data) { int result = out_buffer[0]; 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(out_buffer); return result; @@ -813,6 +824,11 @@ int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, FSStat *out_data) { int result = out_buffer[0]; 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(out_buffer); return result;