summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/CMakeLists.txt1
-rw-r--r--src/core/constants.h1
-rw-r--r--src/core/file_sys/fsmitm_romfsbuild.cpp4
-rw-r--r--src/core/file_sys/fsmitm_romfsbuild.h2
-rw-r--r--src/core/file_sys/vfs_concat.cpp8
-rw-r--r--src/core/file_sys/vfs_concat.h6
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp1
-rw-r--r--src/core/hle/kernel/svc.cpp7
-rw-r--r--src/core/hle/kernel/synchronization.cpp1
-rw-r--r--src/core/hle/kernel/thread.h2
-rw-r--r--src/core/hle/service/mii/manager.cpp6
-rw-r--r--src/core/memory/dmnt_cheat_vm.cpp29
-rw-r--r--src/core/memory/dmnt_cheat_vm.h14
-rw-r--r--src/core/settings.cpp77
-rw-r--r--src/video_core/macro/macro.h3
-rw-r--r--src/video_core/macro/macro_hle.cpp20
-rw-r--r--src/video_core/renderer_vulkan/vk_device.cpp6
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp10
-rw-r--r--src/video_core/shader_cache.h4
20 files changed, 118 insertions, 85 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index ff941d505..c42f95705 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -185,6 +185,7 @@ add_library(core STATIC
185 hle/kernel/object.h 185 hle/kernel/object.h
186 hle/kernel/physical_core.cpp 186 hle/kernel/physical_core.cpp
187 hle/kernel/physical_core.h 187 hle/kernel/physical_core.h
188 hle/kernel/physical_memory.h
188 hle/kernel/process.cpp 189 hle/kernel/process.cpp
189 hle/kernel/process.h 190 hle/kernel/process.h
190 hle/kernel/process_capability.cpp 191 hle/kernel/process_capability.cpp
diff --git a/src/core/constants.h b/src/core/constants.h
index 6d0ec022a..81c5cb279 100644
--- a/src/core/constants.h
+++ b/src/core/constants.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array>
7#include "common/common_types.h" 8#include "common/common_types.h"
8 9
9// This is to consolidate system-wide constants that are used by multiple components of yuzu. 10// This is to consolidate system-wide constants that are used by multiple components of yuzu.
diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp
index d126ae8dd..2aff2708a 100644
--- a/src/core/file_sys/fsmitm_romfsbuild.cpp
+++ b/src/core/file_sys/fsmitm_romfsbuild.cpp
@@ -240,7 +240,7 @@ RomFSBuildContext::RomFSBuildContext(VirtualDir base_, VirtualDir ext_)
240 240
241RomFSBuildContext::~RomFSBuildContext() = default; 241RomFSBuildContext::~RomFSBuildContext() = default;
242 242
243std::map<u64, VirtualFile> RomFSBuildContext::Build() { 243std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
244 const u64 dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs); 244 const u64 dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs);
245 const u64 file_hash_table_entry_count = romfs_get_hash_table_count(num_files); 245 const u64 file_hash_table_entry_count = romfs_get_hash_table_count(num_files);
246 dir_hash_table_size = 4 * dir_hash_table_entry_count; 246 dir_hash_table_size = 4 * dir_hash_table_entry_count;
@@ -294,7 +294,7 @@ std::map<u64, VirtualFile> RomFSBuildContext::Build() {
294 cur_dir->parent->child = cur_dir; 294 cur_dir->parent->child = cur_dir;
295 } 295 }
296 296
297 std::map<u64, VirtualFile> out; 297 std::multimap<u64, VirtualFile> out;
298 298
299 // Populate file tables. 299 // Populate file tables.
300 for (const auto& it : files) { 300 for (const auto& it : files) {
diff --git a/src/core/file_sys/fsmitm_romfsbuild.h b/src/core/file_sys/fsmitm_romfsbuild.h
index a62502193..049de180b 100644
--- a/src/core/file_sys/fsmitm_romfsbuild.h
+++ b/src/core/file_sys/fsmitm_romfsbuild.h
@@ -43,7 +43,7 @@ public:
43 ~RomFSBuildContext(); 43 ~RomFSBuildContext();
44 44
45 // This finalizes the context. 45 // This finalizes the context.
46 std::map<u64, VirtualFile> Build(); 46 std::multimap<u64, VirtualFile> Build();
47 47
48private: 48private:
49 VirtualDir base; 49 VirtualDir base;
diff --git a/src/core/file_sys/vfs_concat.cpp b/src/core/file_sys/vfs_concat.cpp
index 16d801c0c..e0ff70174 100644
--- a/src/core/file_sys/vfs_concat.cpp
+++ b/src/core/file_sys/vfs_concat.cpp
@@ -11,7 +11,7 @@
11 11
12namespace FileSys { 12namespace FileSys {
13 13
14static bool VerifyConcatenationMapContinuity(const std::map<u64, VirtualFile>& map) { 14static bool VerifyConcatenationMapContinuity(const std::multimap<u64, VirtualFile>& map) {
15 const auto last_valid = --map.end(); 15 const auto last_valid = --map.end();
16 for (auto iter = map.begin(); iter != last_valid;) { 16 for (auto iter = map.begin(); iter != last_valid;) {
17 const auto old = iter++; 17 const auto old = iter++;
@@ -27,12 +27,12 @@ ConcatenatedVfsFile::ConcatenatedVfsFile(std::vector<VirtualFile> files_, std::s
27 : name(std::move(name)) { 27 : name(std::move(name)) {
28 std::size_t next_offset = 0; 28 std::size_t next_offset = 0;
29 for (const auto& file : files_) { 29 for (const auto& file : files_) {
30 files[next_offset] = file; 30 files.emplace(next_offset, file);
31 next_offset += file->GetSize(); 31 next_offset += file->GetSize();
32 } 32 }
33} 33}
34 34
35ConcatenatedVfsFile::ConcatenatedVfsFile(std::map<u64, VirtualFile> files_, std::string name) 35ConcatenatedVfsFile::ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files_, std::string name)
36 : files(std::move(files_)), name(std::move(name)) { 36 : files(std::move(files_)), name(std::move(name)) {
37 ASSERT(VerifyConcatenationMapContinuity(files)); 37 ASSERT(VerifyConcatenationMapContinuity(files));
38} 38}
@@ -50,7 +50,7 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(std::vector<VirtualFile> f
50} 50}
51 51
52VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte, 52VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte,
53 std::map<u64, VirtualFile> files, 53 std::multimap<u64, VirtualFile> files,
54 std::string name) { 54 std::string name) {
55 if (files.empty()) 55 if (files.empty())
56 return nullptr; 56 return nullptr;
diff --git a/src/core/file_sys/vfs_concat.h b/src/core/file_sys/vfs_concat.h
index c90f9d5d1..7a26343c0 100644
--- a/src/core/file_sys/vfs_concat.h
+++ b/src/core/file_sys/vfs_concat.h
@@ -15,7 +15,7 @@ namespace FileSys {
15// read-only. 15// read-only.
16class ConcatenatedVfsFile : public VfsFile { 16class ConcatenatedVfsFile : public VfsFile {
17 ConcatenatedVfsFile(std::vector<VirtualFile> files, std::string name); 17 ConcatenatedVfsFile(std::vector<VirtualFile> files, std::string name);
18 ConcatenatedVfsFile(std::map<u64, VirtualFile> files, std::string name); 18 ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files, std::string name);
19 19
20public: 20public:
21 ~ConcatenatedVfsFile() override; 21 ~ConcatenatedVfsFile() override;
@@ -25,7 +25,7 @@ public:
25 25
26 /// Convenience function that turns a map of offsets to files into a concatenated file, filling 26 /// Convenience function that turns a map of offsets to files into a concatenated file, filling
27 /// gaps with a given filler byte. 27 /// gaps with a given filler byte.
28 static VirtualFile MakeConcatenatedFile(u8 filler_byte, std::map<u64, VirtualFile> files, 28 static VirtualFile MakeConcatenatedFile(u8 filler_byte, std::multimap<u64, VirtualFile> files,
29 std::string name); 29 std::string name);
30 30
31 std::string GetName() const override; 31 std::string GetName() const override;
@@ -40,7 +40,7 @@ public:
40 40
41private: 41private:
42 // Maps starting offset to file -- more efficient. 42 // Maps starting offset to file -- more efficient.
43 std::map<u64, VirtualFile> files; 43 std::multimap<u64, VirtualFile> files;
44 std::string name; 44 std::string name;
45}; 45};
46 46
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 4d2a9b35d..df0debe1b 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -24,7 +24,6 @@ namespace Kernel {
24// Wake up num_to_wake (or all) threads in a vector. 24// Wake up num_to_wake (or all) threads in a vector.
25void AddressArbiter::WakeThreads(const std::vector<std::shared_ptr<Thread>>& waiting_threads, 25void AddressArbiter::WakeThreads(const std::vector<std::shared_ptr<Thread>>& waiting_threads,
26 s32 num_to_wake) { 26 s32 num_to_wake) {
27 auto& time_manager = system.Kernel().TimeManager();
28 // Only process up to 'target' threads, unless 'target' is <= 0, in which case process 27 // Only process up to 'target' threads, unless 'target' is <= 0, in which case process
29 // them all. 28 // them all.
30 std::size_t last = waiting_threads.size(); 29 std::size_t last = waiting_threads.size();
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 5db19dcf3..01ae57053 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -458,9 +458,7 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr
458 return ERR_OUT_OF_RANGE; 458 return ERR_OUT_OF_RANGE;
459 } 459 }
460 460
461 auto* const thread = system.CurrentScheduler().GetCurrentThread();
462 auto& kernel = system.Kernel(); 461 auto& kernel = system.Kernel();
463 using ObjectPtr = Thread::ThreadSynchronizationObjects::value_type;
464 Thread::ThreadSynchronizationObjects objects(handle_count); 462 Thread::ThreadSynchronizationObjects objects(handle_count);
465 const auto& handle_table = kernel.CurrentProcess()->GetHandleTable(); 463 const auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
466 464
@@ -1750,9 +1748,9 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
1750 // Only process up to 'target' threads, unless 'target' is less equal 0, in which case process 1748 // Only process up to 'target' threads, unless 'target' is less equal 0, in which case process
1751 // them all. 1749 // them all.
1752 std::size_t last = waiting_threads.size(); 1750 std::size_t last = waiting_threads.size();
1753 if (target > 0) 1751 if (target > 0) {
1754 last = std::min(waiting_threads.size(), static_cast<std::size_t>(target)); 1752 last = std::min(waiting_threads.size(), static_cast<std::size_t>(target));
1755 auto& time_manager = kernel.TimeManager(); 1753 }
1756 for (std::size_t index = 0; index < last; ++index) { 1754 for (std::size_t index = 0; index < last; ++index) {
1757 auto& thread = waiting_threads[index]; 1755 auto& thread = waiting_threads[index];
1758 1756
@@ -1763,7 +1761,6 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
1763 1761
1764 const std::size_t current_core = system.CurrentCoreIndex(); 1762 const std::size_t current_core = system.CurrentCoreIndex();
1765 auto& monitor = system.Monitor(); 1763 auto& monitor = system.Monitor();
1766 auto& memory = system.Memory();
1767 1764
1768 // Atomically read the value of the mutex. 1765 // Atomically read the value of the mutex.
1769 u32 mutex_val = 0; 1766 u32 mutex_val = 0;
diff --git a/src/core/hle/kernel/synchronization.cpp b/src/core/hle/kernel/synchronization.cpp
index 851b702a5..8b875d853 100644
--- a/src/core/hle/kernel/synchronization.cpp
+++ b/src/core/hle/kernel/synchronization.cpp
@@ -19,7 +19,6 @@ Synchronization::Synchronization(Core::System& system) : system{system} {}
19void Synchronization::SignalObject(SynchronizationObject& obj) const { 19void Synchronization::SignalObject(SynchronizationObject& obj) const {
20 auto& kernel = system.Kernel(); 20 auto& kernel = system.Kernel();
21 SchedulerLock lock(kernel); 21 SchedulerLock lock(kernel);
22 auto& time_manager = kernel.TimeManager();
23 if (obj.IsSignaled()) { 22 if (obj.IsSignaled()) {
24 for (auto thread : obj.GetWaitingThreads()) { 23 for (auto thread : obj.GetWaitingThreads()) {
25 if (thread->GetSchedulingStatus() == ThreadSchedStatus::Paused) { 24 if (thread->GetSchedulingStatus() == ThreadSchedStatus::Paused) {
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 9808767e5..8daf79fac 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -583,8 +583,6 @@ private:
583 583
584 void SetCurrentPriority(u32 new_priority); 584 void SetCurrentPriority(u32 new_priority);
585 585
586 void AdjustSchedulingOnAffinity(u64 old_affinity_mask, s32 old_core);
587
588 Common::SpinLock context_guard{}; 586 Common::SpinLock context_guard{};
589 ThreadContext32 context_32{}; 587 ThreadContext32 context_32{};
590 ThreadContext64 context_64{}; 588 ThreadContext64 context_64{};
diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp
index 6e51fe89f..4730070cb 100644
--- a/src/core/hle/service/mii/manager.cpp
+++ b/src/core/hle/service/mii/manager.cpp
@@ -105,9 +105,9 @@ MiiInfo ConvertStoreDataToInfo(const MiiStoreData& data) {
105 105
106u16 GenerateCrc16(const void* data, std::size_t size) { 106u16 GenerateCrc16(const void* data, std::size_t size) {
107 s32 crc{}; 107 s32 crc{};
108 for (int i = 0; i < size; i++) { 108 for (std::size_t i = 0; i < size; i++) {
109 crc ^= reinterpret_cast<const u8*>(data)[i] << 8; 109 crc ^= static_cast<const u8*>(data)[i] << 8;
110 for (int j = 0; j < 8; j++) { 110 for (std::size_t j = 0; j < 8; j++) {
111 crc <<= 1; 111 crc <<= 1;
112 if ((crc & 0x10000) != 0) { 112 if ((crc & 0x10000) != 0) {
113 crc = (crc ^ 0x1021) & 0xFFFF; 113 crc = (crc ^ 0x1021) & 0xFFFF;
diff --git a/src/core/memory/dmnt_cheat_vm.cpp b/src/core/memory/dmnt_cheat_vm.cpp
index fb9f36bfd..2e7da23fe 100644
--- a/src/core/memory/dmnt_cheat_vm.cpp
+++ b/src/core/memory/dmnt_cheat_vm.cpp
@@ -190,6 +190,15 @@ void DmntCheatVm::LogOpcode(const CheatVmOpcode& opcode) {
190 callbacks->CommandLog( 190 callbacks->CommandLog(
191 fmt::format("Act[{:02X}]: {:d}", i, save_restore_regmask->should_operate[i])); 191 fmt::format("Act[{:02X}]: {:d}", i, save_restore_regmask->should_operate[i]));
192 } 192 }
193 } else if (auto rw_static_reg = std::get_if<ReadWriteStaticRegisterOpcode>(&opcode.opcode)) {
194 callbacks->CommandLog("Opcode: Read/Write Static Register");
195 if (rw_static_reg->static_idx < NumReadableStaticRegisters) {
196 callbacks->CommandLog("Op Type: ReadStaticRegister");
197 } else {
198 callbacks->CommandLog("Op Type: WriteStaticRegister");
199 }
200 callbacks->CommandLog(fmt::format("Reg Idx {:X}", rw_static_reg->idx));
201 callbacks->CommandLog(fmt::format("Stc Idx {:X}", rw_static_reg->static_idx));
193 } else if (auto debug_log = std::get_if<DebugLogOpcode>(&opcode.opcode)) { 202 } else if (auto debug_log = std::get_if<DebugLogOpcode>(&opcode.opcode)) {
194 callbacks->CommandLog("Opcode: Debug Log"); 203 callbacks->CommandLog("Opcode: Debug Log");
195 callbacks->CommandLog(fmt::format("Bit Width: {:X}", debug_log->bit_width)); 204 callbacks->CommandLog(fmt::format("Bit Width: {:X}", debug_log->bit_width));
@@ -544,6 +553,16 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
544 } 553 }
545 opcode.opcode = save_restore_regmask; 554 opcode.opcode = save_restore_regmask;
546 } break; 555 } break;
556 case CheatVmOpcodeType::ReadWriteStaticRegister: {
557 ReadWriteStaticRegisterOpcode rw_static_reg{};
558 // C3000XXx
559 // C3 = opcode 0xC3.
560 // XX = static register index.
561 // x = register index.
562 rw_static_reg.static_idx = ((first_dword >> 4) & 0xFF);
563 rw_static_reg.idx = (first_dword & 0xF);
564 opcode.opcode = rw_static_reg;
565 } break;
547 case CheatVmOpcodeType::DebugLog: { 566 case CheatVmOpcodeType::DebugLog: {
548 DebugLogOpcode debug_log{}; 567 DebugLogOpcode debug_log{};
549 // FFFTIX## 568 // FFFTIX##
@@ -667,6 +686,7 @@ void DmntCheatVm::ResetState() {
667 registers.fill(0); 686 registers.fill(0);
668 saved_values.fill(0); 687 saved_values.fill(0);
669 loop_tops.fill(0); 688 loop_tops.fill(0);
689 static_registers.fill(0);
670 instruction_ptr = 0; 690 instruction_ptr = 0;
671 condition_depth = 0; 691 condition_depth = 0;
672 decode_success = true; 692 decode_success = true;
@@ -1153,6 +1173,15 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
1153 } 1173 }
1154 } 1174 }
1155 } 1175 }
1176 } else if (auto rw_static_reg =
1177 std::get_if<ReadWriteStaticRegisterOpcode>(&cur_opcode.opcode)) {
1178 if (rw_static_reg->static_idx < NumReadableStaticRegisters) {
1179 // Load a register with a static register.
1180 registers[rw_static_reg->idx] = static_registers[rw_static_reg->static_idx];
1181 } else {
1182 // Store a register to a static register.
1183 static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx];
1184 }
1156 } else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) { 1185 } else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) {
1157 // Read value from memory. 1186 // Read value from memory.
1158 u64 log_value = 0; 1187 u64 log_value = 0;
diff --git a/src/core/memory/dmnt_cheat_vm.h b/src/core/memory/dmnt_cheat_vm.h
index 8351fd798..21b86b72c 100644
--- a/src/core/memory/dmnt_cheat_vm.h
+++ b/src/core/memory/dmnt_cheat_vm.h
@@ -56,6 +56,7 @@ enum class CheatVmOpcodeType : u32 {
56 BeginRegisterConditionalBlock = 0xC0, 56 BeginRegisterConditionalBlock = 0xC0,
57 SaveRestoreRegister = 0xC1, 57 SaveRestoreRegister = 0xC1,
58 SaveRestoreRegisterMask = 0xC2, 58 SaveRestoreRegisterMask = 0xC2,
59 ReadWriteStaticRegister = 0xC3,
59 60
60 // This is a meta entry, and not a real opcode. 61 // This is a meta entry, and not a real opcode.
61 // This is to facilitate multi-nybble instruction decoding. 62 // This is to facilitate multi-nybble instruction decoding.
@@ -237,6 +238,11 @@ struct SaveRestoreRegisterMaskOpcode {
237 std::array<bool, 0x10> should_operate{}; 238 std::array<bool, 0x10> should_operate{};
238}; 239};
239 240
241struct ReadWriteStaticRegisterOpcode {
242 u32 static_idx{};
243 u32 idx{};
244};
245
240struct DebugLogOpcode { 246struct DebugLogOpcode {
241 u32 bit_width{}; 247 u32 bit_width{};
242 u32 log_id{}; 248 u32 log_id{};
@@ -259,7 +265,8 @@ struct CheatVmOpcode {
259 PerformArithmeticStaticOpcode, BeginKeypressConditionalOpcode, 265 PerformArithmeticStaticOpcode, BeginKeypressConditionalOpcode,
260 PerformArithmeticRegisterOpcode, StoreRegisterToAddressOpcode, 266 PerformArithmeticRegisterOpcode, StoreRegisterToAddressOpcode,
261 BeginRegisterConditionalOpcode, SaveRestoreRegisterOpcode, 267 BeginRegisterConditionalOpcode, SaveRestoreRegisterOpcode,
262 SaveRestoreRegisterMaskOpcode, DebugLogOpcode, UnrecognizedInstruction> 268 SaveRestoreRegisterMaskOpcode, ReadWriteStaticRegisterOpcode, DebugLogOpcode,
269 UnrecognizedInstruction>
263 opcode{}; 270 opcode{};
264}; 271};
265 272
@@ -281,6 +288,10 @@ public:
281 288
282 static constexpr std::size_t MaximumProgramOpcodeCount = 0x400; 289 static constexpr std::size_t MaximumProgramOpcodeCount = 0x400;
283 static constexpr std::size_t NumRegisters = 0x10; 290 static constexpr std::size_t NumRegisters = 0x10;
291 static constexpr std::size_t NumReadableStaticRegisters = 0x80;
292 static constexpr std::size_t NumWritableStaticRegisters = 0x80;
293 static constexpr std::size_t NumStaticRegisters =
294 NumReadableStaticRegisters + NumWritableStaticRegisters;
284 295
285 explicit DmntCheatVm(std::unique_ptr<Callbacks> callbacks); 296 explicit DmntCheatVm(std::unique_ptr<Callbacks> callbacks);
286 ~DmntCheatVm(); 297 ~DmntCheatVm();
@@ -302,6 +313,7 @@ private:
302 std::array<u32, MaximumProgramOpcodeCount> program{}; 313 std::array<u32, MaximumProgramOpcodeCount> program{};
303 std::array<u64, NumRegisters> registers{}; 314 std::array<u64, NumRegisters> registers{};
304 std::array<u64, NumRegisters> saved_values{}; 315 std::array<u64, NumRegisters> saved_values{};
316 std::array<u64, NumStaticRegisters> static_registers{};
305 std::array<std::size_t, NumRegisters> loop_tops{}; 317 std::array<std::size_t, NumRegisters> loop_tops{};
306 318
307 bool DecodeNextOpcode(CheatVmOpcode& out); 319 bool DecodeNextOpcode(CheatVmOpcode& out);
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index 64a3c69d3..e8a6f2a6e 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -2,6 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <string_view>
6
5#include "common/file_util.h" 7#include "common/file_util.h"
6#include "core/core.h" 8#include "core/core.h"
7#include "core/gdbstub/gdbstub.h" 9#include "core/gdbstub/gdbstub.h"
@@ -65,18 +67,18 @@ Values values = {};
65bool configuring_global = true; 67bool configuring_global = true;
66 68
67std::string GetTimeZoneString() { 69std::string GetTimeZoneString() {
68 static constexpr std::array<const char*, 46> timezones{{ 70 static constexpr std::array timezones{
69 "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", 71 "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire",
70 "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", 72 "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0",
71 "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan", 73 "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan",
72 "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", 74 "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT",
73 "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", 75 "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey",
74 "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", 76 "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu",
75 }}; 77 };
76
77 ASSERT(Settings::values.time_zone_index.GetValue() < timezones.size());
78 78
79 return timezones[Settings::values.time_zone_index.GetValue()]; 79 const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue());
80 ASSERT(time_zone_index < timezones.size());
81 return timezones[time_zone_index];
80} 82}
81 83
82void Apply() { 84void Apply() {
@@ -91,41 +93,40 @@ void Apply() {
91 Service::HID::ReloadInputDevices(); 93 Service::HID::ReloadInputDevices();
92} 94}
93 95
94template <typename T>
95void LogSetting(const std::string& name, const T& value) {
96 LOG_INFO(Config, "{}: {}", name, value);
97}
98
99void LogSettings() { 96void LogSettings() {
97 const auto log_setting = [](std::string_view name, const auto& value) {
98 LOG_INFO(Config, "{}: {}", name, value);
99 };
100
100 LOG_INFO(Config, "yuzu Configuration:"); 101 LOG_INFO(Config, "yuzu Configuration:");
101 LogSetting("Controls_UseDockedMode", Settings::values.use_docked_mode); 102 log_setting("Controls_UseDockedMode", values.use_docked_mode);
102 LogSetting("System_RngSeed", Settings::values.rng_seed.GetValue().value_or(0)); 103 log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0));
103 LogSetting("System_CurrentUser", Settings::values.current_user); 104 log_setting("System_CurrentUser", values.current_user);
104 LogSetting("System_LanguageIndex", Settings::values.language_index.GetValue()); 105 log_setting("System_LanguageIndex", values.language_index.GetValue());
105 LogSetting("System_RegionIndex", Settings::values.region_index.GetValue()); 106 log_setting("System_RegionIndex", values.region_index.GetValue());
106 LogSetting("System_TimeZoneIndex", Settings::values.time_zone_index.GetValue()); 107 log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue());
107 LogSetting("Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); 108 log_setting("Core_UseMultiCore", values.use_multi_core.GetValue());
108 LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor.GetValue()); 109 log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
109 LogSetting("Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); 110 log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue());
110 LogSetting("Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); 111 log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
111 LogSetting("Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache.GetValue()); 112 log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue());
112 LogSetting("Renderer_GPUAccuracyLevel", Settings::values.gpu_accuracy.GetValue()); 113 log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue());
113 LogSetting("Renderer_UseAsynchronousGpuEmulation", 114 log_setting("Renderer_UseAsynchronousGpuEmulation",
114 Settings::values.use_asynchronous_gpu_emulation.GetValue()); 115 values.use_asynchronous_gpu_emulation.GetValue());
115 LogSetting("Renderer_UseVsync", Settings::values.use_vsync.GetValue()); 116 log_setting("Renderer_UseVsync", values.use_vsync.GetValue());
116 LogSetting("Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders.GetValue()); 117 log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue());
117 LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy.GetValue()); 118 log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue());
118 LogSetting("Audio_OutputEngine", Settings::values.sink_id); 119 log_setting("Audio_OutputEngine", values.sink_id);
119 LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching.GetValue()); 120 log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue());
120 LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); 121 log_setting("Audio_OutputDevice", values.audio_device_id);
121 LogSetting("DataStorage_UseVirtualSd", Settings::values.use_virtual_sd); 122 log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd);
122 LogSetting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); 123 log_setting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir));
123 LogSetting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)); 124 log_setting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir));
124 LogSetting("Debugging_UseGdbstub", Settings::values.use_gdbstub); 125 log_setting("Debugging_UseGdbstub", values.use_gdbstub);
125 LogSetting("Debugging_GdbstubPort", Settings::values.gdbstub_port); 126 log_setting("Debugging_GdbstubPort", values.gdbstub_port);
126 LogSetting("Debugging_ProgramArgs", Settings::values.program_args); 127 log_setting("Debugging_ProgramArgs", values.program_args);
127 LogSetting("Services_BCATBackend", Settings::values.bcat_backend); 128 log_setting("Services_BCATBackend", values.bcat_backend);
128 LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local); 129 log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local);
129} 130}
130 131
131float Volume() { 132float Volume() {
diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h
index 4d00b84b0..31ee3440a 100644
--- a/src/video_core/macro/macro.h
+++ b/src/video_core/macro/macro.h
@@ -103,8 +103,9 @@ public:
103 virtual ~CachedMacro() = default; 103 virtual ~CachedMacro() = default;
104 /** 104 /**
105 * Executes the macro code with the specified input parameters. 105 * Executes the macro code with the specified input parameters.
106 * @param code The macro byte code to execute 106 *
107 * @param parameters The parameters of the macro 107 * @param parameters The parameters of the macro
108 * @param method The method to execute
108 */ 109 */
109 virtual void Execute(const std::vector<u32>& parameters, u32 method) = 0; 110 virtual void Execute(const std::vector<u32>& parameters, u32 method) = 0;
110}; 111};
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp
index 410f99018..0c9ff59a4 100644
--- a/src/video_core/macro/macro_hle.cpp
+++ b/src/video_core/macro/macro_hle.cpp
@@ -12,13 +12,11 @@ namespace Tegra {
12 12
13namespace { 13namespace {
14// HLE'd functions 14// HLE'd functions
15static void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, 15void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
16 const std::vector<u32>& parameters) {
17 const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); 16 const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B);
18 17
19 maxwell3d.regs.draw.topology.Assign( 18 maxwell3d.regs.draw.topology.Assign(
20 static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0] & 19 static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0] & 0x3ffffff));
21 ~(0x3ffffff << 26)));
22 maxwell3d.regs.vb_base_instance = parameters[5]; 20 maxwell3d.regs.vb_base_instance = parameters[5];
23 maxwell3d.mme_draw.instance_count = instance_count; 21 maxwell3d.mme_draw.instance_count = instance_count;
24 maxwell3d.regs.vb_element_base = parameters[3]; 22 maxwell3d.regs.vb_element_base = parameters[3];
@@ -33,8 +31,7 @@ static void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d,
33 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; 31 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
34} 32}
35 33
36static void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d, 34void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
37 const std::vector<u32>& parameters) {
38 const u32 count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); 35 const u32 count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
39 36
40 maxwell3d.regs.vertex_buffer.first = parameters[3]; 37 maxwell3d.regs.vertex_buffer.first = parameters[3];
@@ -52,8 +49,7 @@ static void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d,
52 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; 49 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
53} 50}
54 51
55static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, 52void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
56 const std::vector<u32>& parameters) {
57 const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); 53 const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
58 const u32 element_base = parameters[4]; 54 const u32 element_base = parameters[4];
59 const u32 base_instance = parameters[5]; 55 const u32 base_instance = parameters[5];
@@ -81,12 +77,12 @@ static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d,
81 maxwell3d.CallMethodFromMME(0x8e5, 0x0); 77 maxwell3d.CallMethodFromMME(0x8e5, 0x0);
82 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; 78 maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
83} 79}
84} // namespace 80} // Anonymous namespace
85 81
86constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{ 82constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{
87 std::make_pair<u64, HLEFunction>(0x771BB18C62444DA0, &HLE_771BB18C62444DA0), 83 {0x771BB18C62444DA0, &HLE_771BB18C62444DA0},
88 std::make_pair<u64, HLEFunction>(0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD), 84 {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD},
89 std::make_pair<u64, HLEFunction>(0x0217920100488FF7, &HLE_0217920100488FF7), 85 {0x0217920100488FF7, &HLE_0217920100488FF7},
90}}; 86}};
91 87
92HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} 88HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp
index 9226e591c..26379ee01 100644
--- a/src/video_core/renderer_vulkan/vk_device.cpp
+++ b/src/video_core/renderer_vulkan/vk_device.cpp
@@ -757,14 +757,14 @@ std::vector<VkDeviceQueueCreateInfo> VKDevice::GetDeviceQueueCreateInfos() const
757 queue_cis.reserve(unique_queue_families.size()); 757 queue_cis.reserve(unique_queue_families.size());
758 758
759 for (const u32 queue_family : unique_queue_families) { 759 for (const u32 queue_family : unique_queue_families) {
760 queue_cis.push_back({ 760 auto& ci = queue_cis.emplace_back(VkDeviceQueueCreateInfo{
761 .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, 761 .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
762 .pNext = nullptr, 762 .pNext = nullptr,
763 .flags = 0, 763 .flags = 0,
764 .queueFamilyIndex = queue_family, 764 .queueFamilyIndex = queue_family,
765 .queueCount = 1,
766 .pQueuePriorities = &QUEUE_PRIORITY,
767 }); 765 });
766 ci.queueCount = 1;
767 ci.pQueuePriorities = &QUEUE_PRIORITY;
768 } 768 }
769 769
770 return queue_cis; 770 return queue_cis;
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index e5a583dd5..9151d9fb1 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -158,6 +158,7 @@ void StateTracker::Initialize() {
158 SetupDirtyFrontFace(tables); 158 SetupDirtyFrontFace(tables);
159 SetupDirtyPrimitiveTopology(tables); 159 SetupDirtyPrimitiveTopology(tables);
160 SetupDirtyStencilOp(tables); 160 SetupDirtyStencilOp(tables);
161 SetupDirtyStencilTestEnable(tables);
161} 162}
162 163
163void StateTracker::InvalidateCommandBufferState() { 164void StateTracker::InvalidateCommandBufferState() {
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 430031665..bd93dcf20 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -281,12 +281,10 @@ void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) {
281 VkBufferMemoryBarrier barrier; 281 VkBufferMemoryBarrier barrier;
282 barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; 282 barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
283 barrier.pNext = nullptr; 283 barrier.pNext = nullptr;
284 barrier.srcAccessMask = VK_PIPELINE_STAGE_TRANSFER_BIT; 284 barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
285 barrier.dstAccessMask = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT; 285 barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
286 barrier.srcQueueFamilyIndex = VK_ACCESS_TRANSFER_WRITE_BIT; 286 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; // They'll be ignored anyway
287 barrier.dstQueueFamilyIndex = VK_ACCESS_SHADER_READ_BIT; 287 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
288 barrier.srcQueueFamilyIndex = 0;
289 barrier.dstQueueFamilyIndex = 0;
290 barrier.buffer = dst_buffer; 288 barrier.buffer = dst_buffer;
291 barrier.offset = 0; 289 barrier.offset = 0;
292 barrier.size = size; 290 barrier.size = size;
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h
index b7608fc7b..015a789d6 100644
--- a/src/video_core/shader_cache.h
+++ b/src/video_core/shader_cache.h
@@ -209,11 +209,11 @@ private:
209 } 209 }
210 210
211 // Remove them from the cache 211 // Remove them from the cache
212 const auto is_removed = [&removed_shaders](std::unique_ptr<T>& shader) { 212 const auto is_removed = [&removed_shaders](const std::unique_ptr<T>& shader) {
213 return std::find(removed_shaders.begin(), removed_shaders.end(), shader.get()) != 213 return std::find(removed_shaders.begin(), removed_shaders.end(), shader.get()) !=
214 removed_shaders.end(); 214 removed_shaders.end();
215 }; 215 };
216 storage.erase(std::remove_if(storage.begin(), storage.end(), is_removed), storage.end()); 216 std::erase_if(storage, is_removed);
217 } 217 }
218 218
219 /// @brief Creates a new entry in the lookup cache and returns its pointer 219 /// @brief Creates a new entry in the lookup cache and returns its pointer