diff --git a/Source/Core/Core/IOS/DI/DI.cpp b/Source/Core/Core/IOS/DI/DI.cpp index 6810943699..4c15a71007 100644 --- a/Source/Core/Core/IOS/DI/DI.cpp +++ b/Source/Core/Core/IOS/DI/DI.cpp @@ -109,7 +109,7 @@ void DIDevice::ProcessQueuedIOCtl() auto finished = StartIOCtl(request); if (finished) { - CoreTiming::ScheduleEvent(2700 * SystemTimers::TIMER_RATIO, s_finish_executing_di_command, + CoreTiming::ScheduleEvent(IPC_OVERHEAD_TICKS, s_finish_executing_di_command, static_cast(finished.value())); return; } diff --git a/Source/Core/Core/IOS/ES/ES.h b/Source/Core/Core/IOS/ES/ES.h index 10af9fbd02..989474749d 100644 --- a/Source/Core/Core/IOS/ES/ES.h +++ b/Source/Core/Core/IOS/ES/ES.h @@ -366,8 +366,6 @@ private: std::string GetContentPath(u64 title_id, const ES::Content& content, Ticks ticks = {}) const; - static constexpr u64 IPC_OVERHEAD_TICKS = 2700_tbticks; - struct OpenedContent { bool m_opened = false; diff --git a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp index 7bd33e44dd..47197164d2 100644 --- a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp +++ b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp @@ -22,16 +22,9 @@ namespace IOS::HLE { using namespace IOS::HLE::FS; -static constexpr u64 GetIPCOverheadTicks() -{ - // According to hardware tests, FS takes at least 2700 TB ticks to reply to commands. - return 2700; -} - static IPCReply GetFSReply(s32 return_value, u64 extra_tb_ticks = 0) { - return IPCReply{return_value, - (GetIPCOverheadTicks() + extra_tb_ticks) * SystemTimers::TIMER_RATIO}; + return IPCReply{return_value, IPC_OVERHEAD_TICKS + extra_tb_ticks * SystemTimers::TIMER_RATIO}; } /// Duration of a superblock write (in timebase ticks). @@ -169,7 +162,7 @@ std::optional FSDevice::Open(const OpenRequest& request) s64 FSDevice::Open(FS::Uid uid, FS::Gid gid, const std::string& path, FS::Mode mode, std::optional ipc_fd, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); if (m_fd_map.size() >= 16) return ConvertResult(ResultCode::NoFreeHandle); @@ -204,7 +197,7 @@ std::optional FSDevice::Close(u32 fd) s32 FSDevice::Close(u64 fd, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); const auto& handle = m_fd_map[fd]; if (handle.fs_fd != INVALID_FD) @@ -318,7 +311,7 @@ std::optional FSDevice::Read(const ReadWriteRequest& request) s32 FSDevice::Read(u64 fd, u8* data, u32 size, std::optional ipc_buffer_addr, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); const Handle& handle = m_fd_map[fd]; if (handle.fs_fd == INVALID_FD) @@ -347,7 +340,7 @@ std::optional FSDevice::Write(const ReadWriteRequest& request) s32 FSDevice::Write(u64 fd, const u8* data, u32 size, std::optional ipc_buffer_addr, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); const Handle& handle = m_fd_map[fd]; if (handle.fs_fd == INVALID_FD) @@ -375,7 +368,7 @@ std::optional FSDevice::Seek(const SeekRequest& request) s32 FSDevice::Seek(u64 fd, u32 offset, FS::SeekMode mode, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); const Handle& handle = m_fd_map[fd]; if (handle.fs_fd == INVALID_FD) @@ -679,7 +672,7 @@ IPCReply FSDevice::GetFileStats(const Handle& handle, const IOCtlRequest& reques FS::Result FSDevice::GetFileStatus(u64 fd, Ticks ticks) { - ticks.AddTimeBaseTicks(GetIPCOverheadTicks()); + ticks.AddTimeBaseTicks(IPC_OVERHEAD_TICKS); const auto& handle = m_fd_map[fd]; if (handle.fs_fd == INVALID_FD) return ResultCode::Invalid; diff --git a/Source/Core/Core/IOS/IOS.h b/Source/Core/Core/IOS/IOS.h index 11220f1194..fe2336cd47 100644 --- a/Source/Core/Core/IOS/IOS.h +++ b/Source/Core/Core/IOS/IOS.h @@ -46,6 +46,8 @@ struct IPCReply u64 reply_delay_ticks; }; +constexpr u64 IPC_OVERHEAD_TICKS = 2700_tbticks; + // Used to make it more convenient for functions to return timing information // without having to explicitly keep track of ticks in callers. class Ticks