Skip to content

Commit

Permalink
Merge pull request #18485 from hrydgard/beats-mp3-dir-fix
Browse files Browse the repository at this point in the history
Beats: Fix file permissions on FAT so it can see custom MP3s.
  • Loading branch information
hrydgard committed Dec 8, 2023
2 parents 6645ddf + ee4d983 commit c6db963
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Core/HLE/sceIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,13 +917,15 @@ void __IoCopyDate(ScePspDateTime& date_out, const tm& date_in)

static void __IoGetStat(SceIoStat *stat, PSPFileInfo &info) {
memset(stat, 0xfe, sizeof(SceIoStat));
stat->st_size = (s64) info.size;

int type, attr;
if (info.type & FILETYPE_DIRECTORY)
type = SCE_STM_FDIR, attr = TYPE_DIR;
else
type = SCE_STM_FREG, attr = TYPE_FILE;
if (info.type & FILETYPE_DIRECTORY) {
type = SCE_STM_FDIR;
attr = TYPE_DIR;
} else {
type = SCE_STM_FREG;
attr = TYPE_FILE;
}

stat->st_mode = type | info.access;
stat->st_attr = attr;
Expand Down Expand Up @@ -2504,6 +2506,8 @@ static u32 sceIoDread(int id, u32 dirent_addr) {
bool isFAT = pspFileSystem.FlagsFromFilename(dir->name) & FileSystemFlags::SIMULATE_FAT32;
// Only write d_private for memory stick
if (isFAT) {
// All files look like they're executable on FAT. This is required for Beats, see issue #14812
entry->d_stat.st_mode |= 0111;
// write d_private for supporting Custom BGM
// ref JPCSP https://code.google.com/p/jpcsp/source/detail?r=3468
if (Memory::IsValidAddress(entry->d_private)){
Expand Down

0 comments on commit c6db963

Please sign in to comment.