IOS: Rewrite FS to use FileSystem

This is the large change in the branch.

This lets us use either the host filesystem or (in the future) a NAND
image exactly the same way, and make sure the IPC emulation code
behaves identically. Less duplicated code.

Note that "FileIO" and "FS" were merged, because it actually doesn't
make a lot of sense to split them: IOS handles requests for both
/dev/fs and files in the same resource manager, and as it turns out,
/dev/fs commands can *also* be sent to non /dev/fs file descriptors!
If we kept /dev/fs and files split, there would be no way to
emulate that correctly. I'm not aware of anything that does that (yet?)
but I think it's important to be correct.
This commit is contained in:
Léo Lam
2018-03-03 18:55:01 +01:00
parent 78478a651d
commit 5a7b966b6d
18 changed files with 589 additions and 1117 deletions

View File

@ -32,6 +32,7 @@ enum LOG_TYPE
IOS_DI,
IOS_ES,
IOS_FILEIO,
IOS_FS,
IOS_NET,
IOS_SD,
IOS_SSL,

View File

@ -100,6 +100,7 @@ LogManager::LogManager()
m_log[LogTypes::IOS_DI] = {"IOS_DI", "IOS - Drive Interface"};
m_log[LogTypes::IOS_ES] = {"IOS_ES", "IOS - ETicket Services"};
m_log[LogTypes::IOS_FILEIO] = {"IOS_FILEIO", "IOS - FileIO"};
m_log[LogTypes::IOS_FS] = {"IOS_FS", "IOS - Filesystem Services"};
m_log[LogTypes::IOS_SD] = {"IOS_SD", "IOS - SDIO"};
m_log[LogTypes::IOS_SSL] = {"IOS_SSL", "IOS - SSL"};
m_log[LogTypes::IOS_STM] = {"IOS_STM", "IOS - State Transition Manager"};

View File

@ -166,4 +166,16 @@ inline T FromBigEndian(T data)
swap<sizeof(data)>(reinterpret_cast<u8*>(&data));
return data;
}
template <typename value_type>
struct BigEndianValue
{
static_assert(std::is_arithmetic<value_type>(), "value_type must be an arithmetic type");
BigEndianValue() = default;
explicit BigEndianValue(value_type val) { *this = val; }
operator value_type() const { return FromBigEndian(raw); }
void operator=(value_type v) { raw = FromBigEndian(v); }
private:
value_type raw;
};
} // Namespace Common