diff --git a/app/src/main/cpp/skyline/common/span.h b/app/src/main/cpp/skyline/common/span.h index 7aad8181..2904adf7 100644 --- a/app/src/main/cpp/skyline/common/span.h +++ b/app/src/main/cpp/skyline/common/span.h @@ -89,7 +89,7 @@ namespace skyline { /** * @return If the span is valid by not being null */ - constexpr bool valid() { + constexpr bool valid() const { return this->data() != nullptr; } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index 5e253c8f..9eb769d7 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include #include @@ -603,6 +604,10 @@ namespace skyline::gpu::interconnect { return constantBufferSelector; auto mappings{channelCtx.asCtx->gmmu.TranslateRange(constantBufferSelector.iova, constantBufferSelector.size)}; + + // Ignore unmapped areas from mappings due to buggy games setting the wrong cbuf size + mappings.erase(ranges::find_if(mappings, [](const auto &mapping) { return !mapping.valid(); }), mappings.end()); + constantBufferSelector.guest.mappings.assign(mappings.begin(), mappings.end()); constantBufferSelector.view = gpu.buffer.FindOrCreate(constantBufferSelector.guest);