early-access version 3858

This commit is contained in:
pineappleEA 2023-09-07 17:18:13 +02:00
parent eef8ceeda0
commit 5db3acb6c7
20 changed files with 54 additions and 140 deletions

View File

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

View File

@ -24,7 +24,7 @@ if (MSVC)
# Ensure that projects build with Unicode support. # Ensure that projects build with Unicode support.
add_definitions(-DUNICODE -D_UNICODE) add_definitions(-DUNICODE -D_UNICODE)
# /W3 - Level 3 warnings # /W4 - Level 4 warnings
# /MP - Multi-threaded compilation # /MP - Multi-threaded compilation
# /Zi - Output debugging information # /Zi - Output debugging information
# /Zm - Specifies the precompiled header memory allocation limit # /Zm - Specifies the precompiled header memory allocation limit
@ -61,7 +61,7 @@ if (MSVC)
/external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers
# Warnings # Warnings
/W3 /W4
/WX /WX
/we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
@ -84,12 +84,17 @@ if (MSVC)
/wd4100 # 'identifier': unreferenced formal parameter /wd4100 # 'identifier': unreferenced formal parameter
/wd4324 # 'struct_name': structure was padded due to __declspec(align()) /wd4324 # 'struct_name': structure was padded due to __declspec(align())
/wd4201 # nonstandard extension used : nameless struct/union
/wd4702 # unreachable code (when used with LTO)
) )
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
add_compile_options(/Z7) add_compile_options(/Z7)
# Avoid D9025 warning
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
else() else()
add_compile_options(/Zi) add_compile_options(/Zi)
endif() endif()

View File

@ -20,7 +20,6 @@ size_t Event::GetManagerIndex(const Type type) const {
default: default:
UNREACHABLE(); UNREACHABLE();
} }
return 3;
} }
void Event::SetAudioEvent(const Type type, const bool signalled) { void Event::SetAudioEvent(const Type type, const bool signalled) {

View File

@ -191,8 +191,6 @@ if (MSVC)
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
) )
target_compile_options(common PRIVATE target_compile_options(common PRIVATE
/W4
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss /we4800 # Implicit conversion from 'type' to bool. Possible information loss

View File

@ -156,7 +156,6 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) {
const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize; const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize;
const size_t num_pages = 1; const size_t num_pages = 1;
const size_t size = num_pages * PageSize; const size_t size = num_pages * PageSize;
R_UNLESS(num_pages != 0, ResultInvalidSize);
R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress); R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress);
R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress); R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress);

View File

@ -21,7 +21,7 @@ constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4};
constexpr std::size_t BaseMiiCount{2}; constexpr std::size_t BaseMiiCount{2};
constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()}; constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()};
constexpr MiiStoreData::Name DefaultMiiName{u'y', u'u', u'z', u'u'}; constexpr MiiStoreData::Name DefaultMiiName{u'n', u'o', u' ', u'n', u'a', u'm', u'e'};
constexpr std::array<u8, 8> HairColorLookup{8, 1, 2, 3, 4, 5, 6, 7}; constexpr std::array<u8, 8> HairColorLookup{8, 1, 2, 3, 4, 5, 6, 7};
constexpr std::array<u8, 6> EyeColorLookup{8, 9, 10, 11, 12, 13}; constexpr std::array<u8, 6> EyeColorLookup{8, 9, 10, 11, 12, 13};
constexpr std::array<u8, 5> MouthColorLookup{19, 20, 21, 22, 23}; constexpr std::array<u8, 5> MouthColorLookup{19, 20, 21, 22, 23};

View File

@ -5,109 +5,7 @@
namespace Service::Mii::RawData { namespace Service::Mii::RawData {
const std::array<Service::Mii::DefaultMii, 8> DefaultMii{ const std::array<Service::Mii::DefaultMii, 6> DefaultMii{
Service::Mii::DefaultMii{
.face_type = 0,
.face_color = 0,
.face_wrinkle = 0,
.face_makeup = 0,
.hair_type = 33,
.hair_color = 1,
.hair_flip = 0,
.eye_type = 2,
.eye_color = 0,
.eye_scale = 4,
.eye_aspect = 3,
.eye_rotate = 4,
.eye_x = 2,
.eye_y = 12,
.eyebrow_type = 6,
.eyebrow_color = 1,
.eyebrow_scale = 4,
.eyebrow_aspect = 3,
.eyebrow_rotate = 6,
.eyebrow_x = 2,
.eyebrow_y = 10,
.nose_type = 1,
.nose_scale = 4,
.nose_y = 9,
.mouth_type = 23,
.mouth_color = 0,
.mouth_scale = 4,
.mouth_aspect = 3,
.mouth_y = 13,
.mustache_type = 0,
.beard_type = 0,
.beard_color = 0,
.mustache_scale = 4,
.mustache_y = 10,
.glasses_type = 0,
.glasses_color = 0,
.glasses_scale = 4,
.glasses_y = 10,
.mole_type = 0,
.mole_scale = 4,
.mole_x = 2,
.mole_y = 20,
.height = 64,
.weight = 64,
.gender = Gender::Male,
.favorite_color = 0,
.region = 0,
.font_region = FontRegion::Standard,
.type = 0,
},
Service::Mii::DefaultMii{
.face_type = 0,
.face_color = 0,
.face_wrinkle = 0,
.face_makeup = 0,
.hair_type = 12,
.hair_color = 1,
.hair_flip = 0,
.eye_type = 4,
.eye_color = 0,
.eye_scale = 4,
.eye_aspect = 3,
.eye_rotate = 3,
.eye_x = 2,
.eye_y = 12,
.eyebrow_type = 0,
.eyebrow_color = 1,
.eyebrow_scale = 4,
.eyebrow_aspect = 3,
.eyebrow_rotate = 6,
.eyebrow_x = 2,
.eyebrow_y = 10,
.nose_type = 1,
.nose_scale = 4,
.nose_y = 9,
.mouth_type = 23,
.mouth_color = 0,
.mouth_scale = 4,
.mouth_aspect = 3,
.mouth_y = 13,
.mustache_type = 0,
.beard_type = 0,
.beard_color = 0,
.mustache_scale = 4,
.mustache_y = 10,
.glasses_type = 0,
.glasses_color = 0,
.glasses_scale = 4,
.glasses_y = 10,
.mole_type = 0,
.mole_scale = 4,
.mole_x = 2,
.mole_y = 20,
.height = 64,
.weight = 64,
.gender = Gender::Female,
.favorite_color = 0,
.region = 0,
.font_region = FontRegion::Standard,
.type = 0,
},
Service::Mii::DefaultMii{ Service::Mii::DefaultMii{
.face_type = 0, .face_type = 0,
.face_color = 4, .face_color = 4,

View File

@ -9,7 +9,7 @@
namespace Service::Mii::RawData { namespace Service::Mii::RawData {
extern const std::array<Service::Mii::DefaultMii, 8> DefaultMii; extern const std::array<Service::Mii::DefaultMii, 6> DefaultMii;
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline; extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline;
extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor; extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor;
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFacelineWrinkle; extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFacelineWrinkle;

View File

@ -160,8 +160,8 @@ u32 NvMap::PinHandle(NvMap::Handle::Id handle) {
u32 address{}; u32 address{};
auto& smmu_allocator = host1x.Allocator(); auto& smmu_allocator = host1x.Allocator();
auto& smmu_memory_manager = host1x.MemoryManager(); auto& smmu_memory_manager = host1x.MemoryManager();
while (!(address = while ((address = smmu_allocator.Allocate(
smmu_allocator.Allocate(static_cast<u32>(handle_description->aligned_size)))) { static_cast<u32>(handle_description->aligned_size))) == 0) {
// Free handles until the allocation succeeds // Free handles until the allocation succeeds
std::scoped_lock queueLock(unmap_queue_lock); std::scoped_lock queueLock(unmap_queue_lock);
if (auto freeHandleDesc{unmap_queue.front()}) { if (auto freeHandleDesc{unmap_queue.front()}) {

View File

@ -477,7 +477,8 @@ public:
return ResultInternalError; return ResultInternalError;
} }
PCCERT_CONTEXT some_cert = nullptr; PCCERT_CONTEXT some_cert = nullptr;
while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert))) { while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert)) !=
nullptr) {
out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded), out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded),
static_cast<u8*>(some_cert->pbCertEncoded) + static_cast<u8*>(some_cert->pbCertEncoded) +
some_cert->cbCertEncoded); some_cert->cbCertEncoded);

View File

@ -368,9 +368,9 @@ int main(int argc, char** argv) {
if (auto room = network.GetRoom().lock()) { if (auto room = network.GetRoom().lock()) {
AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game,
.id = preferred_game_id}; .id = preferred_game_id};
if (!room->Create(room_name, room_description, bind_address, port, password, max_members, if (!room->Create(room_name, room_description, bind_address, static_cast<u16>(port),
username, preferred_game_info, std::move(verify_backend), ban_list, password, max_members, username, preferred_game_info,
enable_yuzu_mods)) { std::move(verify_backend), ban_list, enable_yuzu_mods)) {
LOG_INFO(Network, "Failed to create room: "); LOG_INFO(Network, "Failed to create room: ");
return -1; return -1;
} }

View File

@ -37,8 +37,6 @@ add_library(input_common STATIC
if (MSVC) if (MSVC)
target_compile_options(input_common PRIVATE target_compile_options(input_common PRIVATE
/W4
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss /we4800 # Implicit conversion from 'type' to bool. Possible information loss

View File

@ -805,7 +805,7 @@ IPv4Address Room::RoomImpl::GenerateFakeIPAddress() {
std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE
do { do {
for (std::size_t i = 2; i < result_ip.size(); ++i) { for (std::size_t i = 2; i < result_ip.size(); ++i) {
result_ip[i] = dis(random_gen); result_ip[i] = static_cast<u8>(dis(random_gen));
} }
} while (!IsValidFakeIPAddress(result_ip)); } while (!IsValidFakeIPAddress(result_ip));

View File

@ -245,8 +245,6 @@ target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit)
if (MSVC) if (MSVC)
target_compile_options(shader_recompiler PRIVATE target_compile_options(shader_recompiler PRIVATE
/W4
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss /we4800 # Implicit conversion from 'type' to bool. Possible information loss

View File

@ -74,6 +74,11 @@ spv::ImageFormat GetImageFormat(ImageFormat format) {
throw InvalidArgument("Invalid image format {}", format); throw InvalidArgument("Invalid image format {}", format);
} }
spv::ImageFormat GetImageFormatForBuffer(ImageFormat format) {
const auto spv_format = GetImageFormat(format);
return spv_format == spv::ImageFormat::Unknown ? spv::ImageFormat::R32ui : spv_format;
}
Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) { Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) {
const spv::ImageFormat format{GetImageFormat(desc.format)}; const spv::ImageFormat format{GetImageFormat(desc.format)};
const Id type{ctx.U32[1]}; const Id type{ctx.U32[1]};
@ -1270,7 +1275,7 @@ void EmitContext::DefineImageBuffers(const Info& info, u32& binding) {
if (desc.count != 1) { if (desc.count != 1) {
throw NotImplementedException("Array of image buffers"); throw NotImplementedException("Array of image buffers");
} }
const spv::ImageFormat format{GetImageFormat(desc.format)}; const spv::ImageFormat format{GetImageFormatForBuffer(desc.format)};
const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)}; const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)};
const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)}; const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)};
const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)}; const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)};

View File

@ -55,7 +55,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
// Pushing more values than space available should partially succeed. // Pushing more values than space available should partially succeed.
{ {
std::vector<char> to_push(6); std::vector<char> to_push(6);
std::iota(to_push.begin(), to_push.end(), 88); std::iota(to_push.begin(), to_push.end(), static_cast<char>(88));
const std::size_t count = buf.Push(to_push); const std::size_t count = buf.Push(to_push);
REQUIRE(count == 3U); REQUIRE(count == 3U);
} }

View File

@ -193,14 +193,10 @@ void ConfigureGraphics::PopulateVSyncModeSelection() {
: vsync_mode_combobox_enum_map[current_index]; : vsync_mode_combobox_enum_map[current_index];
int index{}; int index{};
const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device
if (device == -1) {
// Invalid device
return;
}
const auto& present_modes = //< relevant vector of present modes for the selected device or API const auto& present_modes = //< relevant vector of present modes for the selected device or API
backend == Settings::RendererBackend::Vulkan ? device_present_modes[device] backend == Settings::RendererBackend::Vulkan && device > -1 ? device_present_modes[device]
: default_present_modes; : default_present_modes;
vsync_mode_combobox->clear(); vsync_mode_combobox->clear();
vsync_mode_combobox_enum_map.clear(); vsync_mode_combobox_enum_map.clear();
@ -497,11 +493,19 @@ void ConfigureGraphics::RetrieveVulkanDevices() {
} }
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { const auto selected_backend = [&]() {
return Settings::values.renderer_backend.GetValue(true); if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
return Settings::values.renderer_backend.GetValue(true);
}
return static_cast<Settings::RendererBackend>(
combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
.at(api_combobox->currentIndex())
.first);
}();
if (selected_backend == Settings::RendererBackend::Vulkan &&
UISettings::values.has_broken_vulkan) {
return Settings::RendererBackend::OpenGL;
} }
return static_cast<Settings::RendererBackend>( return selected_backend;
combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
.at(api_combobox->currentIndex())
.first);
} }

View File

@ -194,7 +194,7 @@ QWidget* Widget::CreateRadioGroup(std::function<std::string()>& serializer,
return group; return group;
} }
const auto get_selected = [=]() -> u32 { const auto get_selected = [=]() -> int {
for (const auto& [id, button] : radio_buttons) { for (const auto& [id, button] : radio_buttons) {
if (button->isChecked()) { if (button->isChecked()) {
return id; return id;

View File

@ -445,8 +445,13 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan
"#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>" "#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>"
"here for instructions to fix the issue</a>.")); "here for instructions to fix the issue</a>."));
#ifdef HAS_OPENGL
Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; Settings::values.renderer_backend = Settings::RendererBackend::OpenGL;
#else
Settings::values.renderer_backend = Settings::RendererBackend::Null;
#endif
UpdateAPIText();
renderer_status_button->setDisabled(true); renderer_status_button->setDisabled(true);
renderer_status_button->setChecked(false); renderer_status_button->setChecked(false);
} else { } else {
@ -3817,10 +3822,14 @@ void GMainWindow::OnToggleAdaptingFilter() {
void GMainWindow::OnToggleGraphicsAPI() { void GMainWindow::OnToggleGraphicsAPI() {
auto api = Settings::values.renderer_backend.GetValue(); auto api = Settings::values.renderer_backend.GetValue();
if (api == Settings::RendererBackend::OpenGL) { if (api != Settings::RendererBackend::Vulkan) {
api = Settings::RendererBackend::Vulkan; api = Settings::RendererBackend::Vulkan;
} else { } else {
#ifdef HAS_OPENGL
api = Settings::RendererBackend::OpenGL; api = Settings::RendererBackend::OpenGL;
#else
api = Settings::RendererBackend::Null;
#endif
} }
Settings::values.renderer_backend.SetValue(api); Settings::values.renderer_backend.SetValue(api);
renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan); renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan);

View File

@ -265,7 +265,7 @@ int main(int argc, char** argv) {
password = match[2]; password = match[2];
address = match[3]; address = match[3];
if (!match[4].str().empty()) if (!match[4].str().empty())
port = std::stoi(match[4]); port = static_cast<u16>(std::stoi(match[4]));
std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$");
if (!std::regex_match(nickname, nickname_re)) { if (!std::regex_match(nickname, nickname_re)) {
std::cout std::cout