From 87834084de18efdfebbb0fa8d3c295c05cdf7fff Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 28 Jul 2022 18:20:49 +0200 Subject: [PATCH] early-access version 2866 --- CMakeLists.txt | 5 ++ README.md | 2 +- dist/english_plurals/README.md | 5 ++ dist/english_plurals/en.ts | 67 +++++++++++++++++++ src/core/hid/emulated_controller.cpp | 35 +++++++++- src/core/hid/emulated_controller.h | 1 + .../renderer_vulkan/vk_blit_screen.cpp | 16 ++--- src/yuzu/CMakeLists.txt | 14 +++- src/yuzu/configuration/configure_ui.cpp | 1 + src/yuzu/main.cpp | 5 -- 10 files changed, 134 insertions(+), 17 deletions(-) create mode 100755 dist/english_plurals/README.md create mode 100755 dist/english_plurals/en.ts diff --git a/CMakeLists.txt b/CMakeLists.txt index d35ccb696..83e6c9dea 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,11 @@ endif() configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc COPYONLY) +if (EXISTS ${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.json) + configure_file("${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.json" + "${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json" + COPYONLY) +endif() if (ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) message(STATUS "Downloading compatibility list for yuzu...") file(DOWNLOAD diff --git a/README.md b/README.md index 78217c6e4..6bff081af 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2865. +This is the source code for early-access 2866. ## Legal Notice diff --git a/dist/english_plurals/README.md b/dist/english_plurals/README.md new file mode 100755 index 000000000..7cef3d707 --- /dev/null +++ b/dist/english_plurals/README.md @@ -0,0 +1,5 @@ +With CMake flag GENERATE_QT_TRANSLATION a build/src/yuzu/plurals/en.ts is created from the source + +Having the plurals look nice isn't critical, so this has been done manually. + +The en.ts in this directory is taken from a build, edited in Qt Linguist and then committed. diff --git a/dist/english_plurals/en.ts b/dist/english_plurals/en.ts new file mode 100755 index 000000000..172cd4bba --- /dev/null +++ b/dist/english_plurals/en.ts @@ -0,0 +1,67 @@ + + + + + GMainWindow + + + %n file(s) remaining + + %n file remaining + %n files remaining + + + + + %n file(s) were newly installed + + + %n file was newly installed + + %n files were newly installed + + + + + + %n file(s) were overwritten + + + %n file was overwritten + + %n were overwritten + + + + + + %n file(s) failed to install + + + %n file failed to install + + %n files failed to install + + + + + + Building: %n shader(s) + + Building: %n shader + Building: %n shaders + + + + + GameListSearchField + + + %1 of %n result(s) + + %1 of %n result + %1 of %n results + + + + diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 8c3895937..f31d418b5 100755 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -99,8 +99,10 @@ void EmulatedController::ReloadFromSettings() { // Other or debug controller should always be a pro controller if (npad_id_type != NpadIdType::Other) { SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); + original_npad_type = npad_type; } else { SetNpadStyleIndex(NpadStyleIndex::ProController); + original_npad_type = npad_type; } if (player.connected) { @@ -352,6 +354,7 @@ void EmulatedController::DisableConfiguration() { Disconnect(); } SetNpadStyleIndex(tmp_npad_type); + original_npad_type = tmp_npad_type; } // Apply temporary connected status to the real controller @@ -999,13 +1002,27 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles) if (!is_connected) { return; } + + // Attempt to reconnect with the original type + if (npad_type != original_npad_type) { + Disconnect(); + const auto current_npad_type = npad_type; + SetNpadStyleIndex(original_npad_type); + if (IsControllerSupported()) { + Connect(); + return; + } + SetNpadStyleIndex(current_npad_type); + Connect(); + } + if (IsControllerSupported()) { return; } Disconnect(); - // Fallback fullkey controllers to Pro controllers + // Fallback Fullkey controllers to Pro controllers if (IsControllerFullkey() && supported_style_tag.fullkey) { LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type); SetNpadStyleIndex(NpadStyleIndex::ProController); @@ -1013,6 +1030,22 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles) return; } + // Fallback Dual joycon controllers to Pro controllers + if (npad_type == NpadStyleIndex::JoyconDual && supported_style_tag.fullkey) { + LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type); + SetNpadStyleIndex(NpadStyleIndex::ProController); + Connect(); + return; + } + + // Fallback Pro controllers to Dual joycon + if (npad_type == NpadStyleIndex::ProController && supported_style_tag.joycon_dual) { + LOG_WARNING(Service_HID, "Reconnecting controller type {} as Dual Joycons", npad_type); + SetNpadStyleIndex(NpadStyleIndex::JoyconDual); + Connect(); + return; + } + LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller", npad_type); } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 823c1700c..7658ed63b 100755 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -433,6 +433,7 @@ private: const NpadIdType npad_id_type; NpadStyleIndex npad_type{NpadStyleIndex::None}; + NpadStyleIndex original_npad_type{NpadStyleIndex::None}; NpadStyleTag supported_style_tag{NpadStyleSet::All}; bool is_connected{false}; bool is_configuring{false}; diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 4a1d96322..27e6ebf94 100755 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -87,12 +87,8 @@ u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) { } std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { - // TODO(Rodrigo): Read this from HLE - constexpr u32 block_height_log2 = 4; - const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); - const u64 size_bytes{Tegra::Texture::CalculateSize( - true, bytes_per_pixel, framebuffer.stride, framebuffer.height, 1, block_height_log2, 0)}; - return size_bytes; + return static_cast(framebuffer.stride) * + static_cast(framebuffer.height) * GetBytesPerPixel(framebuffer); } VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { @@ -173,10 +169,12 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, // TODO(Rodrigo): Read this from HLE constexpr u32 block_height_log2 = 4; const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); - const u64 size_bytes{GetSizeInBytes(framebuffer)}; - + const u64 linear_size{GetSizeInBytes(framebuffer)}; + const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, + framebuffer.stride, framebuffer.height, + 1, block_height_log2, 0)}; Tegra::Texture::UnswizzleTexture( - mapped_span.subspan(image_offset, size_bytes), std::span(host_ptr, size_bytes), + mapped_span.subspan(image_offset, linear_size), std::span(host_ptr, tiled_size), bytes_per_pixel, framebuffer.width, framebuffer.height, 1, block_height_log2, 0); const VkBufferImageCopy copy{ diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index f6b389ede..50007338f 100755 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -221,6 +221,9 @@ if (ENABLE_QT_TRANSLATION) # Update source TS file if enabled if (GENERATE_QT_TRANSLATION) get_target_property(SRCS yuzu SOURCES) + # these calls to qt_create_translation also creates a rule to generate en.qm which conflicts with providing english plurals + # so we have to set a OUTPUT_LOCATION so that we don't have multiple rules to generate en.qm + set_source_files_properties(${YUZU_QT_LANGUAGES}/en.ts PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations") qt_create_translation(QM_FILES ${SRCS} ${UIS} @@ -229,7 +232,13 @@ if (ENABLE_QT_TRANSLATION) -source-language en_US -target-language en_US ) - add_custom_target(translation ALL DEPENDS ${YUZU_QT_LANGUAGES}/en.ts) + + # Generate plurals into dist/english_plurals/generated_en.ts so it can be used to revise dist/english_plurals/en.ts + set(GENERATED_PLURALS_FILE ${PROJECT_SOURCE_DIR}/dist/english_plurals/generated_en.ts) + set_source_files_properties(${GENERATED_PLURALS_FILE} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/plurals") + qt_create_translation(QM_FILES ${SRCS} ${UIS} ${GENERATED_PLURALS_FILE} OPTIONS -pluralonly -source-language en_US -target-language en_US) + + add_custom_target(translation ALL DEPENDS ${YUZU_QT_LANGUAGES}/en.ts ${GENERATED_PLURALS_FILE}) endif() # Find all TS files except en.ts @@ -239,6 +248,9 @@ if (ENABLE_QT_TRANSLATION) # Compile TS files to QM files qt_add_translation(LANGUAGES_QM ${LANGUAGES_TS}) + # Compile english plurals TS file to en.qm + qt_add_translation(LANGUAGES_QM ${PROJECT_SOURCE_DIR}/dist/english_plurals/en.ts) + # Build a QRC file from the QM file list set(LANGUAGES_QRC ${CMAKE_CURRENT_BINARY_DIR}/languages.qrc) file(WRITE ${LANGUAGES_QRC} "\n") diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 2e98ede8e..48f71b53c 100755 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -219,6 +219,7 @@ void ConfigureUi::InitializeLanguageComboBox() { for (const auto& lang : languages) { if (QString::fromLatin1(lang.id) == QStringLiteral("en")) { ui->language_combobox->addItem(lang.name, QStringLiteral("en")); + language_files.removeOne(QStringLiteral("en.qm")); continue; } for (int i = 0; i < language_files.size(); ++i) { diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f668d510e..99e9aef7a 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3977,11 +3977,6 @@ void GMainWindow::UpdateUITheme() { } void GMainWindow::LoadTranslation() { - // If the selected language is English, no need to install any translation - if (UISettings::values.language == QStringLiteral("en")) { - return; - } - bool loaded; if (UISettings::values.language.isEmpty()) {