mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-22 03:38:55 +02:00
[cmake] enable clang-cl and WoA builds (#348)
Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
428f136a75
commit
9d2681ecc9
276 changed files with 973 additions and 1010 deletions
|
|
@ -683,7 +683,7 @@ public:
|
|||
const auto max_mount_len =
|
||||
out_mount_name_buffer_size == 0
|
||||
? MountNameLengthMax + 1
|
||||
: std::min(MountNameLengthMax + 1, out_mount_name_buffer_size);
|
||||
: (std::min)(MountNameLengthMax + 1, out_mount_name_buffer_size);
|
||||
|
||||
// Parse the path until we see a drive separator
|
||||
size_t mount_len = 0;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
private:
|
||||
Result DoRead(s64* out_count, DirectoryEntry* out_entries, s64 max_entries) {
|
||||
const u64 actual_entries =
|
||||
std::min(static_cast<u64>(max_entries), entries.size() - next_entry_index);
|
||||
(std::min)(static_cast<u64>(max_entries), entries.size() - next_entry_index);
|
||||
const auto* begin = reinterpret_cast<u8*>(entries.data() + next_entry_index);
|
||||
const auto* end = reinterpret_cast<u8*>(entries.data() + next_entry_index + actual_entries);
|
||||
const auto range_size = static_cast<std::size_t>(std::distance(begin, end));
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ protected:
|
|||
R_TRY(this->DoGetSize(std::addressof(file_size)));
|
||||
R_UNLESS(offset <= file_size, ResultOutOfRange);
|
||||
|
||||
*out = static_cast<size_t>(std::min(file_size - offset, static_cast<s64>(size)));
|
||||
*out = static_cast<size_t>((std::min)(file_size - offset, static_cast<s64>(size)));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ size_t AesCtrCounterExtendedStorage::Read(u8* buffer, size_t size, size_t offset
|
|||
|
||||
// Determine how much is left.
|
||||
const auto remaining_size = end_offset - cur_offset;
|
||||
const auto cur_size = static_cast<size_t>(std::min(remaining_size, data_size));
|
||||
const auto cur_size = static_cast<size_t>((std::min)(remaining_size, data_size));
|
||||
ASSERT(cur_size <= size);
|
||||
|
||||
// If necessary, perform decryption.
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ size_t AesCtrStorage::Write(const u8* buffer, size_t size, size_t offset) {
|
|||
while (remaining > 0) {
|
||||
// Determine data we're writing and where.
|
||||
const size_t write_size =
|
||||
use_work_buffer ? std::min(pooled_buffer.GetSize(), remaining) : remaining;
|
||||
use_work_buffer ? (std::min)(pooled_buffer.GetSize(), remaining) : remaining;
|
||||
|
||||
void* write_buf;
|
||||
if (use_work_buffer) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ size_t AesXtsStorage::Read(u8* buffer, size_t size, size_t offset) const {
|
|||
// Determine the size of the pre-data read.
|
||||
const size_t skip_size =
|
||||
static_cast<size_t>(offset - Common::AlignDown(offset, m_block_size));
|
||||
const size_t data_size = std::min(size, m_block_size - skip_size);
|
||||
const size_t data_size = (std::min)(size, m_block_size - skip_size);
|
||||
|
||||
// Decrypt into a pooled buffer.
|
||||
{
|
||||
|
|
@ -84,14 +84,14 @@ size_t AesXtsStorage::Read(u8* buffer, size_t size, size_t offset) const {
|
|||
|
||||
AddCounter(ctr.data(), IvSize, 1);
|
||||
processed_size += data_size;
|
||||
ASSERT(processed_size == std::min(size, m_block_size - skip_size));
|
||||
ASSERT(processed_size == (std::min)(size, m_block_size - skip_size));
|
||||
}
|
||||
|
||||
// Decrypt aligned chunks.
|
||||
char* cur = reinterpret_cast<char*>(buffer) + processed_size;
|
||||
size_t remaining = size - processed_size;
|
||||
while (remaining > 0) {
|
||||
const size_t cur_size = std::min(m_block_size, remaining);
|
||||
const size_t cur_size = (std::min)(m_block_size, remaining);
|
||||
|
||||
m_cipher->SetIV(ctr);
|
||||
m_cipher->Transcode(cur, cur_size, cur, Core::Crypto::Op::Decrypt);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ size_t AlignmentMatchingStorageImpl::Read(VirtualFile base_storage, char* work_b
|
|||
while (remaining_tail_size > 0) {
|
||||
const auto aligned_tail_offset = Common::AlignDown(tail_offset, data_alignment);
|
||||
const auto cur_size =
|
||||
std::min(static_cast<size_t>(aligned_tail_offset + data_alignment - tail_offset),
|
||||
(std::min)(static_cast<size_t>(aligned_tail_offset + data_alignment - tail_offset),
|
||||
remaining_tail_size);
|
||||
base_storage->Read(reinterpret_cast<u8*>(work_buf), data_alignment, aligned_tail_offset);
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ size_t AlignmentMatchingStorageImpl::Write(VirtualFile base_storage, char* work_
|
|||
|
||||
const auto aligned_tail_offset = Common::AlignDown(tail_offset, data_alignment);
|
||||
const auto cur_size =
|
||||
std::min(static_cast<size_t>(aligned_tail_offset + data_alignment - tail_offset),
|
||||
(std::min)(static_cast<size_t>(aligned_tail_offset + data_alignment - tail_offset),
|
||||
remaining_tail_size);
|
||||
|
||||
base_storage->Read(reinterpret_cast<u8*>(work_buf), data_alignment, aligned_tail_offset);
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ void GenerateKey(void* dst_key, size_t dst_key_size, const void* src_key, size_t
|
|||
key_type == static_cast<s32>(KeyType::NcaHeaderKey2)) {
|
||||
const s32 key_index = static_cast<s32>(KeyType::NcaHeaderKey2) == key_type;
|
||||
const auto key = instance.GetKey(Core::Crypto::S256KeyType::Header);
|
||||
std::memcpy(dst_key, key.data() + key_index * 0x10, std::min(dst_key_size, key.size() / 2));
|
||||
std::memcpy(dst_key, key.data() + key_index * 0x10, (std::min)(dst_key_size, key.size() / 2));
|
||||
return;
|
||||
}
|
||||
|
||||
const s32 key_generation =
|
||||
std::max(key_type / NcaCryptoConfiguration::KeyAreaEncryptionKeyIndexCount, 1) - 1;
|
||||
(std::max)(key_type / NcaCryptoConfiguration::KeyAreaEncryptionKeyIndexCount, 1) - 1;
|
||||
const s32 key_index = key_type % NcaCryptoConfiguration::KeyAreaEncryptionKeyIndexCount;
|
||||
|
||||
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void IntegrityVerificationStorage::Initialize(VirtualFile hs,
|
|||
ASSERT(m_verification_block_size == 1ll << m_verification_block_order);
|
||||
|
||||
// Set upper layer block sizes.
|
||||
upper_layer_verif_block_size = std::max(upper_layer_verif_block_size, HashSize);
|
||||
upper_layer_verif_block_size = (std::max)(upper_layer_verif_block_size, HashSize);
|
||||
m_upper_layer_verification_block_size = upper_layer_verif_block_size;
|
||||
m_upper_layer_verification_block_order = ILog2(static_cast<u32>(upper_layer_verif_block_size));
|
||||
ASSERT(m_upper_layer_verification_block_size == 1ll << m_upper_layer_verification_block_order);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
namespace FileSys {
|
||||
|
||||
u8 NcaHeader::GetProperKeyGeneration() const {
|
||||
return std::max(this->key_generation, this->key_generation_2);
|
||||
return (std::max)(this->key_generation, this->key_generation_2);
|
||||
}
|
||||
|
||||
bool NcaPatchInfo::HasIndirectTable() const {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void PooledBuffer::AllocateCore(size_t ideal_size, size_t required_size, bool la
|
|||
ASSERT(required_size <= GetAllocatableSizeMaxCore(large));
|
||||
|
||||
const size_t target_size =
|
||||
std::min(std::max(ideal_size, required_size), GetAllocatableSizeMaxCore(large));
|
||||
(std::min)((std::max)(ideal_size, required_size), GetAllocatableSizeMaxCore(large));
|
||||
|
||||
// Dummy implementation for allocate.
|
||||
if (target_size > 0) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ private:
|
|||
virtual ~ZeroStorage() {}
|
||||
|
||||
virtual size_t GetSize() const override {
|
||||
return std::numeric_limits<size_t>::max();
|
||||
return (std::numeric_limits<size_t>::max)();
|
||||
}
|
||||
|
||||
virtual size_t Read(u8* buffer, size_t size, size_t offset) const override {
|
||||
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
private:
|
||||
void SetZeroStorage() {
|
||||
return this->SetStorage(1, m_zero_storage, 0, std::numeric_limits<s64>::max());
|
||||
return this->SetStorage(1, m_zero_storage, 0, (std::numeric_limits<s64>::max)());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ std::vector<u8> CNMT::Serialize() const {
|
|||
header.type >= TitleType::Application && header.type <= TitleType::AOC;
|
||||
const auto dead_zone = header.table_offset + sizeof(CNMTHeader);
|
||||
std::vector<u8> out(
|
||||
std::max(sizeof(CNMTHeader) + (has_opt_header ? sizeof(OptionalHeader) : 0), dead_zone) +
|
||||
(std::max)(sizeof(CNMTHeader) + (has_opt_header ? sizeof(OptionalHeader) : 0), dead_zone) +
|
||||
content_records.size() * sizeof(ContentRecord) + meta_records.size() * sizeof(MetaRecord));
|
||||
memcpy(out.data(), &header, sizeof(CNMTHeader));
|
||||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ std::vector<NcaID> PlaceholderCache::List() const {
|
|||
NcaID PlaceholderCache::Generate() {
|
||||
std::random_device device;
|
||||
std::mt19937 gen(device());
|
||||
std::uniform_int_distribution<u64> distribution(1, std::numeric_limits<u64>::max());
|
||||
std::uniform_int_distribution<u64> distribution(1, (std::numeric_limits<u64>::max)());
|
||||
|
||||
NcaID out{};
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ std::pair<EntryType, std::string> GetEntry(const RomFSTraversalContext& ctx, siz
|
|||
}
|
||||
std::memcpy(&entry, data + offset, sizeof(EntryType));
|
||||
|
||||
const size_t name_length = std::min(entry_end + entry.name_length, size) - entry_end;
|
||||
const size_t name_length = (std::min)(entry_end + entry.name_length, size) - entry_end;
|
||||
std::string name(reinterpret_cast<const char*>(data + entry_end), name_length);
|
||||
|
||||
return {entry, std::move(name)};
|
||||
|
|
|
|||
|
|
@ -507,9 +507,9 @@ bool VfsRawCopy(const VirtualFile& src, const VirtualFile& dest, std::size_t blo
|
|||
if (!dest->Resize(src->GetSize()))
|
||||
return false;
|
||||
|
||||
std::vector<u8> temp(std::min(block_size, src->GetSize()));
|
||||
std::vector<u8> temp((std::min)(block_size, src->GetSize()));
|
||||
for (std::size_t i = 0; i < src->GetSize(); i += block_size) {
|
||||
const auto read = std::min(block_size, src->GetSize() - i);
|
||||
const auto read = (std::min)(block_size, src->GetSize() - i);
|
||||
|
||||
if (src->Read(temp.data(), read, i) != read) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
}
|
||||
|
||||
std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override {
|
||||
const auto read = std::min(length, size - offset);
|
||||
const auto read = (std::min)(length, size - offset);
|
||||
std::fill(data, data + read, value);
|
||||
return read;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
|
||||
std::vector<u8> ReadBytes(std::size_t length, std::size_t offset) const override {
|
||||
const auto read = std::min(length, size - offset);
|
||||
const auto read = (std::min)(length, size - offset);
|
||||
return std::vector<u8>(read, value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ bool VectorVfsFile::IsReadable() const {
|
|||
}
|
||||
|
||||
std::size_t VectorVfsFile::Read(u8* data_, std::size_t length, std::size_t offset) const {
|
||||
const auto read = std::min(length, data.size() - offset);
|
||||
const auto read = (std::min)(length, data.size() - offset);
|
||||
std::memcpy(data_, data.data() + offset, read);
|
||||
return read;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ std::size_t VectorVfsFile::Read(u8* data_, std::size_t length, std::size_t offse
|
|||
std::size_t VectorVfsFile::Write(const u8* data_, std::size_t length, std::size_t offset) {
|
||||
if (offset + length > data.size())
|
||||
data.resize(offset + length);
|
||||
const auto write = std::min(length, data.size() - offset);
|
||||
const auto write = (std::min)(length, data.size() - offset);
|
||||
std::memcpy(data.data() + offset, data_, write);
|
||||
return write;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
}
|
||||
|
||||
std::size_t Read(u8* data_, std::size_t length, std::size_t offset) const override {
|
||||
const auto read = std::min(length, size - offset);
|
||||
const auto read = (std::min)(length, size - offset);
|
||||
std::memcpy(data_, data.data() + offset, read);
|
||||
return read;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue