summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-02-18 21:06:41 +0100
committerLéo Lam <leo@leolam.fr>2021-02-18 21:10:55 +0100
commite3bf5fca93cc4a9f2d793e286453df40b040dc81 (patch)
treef76d7bca72048e3c2bd88d92ed5d6372e36d46ec /Source/Core
parentf750208aa31a860414fc877346ed17001c0df512 (diff)
IOS: Deduplicate IPC_OVERHEAD_TICKS timing constant
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/DI/DI.cpp2
-rw-r--r--Source/Core/Core/IOS/ES/ES.h2
-rw-r--r--Source/Core/Core/IOS/FS/FileSystemProxy.cpp21
-rw-r--r--Source/Core/Core/IOS/IOS.h2
4 files changed, 10 insertions, 17 deletions
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<u64>(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<IPCReply> FSDevice::Open(const OpenRequest& request)
s64 FSDevice::Open(FS::Uid uid, FS::Gid gid, const std::string& path, FS::Mode mode,
std::optional<u32> 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<IPCReply> 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<IPCReply> FSDevice::Read(const ReadWriteRequest& request)
s32 FSDevice::Read(u64 fd, u8* data, u32 size, std::optional<u32> 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<IPCReply> FSDevice::Write(const ReadWriteRequest& request)
s32 FSDevice::Write(u64 fd, const u8* data, u32 size, std::optional<u32> 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<IPCReply> 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<FS::FileStatus> 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