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
=============
This is the source code for early-access 3905.
This is the source code for early-access 3906.
## Legal Notice

View file

@ -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<u32>(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{},

View file

@ -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;

View file

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

View file

@ -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;

View file

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

View file

@ -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();

View file

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

View file

@ -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);
}

View file

@ -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();