early-access version 3461

This commit is contained in:
pineappleEA 2023-03-18 00:01:25 +01:00
parent 7ddcf90738
commit bf4f531e3f
5 changed files with 26 additions and 36 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3459. This is the source code for early-access 3461.
## Legal Notice ## Legal Notice

View file

@ -3,6 +3,17 @@
#include <array> #include <array>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4701) // Potentially uninitialized local variable 'result' used
#endif
#include <boost/crc.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "common/input.h" #include "common/input.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
@ -843,7 +854,9 @@ void NfpDevice::UpdateSettingsCrc() {
// TODO: this reads data from a global, find what it is // TODO: this reads data from a global, find what it is
std::array<u8, 8> unknown_input{}; std::array<u8, 8> 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() { void NfpDevice::UpdateRegisterInfoCrc() {
@ -866,32 +879,9 @@ void NfpDevice::UpdateRegisterInfoCrc() {
.unknown2 = tag_data.unknown2, .unknown2 = tag_data.unknown2,
}; };
std::array<u8, sizeof(CrcData)> data{}; boost::crc_32_type crc;
memcpy(data.data(), &crc_data, sizeof(CrcData)); crc.process_bytes(&crc_data, sizeof(CrcData));
tag_data.register_info_crc = CalculateCrc(data); tag_data.register_info_crc = crc.checksum();
}
u32 NfpDevice::CalculateCrc(std::span<const u8> 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;
} }
} // namespace Service::NFP } // namespace Service::NFP

View file

@ -81,7 +81,6 @@ private:
u64 RemoveVersionByte(u64 application_id) const; u64 RemoveVersionByte(u64 application_id) const;
void UpdateSettingsCrc(); void UpdateSettingsCrc();
void UpdateRegisterInfoCrc(); void UpdateRegisterInfoCrc();
u32 CalculateCrc(std::span<const u8>);
bool is_controller_set{}; bool is_controller_set{};
int callback_key; int callback_key;

View file

@ -1306,7 +1306,6 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA
auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift); auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift);
if (overlap.info.num_samples != new_image.info.num_samples) { if (overlap.info.num_samples != new_image.info.num_samples) {
runtime.CopyImageMSAA(new_image, overlap, std::move(copies)); runtime.CopyImageMSAA(new_image, overlap, std::move(copies));
continue;
} else { } else {
runtime.CopyImage(new_image, overlap, std::move(copies)); runtime.CopyImage(new_image, overlap, std::move(copies));
} }

View file

@ -14,7 +14,7 @@ namespace Tegra::Texture {
namespace { namespace {
constexpr std::array<float, 256> SRGB_CONVERSION_LUT = { [[maybe_unused]] constexpr std::array<float, 256> SRGB_CONVERSION_LUT = {
0.000000f, 0.000000f, 0.000000f, 0.000012f, 0.000021f, 0.000033f, 0.000046f, 0.000062f, 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.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, 0.000338f, 0.000388f, 0.000443f, 0.000503f, 0.000568f, 0.000639f, 0.000715f, 0.000798f,
@ -52,11 +52,13 @@ constexpr std::array<float, 256> SRGB_CONVERSION_LUT = {
} // Anonymous namespace } // Anonymous namespace
std::array<float, 4> TSCEntry::BorderColor() const noexcept { std::array<float, 4> TSCEntry::BorderColor() const noexcept {
if (!srgb_conversion) { // TODO: Handle SRGB correctly. Using this breaks shadows in some games (Xenoblade).
return border_color; // 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 {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 { float TSCEntry::MaxAnisotropy() const noexcept {