diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 9cf61e2625..54a79c8ed2 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -56,7 +56,7 @@ void PPUThread::AddArgv(const std::string& arg) m_stack_point -= arg.length() + 1; m_stack_point = AlignAddr(m_stack_point, 0x10) - 0x10; m_argv_addr.push_back(m_stack_point); - Memory.WriteString(m_stack_point, arg); + memcpy(vm::get_ptr(m_stack_point), arg.c_str(), arg.size() + 1); } void PPUThread::InitRegs() diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 55b163c442..ae1b8d03b0 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -24,7 +24,7 @@ void MemoryBase::InvalidAddress(const char* func, const u64 addr) void MemoryBase::RegisterPages(u64 addr, u32 size) { - LV2_LOCK(); + LV2_LOCK(0); //LOG_NOTICE(MEMORY, "RegisterPages(addr=0x%llx, size=0x%x)", addr, size); for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) @@ -45,7 +45,7 @@ void MemoryBase::RegisterPages(u64 addr, u32 size) void MemoryBase::UnregisterPages(u64 addr, u32 size) { - LV2_LOCK(); + LV2_LOCK(0); //LOG_NOTICE(MEMORY, "UnregisterPages(addr=0x%llx, size=0x%x)", addr, size); for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) @@ -66,7 +66,7 @@ void MemoryBase::UnregisterPages(u64 addr, u32 size) u32 MemoryBase::InitRawSPU(MemoryBlock* raw_spu) { - LV2_LOCK(); + LV2_LOCK(0); u32 index; for (index = 0; index < sizeof(RawSPUMem) / sizeof(RawSPUMem[0]); index++) @@ -84,7 +84,7 @@ u32 MemoryBase::InitRawSPU(MemoryBlock* raw_spu) void MemoryBase::CloseRawSPU(MemoryBlock* raw_spu, const u32 num) { - LV2_LOCK(); + LV2_LOCK(0); for (int i = 0; i < MemoryBlocks.size(); ++i) { @@ -99,7 +99,7 @@ void MemoryBase::CloseRawSPU(MemoryBlock* raw_spu, const u32 num) void MemoryBase::Init(MemoryType type) { - LV2_LOCK(); + LV2_LOCK(0); if (m_inited) return; m_inited = true; @@ -152,7 +152,7 @@ void MemoryBase::Init(MemoryType type) void MemoryBase::Close() { - LV2_LOCK(); + LV2_LOCK(0); if (!m_inited) return; m_inited = false; @@ -172,7 +172,7 @@ void MemoryBase::Close() void MemoryBase::WriteMMIO32(u32 addr, const u32 data) { { - LV2_LOCK(); + LV2_LOCK(0); if (RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET] && ((RawSPUThread*)RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET])->Write32(addr, data)) @@ -188,7 +188,7 @@ u32 MemoryBase::ReadMMIO32(u32 addr) { u32 res; { - LV2_LOCK(); + LV2_LOCK(0); if (RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET] && ((RawSPUThread*)RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET])->Read32(addr, &res)) @@ -203,7 +203,7 @@ u32 MemoryBase::ReadMMIO32(u32 addr) bool MemoryBase::Map(const u64 addr, const u32 size) { - LV2_LOCK(); + LV2_LOCK(0); if ((u32)addr != addr || (u64)addr + (u64)size > 0x100000000ull) { @@ -224,7 +224,7 @@ bool MemoryBase::Map(const u64 addr, const u32 size) bool MemoryBase::Unmap(const u64 addr) { - LV2_LOCK(); + LV2_LOCK(0); for (u32 i = 0; i < MemoryBlocks.size(); i++) { @@ -360,7 +360,7 @@ DynamicMemoryBlockBase::DynamicMemoryBlockBase() const u32 DynamicMemoryBlockBase::GetUsedSize() const { - LV2_LOCK(); + LV2_LOCK(0); u32 size = 0; @@ -389,7 +389,7 @@ bool DynamicMemoryBlockBase::IsMyAddress(const u64 addr) MemoryBlock* DynamicMemoryBlockBase::SetRange(const u64 start, const u32 size) { - LV2_LOCK(); + LV2_LOCK(0); m_max_size = PAGE_4K(size); if (!MemoryBlock::SetRange(start, 0)) @@ -403,7 +403,7 @@ MemoryBlock* DynamicMemoryBlockBase::SetRange(const u64 start, const u32 size) void DynamicMemoryBlockBase::Delete() { - LV2_LOCK(); + LV2_LOCK(0); m_allocated.clear(); m_max_size = 0; @@ -423,7 +423,7 @@ bool DynamicMemoryBlockBase::AllocFixed(u64 addr, u32 size) return false; } - LV2_LOCK(); + LV2_LOCK(0); for (u32 i = 0; i void WriteString(const T addr, const std::string& str) - { - memcpy((char*)GetMemFromAddr(addr), str.c_str(), str.size() + 1); - } + //template void WriteString(const T addr, const std::string& str) + //{ + // memcpy((char*)GetMemFromAddr(addr), str.c_str(), str.size() + 1); + //} u32 GetUserMemTotalSize() { diff --git a/rpcs3/Emu/Memory/vm_var.h b/rpcs3/Emu/Memory/vm_var.h index f878de752b..4272e6e527 100644 --- a/rpcs3/Emu/Memory/vm_var.h +++ b/rpcs3/Emu/Memory/vm_var.h @@ -106,10 +106,15 @@ namespace vm } */ - template operator ps3::ptr() const + template operator const ps3::ptr() const { return ps3::ptr::make(m_addr); } + + template operator const ps3::ptr() const + { + return ps3::ptr::make(m_addr); + } operator T&() { diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index 5d4d9aac44..aa2eaa7fb6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -181,8 +181,8 @@ int cellFontOpenFontset(vm::ptr library, vm::ptr return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; } - vm::var f((u32)file.length() + 1, 1); - Memory.WriteString(f.addr(), file); + vm::var f((u32)file.length() + 1, 1); + memcpy(f.get_ptr(), file.c_str(), file.size() + 1); int ret = cellFontOpenFontFile(library, f, 0, 0, font); //TODO: Find the correct values of subNum, uniqueId font->origin = CELL_FONT_OPEN_FONTSET; return ret; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index de8aa0eb35..401a38b827 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -16,7 +16,7 @@ Module *cellGame = nullptr; std::string contentInfo = ""; std::string usrdir = ""; -int cellGameBootCheck(vm::ptr> type, vm::ptr> attributes, vm::ptr size, vm::ptr dirName) +int cellGameBootCheck(vm::ptr> type, vm::ptr> attributes, vm::ptr size, vm::ptr dirName) { cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", type.addr(), attributes.addr(), size.addr(), dirName.addr()); @@ -50,7 +50,7 @@ int cellGameBootCheck(vm::ptr> type, vm::ptr> attributes, vm { *type = CELL_GAME_GAMETYPE_DISC; *attributes = 0; // TODO - if (dirName) Memory.WriteString(dirName.addr(), ""); // ??? + if (dirName) strcpy_trunc(*dirName, ""); // ??? contentInfo = "/dev_bdvd/PS3_GAME"; usrdir = "/dev_bdvd/PS3_GAME/USRDIR"; } @@ -59,7 +59,7 @@ int cellGameBootCheck(vm::ptr> type, vm::ptr> attributes, vm std::string titleId = psf.GetString("TITLE_ID"); *type = CELL_GAME_GAMETYPE_HDD; *attributes = 0; // TODO - if (dirName) Memory.WriteString(dirName.addr(), titleId); + if (dirName) strcpy_trunc(*dirName, titleId); contentInfo = "/dev_hdd0/game/" + titleId; usrdir = "/dev_hdd0/game/" + titleId + "/USRDIR"; } @@ -68,7 +68,7 @@ int cellGameBootCheck(vm::ptr> type, vm::ptr> attributes, vm std::string titleId = psf.GetString("TITLE_ID"); *type = CELL_GAME_GAMETYPE_DISC; *attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO - if (dirName) Memory.WriteString(dirName.addr(), titleId); // ??? + if (dirName) strcpy_trunc(*dirName, titleId); // ??? contentInfo = "/dev_bdvd/PS3_GAME"; usrdir = "/dev_bdvd/PS3_GAME/USRDIR"; } @@ -177,7 +177,7 @@ int cellGameDataCheck(u32 type, vm::ptr dirName, vm::ptr contentInfoPath, vm::ptr usrdirPath) +int cellGameContentPermit(vm::ptr contentInfoPath, vm::ptr usrdirPath) { cellGame->Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)", contentInfoPath.addr(), usrdirPath.addr()); @@ -189,8 +189,8 @@ int cellGameContentPermit(vm::ptr contentInfoPath, vm::ptr usrdirPat } // TODO: make it better - Memory.WriteString(contentInfoPath.addr(), contentInfo); - Memory.WriteString(usrdirPath.addr(), usrdir); + strcpy_trunc(*contentInfoPath, contentInfo); + strcpy_trunc(*usrdirPath, usrdir); contentInfo = ""; usrdir = ""; @@ -350,9 +350,9 @@ int cellGameGetParamInt(u32 id, vm::ptr> value) return CELL_OK; } -int cellGameGetParamString(u32 id, u32 buf_addr, u32 bufsize) +int cellGameGetParamString(u32 id, vm::ptr buf, u32 bufsize) { - cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf_addr, bufsize); + cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize); // TODO: Access through cellGame***Check functions vfsFile f("/app_home/PARAM.SFO"); @@ -393,8 +393,8 @@ int cellGameGetParamString(u32 id, u32 buf_addr, u32 bufsize) return CELL_GAME_ERROR_INVALID_ID; } - data.resize(bufsize-1); - Memory.WriteString(buf_addr, data.c_str()); + if (data.size() >= bufsize) data.resize(bufsize - 1); + memcpy(buf.get_ptr(), data.c_str(), data.size() + 1); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index f0d754e2e7..b47d5d8383 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -36,7 +36,7 @@ int UTF16stoUTF8s(vm::lptrl utf16, vm::ptr> utf16_len, } *utf8_len = str.size(); - Memory.WriteString(utf8.addr(), str); + memcpy(utf8.get_ptr(), str.c_str(), str.size()); #endif return ConversionOK; } @@ -305,7 +305,7 @@ int L10nConvertStr(int src_code, vm::ptr src, vm::ptr> src if (target.length() > *dst_len) return DSTExhausted; - Memory.WriteString(dst.addr(), target); + memcpy(dst.get_ptr(), target.c_str(), target.size()); return ConversionOK; #else diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index c02b496db9..da1d05e189 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -71,9 +71,9 @@ int cellRtcGetCurrentClockLocalTime(vm::ptr pClock) return CELL_OK; } -int cellRtcFormatRfc2822(u32 pszDateTime_addr, vm::ptr pUtc, s32 iTimeZone) +int cellRtcFormatRfc2822(vm::ptr pszDateTime, vm::ptr pUtc, s32 iTimeZone) { - cellRtc->Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime_addr, pUtc.addr(), iTimeZone); + cellRtc->Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone); // Add time_zone as offset in minutes. rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); @@ -84,28 +84,28 @@ int cellRtcFormatRfc2822(u32 pszDateTime_addr, vm::ptr pUtc, s32 iT // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::UTC); - Memory.WriteString(pszDateTime_addr, str); + memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1); return CELL_OK; } -int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, vm::ptr pUtc) +int cellRtcFormatRfc2822LocalTime(vm::ptr pszDateTime, vm::ptr pUtc) { - cellRtc->Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.addr()); + cellRtc->Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr()); // Get date from ticks. rDateTime date = rDateTime((time_t)pUtc->tick); // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::Local); - Memory.WriteString(pszDateTime_addr, str); + memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1); return CELL_OK; } -int cellRtcFormatRfc3339(u32 pszDateTime_addr, vm::ptr pUtc, s32 iTimeZone) +int cellRtcFormatRfc3339(vm::ptr pszDateTime, vm::ptr pUtc, s32 iTimeZone) { - cellRtc->Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime_addr, pUtc.addr(), iTimeZone); + cellRtc->Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone); // Add time_zone as offset in minutes. rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); @@ -116,21 +116,21 @@ int cellRtcFormatRfc3339(u32 pszDateTime_addr, vm::ptr pUtc, s32 iT // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::UTC); - Memory.WriteString(pszDateTime_addr, str); + memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1); return CELL_OK; } -int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, vm::ptr pUtc) +int cellRtcFormatRfc3339LocalTime(vm::ptr pszDateTime, vm::ptr pUtc) { - cellRtc->Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.addr()); + cellRtc->Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr()); // Get date from ticks. rDateTime date = rDateTime((time_t) pUtc->tick); // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::Local); - Memory.WriteString(pszDateTime_addr, str); + memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp b/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp index e0e5e29248..02b191a821 100644 --- a/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp +++ b/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp @@ -177,7 +177,7 @@ s32 cellFsOpendir(vm::ptr path, vm::ptr> fd) s32 cellFsReaddir(u32 fd, vm::ptr dir, vm::ptr> nread) { - sys_fs->Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.addr(), nread.addr()); + sys_fs->Warning("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.addr(), nread.addr()); vfsDirBase* directory; if(!sys_fs->CheckId(fd, directory)) @@ -186,10 +186,10 @@ s32 cellFsReaddir(u32 fd, vm::ptr dir, vm::ptr> nread) const DirEntryInfo* info = directory->Read(); if(info) { - *nread = 1; - Memory.WriteString(dir.addr() + 2, info->name); - dir->d_namlen = info->name.length(); dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY; + dir->d_namlen = u8(std::min((u32)info->name.length(), (u32)CELL_MAX_FS_FILE_NAME_LENGTH)); + strcpy_trunc(dir->d_name, info->name); + *nread = sizeof(CellFsDirent); } else { @@ -201,7 +201,7 @@ s32 cellFsReaddir(u32 fd, vm::ptr dir, vm::ptr> nread) s32 cellFsClosedir(u32 fd) { - sys_fs->Log("cellFsClosedir(fd=%d)", fd); + sys_fs->Warning("cellFsClosedir(fd=%d)", fd); if(!Emu.GetIdManager().RemoveID(fd)) return CELL_ESRCH; @@ -252,7 +252,7 @@ s32 cellFsStat(vm::ptr path, vm::ptr sb) s32 cellFsFstat(u32 fd, vm::ptr sb) { - sys_fs->Log("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.addr()); + sys_fs->Warning("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.addr()); IDType type; vfsStream* file; @@ -279,7 +279,7 @@ s32 cellFsFstat(u32 fd, vm::ptr sb) s32 cellFsMkdir(vm::ptr path, u32 mode) { - sys_fs->Log("cellFsMkdir(path=\"%s\", mode=0x%x)", path.get_ptr(), mode); + sys_fs->Warning("cellFsMkdir(path=\"%s\", mode=0x%x)", path.get_ptr(), mode); const std::string _path = path.get_ptr(); @@ -293,7 +293,7 @@ s32 cellFsMkdir(vm::ptr path, u32 mode) s32 cellFsRename(vm::ptr from, vm::ptr to) { - sys_fs->Log("cellFsRename(from='%s' (from_addr=0x%x), to='%s' (to_addr=0x%x))", from.get_ptr(), from.addr(), to.get_ptr(), to.addr()); + sys_fs->Warning("cellFsRename(from='%s', to='%s')", from.get_ptr(), to.get_ptr()); std::string _from = from.get_ptr(); std::string _to = to.get_ptr(); @@ -343,7 +343,7 @@ s32 cellFsFsync(u32 fd) s32 cellFsRmdir(vm::ptr path) { - sys_fs->Log("cellFsRmdir(path=\"%s\")", path.get_ptr()); + sys_fs->Warning("cellFsRmdir(path=\"%s\")", path.get_ptr()); std::string _path = path.get_ptr(); @@ -400,7 +400,7 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr> pos) s32 cellFsFtruncate(u32 fd, u64 size) { - sys_fs->Log("cellFsFtruncate(fd=%d, size=%lld)", fd, size); + sys_fs->Warning("cellFsFtruncate(fd=%d, size=%lld)", fd, size); IDType type; vfsStream* file; @@ -429,7 +429,7 @@ s32 cellFsFtruncate(u32 fd, u64 size) s32 cellFsTruncate(vm::ptr path, u64 size) { - sys_fs->Log("cellFsTruncate(path=\"%s\", size=%lld)", path.get_ptr(), size); + sys_fs->Warning("cellFsTruncate(path=\"%s\", size=%lld)", path.get_ptr(), size); vfsFile f(path.get_ptr(), vfsReadWrite); if(!f.IsOpened()) @@ -459,7 +459,7 @@ s32 cellFsTruncate(vm::ptr path, u64 size) s32 cellFsFGetBlockSize(u32 fd, vm::ptr> sector_size, vm::ptr> block_size) { - sys_fs->Log("cellFsFGetBlockSize(fd=%d, sector_size_addr=0x%x, block_size_addr=0x%x)", + sys_fs->Warning("cellFsFGetBlockSize(fd=%d, sector_size_addr=0x%x, block_size_addr=0x%x)", fd, sector_size.addr(), block_size.addr()); vfsStream* file; @@ -473,7 +473,7 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr> sector_size, vm::ptr path, vm::ptr> sector_size, vm::ptr> block_size) { - sys_fs->Log("cellFsGetBlockSize(file='%s', sector_size_addr=0x%x, block_size_addr=0x%x)", + sys_fs->Warning("cellFsGetBlockSize(file='%s', sector_size_addr=0x%x, block_size_addr=0x%x)", path.get_ptr(), sector_size.addr(), block_size.addr()); *sector_size = 4096; // ? @@ -496,7 +496,7 @@ s32 cellFsGetFreeSize(vm::ptr path, vm::ptr> block_size, v s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr entries, u32 entries_size, vm::ptr> data_count) { - sys_fs->Log("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size = 0x%x, data_count_addr=0x%x)", + sys_fs->Warning("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size=0x%x, data_count_addr=0x%x)", fd, entries.addr(), entries_size, data_count.addr()); vfsDirBase* directory; @@ -506,11 +506,6 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr entries, u32 const DirEntryInfo* info = directory->Read(); if(info) { - *data_count = 1; - Memory.WriteString(entries.addr()+2, info->name); - entries->entry_name.d_namlen = info->name.length(); - entries->entry_name.d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY; - entries->attribute.st_mode = CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | CELL_FS_S_IRGRP | CELL_FS_S_IWGRP | CELL_FS_S_IXGRP | @@ -522,6 +517,11 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr entries, u32 entries->attribute.st_mtime_ = 0; //TODO entries->attribute.st_ctime_ = 0; //TODO entries->attribute.st_blksize = 4096; + + entries->entry_name.d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY; + entries->entry_name.d_namlen = u8(std::min((u32)info->name.length(), (u32)CELL_MAX_FS_FILE_NAME_LENGTH)); + strcpy_trunc(entries->entry_name.d_name, info->name); + *data_count = 1; } else { diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index ad1dea0541..75b1acd17f 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -175,7 +175,7 @@ public: __forceinline bool IsReady() const { return m_status == Ready; } }; -#define LV2_LOCK() std::lock_guard(Emu.GetCoreMutex()) +#define LV2_LOCK(x) std::lock_guard core_lock##x(Emu.GetCoreMutex()) extern Emulator Emu;