From 9de78b45a9ea790883a2647cd44925ba0a606eeb Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 27 Jan 2024 20:06:30 +0100 Subject: [PATCH] early-access version 4093 --- README.md | 2 +- externals/nx_tzdb/CMakeLists.txt | 2 +- externals/nx_tzdb/NxTzdbCreateHeader.cmake | 4 ++++ src/android/app/src/main/jni/native.cpp | 14 +++++++++++--- src/android/app/src/main/jni/native.h | 2 ++ .../abstracted_pad/abstract_properties_handler.cpp | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3ab8cdcf5..33f3f913a 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 4092. +This is the source code for early-access 4093. ## Legal Notice diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 0fad24642..13723f175 100755 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -32,7 +32,7 @@ set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") set(NX_TZDB_ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") -if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) +if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ROMFS_DIR}) set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip") message(STATUS "Downloading time zone data from ${NX_TZDB_DOWNLOAD_URL}...") diff --git a/externals/nx_tzdb/NxTzdbCreateHeader.cmake b/externals/nx_tzdb/NxTzdbCreateHeader.cmake index 8c29e1167..95606d862 100755 --- a/externals/nx_tzdb/NxTzdbCreateHeader.cmake +++ b/externals/nx_tzdb/NxTzdbCreateHeader.cmake @@ -11,6 +11,10 @@ execute_process( WORKING_DIRECTORY ${ZONE_PATH} OUTPUT_VARIABLE FILE_LIST) +if (NOT FILE_LIST) + message(FATAL_ERROR "No timezone files found in directory ${ZONE_PATH}, did the download fail?") +endif() + set(DIRECTORY_NAME ${HEADER_NAME}) set(FILE_DATA "") diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 839677c59..be2c7be86 100755 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -209,6 +209,12 @@ void EmulationSession::InitializeSystem(bool reload) { m_system.GetFileSystemController().CreateFactories(*m_vfs); } +void EmulationSession::SetAppletId(int applet_id) { + m_applet_id = applet_id; + m_system.GetFrontendAppletHolder().SetCurrentAppletId( + static_cast(m_applet_id)); +} + Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string& filepath) { std::scoped_lock lock(m_mutex); @@ -240,7 +246,7 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string // Load the ROM. Service::AM::FrontendAppletParameters params{ - .applet_id = Service::AM::AppletId::Application, + .applet_id = static_cast(m_applet_id), }; m_load_result = m_system.Load(EmulationSession::GetInstance().Window(), filepath, params); if (m_load_result != Core::SystemResultStatus::Success) { @@ -327,6 +333,9 @@ void EmulationSession::RunEmulation() { } } } + + // Reset current applet ID. + m_applet_id = static_cast(Service::AM::AppletId::Application); } bool EmulationSession::IsHandheldOnly() { @@ -759,8 +768,7 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getAppletLaunchPath(JNIEnv* env, j void Java_org_yuzu_yuzu_1emu_NativeLibrary_setCurrentAppletId(JNIEnv* env, jclass clazz, jint jappletId) { - EmulationSession::GetInstance().System().GetFrontendAppletHolder().SetCurrentAppletId( - static_cast(jappletId)); + EmulationSession::GetInstance().SetAppletId(jappletId); } void Java_org_yuzu_yuzu_1emu_NativeLibrary_setCabinetMode(JNIEnv* env, jclass clazz, diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index dadb138ad..feb386a4a 100755 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -45,6 +45,7 @@ public: const Core::PerfStatsResults& PerfStats(); void ConfigureFilesystemProvider(const std::string& filepath); void InitializeSystem(bool reload); + void SetAppletId(int applet_id); Core::SystemResultStatus InitializeEmulation(const std::string& filepath); bool IsHandheldOnly(); @@ -77,6 +78,7 @@ private: std::atomic m_is_paused = false; SoftwareKeyboard::AndroidKeyboard* m_software_keyboard{}; std::unique_ptr m_manual_provider; + int m_applet_id{1}; // GPU driver parameters std::shared_ptr m_vulkan_library; diff --git a/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp b/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp index 4897a2784..36b630c7f 100755 --- a/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp +++ b/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp @@ -137,7 +137,7 @@ void NpadAbstractPropertiesHandler::UpdateAllDeviceProperties() { const auto npad_index = NpadIdTypeToIndex(npad_id_type); for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) { auto* data = applet_resource_holder->applet_resource->GetAruidData(aruid_index); - if (!data->flag.is_assigned) { + if (data == nullptr || !data->flag.is_assigned) { continue; } auto& npad_entry = data->shared_memory_format->npad.npad_entry[npad_index];