yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

General: Tidy up clang-format warnings part 2

This commit is contained in:
Lioncash 2020-08-11 11:08:10 -04:00
parent 4605e4d6ff
commit b724a4d90c
18 changed files with 129 additions and 119 deletions

View File

@ -8,8 +8,6 @@ fi
# Default clang-format points to default 3.5 version one # Default clang-format points to default 3.5 version one
CLANG_FORMAT=clang-format-10 CLANG_FORMAT=clang-format-10
ls /usr/bin
$CLANG_FORMAT --version $CLANG_FORMAT --version
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then

View File

@ -78,7 +78,7 @@ public:
const s16 surround_left{samples[i + 4]}; const s16 surround_left{samples[i + 4]};
const s16 surround_right{samples[i + 5]}; const s16 surround_right{samples[i + 5]};
// Not used in the ATSC reference implementation // Not used in the ATSC reference implementation
[[maybe_unused]] const s16 low_frequency_effects { samples[i + 3] }; [[maybe_unused]] const s16 low_frequency_effects{samples[i + 3]};
constexpr s32 clev{707}; // center mixing level coefficient constexpr s32 clev{707}; // center mixing level coefficient
constexpr s32 slev{707}; // surround mixing level coefficient constexpr s32 slev{707}; // surround mixing level coefficient

View File

@ -161,7 +161,7 @@ public:
} }
} }
/// This constructor and assignment operator might be considered ambiguous: // This constructor and assignment operator might be considered ambiguous:
// Would they initialize the storage or just the bitfield? // Would they initialize the storage or just the bitfield?
// Hence, delete them. Use the Assign method to set bitfield values! // Hence, delete them. Use the Assign method to set bitfield values!
BitField(T val) = delete; BitField(T val) = delete;

View File

@ -34,8 +34,7 @@ void DetachedTasks::AddTask(std::function<void()> task) {
std::unique_lock lock{instance->mutex}; std::unique_lock lock{instance->mutex};
--instance->count; --instance->count;
std::notify_all_at_thread_exit(instance->cv, std::move(lock)); std::notify_all_at_thread_exit(instance->cv, std::move(lock));
}) }).detach();
.detach();
} }
} // namespace Common } // namespace Common

View File

@ -54,6 +54,6 @@ struct Rectangle {
}; };
template <typename T> template <typename T>
Rectangle(T, T, T, T)->Rectangle<T>; Rectangle(T, T, T, T) -> Rectangle<T>;
} // namespace Common } // namespace Common

View File

@ -133,8 +133,8 @@ public:
// Parsing function defines the conversion from raw file to NCA. If there are other steps // Parsing function defines the conversion from raw file to NCA. If there are other steps
// besides creating the NCA from the file (e.g. NAX0 on SD Card), that should go in a custom // besides creating the NCA from the file (e.g. NAX0 on SD Card), that should go in a custom
// parsing function. // parsing function.
explicit RegisteredCache(VirtualDir dir, explicit RegisteredCache(
ContentProviderParsingFunction parsing_function = VirtualDir dir, ContentProviderParsingFunction parsing_function =
[](const VirtualFile& file, const NcaID& id) { return file; }); [](const VirtualFile& file, const NcaID& id) { return file; });
~RegisteredCache() override; ~RegisteredCache() override;

View File

@ -293,12 +293,14 @@ std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
BufferDescriptorA()[buffer_index].Size()}; BufferDescriptorA()[buffer_index].Size()};
if (is_buffer_a) { if (is_buffer_a) {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorA().size() > buffer_index, { return buffer; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorA().size() > buffer_index, { return buffer; },
"BufferDescriptorA invalid buffer_index {}", buffer_index); "BufferDescriptorA invalid buffer_index {}", buffer_index);
buffer.resize(BufferDescriptorA()[buffer_index].Size()); buffer.resize(BufferDescriptorA()[buffer_index].Size());
memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size()); memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size());
} else { } else {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorX().size() > buffer_index, { return buffer; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorX().size() > buffer_index, { return buffer; },
"BufferDescriptorX invalid buffer_index {}", buffer_index); "BufferDescriptorX invalid buffer_index {}", buffer_index);
buffer.resize(BufferDescriptorX()[buffer_index].Size()); buffer.resize(BufferDescriptorX()[buffer_index].Size());
memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size()); memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size());
@ -324,16 +326,16 @@ std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,
} }
if (is_buffer_b) { if (is_buffer_b) {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorB().size() > buffer_index && ASSERT_OR_EXECUTE_MSG(
BufferDescriptorB().size() > buffer_index &&
BufferDescriptorB()[buffer_index].Size() >= size, BufferDescriptorB()[buffer_index].Size() >= size,
{ return 0; }, "BufferDescriptorB is invalid, index={}, size={}", { return 0; }, "BufferDescriptorB is invalid, index={}, size={}", buffer_index, size);
buffer_index, size);
memory.WriteBlock(BufferDescriptorB()[buffer_index].Address(), buffer, size); memory.WriteBlock(BufferDescriptorB()[buffer_index].Address(), buffer, size);
} else { } else {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorC().size() > buffer_index && ASSERT_OR_EXECUTE_MSG(
BufferDescriptorC().size() > buffer_index &&
BufferDescriptorC()[buffer_index].Size() >= size, BufferDescriptorC()[buffer_index].Size() >= size,
{ return 0; }, "BufferDescriptorC is invalid, index={}, size={}", { return 0; }, "BufferDescriptorC is invalid, index={}, size={}", buffer_index, size);
buffer_index, size);
memory.WriteBlock(BufferDescriptorC()[buffer_index].Address(), buffer, size); memory.WriteBlock(BufferDescriptorC()[buffer_index].Address(), buffer, size);
} }
@ -344,11 +346,13 @@ std::size_t HLERequestContext::GetReadBufferSize(std::size_t buffer_index) const
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
BufferDescriptorA()[buffer_index].Size()}; BufferDescriptorA()[buffer_index].Size()};
if (is_buffer_a) { if (is_buffer_a) {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorA().size() > buffer_index, { return 0; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorA().size() > buffer_index, { return 0; },
"BufferDescriptorA invalid buffer_index {}", buffer_index); "BufferDescriptorA invalid buffer_index {}", buffer_index);
return BufferDescriptorA()[buffer_index].Size(); return BufferDescriptorA()[buffer_index].Size();
} else { } else {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorX().size() > buffer_index, { return 0; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorX().size() > buffer_index, { return 0; },
"BufferDescriptorX invalid buffer_index {}", buffer_index); "BufferDescriptorX invalid buffer_index {}", buffer_index);
return BufferDescriptorX()[buffer_index].Size(); return BufferDescriptorX()[buffer_index].Size();
} }
@ -358,11 +362,13 @@ std::size_t HLERequestContext::GetWriteBufferSize(std::size_t buffer_index) cons
const bool is_buffer_b{BufferDescriptorB().size() > buffer_index && const bool is_buffer_b{BufferDescriptorB().size() > buffer_index &&
BufferDescriptorB()[buffer_index].Size()}; BufferDescriptorB()[buffer_index].Size()};
if (is_buffer_b) { if (is_buffer_b) {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorB().size() > buffer_index, { return 0; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorB().size() > buffer_index, { return 0; },
"BufferDescriptorB invalid buffer_index {}", buffer_index); "BufferDescriptorB invalid buffer_index {}", buffer_index);
return BufferDescriptorB()[buffer_index].Size(); return BufferDescriptorB()[buffer_index].Size();
} else { } else {
ASSERT_OR_EXECUTE_MSG(BufferDescriptorC().size() > buffer_index, { return 0; }, ASSERT_OR_EXECUTE_MSG(
BufferDescriptorC().size() > buffer_index, { return 0; },
"BufferDescriptorC invalid buffer_index {}", buffer_index); "BufferDescriptorC invalid buffer_index {}", buffer_index);
return BufferDescriptorC()[buffer_index].Size(); return BufferDescriptorC()[buffer_index].Size();
} }

View File

@ -851,7 +851,8 @@ ResultCode PageTable::LockForDeviceAddressSpace(VAddr addr, std::size_t size) {
return result; return result;
} }
block_manager->UpdateLock(addr, size / PageSize, block_manager->UpdateLock(
addr, size / PageSize,
[](MemoryBlockManager::iterator block, MemoryPermission perm) { [](MemoryBlockManager::iterator block, MemoryPermission perm) {
block->ShareToDevice(perm); block->ShareToDevice(perm);
}, },
@ -873,7 +874,8 @@ ResultCode PageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size)
return result; return result;
} }
block_manager->UpdateLock(addr, size / PageSize, block_manager->UpdateLock(
addr, size / PageSize,
[](MemoryBlockManager::iterator block, MemoryPermission perm) { [](MemoryBlockManager::iterator block, MemoryPermission perm) {
block->UnshareToDevice(perm); block->UnshareToDevice(perm);
}, },

View File

@ -551,7 +551,8 @@ void WebBrowser::ExecuteShop() {
} }
void WebBrowser::ExecuteOffline() { void WebBrowser::ExecuteOffline() {
frontend.OpenPageLocal(filename, [this] { UnpackRomFS(); }, [this] { Finalize(); }); frontend.OpenPageLocal(
filename, [this] { UnpackRomFS(); }, [this] { Finalize(); });
} }
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View File

@ -206,7 +206,7 @@ private:
AudioCore::StreamPtr stream; AudioCore::StreamPtr stream;
std::string device_name; std::string device_name;
[[maybe_unused]] AudoutParams audio_params {}; [[maybe_unused]] AudoutParams audio_params{};
/// This is the event handle used to check if the audio buffer was released /// This is the event handle used to check if the audio buffer was released
Kernel::EventPair buffer_event; Kernel::EventPair buffer_event;

View File

@ -365,8 +365,7 @@ bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress)
std::thread([this, title, &progress] { std::thread([this, title, &progress] {
SynchronizeInternal(applet_manager, dir_getter, title, progress); SynchronizeInternal(applet_manager, dir_getter, title, progress);
}) }).detach();
.detach();
return true; return true;
} }
@ -377,8 +376,7 @@ bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
std::thread([this, title, name, &progress] { std::thread([this, title, name, &progress] {
SynchronizeInternal(applet_manager, dir_getter, title, progress, name); SynchronizeInternal(applet_manager, dir_getter, title, progress, name);
}) }).detach();
.detach();
return true; return true;
} }

View File

@ -86,9 +86,11 @@ public:
[[nodiscard]] s64 GetNextTicks() const; [[nodiscard]] s64 GetNextTicks() const;
[[nodiscard]] std::unique_lock<std::mutex> Lock() const { return std::unique_lock{*guard}; } [[nodiscard]] std::unique_lock<std::mutex> Lock() const {
return std::unique_lock{*guard};
}
private : private:
/// Finds the display identified by the specified ID. /// Finds the display identified by the specified ID.
[[nodiscard]] VI::Display* FindDisplay(u64 display_id); [[nodiscard]] VI::Display* FindDisplay(u64 display_id);

View File

@ -224,8 +224,7 @@ void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 clie
} else { } else {
failure_callback(); failure_callback();
} }
}) }).detach();
.detach();
} }
CalibrationConfigurationJob::CalibrationConfigurationJob( CalibrationConfigurationJob::CalibrationConfigurationJob(
@ -279,8 +278,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
complete_event.Wait(); complete_event.Wait();
socket.Stop(); socket.Stop();
worker_thread.join(); worker_thread.join();
}) }).detach();
.detach();
} }
CalibrationConfigurationJob::~CalibrationConfigurationJob() { CalibrationConfigurationJob::~CalibrationConfigurationJob() {

View File

@ -756,8 +756,8 @@ public:
} }
VkResult GetQueryResults(VkQueryPool query_pool, u32 first, u32 count, std::size_t data_size, VkResult GetQueryResults(VkQueryPool query_pool, u32 first, u32 count, std::size_t data_size,
void* data, VkDeviceSize stride, VkQueryResultFlags flags) const void* data, VkDeviceSize stride,
noexcept { VkQueryResultFlags flags) const noexcept {
return dld->vkGetQueryPoolResults(handle, query_pool, first, count, data_size, data, stride, return dld->vkGetQueryPoolResults(handle, query_pool, first, count, data_size, data, stride,
flags); flags);
} }
@ -849,8 +849,8 @@ public:
dld->vkCmdBindPipeline(handle, bind_point, pipeline); dld->vkCmdBindPipeline(handle, bind_point, pipeline);
} }
void BindIndexBuffer(VkBuffer buffer, VkDeviceSize offset, VkIndexType index_type) const void BindIndexBuffer(VkBuffer buffer, VkDeviceSize offset,
noexcept { VkIndexType index_type) const noexcept {
dld->vkCmdBindIndexBuffer(handle, buffer, offset, index_type); dld->vkCmdBindIndexBuffer(handle, buffer, offset, index_type);
} }
@ -863,8 +863,8 @@ public:
BindVertexBuffers(binding, 1, &buffer, &offset); BindVertexBuffers(binding, 1, &buffer, &offset);
} }
void Draw(u32 vertex_count, u32 instance_count, u32 first_vertex, u32 first_instance) const void Draw(u32 vertex_count, u32 instance_count, u32 first_vertex,
noexcept { u32 first_instance) const noexcept {
dld->vkCmdDraw(handle, vertex_count, instance_count, first_vertex, first_instance); dld->vkCmdDraw(handle, vertex_count, instance_count, first_vertex, first_instance);
} }
@ -874,15 +874,15 @@ public:
first_instance); first_instance);
} }
void ClearAttachments(Span<VkClearAttachment> attachments, Span<VkClearRect> rects) const void ClearAttachments(Span<VkClearAttachment> attachments,
noexcept { Span<VkClearRect> rects) const noexcept {
dld->vkCmdClearAttachments(handle, attachments.size(), attachments.data(), rects.size(), dld->vkCmdClearAttachments(handle, attachments.size(), attachments.data(), rects.size(),
rects.data()); rects.data());
} }
void BlitImage(VkImage src_image, VkImageLayout src_layout, VkImage dst_image, void BlitImage(VkImage src_image, VkImageLayout src_layout, VkImage dst_image,
VkImageLayout dst_layout, Span<VkImageBlit> regions, VkFilter filter) const VkImageLayout dst_layout, Span<VkImageBlit> regions,
noexcept { VkFilter filter) const noexcept {
dld->vkCmdBlitImage(handle, src_image, src_layout, dst_image, dst_layout, regions.size(), dld->vkCmdBlitImage(handle, src_image, src_layout, dst_image, dst_layout, regions.size(),
regions.data(), filter); regions.data(), filter);
} }
@ -907,8 +907,8 @@ public:
regions.data()); regions.data());
} }
void CopyBuffer(VkBuffer src_buffer, VkBuffer dst_buffer, Span<VkBufferCopy> regions) const void CopyBuffer(VkBuffer src_buffer, VkBuffer dst_buffer,
noexcept { Span<VkBufferCopy> regions) const noexcept {
dld->vkCmdCopyBuffer(handle, src_buffer, dst_buffer, regions.size(), regions.data()); dld->vkCmdCopyBuffer(handle, src_buffer, dst_buffer, regions.size(), regions.data());
} }
@ -924,8 +924,8 @@ public:
regions.data()); regions.data());
} }
void FillBuffer(VkBuffer dst_buffer, VkDeviceSize dst_offset, VkDeviceSize size, u32 data) const void FillBuffer(VkBuffer dst_buffer, VkDeviceSize dst_offset, VkDeviceSize size,
noexcept { u32 data) const noexcept {
dld->vkCmdFillBuffer(handle, dst_buffer, dst_offset, size, data); dld->vkCmdFillBuffer(handle, dst_buffer, dst_offset, size, data);
} }

View File

@ -187,7 +187,8 @@ std::optional<std::pair<BufferInfo, u64>> TrackLDC(const CFGRebuildState& state,
std::optional<u64> TrackSHLRegister(const CFGRebuildState& state, u32& pos, std::optional<u64> TrackSHLRegister(const CFGRebuildState& state, u32& pos,
u64 ldc_tracked_register) { u64 ldc_tracked_register) {
return TrackInstruction<u64>(state, pos, return TrackInstruction<u64>(
state, pos,
[ldc_tracked_register](auto instr, const auto& opcode) { [ldc_tracked_register](auto instr, const auto& opcode) {
return opcode.GetId() == OpCode::Id::SHL_IMM && return opcode.GetId() == OpCode::Id::SHL_IMM &&
instr.gpr0.Value() == ldc_tracked_register; instr.gpr0.Value() == ldc_tracked_register;
@ -197,7 +198,8 @@ std::optional<u64> TrackSHLRegister(const CFGRebuildState& state, u32& pos,
std::optional<u32> TrackIMNMXValue(const CFGRebuildState& state, u32& pos, std::optional<u32> TrackIMNMXValue(const CFGRebuildState& state, u32& pos,
u64 shl_tracked_register) { u64 shl_tracked_register) {
return TrackInstruction<u32>(state, pos, return TrackInstruction<u32>(
state, pos,
[shl_tracked_register](auto instr, const auto& opcode) { [shl_tracked_register](auto instr, const auto& opcode) {
return opcode.GetId() == OpCode::Id::IMNMX_IMM && return opcode.GetId() == OpCode::Id::IMNMX_IMM &&
instr.gpr0.Value() == shl_tracked_register; instr.gpr0.Value() == shl_tracked_register;

View File

@ -471,8 +471,8 @@ std::tuple<Node, Node, GlobalMemoryBase> ShaderIR::TrackGlobalMemory(NodeBlock&
const auto [base_address, index, offset] = const auto [base_address, index, offset] =
TrackCbuf(addr_register, global_code, static_cast<s64>(global_code.size())); TrackCbuf(addr_register, global_code, static_cast<s64>(global_code.size()));
ASSERT_OR_EXECUTE_MSG(base_address != nullptr, ASSERT_OR_EXECUTE_MSG(
{ return std::make_tuple(nullptr, nullptr, GlobalMemoryBase{}); }, base_address != nullptr, { return std::make_tuple(nullptr, nullptr, GlobalMemoryBase{}); },
"Global memory tracking failed"); "Global memory tracking failed");
bb.push_back(Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", index, offset))); bb.push_back(Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", index, offset)));

View File

@ -281,7 +281,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
button->setContextMenuPolicy(Qt::CustomContextMenu); button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button, &QPushButton::clicked, [=, this] { connect(button, &QPushButton::clicked, [=, this] {
HandleClick(button_map[button_id], HandleClick(
button_map[button_id],
[=, this](Common::ParamPackage params) { [=, this](Common::ParamPackage params) {
// Workaround for ZL & ZR for analog triggers like on XBOX controllors. // Workaround for ZL & ZR for analog triggers like on XBOX controllors.
// Analog triggers (from controllers like the XBOX controller) would not // Analog triggers (from controllers like the XBOX controller) would not
@ -325,7 +326,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
analog_button->setContextMenuPolicy(Qt::CustomContextMenu); analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(analog_button, &QPushButton::clicked, [=, this] { connect(analog_button, &QPushButton::clicked, [=, this] {
HandleClick(analog_map_buttons[analog_id][sub_button_id], HandleClick(
analog_map_buttons[analog_id][sub_button_id],
[=, this](const Common::ParamPackage& params) { [=, this](const Common::ParamPackage& params) {
SetAnalogButton(params, analogs_param[analog_id], SetAnalogButton(params, analogs_param[analog_id],
analog_sub_buttons[sub_button_id]); analog_sub_buttons[sub_button_id]);
@ -357,7 +359,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
tr("After pressing OK, first move your joystick horizontally, " tr("After pressing OK, first move your joystick horizontally, "
"and then vertically."), "and then vertically."),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
HandleClick(analog_map_stick[analog_id], HandleClick(
analog_map_stick[analog_id],
[=, this](const Common::ParamPackage& params) { [=, this](const Common::ParamPackage& params) {
analogs_param[analog_id] = params; analogs_param[analog_id] = params;
}, },

View File

@ -84,7 +84,8 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
button->setContextMenuPolicy(Qt::CustomContextMenu); button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button, &QPushButton::clicked, [=, this] { connect(button, &QPushButton::clicked, [=, this] {
HandleClick(button_map[button_id], HandleClick(
button_map[button_id],
[=, this](const Common::ParamPackage& params) { [=, this](const Common::ParamPackage& params) {
buttons_param[button_id] = params; buttons_param[button_id] = params;
}, },