diff --git a/Source/Core/Core/IOS/FS/FileIO.cpp b/Source/Core/Core/IOS/FS/FileIO.cpp index 48dc4891c8..2029055f84 100644 --- a/Source/Core/Core/IOS/FS/FileIO.cpp +++ b/Source/Core/Core/IOS/FS/FileIO.cpp @@ -291,31 +291,18 @@ IPCCommandResult FileIO::Write(const ReadWriteRequest& request) IPCCommandResult FileIO::IOCtl(const IOCtlRequest& request) { DEBUG_LOG(IOS_FILEIO, "FileIO: IOCtl (Device=%s)", m_name.c_str()); - s32 return_value = IPC_SUCCESS; switch (request.request) { case ISFS_IOCTL_GETFILESTATS: - { - if (m_file->IsOpen()) - { - DEBUG_LOG(IOS_FILEIO, "File: %s, Length: %" PRIu64 ", Pos: %i", m_name.c_str(), - m_file->GetSize(), m_SeekPos); - Memory::Write_U32(static_cast(m_file->GetSize()), request.buffer_out); - Memory::Write_U32(m_SeekPos, request.buffer_out + 4); - } - else - { - return_value = FS_ENOENT; - } - } - break; + return GetFileStats(request); default: request.Log(GetDeviceName(), LogTypes::IOS_FILEIO, LogTypes::LERROR); + break; } - return GetDefaultReply(return_value); + return GetDefaultReply(IPC_SUCCESS); } void FileIO::PrepareForState(PointerWrap::Mode mode) @@ -338,6 +325,18 @@ void FileIO::DoState(PointerWrap& p) // Open it again OpenFile(); } + +IPCCommandResult FileIO::GetFileStats(const IOCtlRequest& request) +{ + if (!m_file->IsOpen()) + return GetDefaultReply(FS_ENOENT); + + DEBUG_LOG(IOS_FILEIO, "File: %s, Length: %" PRIu64 ", Pos: %u", m_name.c_str(), m_file->GetSize(), + m_SeekPos); + Memory::Write_U32(static_cast(m_file->GetSize()), request.buffer_out); + Memory::Write_U32(m_SeekPos, request.buffer_out + 4); + return GetDefaultReply(IPC_SUCCESS); +} } // namespace Device } // namespace HLE } // namespace IOS diff --git a/Source/Core/Core/IOS/FS/FileIO.h b/Source/Core/Core/IOS/FS/FileIO.h index edc192e418..feb8878892 100644 --- a/Source/Core/Core/IOS/FS/FileIO.h +++ b/Source/Core/Core/IOS/FS/FileIO.h @@ -70,6 +70,8 @@ private: ISFS_IOCTL_SHUTDOWN = 13 }; + IPCCommandResult GetFileStats(const IOCtlRequest& request); + u32 m_Mode = 0; u32 m_SeekPos = 0;