From bf4f531e3fe769e92ef7ad9b2b37b35480a74b8d Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 18 Mar 2023 00:01:25 +0100 Subject: [PATCH] early-access version 3461 --- README.md | 2 +- src/core/hle/service/nfp/nfp_device.cpp | 44 ++++++++------------ src/core/hle/service/nfp/nfp_device.h | 1 - src/video_core/texture_cache/texture_cache.h | 1 - src/video_core/textures/texture.cpp | 14 ++++--- 5 files changed, 26 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index cfa3ff2f7..749864cc5 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3459. +This is the source code for early-access 3461. ## Legal Notice diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp index 32e398c8b..c93088932 100755 --- a/src/core/hle/service/nfp/nfp_device.cpp +++ b/src/core/hle/service/nfp/nfp_device.cpp @@ -3,6 +3,17 @@ #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4701) // Potentially uninitialized local variable 'result' used +#endif + +#include + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #include "common/input.h" #include "common/logging/log.h" #include "common/string_util.h" @@ -843,7 +854,9 @@ void NfpDevice::UpdateSettingsCrc() { // TODO: this reads data from a global, find what it is std::array unknown_input{}; - settings.crc = CalculateCrc(unknown_input); + boost::crc_32_type crc; + crc.process_bytes(&unknown_input, sizeof(unknown_input)); + settings.crc = crc.checksum(); } void NfpDevice::UpdateRegisterInfoCrc() { @@ -866,32 +879,9 @@ void NfpDevice::UpdateRegisterInfoCrc() { .unknown2 = tag_data.unknown2, }; - std::array data{}; - memcpy(data.data(), &crc_data, sizeof(CrcData)); - tag_data.register_info_crc = CalculateCrc(data); -} - -u32 NfpDevice::CalculateCrc(std::span data) { - constexpr u32 magic = 0xedb88320; - u32 crc = 0xffffffff; - - if (data.size() == 0) { - return 0; - } - - for (u8 input : data) { - crc ^= input; - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - crc = crc >> 1 ^ ((crc & 1) ? magic : 0x0); - } - - return ~crc; + boost::crc_32_type crc; + crc.process_bytes(&crc_data, sizeof(CrcData)); + tag_data.register_info_crc = crc.checksum(); } } // namespace Service::NFP diff --git a/src/core/hle/service/nfp/nfp_device.h b/src/core/hle/service/nfp/nfp_device.h index 9f1fe3c8a..cf9d7c407 100755 --- a/src/core/hle/service/nfp/nfp_device.h +++ b/src/core/hle/service/nfp/nfp_device.h @@ -81,7 +81,6 @@ private: u64 RemoveVersionByte(u64 application_id) const; void UpdateSettingsCrc(); void UpdateRegisterInfoCrc(); - u32 CalculateCrc(std::span); bool is_controller_set{}; int callback_key; diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4d6622357..32a1651b5 100755 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1306,7 +1306,6 @@ ImageId TextureCache

::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift); if (overlap.info.num_samples != new_image.info.num_samples) { runtime.CopyImageMSAA(new_image, overlap, std::move(copies)); - continue; } else { runtime.CopyImage(new_image, overlap, std::move(copies)); } diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index ba147a4c1..3705ea6a5 100755 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -14,7 +14,7 @@ namespace Tegra::Texture { namespace { -constexpr std::array SRGB_CONVERSION_LUT = { +[[maybe_unused]] constexpr std::array SRGB_CONVERSION_LUT = { 0.000000f, 0.000000f, 0.000000f, 0.000012f, 0.000021f, 0.000033f, 0.000046f, 0.000062f, 0.000081f, 0.000102f, 0.000125f, 0.000151f, 0.000181f, 0.000214f, 0.000251f, 0.000293f, 0.000338f, 0.000388f, 0.000443f, 0.000503f, 0.000568f, 0.000639f, 0.000715f, 0.000798f, @@ -52,11 +52,13 @@ constexpr std::array SRGB_CONVERSION_LUT = { } // Anonymous namespace std::array TSCEntry::BorderColor() const noexcept { - if (!srgb_conversion) { - return border_color; - } - return {SRGB_CONVERSION_LUT[srgb_border_color_r], SRGB_CONVERSION_LUT[srgb_border_color_g], - SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]}; + // TODO: Handle SRGB correctly. Using this breaks shadows in some games (Xenoblade). + // if (!srgb_conversion) { + // return border_color; + //} + // return {SRGB_CONVERSION_LUT[srgb_border_color_r], SRGB_CONVERSION_LUT[srgb_border_color_g], + // SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]}; + return border_color; } float TSCEntry::MaxAnisotropy() const noexcept {