From 712d3884288500912bc4ea10640259dc61b3cc0c Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 1 Oct 2023 13:26:09 +0200 Subject: [PATCH] early-access version 3906 --- README.md | 2 +- src/core/hle/service/am/am.cpp | 37 +++++++++++-------- .../hle/service/am/applets/applet_cabinet.h | 11 +++++- .../am/applets/applet_general_backend.cpp | 6 +-- src/core/hle/service/am/applets/applets.h | 36 +++++++++++++----- .../nvnflinger/fb_share_buffer_manager.h | 2 +- src/video_core/query_cache/bank_base.h | 1 + .../renderer_vulkan/vk_query_cache.cpp | 1 + src/yuzu/main.cpp | 32 +++++----------- src/yuzu/main.h | 4 -- 10 files changed, 75 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index bc5cb4317..192f9d4fa 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3905. +This is the source code for early-access 3906. ## Legal Notice diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 6d26f0a14..bb6659476 100755 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -8,6 +8,7 @@ #include "common/settings.h" #include "common/settings_enums.h" #include "core/core.h" +#include "core/core_timing.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/registered_cache.h" @@ -544,17 +545,23 @@ void ISelfController::GetSystemSharedBufferHandle(HLERequestContext& ctx) { } Result ISelfController::EnsureBufferSharingEnabled() { - R_SUCCEED_IF(buffer_sharing_enabled); - R_UNLESS(system.GetAppletManager().GetCurrentAppletId() > Applets::AppletId::Application, - VI::ResultOperationFailed); + if (buffer_sharing_enabled) { + return ResultSuccess; + } - ON_RESULT_SUCCESS { - buffer_sharing_enabled = true; - }; + if (system.GetAppletManager().GetCurrentAppletId() <= Applets::AppletId::Application) { + return VI::ResultOperationFailed; + } const auto display_id = nvnflinger.OpenDisplay("Default"); - R_RETURN(nvnflinger.GetSystemBufferManager().Initialize(&system_shared_buffer_id, - &system_shared_layer_id, *display_id)); + const auto result = nvnflinger.GetSystemBufferManager().Initialize( + &system_shared_buffer_id, &system_shared_layer_id, *display_id); + + if (result.IsSuccess()) { + buffer_sharing_enabled = true; + } + + return result; } void ISelfController::CreateManagedDisplaySeparableLayer(HLERequestContext& ctx) { @@ -1563,19 +1570,19 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& } void ILibraryAppletSelfAccessor::PushInShowCabinetData() { - constexpr Applets::Applet::CommonArguments arguments{ - .arguments_version = 3, - .size = 0x20, - .library_version = 1, - .theme_color = 3, + const Applets::CommonArguments arguments{ + .arguments_version = Applets::CommonArgumentVersion::Version3, + .size = Applets::CommonArgumentSize::Version3, + .library_version = static_cast(Applets::CabinetAppletVersion::Version1), + .theme_color = Applets::ThemeColor::BasicBlack, .play_startup_sound = true, - .system_tick = 0, + .system_tick = system.CoreTiming().GetClockTicks(), }; const Applets::StartParamForAmiiboSettings amiibo_settings{ .param_1 = 0, .applet_mode = system.GetAppletManager().GetCabinetMode(), - .flags = 0, + .flags = Applets::CabinetFlags::None, .amiibo_settings_1 = 0, .device_handle = 0, .tag_info{}, diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/applets/applet_cabinet.h index b56427021..f498796f7 100755 --- a/src/core/hle/service/am/applets/applet_cabinet.h +++ b/src/core/hle/service/am/applets/applet_cabinet.h @@ -29,6 +29,15 @@ enum class CabinetAppletVersion : u32 { Version1 = 0x1, }; +enum class CabinetFlags : u8 { + None = 0, + DeviceHandle = 1 << 0, + TagInfo = 1 << 1, + RegisterInfo = 1 << 2, + All = DeviceHandle | TagInfo | RegisterInfo, +}; +DECLARE_ENUM_FLAG_OPERATORS(CabinetFlags) + enum class CabinetResult : u8 { Cancel = 0, TagInfo = 1 << 1, @@ -51,7 +60,7 @@ static_assert(sizeof(AmiiboSettingsStartParam) == 0x30, struct StartParamForAmiiboSettings { u8 param_1; Service::NFP::CabinetMode applet_mode; - u8 flags; + CabinetFlags flags; u8 amiibo_settings_1; u64 device_handle; Service::NFP::TagInfo tag_info; diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp index 13ee41a07..1a9f07999 100755 --- a/src/core/hle/service/am/applets/applet_general_backend.cpp +++ b/src/core/hle/service/am/applets/applet_general_backend.cpp @@ -223,9 +223,9 @@ void StubApplet::Initialize() { const auto data = broker.PeekDataToAppletForDebug(); system.GetReporter().SaveUnimplementedAppletReport( - static_cast(id), common_args.arguments_version, common_args.library_version, - common_args.theme_color, common_args.play_startup_sound, common_args.system_tick, - data.normal, data.interactive); + static_cast(id), static_cast(common_args.arguments_version), + common_args.library_version, static_cast(common_args.theme_color), + common_args.play_startup_sound, common_args.system_tick, data.normal, data.interactive); LogCurrentStorage(broker, "Initialize"); } diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 0b36995b3..0da794d03 100755 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -77,6 +77,32 @@ enum class LibraryAppletMode : u32 { AllForegroundInitiallyHidden = 4, }; +enum class CommonArgumentVersion : u32 { + Version0, + Version1, + Version2, + Version3, +}; + +enum class CommonArgumentSize : u32 { + Version3 = 0x20, +}; + +enum class ThemeColor : u32 { + BasicWhite = 0, + BasicBlack = 3, +}; + +struct CommonArguments { + CommonArgumentVersion arguments_version; + CommonArgumentSize size; + u32 library_version; + ThemeColor theme_color; + bool play_startup_sound; + u64_le system_tick; +}; +static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); + class AppletDataBroker final { public: explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_); @@ -166,16 +192,6 @@ public: return initialized; } - struct CommonArguments { - u32_le arguments_version; - u32_le size; - u32_le library_version; - u32_le theme_color; - bool play_startup_sound; - u64_le system_tick; - }; - static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); - protected: CommonArguments common_args{}; AppletDataBroker broker; diff --git a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h index 618f4bd7f..c809c01b4 100755 --- a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h +++ b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h @@ -23,7 +23,7 @@ static_assert(sizeof(SharedMemorySlot) == 0x18, "SharedMemorySlot has wrong size struct SharedMemoryPoolLayout { s32 num_slots; - SharedMemorySlot slots[0x10]; + std::array slots; }; static_assert(sizeof(SharedMemoryPoolLayout) == 0x188, "SharedMemoryPoolLayout has wrong size"); diff --git a/src/video_core/query_cache/bank_base.h b/src/video_core/query_cache/bank_base.h index 420927091..44769ea97 100755 --- a/src/video_core/query_cache/bank_base.h +++ b/src/video_core/query_cache/bank_base.h @@ -82,6 +82,7 @@ public: size_t new_index = bank_indices.front(); bank_indices.pop_front(); bank_pool[new_index].Reset(); + bank_indices.push_back(new_index); return new_index; } size_t new_index = bank_pool.size(); diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 30926e269..17f25ba42 100755 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -508,6 +508,7 @@ private: SetAccumulationValue(query->value); Free(index); }); + rasterizer->SyncOperation(std::move(func)); } template diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 565bb6dd9..11cecd0a2 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1556,10 +1556,14 @@ void GMainWindow::ConnectMenuEvents() { // Tools connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, ReinitializeKeyBehavior::Warning)); - connect_menu(ui->action_Load_Cabinet_Nickname_Owner, &GMainWindow::OnCabinetNicknameAndOwner); - connect_menu(ui->action_Load_Cabinet_Eraser, &GMainWindow::OnCabinetEraser); - connect_menu(ui->action_Load_Cabinet_Restorer, &GMainWindow::OnCabinetRestorer); - connect_menu(ui->action_Load_Cabinet_Formatter, &GMainWindow::OnCabinetFormatter); + connect_menu(ui->action_Load_Cabinet_Nickname_Owner, + [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); }); + connect_menu(ui->action_Load_Cabinet_Eraser, + [this]() { OnCabinet(Service::NFP::CabinetMode::StartGameDataEraser); }); + connect_menu(ui->action_Load_Cabinet_Restorer, + [this]() { OnCabinet(Service::NFP::CabinetMode::StartRestorer); }); + connect_menu(ui->action_Load_Cabinet_Formatter, + [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); @@ -1601,7 +1605,7 @@ void GMainWindow::UpdateMenuState() { } for (QAction* action : applet_actions) { - action->setEnabled(is_firmware_available); + action->setEnabled(is_firmware_available && !emulation_running); } ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused); @@ -4174,22 +4178,6 @@ void GMainWindow::OnToggleStatusBar() { statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); } -void GMainWindow::OnCabinetNicknameAndOwner() { - OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); -} - -void GMainWindow::OnCabinetEraser() { - OnCabinet(Service::NFP::CabinetMode::StartGameDataEraser); -} - -void GMainWindow::OnCabinetRestorer() { - OnCabinet(Service::NFP::CabinetMode::StartRestorer); -} - -void GMainWindow::OnCabinetFormatter() { - OnCabinet(Service::NFP::CabinetMode::StartFormatter); -} - void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { constexpr u64 CabinetId = 0x0100000000001002ull; auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); @@ -4209,7 +4197,7 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Cabinet); system->GetAppletManager().SetCabinetMode(mode); - QString filename = QString::fromStdString((cabinet_nca->GetFullPath())); + const auto filename = QString::fromStdString(cabinet_nca->GetFullPath()); UISettings::values.roms_path = QFileInfo(filename).path(); BootGame(filename); } diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 0c49c5e0c..1149a36c1 100755 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -374,10 +374,6 @@ private slots: void ResetWindowSize720(); void ResetWindowSize900(); void ResetWindowSize1080(); - void OnCabinetNicknameAndOwner(); - void OnCabinetEraser(); - void OnCabinetRestorer(); - void OnCabinetFormatter(); void OnCabinet(Service::NFP::CabinetMode mode); void OnMiiEdit(); void OnCaptureScreenshot();