mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-08 15:20:45 +01:00
Modernize std::any_of
with ranges
In WiimoteReal.cpp, JitRegCache.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In ConvertDialog.cpp, the `std::mem_fn` helper was removed because ranges algorithms are able to handle pointers to member functions as predicates.
This commit is contained in:
parent
860e6cf5cb
commit
140252ffc0
@ -91,7 +91,7 @@ void MemoryPatches::DisablePatch(const Core::CPUThreadGuard& guard, std::size_t
|
||||
|
||||
bool MemoryPatches::HasEnabledPatch(u32 address) const
|
||||
{
|
||||
return std::any_of(m_patches.begin(), m_patches.end(), [address](const MemoryPatch& patch) {
|
||||
return std::ranges::any_of(m_patches, [address](const MemoryPatch& patch) {
|
||||
return patch.address == address && patch.is_enabled == MemoryPatch::State::Enabled;
|
||||
});
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ void Watches::DisableWatch(std::size_t index)
|
||||
|
||||
bool Watches::HasEnabledWatch(u32 address) const
|
||||
{
|
||||
return std::any_of(m_watches.begin(), m_watches.end(), [address](const auto& watch) {
|
||||
return std::ranges::any_of(m_watches, [address](const auto& watch) {
|
||||
return watch.address == address && watch.is_enabled == Watch::State::Enabled;
|
||||
});
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
|
||||
// N.B. This avoids doing any copies
|
||||
auto ext_matches = [&native_exts](const fs::path& path) {
|
||||
const std::basic_string_view<fs::path::value_type> native_path = path.native();
|
||||
return std::any_of(native_exts.cbegin(), native_exts.cend(), [&native_path](const auto& ext) {
|
||||
return std::ranges::any_of(native_exts, [&native_path](const auto& ext) {
|
||||
const auto compare_len = ext.native().length();
|
||||
if (native_path.length() < compare_len)
|
||||
return false;
|
||||
|
@ -114,9 +114,8 @@ public:
|
||||
for (const auto& value : section_map)
|
||||
{
|
||||
const Config::Location location{system.first, section_name, value.first};
|
||||
const bool load_disallowed =
|
||||
std::any_of(begin(s_setting_disallowed), end(s_setting_disallowed),
|
||||
[&location](const Config::Location* l) { return *l == location; });
|
||||
const bool load_disallowed = std::ranges::any_of(
|
||||
s_setting_disallowed, [&location](const auto* l) { return *l == location; });
|
||||
if (load_disallowed)
|
||||
continue;
|
||||
|
||||
|
@ -27,8 +27,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||
&Config::WIIMOTE_BB_SOURCE.GetLocation(),
|
||||
};
|
||||
|
||||
return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),
|
||||
[&config_location](const Config::Location* location) {
|
||||
return std::ranges::any_of(s_setting_saveable, [&config_location](const auto* location) {
|
||||
return *location == config_location;
|
||||
});
|
||||
}
|
||||
|
@ -267,8 +267,8 @@ HitType CodeTrace::TraceLogic(const TraceOutput& current_instr, bool first_hit)
|
||||
|
||||
// Checks if the intstruction is a type that needs special handling.
|
||||
const auto CompareInstruction = [](std::string_view instruction, const auto& type_compare) {
|
||||
return std::any_of(type_compare.begin(), type_compare.end(),
|
||||
[&instruction](std::string_view s) { return instruction.starts_with(s); });
|
||||
return std::ranges::any_of(
|
||||
type_compare, [&instruction](std::string_view s) { return instruction.starts_with(s); });
|
||||
};
|
||||
|
||||
// Exclusions from updating tracking logic. mt operations are too complex and specialized.
|
||||
|
@ -101,7 +101,7 @@ std::pair<GCMemcardErrorCode, std::optional<GCMemcard>> GCMemcard::Open(std::str
|
||||
MBIT_SIZE_MEMORY_CARD_2043,
|
||||
}};
|
||||
|
||||
if (!std::any_of(valid_megabits.begin(), valid_megabits.end(),
|
||||
if (!std::ranges::any_of(valid_megabits,
|
||||
[filesize_megabits](u64 mbits) { return mbits == filesize_megabits; }))
|
||||
{
|
||||
error_code.Set(GCMemcardValidityIssues::INVALID_CARD_SIZE);
|
||||
@ -1296,8 +1296,8 @@ GCMemcardErrorCode Header::CheckForErrors(u16 card_size_mbits) const
|
||||
error_code.Set(GCMemcardValidityIssues::MISMATCHED_CARD_SIZE);
|
||||
|
||||
// unused areas, should always be filled with 0xFF
|
||||
if (std::any_of(m_unused_1.begin(), m_unused_1.end(), [](u8 val) { return val != 0xFF; }) ||
|
||||
std::any_of(m_unused_2.begin(), m_unused_2.end(), [](u8 val) { return val != 0xFF; }))
|
||||
if (std::ranges::any_of(m_unused_1, [](u8 val) { return val != 0xFF; }) ||
|
||||
std::ranges::any_of(m_unused_2, [](u8 val) { return val != 0xFF; }))
|
||||
{
|
||||
error_code.Set(GCMemcardValidityIssues::DATA_IN_UNUSED_AREA);
|
||||
}
|
||||
@ -1361,7 +1361,7 @@ GCMemcardErrorCode Directory::CheckForErrors() const
|
||||
error_code.Set(GCMemcardValidityIssues::INVALID_CHECKSUM);
|
||||
|
||||
// unused area, should always be filled with 0xFF
|
||||
if (std::any_of(m_padding.begin(), m_padding.end(), [](u8 val) { return val != 0xFF; }))
|
||||
if (std::ranges::any_of(m_padding, [](u8 val) { return val != 0xFF; }))
|
||||
error_code.Set(GCMemcardValidityIssues::DATA_IN_UNUSED_AREA);
|
||||
|
||||
return error_code;
|
||||
|
@ -613,8 +613,7 @@ void WiimoteScanner::SetScanMode(WiimoteScanMode scan_mode)
|
||||
bool WiimoteScanner::IsReady() const
|
||||
{
|
||||
std::lock_guard lg(m_backends_mutex);
|
||||
return std::any_of(m_backends.begin(), m_backends.end(),
|
||||
[](const auto& backend) { return backend->IsReady(); });
|
||||
return std::ranges::any_of(m_backends, &WiimoteScannerBackend::IsReady);
|
||||
}
|
||||
|
||||
static void CheckForDisconnectedWiimotes()
|
||||
|
@ -878,7 +878,7 @@ ReturnCode ESCore::DeleteSharedContent(const std::array<u8, 20>& sha1) const
|
||||
|
||||
// Check whether the shared content is used by a system title.
|
||||
const std::vector<u64> titles = GetInstalledTitles();
|
||||
const bool is_used_by_system_title = std::any_of(titles.begin(), titles.end(), [&](u64 id) {
|
||||
const bool is_used_by_system_title = std::ranges::any_of(titles, [&](u64 id) {
|
||||
if (!ES::IsTitleType(id, ES::TitleType::System))
|
||||
return false;
|
||||
|
||||
@ -887,7 +887,7 @@ ReturnCode ESCore::DeleteSharedContent(const std::array<u8, 20>& sha1) const
|
||||
return true;
|
||||
|
||||
const auto contents = tmd.GetContents();
|
||||
return std::any_of(contents.begin(), contents.end(),
|
||||
return std::ranges::any_of(contents,
|
||||
[&sha1](const auto& content) { return content.sha1 == sha1; });
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ bool IsValidNonRootPath(std::string_view path)
|
||||
bool IsValidFilename(std::string_view filename)
|
||||
{
|
||||
return filename.length() <= MaxFilenameLength &&
|
||||
!std::any_of(filename.begin(), filename.end(), [](char c) { return c == '/'; });
|
||||
!std::ranges::any_of(filename, [](char c) { return c == '/'; });
|
||||
}
|
||||
|
||||
SplitPathResult SplitPathAndBasename(std::string_view path)
|
||||
|
@ -515,14 +515,14 @@ ResultCode HostFileSystem::CreateDirectory(Uid uid, Gid gid, const std::string&
|
||||
|
||||
bool HostFileSystem::IsFileOpened(const std::string& path) const
|
||||
{
|
||||
return std::any_of(m_handles.begin(), m_handles.end(), [&path](const Handle& handle) {
|
||||
return std::ranges::any_of(m_handles, [&path](const Handle& handle) {
|
||||
return handle.opened && handle.wii_path == path;
|
||||
});
|
||||
}
|
||||
|
||||
bool HostFileSystem::IsDirectoryInUse(const std::string& path) const
|
||||
{
|
||||
return std::any_of(m_handles.begin(), m_handles.end(), [&path](const Handle& handle) {
|
||||
return std::ranges::any_of(m_handles, [&path](const Handle& handle) {
|
||||
return handle.opened && handle.wii_path.starts_with(path);
|
||||
});
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ bool WC24FriendList::CheckFriendList() const
|
||||
|
||||
bool WC24FriendList::DoesFriendExist(u64 friend_id) const
|
||||
{
|
||||
return std::any_of(m_data.friend_codes.cbegin(), m_data.friend_codes.cend(),
|
||||
return std::ranges::any_of(m_data.friend_codes,
|
||||
[&friend_id](const u64 v) { return v == friend_id; });
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ bool Device::HasClass(const u8 device_class) const
|
||||
if (GetDeviceDescriptor().bDeviceClass == device_class)
|
||||
return true;
|
||||
const auto interfaces = GetInterfaces(0);
|
||||
return std::any_of(interfaces.begin(), interfaces.end(), [device_class](const auto& interface) {
|
||||
return std::ranges::any_of(interfaces, [device_class](const auto& interface) {
|
||||
return interface.bInterfaceClass == device_class;
|
||||
});
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ std::optional<IPCReply> OH0::RegisterClassChangeHook(const IOCtlVRequest& reques
|
||||
|
||||
bool OH0::HasDeviceWithVidPid(const u16 vid, const u16 pid) const
|
||||
{
|
||||
return std::any_of(m_devices.begin(), m_devices.end(), [=](const auto& device) {
|
||||
return std::ranges::any_of(m_devices, [=](const auto& device) {
|
||||
return device.second->GetVid() == vid && device.second->GetPid() == pid;
|
||||
});
|
||||
}
|
||||
|
@ -380,9 +380,9 @@ bool IsEmulated(u32 major_version)
|
||||
if (major_version == static_cast<u32>(Titles::BC & 0xffffffff))
|
||||
return true;
|
||||
|
||||
return std::any_of(
|
||||
ios_memory_values.begin(), ios_memory_values.end(),
|
||||
[major_version](const MemoryValues& values) { return values.ios_number == major_version; });
|
||||
return std::ranges::any_of(ios_memory_values, [major_version](const MemoryValues& values) {
|
||||
return values.ios_number == major_version;
|
||||
});
|
||||
}
|
||||
|
||||
bool IsEmulated(u64 title_id)
|
||||
|
@ -375,8 +375,8 @@ s32 WFSSRVDevice::Rename(std::string source, std::string dest) const
|
||||
|
||||
INFO_LOG_FMT(IOS_WFS, "IOCTL_WFS_RENAME: {} to {}", source, dest);
|
||||
|
||||
const bool opened = std::any_of(m_fds.begin(), m_fds.end(),
|
||||
[&](const auto& fd) { return fd.in_use && fd.path == source; });
|
||||
const bool opened =
|
||||
std::ranges::any_of(m_fds, [&](const auto& fd) { return fd.in_use && fd.path == source; });
|
||||
|
||||
if (opened)
|
||||
return WFS_FILE_IS_OPENED;
|
||||
|
@ -2486,8 +2486,8 @@ bool NetPlayClient::PlayerHasControllerMapped(const PlayerId pid) const
|
||||
{
|
||||
const auto mapping_matches_player_id = [pid](const PlayerId& mapping) { return mapping == pid; };
|
||||
|
||||
return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
|
||||
std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
|
||||
return std::ranges::any_of(m_pad_map, mapping_matches_player_id) ||
|
||||
std::ranges::any_of(m_wiimote_map, mapping_matches_player_id);
|
||||
}
|
||||
|
||||
bool NetPlayClient::IsLocalPlayer(const PlayerId pid) const
|
||||
|
@ -2232,8 +2232,8 @@ bool NetPlayServer::PlayerHasControllerMapped(const PlayerId pid) const
|
||||
{
|
||||
const auto mapping_matches_player_id = [pid](const PlayerId& mapping) { return mapping == pid; };
|
||||
|
||||
return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
|
||||
std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
|
||||
return std::ranges::any_of(m_pad_map, mapping_matches_player_id) ||
|
||||
std::ranges::any_of(m_wiimote_map, mapping_matches_player_id);
|
||||
}
|
||||
|
||||
void NetPlayServer::AssignNewUserAPad(const Client& player)
|
||||
|
@ -371,7 +371,7 @@ bool MemChecks::OverlapsMemcheck(u32 address, u32 length) const
|
||||
const u32 page_end_suffix = length - 1;
|
||||
const u32 page_end_address = address | page_end_suffix;
|
||||
|
||||
return std::any_of(m_mem_checks.cbegin(), m_mem_checks.cend(), [&](const auto& mc) {
|
||||
return std::ranges::any_of(m_mem_checks, [&](const auto& mc) {
|
||||
return ((mc.start_address | page_end_suffix) == page_end_address ||
|
||||
(mc.end_address | page_end_suffix) == page_end_address) ||
|
||||
((mc.start_address | page_end_suffix) < page_end_address &&
|
||||
|
@ -136,15 +136,14 @@ static double CallstackFunc(expr_func* f, vec_expr_t* args, void* c)
|
||||
if (!std::isnan(num))
|
||||
{
|
||||
u32 address = static_cast<u32>(num);
|
||||
return std::any_of(stack.begin(), stack.end(),
|
||||
[address](const auto& s) { return s.vAddress == address; });
|
||||
return std::ranges::any_of(stack, [address](const auto& s) { return s.vAddress == address; });
|
||||
}
|
||||
|
||||
const char* cstr = expr_get_str(&vec_nth(args, 0));
|
||||
if (cstr != nullptr)
|
||||
{
|
||||
return std::any_of(stack.begin(), stack.end(),
|
||||
[cstr](const auto& s) { return s.Name.find(cstr) != std::string::npos; });
|
||||
return std::ranges::any_of(
|
||||
stack, [cstr](const auto& s) { return s.Name.find(cstr) != std::string::npos; });
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -754,6 +754,5 @@ void RegCache::Realize(preg_t preg)
|
||||
|
||||
bool RegCache::IsAnyConstraintActive() const
|
||||
{
|
||||
return std::any_of(m_constraints.begin(), m_constraints.end(),
|
||||
[](const auto& c) { return c.IsActive(); });
|
||||
return std::ranges::any_of(m_constraints, &RCConstraint::IsActive);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ JitBase::~JitBase()
|
||||
|
||||
bool JitBase::DoesConfigNeedRefresh()
|
||||
{
|
||||
return std::any_of(JIT_SETTINGS.begin(), JIT_SETTINGS.end(), [this](const auto& pair) {
|
||||
return std::ranges::any_of(JIT_SETTINGS, [this](const auto& pair) {
|
||||
return this->*pair.first != Config::Get(*pair.second);
|
||||
});
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ static void AnalyzeFunction2(PPCSymbolDB* func_db, Common::Symbol* func)
|
||||
{
|
||||
u32 flags = func->flags;
|
||||
|
||||
bool nonleafcall = std::any_of(func->calls.begin(), func->calls.end(), [&](const auto& call) {
|
||||
bool nonleafcall = std::ranges::any_of(func->calls, [&](const auto& call) {
|
||||
const Common::Symbol* const called_func = func_db->GetSymbolFromAddr(call.function);
|
||||
return called_func && (called_func->flags & Common::FFLAG_LEAF) == 0;
|
||||
});
|
||||
|
@ -223,15 +223,14 @@ bool IsTitleInstalled(u64 title_id)
|
||||
// Since this isn't IOS and we only need a simple way to figure out if a title is installed,
|
||||
// we make the (reasonable) assumption that having more than just the TMD in the content
|
||||
// directory means that the title is installed.
|
||||
return std::any_of(entries->begin(), entries->end(),
|
||||
[](const std::string& file) { return file != "title.tmd"; });
|
||||
return std::ranges::any_of(*entries, [](const std::string& file) { return file != "title.tmd"; });
|
||||
}
|
||||
|
||||
bool IsTMDImported(IOS::HLE::FS::FileSystem& fs, u64 title_id)
|
||||
{
|
||||
const auto entries = fs.ReadDirectory(0, 0, Common::GetTitleContentPath(title_id));
|
||||
return entries && std::any_of(entries->begin(), entries->end(),
|
||||
[](const std::string& file) { return file == "title.tmd"; });
|
||||
return entries &&
|
||||
std::ranges::any_of(*entries, [](const std::string& file) { return file == "title.tmd"; });
|
||||
}
|
||||
|
||||
IOS::ES::TMDReader FindBackupTMD(IOS::HLE::FS::FileSystem& fs, u64 title_id)
|
||||
@ -947,8 +946,8 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
|
||||
}
|
||||
|
||||
const auto installed_contents = es.GetStoredContentsFromTMD(tmd);
|
||||
const bool is_installed = std::any_of(installed_contents.begin(), installed_contents.end(),
|
||||
[](const auto& content) { return !content.IsShared(); });
|
||||
const bool is_installed = std::ranges::any_of(
|
||||
installed_contents, [](const auto& content) { return !content.IsShared(); });
|
||||
|
||||
if (is_installed && installed_contents != tmd.GetContents() &&
|
||||
(tmd.GetTitleFlags() & IOS::ES::TitleFlags::TITLE_TYPE_DATA) == 0)
|
||||
|
@ -729,7 +729,7 @@ bool VolumeVerifier::ShouldHaveInstallPartition() const
|
||||
static constexpr std::array<std::string_view, 4> dragon_quest_x = {"S4MJGD", "S4SJGD", "S6TJGD",
|
||||
"SDQJGD"};
|
||||
const std::string& game_id = m_volume.GetGameID();
|
||||
return std::any_of(dragon_quest_x.cbegin(), dragon_quest_x.cend(),
|
||||
return std::ranges::any_of(dragon_quest_x,
|
||||
[&game_id](std::string_view x) { return x == game_id; });
|
||||
}
|
||||
|
||||
@ -737,8 +737,7 @@ bool VolumeVerifier::ShouldHaveMasterpiecePartitions() const
|
||||
{
|
||||
static constexpr std::array<std::string_view, 4> ssbb = {"RSBE01", "RSBJ01", "RSBK01", "RSBP01"};
|
||||
const std::string& game_id = m_volume.GetGameID();
|
||||
return std::any_of(ssbb.cbegin(), ssbb.cend(),
|
||||
[&game_id](std::string_view x) { return x == game_id; });
|
||||
return std::ranges::any_of(ssbb, [&game_id](std::string_view x) { return x == game_id; });
|
||||
}
|
||||
|
||||
bool VolumeVerifier::ShouldBeDualLayer() const
|
||||
@ -1039,7 +1038,7 @@ void VolumeVerifier::CheckSuperPaperMario()
|
||||
if (!m_volume.Read(offset, length, data.data(), partition))
|
||||
return;
|
||||
|
||||
if (std::any_of(data.cbegin(), data.cend(), [](u8 x) { return x != 0; }))
|
||||
if (std::ranges::any_of(data, [](u8 x) { return x != 0; }))
|
||||
{
|
||||
AddProblem(Severity::High,
|
||||
Common::GetStringT("Some padding data that should be zero is not zero. "
|
||||
|
@ -598,9 +598,8 @@ void ShakeMappingIndicator::Update(float elapsed_seconds)
|
||||
|
||||
m_position_samples.push_front(ShakeSample{m_motion_state.position / MAX_DISTANCE});
|
||||
|
||||
const bool any_non_zero_samples =
|
||||
std::any_of(m_position_samples.begin(), m_position_samples.end(),
|
||||
[](const ShakeSample& s) { return s.state.LengthSquared() != 0.0; });
|
||||
const bool any_non_zero_samples = std::ranges::any_of(
|
||||
m_position_samples, [](const ShakeSample& s) { return s.state.LengthSquared() != 0.0; });
|
||||
|
||||
// Only start moving the line if there's non-zero data.
|
||||
if (m_grid_line_position || any_non_zero_samples)
|
||||
|
@ -309,7 +309,7 @@ void ConvertDialog::Convert()
|
||||
}
|
||||
|
||||
if (!scrub && format == DiscIO::BlobType::GCZ &&
|
||||
std::any_of(m_files.begin(), m_files.end(), [](const auto& file) {
|
||||
std::ranges::any_of(m_files, [](const auto& file) {
|
||||
return file->GetPlatform() == DiscIO::Platform::WiiDisc && !file->IsDatelDisc();
|
||||
}))
|
||||
{
|
||||
@ -321,7 +321,7 @@ void ConvertDialog::Convert()
|
||||
}
|
||||
}
|
||||
|
||||
if (std::any_of(m_files.begin(), m_files.end(), std::mem_fn(&UICommon::GameFile::IsNKit)))
|
||||
if (std::ranges::any_of(m_files, &UICommon::GameFile::IsNKit))
|
||||
{
|
||||
if (!ShowAreYouSureDialog(
|
||||
tr("Dolphin can't convert NKit files to non-NKit files. Converting an NKit file in "
|
||||
|
@ -428,8 +428,7 @@ void AudioPane::OnVolumeChanged(int volume)
|
||||
void AudioPane::CheckNeedForLatencyControl()
|
||||
{
|
||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||
m_latency_control_supported =
|
||||
std::any_of(backends.cbegin(), backends.cend(), AudioCommon::SupportsLatencyControl);
|
||||
m_latency_control_supported = std::ranges::any_of(backends, AudioCommon::SupportsLatencyControl);
|
||||
}
|
||||
|
||||
QString AudioPane::GetDPL2QualityLabel(AudioCommon::DPL2Quality value) const
|
||||
|
@ -90,7 +90,7 @@ void IMUGyroscope::UpdateCalibration(const StateData& state)
|
||||
// Check for required calibration update frequency
|
||||
// and if current data is within deadzone distance of mean stable value.
|
||||
if (calibration_freq < WORST_ACCEPTABLE_CALIBRATION_UPDATE_FREQUENCY ||
|
||||
std::any_of(current_difference.data.begin(), current_difference.data.end(),
|
||||
std::ranges::any_of(current_difference.data,
|
||||
[&](auto c) { return std::abs(c) > deadzone; }))
|
||||
{
|
||||
RestartCalibration();
|
||||
|
@ -248,7 +248,7 @@ bool ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device
|
||||
std::lock_guard lk(m_devices_mutex);
|
||||
|
||||
const auto is_id_in_use = [&device, this](int id) {
|
||||
return std::any_of(m_devices.begin(), m_devices.end(), [&device, &id](const auto& d) {
|
||||
return std::ranges::any_of(m_devices, [&device, &id](const auto& d) {
|
||||
return d->GetSource() == device->GetSource() && d->GetName() == device->GetName() &&
|
||||
d->GetId() == id;
|
||||
});
|
||||
@ -368,10 +368,8 @@ void ControllerInterface::UpdateInput()
|
||||
if (devices_to_remove.size() > 0)
|
||||
{
|
||||
RemoveDevice([&](const ciface::Core::Device* device) {
|
||||
return std::any_of(devices_to_remove.begin(), devices_to_remove.end(),
|
||||
[device](const std::weak_ptr<ciface::Core::Device>& d) {
|
||||
return d.lock().get() == device;
|
||||
});
|
||||
return std::ranges::any_of(devices_to_remove,
|
||||
[device](const auto& d) { return d.lock().get() == device; });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection>
|
||||
void RemoveSpuriousTriggerCombinations(
|
||||
std::vector<ciface::Core::DeviceContainer::InputDetection>* detections)
|
||||
{
|
||||
const auto is_spurious = [&](auto& detection) {
|
||||
return std::any_of(detections->begin(), detections->end(), [&](auto& d) {
|
||||
const auto is_spurious = [&](const auto& detection) {
|
||||
return std::ranges::any_of(*detections, [&](const auto& d) {
|
||||
// This is a spurious digital detection if a "smooth" (analog) detection is temporally near.
|
||||
return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness &&
|
||||
abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD;
|
||||
|
@ -304,8 +304,8 @@ void OGLGfx::DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x
|
||||
static_cast<const OGLPipeline*>(m_current_pipeline)->GetProgram()->shader.Bind();
|
||||
|
||||
// Barrier to texture can be used for reads.
|
||||
if (std::any_of(m_bound_image_textures.begin(), m_bound_image_textures.end(),
|
||||
[](auto image) { return image != nullptr; }))
|
||||
if (std::ranges::any_of(m_bound_image_textures,
|
||||
[](const auto* image) { return image != nullptr; }))
|
||||
{
|
||||
glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT);
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ void VulkanContext::DisableDebugUtils()
|
||||
|
||||
bool VulkanContext::SupportsDeviceExtension(const char* name) const
|
||||
{
|
||||
return std::any_of(m_device_extensions.begin(), m_device_extensions.end(),
|
||||
return std::ranges::any_of(m_device_extensions,
|
||||
[name](const std::string& extension) { return extension == name; });
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,8 @@ CustomAssetLibrary::LoadInfo CustomAssetLibrary::LoadGameTexture(const AssetID&
|
||||
}
|
||||
|
||||
// All levels have to have the same format.
|
||||
if (std::any_of(slice.m_levels.begin(), slice.m_levels.end(),
|
||||
[&first_mip](const VideoCommon::CustomTextureData::ArraySlice::Level& l) {
|
||||
return l.format != first_mip.format;
|
||||
}))
|
||||
if (std::ranges::any_of(slice.m_levels,
|
||||
[&first_mip](const auto& l) { return l.format != first_mip.format; }))
|
||||
{
|
||||
ERROR_LOG_FMT(
|
||||
VIDEO, "Custom game texture {} has inconsistent formats across mip levels for slice {}.",
|
||||
|
Loading…
Reference in New Issue
Block a user