early-access version 3906

This commit is contained in:
pineappleEA 2023-10-01 13:26:09 +02:00
parent 02452680a7
commit 712d388428
10 changed files with 75 additions and 57 deletions

View File

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

View File

@ -8,6 +8,7 @@
#include "common/settings.h" #include "common/settings.h"
#include "common/settings_enums.h" #include "common/settings_enums.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h"
#include "core/file_sys/control_metadata.h" #include "core/file_sys/control_metadata.h"
#include "core/file_sys/patch_manager.h" #include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
@ -544,17 +545,23 @@ void ISelfController::GetSystemSharedBufferHandle(HLERequestContext& ctx) {
} }
Result ISelfController::EnsureBufferSharingEnabled() { Result ISelfController::EnsureBufferSharingEnabled() {
R_SUCCEED_IF(buffer_sharing_enabled); if (buffer_sharing_enabled) {
R_UNLESS(system.GetAppletManager().GetCurrentAppletId() > Applets::AppletId::Application, return ResultSuccess;
VI::ResultOperationFailed); }
ON_RESULT_SUCCESS { if (system.GetAppletManager().GetCurrentAppletId() <= Applets::AppletId::Application) {
buffer_sharing_enabled = true; return VI::ResultOperationFailed;
}; }
const auto display_id = nvnflinger.OpenDisplay("Default"); const auto display_id = nvnflinger.OpenDisplay("Default");
R_RETURN(nvnflinger.GetSystemBufferManager().Initialize(&system_shared_buffer_id, const auto result = nvnflinger.GetSystemBufferManager().Initialize(
&system_shared_layer_id, *display_id)); &system_shared_buffer_id, &system_shared_layer_id, *display_id);
if (result.IsSuccess()) {
buffer_sharing_enabled = true;
}
return result;
} }
void ISelfController::CreateManagedDisplaySeparableLayer(HLERequestContext& ctx) { void ISelfController::CreateManagedDisplaySeparableLayer(HLERequestContext& ctx) {
@ -1563,19 +1570,19 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext&
} }
void ILibraryAppletSelfAccessor::PushInShowCabinetData() { void ILibraryAppletSelfAccessor::PushInShowCabinetData() {
constexpr Applets::Applet::CommonArguments arguments{ const Applets::CommonArguments arguments{
.arguments_version = 3, .arguments_version = Applets::CommonArgumentVersion::Version3,
.size = 0x20, .size = Applets::CommonArgumentSize::Version3,
.library_version = 1, .library_version = static_cast<u32>(Applets::CabinetAppletVersion::Version1),
.theme_color = 3, .theme_color = Applets::ThemeColor::BasicBlack,
.play_startup_sound = true, .play_startup_sound = true,
.system_tick = 0, .system_tick = system.CoreTiming().GetClockTicks(),
}; };
const Applets::StartParamForAmiiboSettings amiibo_settings{ const Applets::StartParamForAmiiboSettings amiibo_settings{
.param_1 = 0, .param_1 = 0,
.applet_mode = system.GetAppletManager().GetCabinetMode(), .applet_mode = system.GetAppletManager().GetCabinetMode(),
.flags = 0, .flags = Applets::CabinetFlags::None,
.amiibo_settings_1 = 0, .amiibo_settings_1 = 0,
.device_handle = 0, .device_handle = 0,
.tag_info{}, .tag_info{},

View File

@ -29,6 +29,15 @@ enum class CabinetAppletVersion : u32 {
Version1 = 0x1, 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 { enum class CabinetResult : u8 {
Cancel = 0, Cancel = 0,
TagInfo = 1 << 1, TagInfo = 1 << 1,
@ -51,7 +60,7 @@ static_assert(sizeof(AmiiboSettingsStartParam) == 0x30,
struct StartParamForAmiiboSettings { struct StartParamForAmiiboSettings {
u8 param_1; u8 param_1;
Service::NFP::CabinetMode applet_mode; Service::NFP::CabinetMode applet_mode;
u8 flags; CabinetFlags flags;
u8 amiibo_settings_1; u8 amiibo_settings_1;
u64 device_handle; u64 device_handle;
Service::NFP::TagInfo tag_info; Service::NFP::TagInfo tag_info;

View File

@ -223,9 +223,9 @@ void StubApplet::Initialize() {
const auto data = broker.PeekDataToAppletForDebug(); const auto data = broker.PeekDataToAppletForDebug();
system.GetReporter().SaveUnimplementedAppletReport( system.GetReporter().SaveUnimplementedAppletReport(
static_cast<u32>(id), common_args.arguments_version, common_args.library_version, static_cast<u32>(id), static_cast<u32>(common_args.arguments_version),
common_args.theme_color, common_args.play_startup_sound, common_args.system_tick, common_args.library_version, static_cast<u32>(common_args.theme_color),
data.normal, data.interactive); common_args.play_startup_sound, common_args.system_tick, data.normal, data.interactive);
LogCurrentStorage(broker, "Initialize"); LogCurrentStorage(broker, "Initialize");
} }

View File

@ -77,6 +77,32 @@ enum class LibraryAppletMode : u32 {
AllForegroundInitiallyHidden = 4, 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 { class AppletDataBroker final {
public: public:
explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_); explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_);
@ -166,16 +192,6 @@ public:
return initialized; 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: protected:
CommonArguments common_args{}; CommonArguments common_args{};
AppletDataBroker broker; AppletDataBroker broker;

View File

@ -23,7 +23,7 @@ static_assert(sizeof(SharedMemorySlot) == 0x18, "SharedMemorySlot has wrong size
struct SharedMemoryPoolLayout { struct SharedMemoryPoolLayout {
s32 num_slots; s32 num_slots;
SharedMemorySlot slots[0x10]; std::array<SharedMemorySlot, 0x10> slots;
}; };
static_assert(sizeof(SharedMemoryPoolLayout) == 0x188, "SharedMemoryPoolLayout has wrong size"); static_assert(sizeof(SharedMemoryPoolLayout) == 0x188, "SharedMemoryPoolLayout has wrong size");

View File

@ -82,6 +82,7 @@ public:
size_t new_index = bank_indices.front(); size_t new_index = bank_indices.front();
bank_indices.pop_front(); bank_indices.pop_front();
bank_pool[new_index].Reset(); bank_pool[new_index].Reset();
bank_indices.push_back(new_index);
return new_index; return new_index;
} }
size_t new_index = bank_pool.size(); size_t new_index = bank_pool.size();

View File

@ -508,6 +508,7 @@ private:
SetAccumulationValue(query->value); SetAccumulationValue(query->value);
Free(index); Free(index);
}); });
rasterizer->SyncOperation(std::move(func));
} }
template <bool is_resolve> template <bool is_resolve>

View File

@ -1556,10 +1556,14 @@ void GMainWindow::ConnectMenuEvents() {
// Tools // Tools
connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this,
ReinitializeKeyBehavior::Warning)); ReinitializeKeyBehavior::Warning));
connect_menu(ui->action_Load_Cabinet_Nickname_Owner, &GMainWindow::OnCabinetNicknameAndOwner); connect_menu(ui->action_Load_Cabinet_Nickname_Owner,
connect_menu(ui->action_Load_Cabinet_Eraser, &GMainWindow::OnCabinetEraser); [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); });
connect_menu(ui->action_Load_Cabinet_Restorer, &GMainWindow::OnCabinetRestorer); connect_menu(ui->action_Load_Cabinet_Eraser,
connect_menu(ui->action_Load_Cabinet_Formatter, &GMainWindow::OnCabinetFormatter); [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_Load_Mii_Edit, &GMainWindow::OnMiiEdit);
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
@ -1601,7 +1605,7 @@ void GMainWindow::UpdateMenuState() {
} }
for (QAction* action : applet_actions) { 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); ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused);
@ -4174,22 +4178,6 @@ void GMainWindow::OnToggleStatusBar() {
statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); 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) { void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
constexpr u64 CabinetId = 0x0100000000001002ull; constexpr u64 CabinetId = 0x0100000000001002ull;
auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); 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().SetCurrentAppletId(Service::AM::Applets::AppletId::Cabinet);
system->GetAppletManager().SetCabinetMode(mode); 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(); UISettings::values.roms_path = QFileInfo(filename).path();
BootGame(filename); BootGame(filename);
} }

View File

@ -374,10 +374,6 @@ private slots:
void ResetWindowSize720(); void ResetWindowSize720();
void ResetWindowSize900(); void ResetWindowSize900();
void ResetWindowSize1080(); void ResetWindowSize1080();
void OnCabinetNicknameAndOwner();
void OnCabinetEraser();
void OnCabinetRestorer();
void OnCabinetFormatter();
void OnCabinet(Service::NFP::CabinetMode mode); void OnCabinet(Service::NFP::CabinetMode mode);
void OnMiiEdit(); void OnMiiEdit();
void OnCaptureScreenshot(); void OnCaptureScreenshot();