From eec52f8808d0aaaa8ee1f4ceb6e125492e9b9e6c Mon Sep 17 00:00:00 2001 From: Jarrod Norwell Date: Sun, 30 Jun 2024 01:21:59 +0800 Subject: [PATCH] Updated externals, fixed SDL2 on Windows, fixed user presence view, maybe fixed Odin 2 with The Walking Dead --- CMakeLists.txt | 7 ++- README.md | 4 +- externals/CMakeLists.txt | 2 +- externals/SDL | 2 +- externals/enet | 2 +- externals/libusb/libusb | 2 +- externals/opus | 2 +- externals/vcpkg | 2 +- externals/xbyak | 2 +- src/CMakeLists.txt | 48 ++++++++++--------- src/android/build.gradle.kts | 8 ++-- .../gradle/wrapper/gradle-wrapper.properties | 4 +- src/android/sudachi/build.gradle.kts | 10 ++-- src/common/logging/log.h | 24 ++++++++-- src/common/microprofile.h | 5 +- src/core/core.cpp | 8 ++++ src/core/hle/kernel/kernel.cpp | 6 +++ .../am/library_applet_self_accessor.cpp | 9 +++- .../service/am/library_applet_self_accessor.h | 1 + .../service/am/process_winding_controller.cpp | 28 +++++++++-- .../service/am/process_winding_controller.h | 4 ++ .../service/library_applet_self_accessor.cpp | 7 ++- .../am/service/library_applet_self_accessor.h | 1 + .../am/service/process_winding_controller.cpp | 23 +++++++-- .../am/service/process_winding_controller.h | 4 ++ src/core/hle/service/friend/friend.cpp | 9 +++- src/core/hle/service/friend/friend.h | 1 + src/video_core/host_shaders/CMakeLists.txt | 1 + .../convert_abgr8_srgb_to_d24s8.frag | 45 +++++++++++++++++ src/video_core/renderer_vulkan/blit_image.cpp | 9 ++++ src/video_core/renderer_vulkan/blit_image.h | 7 ++- .../renderer_vulkan/vk_texture_cache.cpp | 5 +- vcpkg.json | 2 +- 33 files changed, 230 insertions(+), 64 deletions(-) create mode 100644 src/video_core/host_shaders/convert_abgr8_srgb_to_d24s8.frag diff --git a/CMakeLists.txt b/CMakeLists.txt index f4dedb3..d3b7f8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,9 @@ include(CTest) # Set bundled sdl2/qt as dependent options. # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) + +set(USE_SDL2_FROM_EXTERNALS "Uses SDL2 from the externals directory" ON) + CMAKE_DEPENDENT_OPTION(SUDACHI_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF) # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion CMAKE_DEPENDENT_OPTION(SUDACHI_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF) @@ -535,7 +538,7 @@ if(ENABLE_QT) endif() # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the sudachi_find_package -if (ENABLE_SDL2) +if (ENABLE_SDL2 AND NOT USE_SDL2_FROM_EXTERNALS) if (SUDACHI_USE_BUNDLED_SDL2) # Detect toolchain and platform if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) @@ -556,7 +559,7 @@ if (ENABLE_SDL2) add_library(SDL2::SDL2 INTERFACE IMPORTED) target_link_libraries(SDL2::SDL2 INTERFACE "${SDL2_LIBRARY}") target_include_directories(SDL2::SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") - elseif (SUDACHI_USE_EXTERNAL_SDL2) + elseif (USE_SDL2_FROM_EXTERNALS) message(STATUS "Using SDL2 from externals.") else() find_package(SDL2 2.26.4 REQUIRED) diff --git a/README.md b/README.md index 09df362..d44fadd 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ Sudachi is a Nintendo Switch emulator for Android, Linux and Windows, written in # Building - **[Building for Android](documentation/building/ANDROID.md)** -- TODO: ~~**[Building for Linux](https://official-antique.gitbook.io/sudachi/building/linux)**~~ -- TODO: ~~**[Building for Windows](https://official-antique.gitbook.io/sudachi/building/window)**~~ # Compatibility > [!NOTE] @@ -24,4 +22,4 @@ Sudachi is not and never will be locked behind a paywall, e.g. BuyMeACoffee, Gum - **[BuyMeACoffee](https://buymeacoffee.com/jarrodnorwell)** - BuyMeACoffee Standard or higher members will receive in-app features in Folium and Sudachi such as online save file hosting, statistics (play time, etc.), global in-game messaging and more - **[Ko-Fi](https://ko-fi.com/antiquecodes)** -- **[PayPal](https://paypal.me/officialantique)** +- **[PayPal](https://paypal.me/officialantique)** \ No newline at end of file diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 3fc53c2..dd38ec4 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -63,7 +63,7 @@ if (ENABLE_LIBUSB AND NOT TARGET libusb::usb) endif() # SDL2 -if (SUDACHI_USE_EXTERNAL_SDL2) +if (USE_SDL2_FROM_EXTERNALS) if (NOT WIN32) # Sudachi itself needs: Atomic Audio Events Joystick Haptic Sensor Threads Timers # Since 2.0.18 Atomic+Threads required for HIDAPI/libusb (see https://github.com/libsdl-org/SDL/issues/5095) diff --git a/externals/SDL b/externals/SDL index cc016b0..c60e270 160000 --- a/externals/SDL +++ b/externals/SDL @@ -1 +1 @@ -Subproject commit cc016b0046d563287f0aa9f09b958b5e70d43696 +Subproject commit c60e2704c88ecb8bf55d69085b9c1bd2a68e5321 diff --git a/externals/enet b/externals/enet index c44b7d0..0b924c7 160000 --- a/externals/enet +++ b/externals/enet @@ -1 +1 @@ -Subproject commit c44b7d0f7ff21edb702745e4c019d0537928c373 +Subproject commit 0b924c79ceb7b3c46d82dd00f6f1ed3f664d02d0 diff --git a/externals/libusb/libusb b/externals/libusb/libusb index 6cf58ba..e678b3f 160000 --- a/externals/libusb/libusb +++ b/externals/libusb/libusb @@ -1 +1 @@ -Subproject commit 6cf58bac95ff62cd3453cba2c898993b40e1da66 +Subproject commit e678b3fad58a508cbd0a6e6dc777fb48346f948b diff --git a/externals/opus b/externals/opus index c1f0f54..2554a89 160000 --- a/externals/opus +++ b/externals/opus @@ -1 +1 @@ -Subproject commit c1f0f54018bf1f6f86710be1517313fb7b49556c +Subproject commit 2554a89e02c7fc30a980b4f7e635ceae1ecba5d6 diff --git a/externals/vcpkg b/externals/vcpkg index 099fb92..1cdb5e0 160000 --- a/externals/vcpkg +++ b/externals/vcpkg @@ -1 +1 @@ -Subproject commit 099fb9250d916511782bf5215f01f2e7141beb3a +Subproject commit 1cdb5e0b24c303b41fcac0dce00baf21881f6da2 diff --git a/externals/xbyak b/externals/xbyak index 80477f6..aabb091 160000 --- a/externals/xbyak +++ b/externals/xbyak @@ -1 +1 @@ -Subproject commit 80477f635345e8f13efc512d84b01b94cad92cd9 +Subproject commit aabb091ae37068498751fd58202a9854408ecb0e diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb47b69..4d323ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,31 +61,33 @@ if (MSVC) /external:W0 # Sets the default warning level to 0 for external headers, effectively disabling warnings for them. # Warnings - /W4 - /WX + # /W4 + # /WX - /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled - /we4189 # 'identifier': local variable is initialized but not referenced - /we4265 # 'class': class has virtual functions, but destructor is not virtual - /we4388 # 'expression': signed/unsigned mismatch - /we4389 # 'operator': signed/unsigned mismatch - /we4456 # Declaration of 'identifier' hides previous local declaration - /we4457 # Declaration of 'identifier' hides function parameter - /we4458 # Declaration of 'identifier' hides class member - /we4459 # Declaration of 'identifier' hides global declaration - /we4505 # 'function': unreferenced local function has been removed - /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect - /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? - /we4555 # Expression has no effect; expected expression with side-effect - /we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior. - /we5038 # data member 'member1' will be initialized after data member 'member2' - /we5233 # explicit lambda capture 'identifier' is not used - /we5245 # 'function': unreferenced function with internal linkage has been removed + # /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled + # /we4189 # 'identifier': local variable is initialized but not referenced + # /we4265 # 'class': class has virtual functions, but destructor is not virtual + # /we4388 # 'expression': signed/unsigned mismatch + # /we4389 # 'operator': signed/unsigned mismatch + # /we4456 # Declaration of 'identifier' hides previous local declaration + # /we4457 # Declaration of 'identifier' hides function parameter + # /we4458 # Declaration of 'identifier' hides class member + # /we4459 # Declaration of 'identifier' hides global declaration + # /we4505 # 'function': unreferenced local function has been removed + # /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect + # /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? + # /we4555 # Expression has no effect; expected expression with side-effect + # /we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior. + # /we5038 # data member 'member1' will be initialized after data member 'member2' + # /we5233 # explicit lambda capture 'identifier' is not used + # /we5245 # 'function': unreferenced function with internal linkage has been removed - /wd4100 # 'identifier': unreferenced formal parameter - /wd4324 # 'struct_name': structure was padded due to __declspec(align()) - /wd4201 # nonstandard extension used : nameless struct/union - /wd4702 # unreachable code (when used with LTO) + # /wd4189 + # /wd4101 + # /wd4100 # 'identifier': unreferenced formal parameter + # /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 SUDACHI_USE_PRECOMPILED_HEADERS) diff --git a/src/android/build.gradle.kts b/src/android/build.gradle.kts index 5a49d62..585dab1 100644 --- a/src/android/build.gradle.kts +++ b/src/android/build.gradle.kts @@ -3,9 +3,9 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.4.1" apply false - id("com.android.library") version "8.4.1" apply false - id("org.jetbrains.kotlin.android") version "1.9.20" apply false + id("com.android.application") version "8.5.0" apply false + id("com.android.library") version "8.5.0" apply false + id("org.jetbrains.kotlin.android") version "2.0.20-Beta1" apply false } tasks.register("clean").configure { @@ -17,6 +17,6 @@ buildscript { google() } dependencies { - classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0") + classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7") } } diff --git a/src/android/gradle/wrapper/gradle-wrapper.properties b/src/android/gradle/wrapper/gradle-wrapper.properties index e34969b..376d1fa 100644 --- a/src/android/gradle/wrapper/gradle-wrapper.properties +++ b/src/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue May 28 14:57:37 GMT+08:00 2024 +#Wed Jun 26 17:33:19 AWST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-rc-1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/android/sudachi/build.gradle.kts b/src/android/sudachi/build.gradle.kts index 2d81ae1..04c7f52 100644 --- a/src/android/sudachi/build.gradle.kts +++ b/src/android/sudachi/build.gradle.kts @@ -219,23 +219,23 @@ play { dependencies { implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.appcompat:appcompat:1.7.0") implementation("androidx.recyclerview:recyclerview:1.3.2") implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.fragment:fragment-ktx:1.7.1") + implementation("androidx.fragment:fragment-ktx:1.8.0") implementation("androidx.documentfile:documentfile:1.0.1") implementation("com.google.android.material:material:1.12.0") implementation("androidx.preference:preference-ktx:1.2.1") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2") implementation("io.coil-kt:coil:2.6.0") implementation("androidx.core:core-splashscreen:1.0.1") - implementation("androidx.window:window:1.2.0") + implementation("androidx.window:window:1.3.0") implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation("androidx.navigation:navigation-fragment-ktx:2.7.7") implementation("androidx.navigation:navigation-ui-ktx:2.7.7") implementation("info.debatty:java-string-similarity:2.0.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") } fun runGitCommand(command: List): String { diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 79f7102..37bb66a 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -41,10 +41,6 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Trace, \ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ __VA_ARGS__) -#else -#define LOG_TRACE(log_class, fmt, ...) (void(0)) -#endif - #define LOG_DEBUG(log_class, ...) \ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ @@ -65,3 +61,23 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ __VA_ARGS__) +#else +#define LOG_TRACE(log_class, fmt, ...) (void(0)) +#define LOG_DEBUG(log_class, fmt, ...) (void(0)) +#define LOG_INFO(log_class, ...) \ + Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \ + Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ + __VA_ARGS__) +#define LOG_WARNING(log_class, ...) \ + Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \ + Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ + __VA_ARGS__) +#define LOG_ERROR(log_class, ...) \ + Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \ + Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ + __VA_ARGS__) +#define LOG_CRITICAL(log_class, ...) \ + Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \ + Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \ + __VA_ARGS__) +#endif \ No newline at end of file diff --git a/src/common/microprofile.h b/src/common/microprofile.h index 56ef0a2..0614ac7 100644 --- a/src/common/microprofile.h +++ b/src/common/microprofile.h @@ -5,7 +5,7 @@ // Uncomment this to disable microprofile. This will get you cleaner profiles when using // external sampling profilers like "Very Sleepy", and will improve performance somewhat. -// #define MICROPROFILE_ENABLED 0 +#define MICROPROFILE_ENABLED 0 // Customized Citra settings. // This file wraps the MicroProfile header so that these are consistent everywhere. @@ -19,6 +19,9 @@ typedef void* HANDLE; #endif +#if MICROPROFILE_ENABLED == 0 +#define MicroProfileOnThreadExit __noop +#endif #include #define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0) diff --git a/src/core/core.cpp b/src/core/core.cpp index e1c8b41..eb950b7 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -64,10 +64,12 @@ #include "video_core/renderer_base.h" #include "video_core/video_core.h" +#if MICROPROFILE == 1 MICROPROFILE_DEFINE(ARM_CPU0, "ARM", "CPU 0", MP_RGB(255, 64, 64)); MICROPROFILE_DEFINE(ARM_CPU1, "ARM", "CPU 1", MP_RGB(255, 64, 64)); MICROPROFILE_DEFINE(ARM_CPU2, "ARM", "CPU 2", MP_RGB(255, 64, 64)); MICROPROFILE_DEFINE(ARM_CPU3, "ARM", "CPU 3", MP_RGB(255, 64, 64)); +#endif namespace Core { @@ -290,10 +292,12 @@ struct System::Impl { exit_locked = false; exit_requested = false; +#if MICROPROFILE_ENABLED == 1 microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0); microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1); microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2); microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3); +#endif if (Settings::values.enable_renderdoc_hotkey) { renderdoc_api = std::make_unique(); @@ -946,13 +950,17 @@ void System::RegisterHostThread() { } void System::EnterCPUProfile() { +#if MICROPROFILE_ENABLED == 1 std::size_t core = impl->kernel.GetCurrentHostThreadID(); impl->dynarmic_ticks[core] = MicroProfileEnter(impl->microprofile_cpu[core]); +#endif } void System::ExitCPUProfile() { +#if MICROPROFILE_ENABLED == 1 std::size_t core = impl->kernel.GetCurrentHostThreadID(); MicroProfileLeave(impl->microprofile_cpu[core], impl->dynarmic_ticks[core]); +#endif } bool System::IsMulticore() const { diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index ae90e44..d2d2999 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -46,7 +46,9 @@ #include "core/hle/service/sm/sm.h" #include "core/memory.h" +#if MICROPROFILE_ENABLED == 1 MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); +#endif namespace Kernel { @@ -1279,11 +1281,15 @@ void KernelCore::ExceptionalExitApplication() { } void KernelCore::EnterSVCProfile() { +#if MICROPROFILE_ENABLED == 1 impl->svc_ticks[CurrentPhysicalCoreIndex()] = MicroProfileEnter(MICROPROFILE_TOKEN(Kernel_SVC)); +#endif } void KernelCore::ExitSVCProfile() { +#if MICROPROFILE_ENABLED == 1 MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]); +#endif } Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() { diff --git a/src/core/hle/service/am/library_applet_self_accessor.cpp b/src/core/hle/service/am/library_applet_self_accessor.cpp index b5ecb6c..459a9a2 100644 --- a/src/core/hle/service/am/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/library_applet_self_accessor.cpp @@ -67,7 +67,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, {19, &ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout, "GetDesirableKeyboardLayout"}, {20, nullptr, "PopExtraStorage"}, {25, nullptr, "GetPopExtraStorageEvent"}, - {30, nullptr, "UnpopInData"}, + {30, &ILibraryAppletSelfAccessor::UnpopInData, "UnpopInData"}, {31, nullptr, "UnpopExtraStorage"}, {40, nullptr, "GetIndirectLayerProducerHandle"}, {50, nullptr, "ReportVisibleError"}, @@ -226,6 +226,13 @@ void ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(HLERequestContext& c rb.Push(0); } +void ILibraryAppletSelfAccessor::UnpopInData(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(HLERequestContext& ctx) { // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage auto identity = GetCallerIdentity(applet); diff --git a/src/core/hle/service/am/library_applet_self_accessor.h b/src/core/hle/service/am/library_applet_self_accessor.h index 5cd092a..ed15dfa 100644 --- a/src/core/hle/service/am/library_applet_self_accessor.h +++ b/src/core/hle/service/am/library_applet_self_accessor.h @@ -31,6 +31,7 @@ private: void ExitProcessAndReturn(HLERequestContext& ctx); void GetCallerAppletIdentityInfo(HLERequestContext& ctx); void GetDesirableKeyboardLayout(HLERequestContext& ctx); + void UnpopInData(HLERequestContext& ctx); void GetMainAppletApplicationDesiredLanguage(HLERequestContext& ctx); void GetCurrentApplicationId(HLERequestContext& ctx); void GetMainAppletAvailableUsers(HLERequestContext& ctx); diff --git a/src/core/hle/service/am/process_winding_controller.cpp b/src/core/hle/service/am/process_winding_controller.cpp index ced65ba..fb4963d 100644 --- a/src/core/hle/service/am/process_winding_controller.cpp +++ b/src/core/hle/service/am/process_winding_controller.cpp @@ -4,6 +4,7 @@ #include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/library_applet_accessor.h" #include "core/hle/service/am/process_winding_controller.h" +#include "core/hle/service/am/service/storage.h" #include "core/hle/service/ipc_helpers.h" namespace Service::AM { @@ -15,11 +16,11 @@ IProcessWindingController::IProcessWindingController(Core::System& system_, static const FunctionInfo functions[] = { {0, &IProcessWindingController::GetLaunchReason, "GetLaunchReason"}, {11, &IProcessWindingController::OpenCallingLibraryApplet, "OpenCallingLibraryApplet"}, - {21, nullptr, "PushContext"}, + {21, &IProcessWindingController::PushContext, "PushContext"}, {22, nullptr, "PopContext"}, {23, nullptr, "CancelWindingReservation"}, - {30, nullptr, "WindAndDoReserved"}, - {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"}, + {30, &IProcessWindingController::WindAndDoReserved, "WindAndDoReserved"}, + {40, &IProcessWindingController::ReserveToStartAndWaitAndUnwindThis, "ReserveToStartAndWaitAndUnwindThis"}, {41, nullptr, "ReserveToStartAndWait"}, }; // clang-format on @@ -53,4 +54,25 @@ void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) caller_applet); } +void IProcessWindingController::PushContext(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IProcessWindingController::ReserveToStartAndWaitAndUnwindThis(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IProcessWindingController::WindAndDoReserved(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + } // namespace Service::AM diff --git a/src/core/hle/service/am/process_winding_controller.h b/src/core/hle/service/am/process_winding_controller.h index 086d194..238f09c 100644 --- a/src/core/hle/service/am/process_winding_controller.h +++ b/src/core/hle/service/am/process_winding_controller.h @@ -8,6 +8,7 @@ namespace Service::AM { struct Applet; +class IStorage; class IProcessWindingController final : public ServiceFramework { public: @@ -17,6 +18,9 @@ public: private: void GetLaunchReason(HLERequestContext& ctx); void OpenCallingLibraryApplet(HLERequestContext& ctx); + void PushContext(HLERequestContext& ctx); + void WindAndDoReserved(HLERequestContext& ctx); + void ReserveToStartAndWaitAndUnwindThis(HLERequestContext& ctx); const std::shared_ptr applet; }; diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp index bfc7347..0a6c15b 100644 --- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_self_accessor.cpp @@ -63,7 +63,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, {19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, {20, nullptr, "PopExtraStorage"}, {25, nullptr, "GetPopExtraStorageEvent"}, - {30, nullptr, "UnpopInData"}, + {30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"}, {31, nullptr, "UnpopExtraStorage"}, {40, nullptr, "GetIndirectLayerProducerHandle"}, {50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, @@ -210,6 +210,11 @@ Result ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(Out out_desir R_SUCCEED(); } +Result ILibraryAppletSelfAccessor::UnpopInData(SharedPointer storage) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + Result ILibraryAppletSelfAccessor::ReportVisibleError(ErrorCode error_code) { LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, error_code.number); diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.h b/src/core/hle/service/am/service/library_applet_self_accessor.h index 411af66..27d1948 100644 --- a/src/core/hle/service/am/service/library_applet_self_accessor.h +++ b/src/core/hle/service/am/service/library_applet_self_accessor.h @@ -66,6 +66,7 @@ private: Out out_count, OutArray out_identity_info); Result GetDesirableKeyboardLayout(Out out_desirable_layout); + Result UnpopInData(SharedPointer storage); Result ReportVisibleError(ErrorCode error_code); Result ReportVisibleErrorWithErrorContext( ErrorCode error_code, InLargeData error_context); diff --git a/src/core/hle/service/am/service/process_winding_controller.cpp b/src/core/hle/service/am/service/process_winding_controller.cpp index ffffa45..57b4b3f 100644 --- a/src/core/hle/service/am/service/process_winding_controller.cpp +++ b/src/core/hle/service/am/service/process_winding_controller.cpp @@ -4,6 +4,7 @@ #include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/service/library_applet_accessor.h" #include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/storage.h" #include "core/hle/service/cmif_serialization.h" namespace Service::AM { @@ -15,11 +16,11 @@ IProcessWindingController::IProcessWindingController(Core::System& system_, static const FunctionInfo functions[] = { {0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, {11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, - {21, nullptr, "PushContext"}, + {21, D<&IProcessWindingController::PushContext>, "PushContext"}, {22, nullptr, "PopContext"}, {23, nullptr, "CancelWindingReservation"}, - {30, nullptr, "WindAndDoReserved"}, - {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"}, + {30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, + {40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, {41, nullptr, "ReserveToStartAndWait"}, }; // clang-format on @@ -51,4 +52,20 @@ Result IProcessWindingController::OpenCallingLibraryApplet( R_SUCCEED(); } +Result IProcessWindingController::PushContext(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + +Result IProcessWindingController::ReserveToStartAndWaitAndUnwindThis( + SharedPointer library_applet) { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + +Result IProcessWindingController::WindAndDoReserved() { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + } // namespace Service::AM diff --git a/src/core/hle/service/am/service/process_winding_controller.h b/src/core/hle/service/am/service/process_winding_controller.h index 8fc2deb..331a2ac 100644 --- a/src/core/hle/service/am/service/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h @@ -11,6 +11,7 @@ namespace Service::AM { struct Applet; class ILibraryAppletAccessor; +class IStorage; class IProcessWindingController final : public ServiceFramework { public: @@ -21,6 +22,9 @@ private: Result GetLaunchReason(Out out_launch_reason); Result OpenCallingLibraryApplet( Out> out_calling_library_applet); + Result PushContext(SharedPointer storage); + Result ReserveToStartAndWaitAndUnwindThis(SharedPointer library_applet); + Result WindAndDoReserved(); const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index f09b2e1..d5bb38e 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -62,7 +62,7 @@ public: {20401, nullptr, "SyncBlockedUserList"}, {20500, nullptr, "GetProfileExtraList"}, {20501, nullptr, "GetRelationship"}, - {20600, nullptr, "GetUserPresenceView"}, + {20600, &IFriendService::GetUserPresenceView, "GetUserPresenceView"}, {20700, nullptr, "GetPlayHistoryList"}, {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, {20800, nullptr, "LoadUserSetting"}, @@ -261,6 +261,13 @@ private: rb.Push(0); } + void GetUserPresenceView(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + KernelHelpers::ServiceContext service_context; Kernel::KEvent* completion_event; diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h index 931a7d5..b403772 100644 --- a/src/core/hle/service/friend/friend.h +++ b/src/core/hle/service/friend/friend.h @@ -21,6 +21,7 @@ public: void CreateFriendService(HLERequestContext& ctx); void CreateNotificationService(HLERequestContext& ctx); + void GetUserPresenceView(HLERequestContext& ctx); protected: std::shared_ptr module; diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index a81d0b5..7803382 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -18,6 +18,7 @@ set(SHADER_FILES blit_color_float.frag block_linear_unswizzle_2d.comp block_linear_unswizzle_3d.comp + convert_abgr8_srgb_to_d24s8.frag convert_abgr8_to_d24s8.frag convert_abgr8_to_d32f.frag convert_d32f_to_abgr8.frag diff --git a/src/video_core/host_shaders/convert_abgr8_srgb_to_d24s8.frag b/src/video_core/host_shaders/convert_abgr8_srgb_to_d24s8.frag new file mode 100644 index 0000000..6fc2404 --- /dev/null +++ b/src/video_core/host_shaders/convert_abgr8_srgb_to_d24s8.frag @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#version 450 +#extension GL_ARB_shader_stencil_export : require + +precision highp int; +precision highp float; + +layout(binding = 0) uniform sampler2D color_texture; + +// Utility function to convert sRGB to linear space +highp float srgbToLinear(highp float srgb) { + if (srgb <= 0.04045) + return srgb / 12.92; + else + return pow((srgb + 0.055) / 1.055, 2.4); +} + +void main() { + ivec2 coord = ivec2(gl_FragCoord.xy); + + // Fetch sRGB color and convert to linear space + vec4 srgbColor = texelFetch(color_texture, coord, 0); + highp float r_linear = srgbToLinear(srgbColor.r); + highp float g_linear = srgbToLinear(srgbColor.g); + highp float b_linear = srgbToLinear(srgbColor.b); + + // Compute luminance for depth + highp float luminance = 0.2126 * r_linear + 0.7152 * g_linear + 0.0722 * b_linear; + highp uint depth_val = uint(luminance * (exp2(24.0) - 1.0)); + + // Extract the stencil value from the alpha component + highp uint stencil_val = uint(srgbColor.a * (exp2(8) - 1.0)); + + // Pack stencil and depth values into a single uint + highp uint byte0 = stencil_val << 24; + highp uint byte1 = (depth_val & 0x00FF0000u) >> 16; + highp uint byte2 = (depth_val & 0x0000FF00u) >> 8; + highp uint byte3 = depth_val & 0x000000FFu; + highp uint depth_stencil_unorm = byte0 | (byte1 << 16) | (byte2 << 8) | byte3; + + // Set depth and stencil values for the fragment + gl_FragDepth = float(depth_stencil_unorm & 0x00FFFFFFu) / (exp2(24.0) - 1.0); + gl_FragStencilRefARB = int(depth_stencil_unorm >> 24); +} \ No newline at end of file diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 1c96cac..6124df3 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp @@ -7,6 +7,7 @@ #include "common/settings.h" #include "video_core/host_shaders/blit_color_float_frag_spv.h" +#include "video_core/host_shaders/convert_abgr8_srgb_to_d24s8_frag_spv.h" #include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h" #include "video_core/host_shaders/convert_abgr8_to_d32f_frag_spv.h" #include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h" @@ -434,6 +435,7 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, clear_stencil_frag(BuildShader(device, VULKAN_DEPTHSTENCIL_CLEAR_FRAG_SPV)), convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)), convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)), + convert_abgr8_srgb_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_SRGB_TO_D24S8_FRAG_SPV)), convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)), convert_abgr8_to_d32f_frag(BuildShader(device, CONVERT_ABGR8_TO_D32F_FRAG_SPV)), convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), @@ -554,6 +556,13 @@ void BlitImageHelper::ConvertR16ToD16(const Framebuffer* dst_framebuffer, Convert(*convert_r16_to_d16_pipeline, dst_framebuffer, src_image_view); } +void BlitImageHelper::ConvertABGR8SRGBToD24S8(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipelineDepthTargetEx(convert_abgr8_srgb_to_d24s8_pipeline, + dst_framebuffer->RenderPass(), convert_abgr8_srgb_to_d24s8_frag); + Convert(*convert_abgr8_srgb_to_d24s8_pipeline, dst_framebuffer, src_image_view); +} + void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view) { ConvertPipelineDepthTargetEx(convert_abgr8_to_d24s8_pipeline, dst_framebuffer->RenderPass(), diff --git a/src/video_core/renderer_vulkan/blit_image.h b/src/video_core/renderer_vulkan/blit_image.h index 2d3e759..d053fa0 100644 --- a/src/video_core/renderer_vulkan/blit_image.h +++ b/src/video_core/renderer_vulkan/blit_image.h @@ -67,6 +67,9 @@ public: void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); + void ConvertABGR8SRGBToD24S8(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view); + void ConvertABGR8ToD32F(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view); @@ -131,7 +134,7 @@ private: vk::ShaderModule clear_stencil_frag; vk::ShaderModule convert_depth_to_float_frag; vk::ShaderModule convert_float_to_depth_frag; - vk::ShaderModule convert_abgr8_to_d24s8_frag; + vk::ShaderModule convert_abgr8_srgb_to_d24s8_frag, convert_abgr8_to_d24s8_frag; vk::ShaderModule convert_abgr8_to_d32f_frag; vk::ShaderModule convert_d32f_to_abgr8_frag; vk::ShaderModule convert_d24s8_to_abgr8_frag; @@ -151,7 +154,7 @@ private: vk::Pipeline convert_r32_to_d32_pipeline; vk::Pipeline convert_d16_to_r16_pipeline; vk::Pipeline convert_r16_to_d16_pipeline; - vk::Pipeline convert_abgr8_to_d24s8_pipeline; + vk::Pipeline convert_abgr8_srgb_to_d24s8_pipeline, convert_abgr8_to_d24s8_pipeline; vk::Pipeline convert_abgr8_to_d32f_pipeline; vk::Pipeline convert_d32f_to_abgr8_pipeline; vk::Pipeline convert_d24s8_to_abgr8_pipeline; diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 4fc9243..11368b2 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1230,11 +1230,14 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im return blit_image_helper.ConvertR16ToD16(dst, src_view); } break; - case PixelFormat::S8_UINT_D24_UNORM: + case PixelFormat::S8_UINT_D24_UNORM: // TODO: A8B8G8R8_SRGB if (src_view.format == PixelFormat::A8B8G8R8_UNORM || src_view.format == PixelFormat::B8G8R8A8_UNORM) { return blit_image_helper.ConvertABGR8ToD24S8(dst, src_view); } + if (src_view.format == PixelFormat::A8B8G8R8_SRGB) { + return blit_image_helper.ConvertABGR8SRGBToD24S8(dst, src_view); + } break; case PixelFormat::D32_FLOAT: if (src_view.format == PixelFormat::A8B8G8R8_UNORM || diff --git a/vcpkg.json b/vcpkg.json index 6208a02..b0c0449 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "sudachi", - "builtin-baseline": "a42af01b72c28a8e1d7b48107b33e4f286a55ef6", + "builtin-baseline": "1cdb5e0b24c303b41fcac0dce00baf21881f6da2", "version": "1.0", "dependencies": [ "boost-algorithm",