summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/audio_core/algorithm/interpolate.cpp5
-rw-r--r--src/audio_core/audio_renderer.cpp7
-rw-r--r--src/core/file_sys/patch_manager.cpp7
-rw-r--r--src/core/hle/kernel/shared_memory.cpp6
-rw-r--r--src/core/hle/kernel/shared_memory.h6
-rw-r--r--src/core/hle/kernel/svc.cpp13
-rw-r--r--src/core/hle/kernel/svc_wrap.h2
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp17
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp2
-rw-r--r--src/yuzu/debugger/wait_tree.cpp2
-rw-r--r--src/yuzu/debugger/wait_tree.h2
12 files changed, 45 insertions, 30 deletions
diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp
index 3aea9b0f2..5005ba519 100644
--- a/src/audio_core/algorithm/interpolate.cpp
+++ b/src/audio_core/algorithm/interpolate.cpp
@@ -54,8 +54,9 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
54 double l = 0.0; 54 double l = 0.0;
55 double r = 0.0; 55 double r = 0.0;
56 for (std::size_t j = 0; j < h.size(); j++) { 56 for (std::size_t j = 0; j < h.size(); j++) {
57 l += Lanczos(taps, pos + j - taps + 1) * h[j][0]; 57 const double lanczos_calc = Lanczos(taps, pos + j - taps + 1);
58 r += Lanczos(taps, pos + j - taps + 1) * h[j][1]; 58 l += lanczos_calc * h[j][0];
59 r += lanczos_calc * h[j][1];
59 } 60 }
60 output.emplace_back(static_cast<s16>(std::clamp(l, -32768.0, 32767.0))); 61 output.emplace_back(static_cast<s16>(std::clamp(l, -32768.0, 32767.0)));
61 output.emplace_back(static_cast<s16>(std::clamp(r, -32768.0, 32767.0))); 62 output.emplace_back(static_cast<s16>(std::clamp(r, -32768.0, 32767.0)));
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp
index 2e59894ab..2683f3a5f 100644
--- a/src/audio_core/audio_renderer.cpp
+++ b/src/audio_core/audio_renderer.cpp
@@ -285,8 +285,11 @@ void AudioRenderer::VoiceState::RefreshBuffer() {
285 break; 285 break;
286 } 286 }
287 287
288 samples = 288 // Only interpolate when necessary, expensive.
289 Interpolate(interp_state, std::move(samples), GetInfo().sample_rate, STREAM_SAMPLE_RATE); 289 if (GetInfo().sample_rate != STREAM_SAMPLE_RATE) {
290 samples = Interpolate(interp_state, std::move(samples), GetInfo().sample_rate,
291 STREAM_SAMPLE_RATE);
292 }
290 293
291 is_refresh_pending = false; 294 is_refresh_pending = false;
292} 295}
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index ecdc21c87..61706966e 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -286,13 +286,12 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
286VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type, 286VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type,
287 VirtualFile update_raw) const { 287 VirtualFile update_raw) const {
288 const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}", 288 const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}",
289 title_id, static_cast<u8>(type)) 289 title_id, static_cast<u8>(type));
290 .c_str();
291 290
292 if (type == ContentRecordType::Program || type == ContentRecordType::Data) 291 if (type == ContentRecordType::Program || type == ContentRecordType::Data)
293 LOG_INFO(Loader, log_string); 292 LOG_INFO(Loader, "{}", log_string);
294 else 293 else
295 LOG_DEBUG(Loader, log_string); 294 LOG_DEBUG(Loader, "{}", log_string);
296 295
297 if (romfs == nullptr) 296 if (romfs == nullptr)
298 return romfs; 297 return romfs;
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index d1ca60125..22d0c1dd5 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -17,13 +17,13 @@ namespace Kernel {
17SharedMemory::SharedMemory(KernelCore& kernel) : Object{kernel} {} 17SharedMemory::SharedMemory(KernelCore& kernel) : Object{kernel} {}
18SharedMemory::~SharedMemory() = default; 18SharedMemory::~SharedMemory() = default;
19 19
20SharedPtr<SharedMemory> SharedMemory::Create(KernelCore& kernel, SharedPtr<Process> owner_process, 20SharedPtr<SharedMemory> SharedMemory::Create(KernelCore& kernel, Process* owner_process, u64 size,
21 u64 size, MemoryPermission permissions, 21 MemoryPermission permissions,
22 MemoryPermission other_permissions, VAddr address, 22 MemoryPermission other_permissions, VAddr address,
23 MemoryRegion region, std::string name) { 23 MemoryRegion region, std::string name) {
24 SharedPtr<SharedMemory> shared_memory(new SharedMemory(kernel)); 24 SharedPtr<SharedMemory> shared_memory(new SharedMemory(kernel));
25 25
26 shared_memory->owner_process = std::move(owner_process); 26 shared_memory->owner_process = owner_process;
27 shared_memory->name = std::move(name); 27 shared_memory->name = std::move(name);
28 shared_memory->size = size; 28 shared_memory->size = size;
29 shared_memory->permissions = permissions; 29 shared_memory->permissions = permissions;
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index 0b48db699..dab2a6bea 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -45,8 +45,8 @@ public:
45 * linear heap. 45 * linear heap.
46 * @param name Optional object name, used for debugging purposes. 46 * @param name Optional object name, used for debugging purposes.
47 */ 47 */
48 static SharedPtr<SharedMemory> Create(KernelCore& kernel, SharedPtr<Process> owner_process, 48 static SharedPtr<SharedMemory> Create(KernelCore& kernel, Process* owner_process, u64 size,
49 u64 size, MemoryPermission permissions, 49 MemoryPermission permissions,
50 MemoryPermission other_permissions, VAddr address = 0, 50 MemoryPermission other_permissions, VAddr address = 0,
51 MemoryRegion region = MemoryRegion::BASE, 51 MemoryRegion region = MemoryRegion::BASE,
52 std::string name = "Unknown"); 52 std::string name = "Unknown");
@@ -139,7 +139,7 @@ private:
139 /// Permission restrictions applied to other processes mapping the block. 139 /// Permission restrictions applied to other processes mapping the block.
140 MemoryPermission other_permissions{}; 140 MemoryPermission other_permissions{};
141 /// Process that created this shared memory block. 141 /// Process that created this shared memory block.
142 SharedPtr<Process> owner_process; 142 Process* owner_process;
143 /// Address of shared memory block in the owner process if specified. 143 /// Address of shared memory block in the owner process if specified.
144 VAddr base_address = 0; 144 VAddr base_address = 0;
145 /// Name of shared memory object. 145 /// Name of shared memory object.
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index c1100f197..5d36792ca 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1491,9 +1491,9 @@ static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32
1491 } 1491 }
1492 1492
1493 auto& kernel = Core::System::GetInstance().Kernel(); 1493 auto& kernel = Core::System::GetInstance().Kernel();
1494 auto& handle_table = Core::CurrentProcess()->GetHandleTable(); 1494 auto process = kernel.CurrentProcess();
1495 const auto shared_mem_handle = SharedMemory::Create( 1495 auto& handle_table = process->GetHandleTable();
1496 kernel, handle_table.Get<Process>(CurrentProcess), size, perms, perms, addr); 1496 const auto shared_mem_handle = SharedMemory::Create(kernel, process, size, perms, perms, addr);
1497 1497
1498 CASCADE_RESULT(*handle, handle_table.Create(shared_mem_handle)); 1498 CASCADE_RESULT(*handle, handle_table.Create(shared_mem_handle));
1499 return RESULT_SUCCESS; 1499 return RESULT_SUCCESS;
@@ -1603,10 +1603,9 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss
1603 } 1603 }
1604 1604
1605 auto& kernel = Core::System::GetInstance().Kernel(); 1605 auto& kernel = Core::System::GetInstance().Kernel();
1606 auto& handle_table = Core::CurrentProcess()->GetHandleTable(); 1606 auto process = kernel.CurrentProcess();
1607 auto shared_mem_handle = 1607 auto& handle_table = process->GetHandleTable();
1608 SharedMemory::Create(kernel, handle_table.Get<Process>(KernelHandle::CurrentProcess), size, 1608 auto shared_mem_handle = SharedMemory::Create(kernel, process, size, local_perms, remote_perms);
1609 local_perms, remote_perms);
1610 1609
1611 CASCADE_RESULT(*handle, handle_table.Create(shared_mem_handle)); 1610 CASCADE_RESULT(*handle, handle_table.Create(shared_mem_handle));
1612 return RESULT_SUCCESS; 1611 return RESULT_SUCCESS;
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h
index b762fd93e..2f758b959 100644
--- a/src/core/hle/kernel/svc_wrap.h
+++ b/src/core/hle/kernel/svc_wrap.h
@@ -127,7 +127,7 @@ void SvcWrap() {
127template <ResultCode func(u64, u64, u32, u32)> 127template <ResultCode func(u64, u64, u32, u32)>
128void SvcWrap() { 128void SvcWrap() {
129 FuncReturn( 129 FuncReturn(
130 func(Param(0), Param(1), static_cast<u32>(Param(3)), static_cast<u32>(Param(3))).raw); 130 func(Param(0), Param(1), static_cast<u32>(Param(2)), static_cast<u32>(Param(3))).raw);
131} 131}
132 132
133template <ResultCode func(u64, u64, u32, u64)> 133template <ResultCode func(u64, u64, u32, u64)>
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 63fa48133..74c4e583b 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -45,8 +45,12 @@ public:
45 explicit IStorage(FileSys::VirtualFile backend_) 45 explicit IStorage(FileSys::VirtualFile backend_)
46 : ServiceFramework("IStorage"), backend(std::move(backend_)) { 46 : ServiceFramework("IStorage"), backend(std::move(backend_)) {
47 static const FunctionInfo functions[] = { 47 static const FunctionInfo functions[] = {
48 {0, &IStorage::Read, "Read"}, {1, nullptr, "Write"}, {2, nullptr, "Flush"}, 48 {0, &IStorage::Read, "Read"},
49 {3, nullptr, "SetSize"}, {4, nullptr, "GetSize"}, {5, nullptr, "OperateRange"}, 49 {1, nullptr, "Write"},
50 {2, nullptr, "Flush"},
51 {3, nullptr, "SetSize"},
52 {4, &IStorage::GetSize, "GetSize"},
53 {5, nullptr, "OperateRange"},
50 }; 54 };
51 RegisterHandlers(functions); 55 RegisterHandlers(functions);
52 } 56 }
@@ -83,6 +87,15 @@ private:
83 IPC::ResponseBuilder rb{ctx, 2}; 87 IPC::ResponseBuilder rb{ctx, 2};
84 rb.Push(RESULT_SUCCESS); 88 rb.Push(RESULT_SUCCESS);
85 } 89 }
90
91 void GetSize(Kernel::HLERequestContext& ctx) {
92 const u64 size = backend->GetSize();
93 LOG_DEBUG(Service_FS, "called, size={}", size);
94
95 IPC::ResponseBuilder rb{ctx, 4};
96 rb.Push(RESULT_SUCCESS);
97 rb.Push<u64>(size);
98 }
86}; 99};
87 100
88class IFile final : public ServiceFramework<IFile> { 101class IFile final : public ServiceFramework<IFile> {
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index a4265f498..aea6bf1af 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -145,7 +145,7 @@ GLuint CachedShader::LazyGeometryProgram(OGLProgram& target_program,
145 return target_program.handle; 145 return target_program.handle;
146}; 146};
147 147
148static bool IsSchedInstruction(u32 offset, u32 main_offset) { 148static bool IsSchedInstruction(std::size_t offset, std::size_t main_offset) {
149 // sched instructions appear once every 4 instructions. 149 // sched instructions appear once every 4 instructions.
150 static constexpr std::size_t SchedPeriod = 4; 150 static constexpr std::size_t SchedPeriod = 4;
151 const std::size_t absolute_offset = offset - main_offset; 151 const std::size_t absolute_offset = offset - main_offset;
@@ -153,7 +153,7 @@ static bool IsSchedInstruction(u32 offset, u32 main_offset) {
153} 153}
154 154
155static std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) { 155static std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
156 const std::size_t start_offset = 10; 156 constexpr std::size_t start_offset = 10;
157 std::size_t offset = start_offset; 157 std::size_t offset = start_offset;
158 std::size_t size = start_offset * sizeof(u64); 158 std::size_t size = start_offset * sizeof(u64);
159 while (offset < program.size()) { 159 while (offset < program.size()) {
@@ -163,7 +163,7 @@ static std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
163 break; 163 break;
164 } 164 }
165 } 165 }
166 size += 8; 166 size += sizeof(inst);
167 offset++; 167 offset++;
168 } 168 }
169 return size; 169 return size;
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index e7057a9cb..a5cfa0070 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -928,7 +928,7 @@ private:
928 case Attribute::Index::FrontFacing: 928 case Attribute::Index::FrontFacing:
929 // TODO(Subv): Find out what the values are for the other elements. 929 // TODO(Subv): Find out what the values are for the other elements.
930 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Fragment); 930 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Fragment);
931 return "vec4(0, 0, 0, uintBitsToFloat(gl_FrontFacing ? 1 : 0))"; 931 return "vec4(0, 0, 0, intBitsToFloat(gl_FrontFacing ? -1 : 0))";
932 default: 932 default:
933 const u32 index{static_cast<u32>(attribute) - 933 const u32 index{static_cast<u32>(attribute) -
934 static_cast<u32>(Attribute::Index::Attribute_0)}; 934 static_cast<u32>(Attribute::Index::Attribute_0)};
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index f9c18ede4..6b3a757e0 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -75,7 +75,7 @@ std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList()
75 return item_list; 75 return item_list;
76} 76}
77 77
78WaitTreeText::WaitTreeText(const QString& t) : text(t) {} 78WaitTreeText::WaitTreeText(QString t) : text(std::move(t)) {}
79WaitTreeText::~WaitTreeText() = default; 79WaitTreeText::~WaitTreeText() = default;
80 80
81QString WaitTreeText::GetText() const { 81QString WaitTreeText::GetText() const {
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h
index 492fb6ac9..e639ef412 100644
--- a/src/yuzu/debugger/wait_tree.h
+++ b/src/yuzu/debugger/wait_tree.h
@@ -52,7 +52,7 @@ private:
52class WaitTreeText : public WaitTreeItem { 52class WaitTreeText : public WaitTreeItem {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 explicit WaitTreeText(const QString& text); 55 explicit WaitTreeText(QString text);
56 ~WaitTreeText() override; 56 ~WaitTreeText() override;
57 57
58 QString GetText() const override; 58 QString GetText() const override;