Merge branch 'yuzu-emu:master' into import-firmware
This commit is contained in:
commit
e2e0916100
42 changed files with 1912 additions and 2241 deletions
|
|
@ -959,14 +959,26 @@ add_library(core STATIC
|
|||
hle/service/vi/display/vi_display.h
|
||||
hle/service/vi/layer/vi_layer.cpp
|
||||
hle/service/vi/layer/vi_layer.h
|
||||
hle/service/vi/application_display_service.cpp
|
||||
hle/service/vi/application_display_service.h
|
||||
hle/service/vi/application_root_service.cpp
|
||||
hle/service/vi/application_root_service.h
|
||||
hle/service/vi/hos_binder_driver.cpp
|
||||
hle/service/vi/hos_binder_driver.h
|
||||
hle/service/vi/manager_display_service.cpp
|
||||
hle/service/vi/manager_display_service.h
|
||||
hle/service/vi/manager_root_service.cpp
|
||||
hle/service/vi/manager_root_service.h
|
||||
hle/service/vi/service_creator.cpp
|
||||
hle/service/vi/service_creator.h
|
||||
hle/service/vi/system_display_service.cpp
|
||||
hle/service/vi/system_display_service.h
|
||||
hle/service/vi/system_root_service.cpp
|
||||
hle/service/vi/system_root_service.h
|
||||
hle/service/vi/vi_results.h
|
||||
hle/service/vi/vi_types.h
|
||||
hle/service/vi/vi.cpp
|
||||
hle/service/vi/vi.h
|
||||
hle/service/vi/vi_m.cpp
|
||||
hle/service/vi/vi_m.h
|
||||
hle/service/vi/vi_s.cpp
|
||||
hle/service/vi/vi_s.h
|
||||
hle/service/vi/vi_u.cpp
|
||||
hle/service/vi/vi_u.h
|
||||
internal_network/network.cpp
|
||||
internal_network/network.h
|
||||
internal_network/network_interface.cpp
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "core/hle/service/pm/pm.h"
|
||||
#include "core/hle/service/sm/sm.h"
|
||||
#include "core/hle/service/vi/vi.h"
|
||||
#include "core/hle/service/vi/vi_types.h"
|
||||
|
||||
namespace Service::AM {
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void AudCtl::GetAudioOutputMode(HLERequestContext& ctx) {
|
|||
const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
|
||||
|
||||
Set::AudioOutputMode output_mode{};
|
||||
const auto result = m_set_sys->GetAudioOutputMode(output_mode, target);
|
||||
const auto result = m_set_sys->GetAudioOutputMode(&output_mode, target);
|
||||
|
||||
LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ void AudCtl::SetSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
|
|||
|
||||
void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
|
||||
bool is_speaker_auto_mute_enabled{};
|
||||
const auto result = m_set_sys->GetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled);
|
||||
const auto result = m_set_sys->GetSpeakerAutoMuteFlag(&is_speaker_auto_mute_enabled);
|
||||
|
||||
LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
|
||||
is_speaker_auto_mute_enabled);
|
||||
|
|
|
|||
|
|
@ -21,19 +21,6 @@
|
|||
|
||||
namespace Service::Glue::Time {
|
||||
namespace {
|
||||
|
||||
template <typename T>
|
||||
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
|
||||
const char* category, const char* name) {
|
||||
std::vector<u8> interval_buf;
|
||||
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
T v{};
|
||||
std::memcpy(&v, interval_buf.data(), sizeof(T));
|
||||
return v;
|
||||
}
|
||||
|
||||
s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
|
||||
constexpr auto is_leap = [](s32 year) -> bool {
|
||||
return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0));
|
||||
|
|
@ -65,13 +52,15 @@ s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
|
|||
|
||||
s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) {
|
||||
Service::PSC::Time::CalendarTime calendar{
|
||||
.year = GetSettingsItemValue<s16>(set_sys, "time", "standard_user_clock_initial_year"),
|
||||
.year = 2000,
|
||||
.month = 1,
|
||||
.day = 1,
|
||||
.hour = 0,
|
||||
.minute = 0,
|
||||
.second = 0,
|
||||
};
|
||||
set_sys->GetSettingsItemValueImpl<s16>(calendar.year, "time",
|
||||
"standard_user_clock_initial_year");
|
||||
return CalendarTimeToEpoch(calendar);
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +113,7 @@ TimeManager::TimeManager(Core::System& system)
|
|||
ASSERT(res == ResultSuccess);
|
||||
|
||||
Service::PSC::Time::SystemClockContext user_clock_context{};
|
||||
res = m_set_sys->GetUserSystemClockContext(user_clock_context);
|
||||
res = m_set_sys->GetUserSystemClockContext(&user_clock_context);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
// TODO the local clock should initialise with this epoch time, and be updated somewhere else on
|
||||
|
|
@ -140,11 +129,12 @@ TimeManager::TimeManager(Core::System& system)
|
|||
ASSERT(res == ResultSuccess);
|
||||
|
||||
Service::PSC::Time::SystemClockContext network_clock_context{};
|
||||
res = m_set_sys->GetNetworkSystemClockContext(network_clock_context);
|
||||
res = m_set_sys->GetNetworkSystemClockContext(&network_clock_context);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
auto network_accuracy_m{GetSettingsItemValue<s32>(
|
||||
m_set_sys, "time", "standard_network_clock_sufficient_accuracy_minutes")};
|
||||
s32 network_accuracy_m{};
|
||||
m_set_sys->GetSettingsItemValueImpl<s32>(network_accuracy_m, "time",
|
||||
"standard_network_clock_sufficient_accuracy_minutes");
|
||||
auto one_minute_ns{
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
|
||||
s64 network_accuracy_ns{network_accuracy_m * one_minute_ns};
|
||||
|
|
@ -153,12 +143,12 @@ TimeManager::TimeManager(Core::System& system)
|
|||
ASSERT(res == ResultSuccess);
|
||||
|
||||
bool is_automatic_correction_enabled{};
|
||||
res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(is_automatic_correction_enabled);
|
||||
res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(&is_automatic_correction_enabled);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{};
|
||||
res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime(
|
||||
automatic_correction_time_point);
|
||||
&automatic_correction_time_point);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled,
|
||||
|
|
@ -198,11 +188,11 @@ TimeManager::TimeManager(Core::System& system)
|
|||
|
||||
Result TimeManager::SetupStandardSteadyClockCore() {
|
||||
Common::UUID external_clock_source_id{};
|
||||
auto res = m_set_sys->GetExternalSteadyClockSourceId(external_clock_source_id);
|
||||
auto res = m_set_sys->GetExternalSteadyClockSourceId(&external_clock_source_id);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
s64 external_steady_clock_internal_offset_s{};
|
||||
res = m_set_sys->GetExternalSteadyClockInternalOffset(external_steady_clock_internal_offset_s);
|
||||
res = m_set_sys->GetExternalSteadyClockInternalOffset(&external_steady_clock_internal_offset_s);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
auto one_second_ns{
|
||||
|
|
@ -210,8 +200,9 @@ Result TimeManager::SetupStandardSteadyClockCore() {
|
|||
s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s *
|
||||
one_second_ns};
|
||||
|
||||
s32 standard_steady_clock_test_offset_m{
|
||||
GetSettingsItemValue<s32>(m_set_sys, "time", "standard_steady_clock_test_offset_minutes")};
|
||||
s32 standard_steady_clock_test_offset_m{};
|
||||
m_set_sys->GetSettingsItemValueImpl<s32>(standard_steady_clock_test_offset_m, "time",
|
||||
"standard_steady_clock_test_offset_minutes");
|
||||
auto one_minute_ns{
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
|
||||
s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns};
|
||||
|
|
@ -237,7 +228,7 @@ Result TimeManager::SetupStandardSteadyClockCore() {
|
|||
|
||||
Result TimeManager::SetupTimeZoneServiceCore() {
|
||||
Service::PSC::Time::LocationName name{};
|
||||
auto res = m_set_sys->GetDeviceTimeZoneLocationName(name);
|
||||
auto res = m_set_sys->GetDeviceTimeZoneLocationName(&name);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
auto configured_zone = GetTimeZoneString(name);
|
||||
|
|
@ -255,7 +246,7 @@ Result TimeManager::SetupTimeZoneServiceCore() {
|
|||
}
|
||||
|
||||
Service::PSC::Time::SteadyClockTimePoint time_point{};
|
||||
res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(time_point);
|
||||
res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(&time_point);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
auto location_count = GetTimeZoneCount();
|
||||
|
|
|
|||
|
|
@ -20,19 +20,6 @@
|
|||
#include "core/hle/service/sm/sm.h"
|
||||
|
||||
namespace Service::Glue::Time {
|
||||
namespace {
|
||||
template <typename T>
|
||||
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
|
||||
const char* category, const char* name) {
|
||||
std::vector<u8> interval_buf;
|
||||
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
T v{};
|
||||
std::memcpy(&v, interval_buf.data(), sizeof(T));
|
||||
return v;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
StaticService::StaticService(Core::System& system_,
|
||||
Service::PSC::Time::StaticServiceSetupInfo setup_info,
|
||||
|
|
@ -181,8 +168,8 @@ Result StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled(
|
|||
Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) {
|
||||
SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); });
|
||||
|
||||
*out_year = GetSettingsItemValue<s32>(m_set_sys, "time", "standard_user_clock_initial_year");
|
||||
R_SUCCEED();
|
||||
R_RETURN(m_set_sys->GetSettingsItemValueImpl<s32>(*out_year, "time",
|
||||
"standard_user_clock_initial_year"));
|
||||
}
|
||||
|
||||
Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ template <typename T>
|
|||
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
|
||||
const char* category, const char* name) {
|
||||
std::vector<u8> interval_buf;
|
||||
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
|
||||
auto res = set_sys->GetSettingsItemValueImpl(interval_buf, category, name);
|
||||
ASSERT(res == ResultSuccess);
|
||||
|
||||
T v{};
|
||||
|
|
|
|||
|
|
@ -207,7 +207,8 @@ private:
|
|||
|
||||
Result DestroyFile() {
|
||||
bool is_db_test_mode_enabled{};
|
||||
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled");
|
||||
m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
|
||||
"is_db_test_mode_enabled");
|
||||
|
||||
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
|
||||
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
|
||||
|
|
@ -217,7 +218,8 @@ private:
|
|||
|
||||
Result DeleteFile() {
|
||||
bool is_db_test_mode_enabled{};
|
||||
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled");
|
||||
m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
|
||||
"is_db_test_mode_enabled");
|
||||
|
||||
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
|
||||
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
|
||||
|
|
@ -227,7 +229,8 @@ private:
|
|||
|
||||
Result Format() {
|
||||
bool is_db_test_mode_enabled{};
|
||||
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled");
|
||||
m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
|
||||
"is_db_test_mode_enabled");
|
||||
|
||||
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
|
||||
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
|
@ -38,7 +40,8 @@ enum class TransactionId {
|
|||
class IBinder {
|
||||
public:
|
||||
virtual ~IBinder() = default;
|
||||
virtual void Transact(HLERequestContext& ctx, android::TransactionId code, u32 flags) = 0;
|
||||
virtual void Transact(android::TransactionId code, u32 flags, std::span<const u8> parcel_data,
|
||||
std::span<u8> parcel_reply) = 0;
|
||||
virtual Kernel::KReadableEvent& GetNativeHandle() = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -807,9 +807,10 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
|
|||
return Status::NoError;
|
||||
}
|
||||
|
||||
void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u32 flags) {
|
||||
void BufferQueueProducer::Transact(TransactionId code, u32 flags, std::span<const u8> parcel_data,
|
||||
std::span<u8> parcel_reply) {
|
||||
Status status{Status::NoError};
|
||||
InputParcel parcel_in{ctx.ReadBuffer()};
|
||||
InputParcel parcel_in{parcel_data};
|
||||
OutputParcel parcel_out{};
|
||||
|
||||
switch (code) {
|
||||
|
|
@ -917,7 +918,9 @@ void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u
|
|||
|
||||
parcel_out.Write(status);
|
||||
|
||||
ctx.WriteBuffer(parcel_out.Serialize());
|
||||
const auto serialized = parcel_out.Serialize();
|
||||
std::memcpy(parcel_reply.data(), serialized.data(),
|
||||
std::min(parcel_reply.size(), serialized.size()));
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent& BufferQueueProducer::GetNativeHandle() {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ public:
|
|||
Service::Nvidia::NvCore::NvMap& nvmap_);
|
||||
~BufferQueueProducer();
|
||||
|
||||
void Transact(HLERequestContext& ctx, android::TransactionId code, u32 flags) override;
|
||||
void Transact(android::TransactionId code, u32 flags, std::span<const u8> parcel_data,
|
||||
std::span<u8> parcel_reply) override;
|
||||
|
||||
Kernel::KReadableEvent& GetNativeHandle() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ struct SystemSettings {
|
|||
INSERT_PADDING_BYTES(0x60); // Reserved
|
||||
|
||||
// nn::settings::system::AccountNotificationSettings
|
||||
u32 account_notification_settings_count;
|
||||
s32 account_notification_settings_count;
|
||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
||||
std::array<AccountNotificationSettings, 8> account_notification_settings;
|
||||
INSERT_PADDING_BYTES(0x140); // Reserved
|
||||
|
|
@ -308,7 +308,7 @@ struct SystemSettings {
|
|||
INSERT_PADDING_BYTES(0x34); // Reserved
|
||||
|
||||
// nn::settings::system::EulaVersion
|
||||
u32 eula_version_count;
|
||||
s32 eula_version_count;
|
||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
||||
std::array<EulaVersion, 32> eula_versions;
|
||||
INSERT_PADDING_BYTES(0x200); // Reserved
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "core/hle/service/psc/time/common.h"
|
||||
|
||||
namespace Service::Set {
|
||||
using SettingItemName = std::array<u8, 0x48>;
|
||||
|
||||
/// This is nn::settings::system::AudioOutputMode
|
||||
enum class AudioOutputMode : u32 {
|
||||
|
|
@ -413,16 +414,18 @@ struct FirmwareVersionFormat {
|
|||
u8 major;
|
||||
u8 minor;
|
||||
u8 micro;
|
||||
INSERT_PADDING_BYTES(1);
|
||||
INSERT_PADDING_BYTES_NOINIT(1);
|
||||
u8 revision_major;
|
||||
u8 revision_minor;
|
||||
INSERT_PADDING_BYTES(2);
|
||||
INSERT_PADDING_BYTES_NOINIT(2);
|
||||
std::array<char, 0x20> platform;
|
||||
std::array<u8, 0x40> version_hash;
|
||||
std::array<char, 0x18> display_version;
|
||||
std::array<char, 0x80> display_title;
|
||||
};
|
||||
static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size");
|
||||
static_assert(std::is_trivial_v<FirmwareVersionFormat>,
|
||||
"FirmwareVersionFormat type must be trivially copyable.");
|
||||
|
||||
/// This is nn::settings::system::HomeMenuScheme
|
||||
struct HomeMenuScheme {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -11,6 +11,7 @@
|
|||
#include "common/polyfill_thread.h"
|
||||
#include "common/uuid.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/psc/time/common.h"
|
||||
#include "core/hle/service/service.h"
|
||||
#include "core/hle/service/set/setting_formats/appln_settings.h"
|
||||
|
|
@ -33,13 +34,14 @@ public:
|
|||
explicit ISystemSettingsServer(Core::System& system_);
|
||||
~ISystemSettingsServer() override;
|
||||
|
||||
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
|
||||
const std::string& name);
|
||||
Result GetSettingsItemValueImpl(std::vector<u8>& out_value, const std::string& category,
|
||||
const std::string& name);
|
||||
|
||||
template <typename T>
|
||||
Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) {
|
||||
Result GetSettingsItemValueImpl(T& value, const std::string& category,
|
||||
const std::string& name) {
|
||||
std::vector<u8> data;
|
||||
const auto result = GetSettingsItemValue(data, category, name);
|
||||
const auto result = GetSettingsItemValueImpl(data, category, name);
|
||||
if (result.IsError()) {
|
||||
return result;
|
||||
}
|
||||
|
|
@ -48,120 +50,114 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
Result GetVibrationMasterVolume(f32& out_volume) const;
|
||||
Result SetVibrationMasterVolume(f32 volume);
|
||||
Result GetAudioOutputMode(AudioOutputMode& out_output_mode, AudioOutputModeTarget target) const;
|
||||
public:
|
||||
Result SetLanguageCode(LanguageCode language_code);
|
||||
Result GetFirmwareVersion(
|
||||
OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
|
||||
Result GetFirmwareVersion2(
|
||||
OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
|
||||
Result GetLockScreenFlag(Out<bool> out_lock_screen_flag);
|
||||
Result SetLockScreenFlag(bool lock_screen_flag);
|
||||
Result GetExternalSteadyClockSourceId(Out<Common::UUID> out_clock_source_id);
|
||||
Result SetExternalSteadyClockSourceId(const Common::UUID& clock_source_id);
|
||||
Result GetUserSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_clock_context);
|
||||
Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& clock_context);
|
||||
Result GetAccountSettings(Out<AccountSettings> out_account_settings);
|
||||
Result SetAccountSettings(AccountSettings account_settings);
|
||||
Result GetEulaVersions(Out<s32> out_count,
|
||||
OutArray<EulaVersion, BufferAttr_HipcMapAlias> out_eula_versions);
|
||||
Result SetEulaVersions(InArray<EulaVersion, BufferAttr_HipcMapAlias> eula_versions);
|
||||
Result GetColorSetId(Out<ColorSet> out_color_set_id);
|
||||
Result SetColorSetId(ColorSet color_set_id);
|
||||
Result GetNotificationSettings(Out<NotificationSettings> out_notification_settings);
|
||||
Result SetNotificationSettings(const NotificationSettings& notification_settings);
|
||||
Result GetAccountNotificationSettings(
|
||||
Out<s32> out_count, OutArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
|
||||
out_account_notification_settings);
|
||||
Result SetAccountNotificationSettings(
|
||||
InArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
|
||||
account_notification_settings);
|
||||
Result GetVibrationMasterVolume(Out<f32> vibration_master_volume);
|
||||
Result SetVibrationMasterVolume(f32 vibration_master_volume);
|
||||
Result GetSettingsItemValueSize(
|
||||
Out<u64> out_size,
|
||||
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
|
||||
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buf);
|
||||
Result GetSettingsItemValue(
|
||||
OutBuffer<BufferAttr_HipcMapAlias> out_data,
|
||||
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
|
||||
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buffer);
|
||||
Result GetTvSettings(Out<TvSettings> out_tv_settings);
|
||||
Result SetTvSettings(TvSettings tv_settings);
|
||||
Result GetAudioOutputMode(Out<AudioOutputMode> out_output_mode, AudioOutputModeTarget target);
|
||||
Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode);
|
||||
Result GetSpeakerAutoMuteFlag(bool& is_auto_mute) const;
|
||||
Result SetSpeakerAutoMuteFlag(bool auto_mute);
|
||||
Result GetExternalSteadyClockSourceId(Common::UUID& out_id) const;
|
||||
Result SetExternalSteadyClockSourceId(const Common::UUID& id);
|
||||
Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const;
|
||||
Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
|
||||
Result GetDeviceTimeZoneLocationName(Service::PSC::Time::LocationName& out_name) const;
|
||||
Result GetSpeakerAutoMuteFlag(Out<bool> out_force_mute_on_headphone_removed);
|
||||
Result SetSpeakerAutoMuteFlag(bool force_mute_on_headphone_removed);
|
||||
Result GetQuestFlag(Out<QuestFlag> out_quest_flag);
|
||||
Result SetQuestFlag(QuestFlag quest_flag);
|
||||
Result GetDeviceTimeZoneLocationName(Out<Service::PSC::Time::LocationName> out_name);
|
||||
Result SetDeviceTimeZoneLocationName(const Service::PSC::Time::LocationName& name);
|
||||
Result GetNetworkSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const;
|
||||
Result SetRegionCode(SystemRegionCode region_code);
|
||||
Result GetNetworkSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_context);
|
||||
Result SetNetworkSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
|
||||
Result IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) const;
|
||||
Result SetUserSystemClockAutomaticCorrectionEnabled(bool enabled);
|
||||
Result IsUserSystemClockAutomaticCorrectionEnabled(Out<bool> out_automatic_correction_enabled);
|
||||
Result SetUserSystemClockAutomaticCorrectionEnabled(bool automatic_correction_enabled);
|
||||
Result GetDebugModeFlag(Out<bool> is_debug_mode_enabled);
|
||||
Result GetPrimaryAlbumStorage(Out<PrimaryAlbumStorage> out_primary_album_storage);
|
||||
Result SetPrimaryAlbumStorage(PrimaryAlbumStorage primary_album_storage);
|
||||
Result GetBatteryLot(Out<BatteryLot> out_battery_lot);
|
||||
Result GetSerialNumber(Out<SerialNumber> out_console_serial);
|
||||
Result GetNfcEnableFlag(Out<bool> out_nfc_enable_flag);
|
||||
Result SetNfcEnableFlag(bool nfc_enable_flag);
|
||||
Result GetSleepSettings(Out<SleepSettings> out_sleep_settings);
|
||||
Result SetSleepSettings(SleepSettings sleep_settings);
|
||||
Result GetWirelessLanEnableFlag(Out<bool> out_wireless_lan_enable_flag);
|
||||
Result SetWirelessLanEnableFlag(bool wireless_lan_enable_flag);
|
||||
Result GetInitialLaunchSettings(Out<InitialLaunchSettings> out_initial_launch_settings);
|
||||
Result SetInitialLaunchSettings(InitialLaunchSettings initial_launch_settings);
|
||||
Result GetDeviceNickName(
|
||||
OutLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> out_device_name);
|
||||
Result SetDeviceNickName(
|
||||
InLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> device_name_buffer);
|
||||
Result GetProductModel(Out<u32> out_product_model);
|
||||
Result GetBluetoothEnableFlag(Out<bool> out_bluetooth_enable_flag);
|
||||
Result SetBluetoothEnableFlag(bool bluetooth_enable_flag);
|
||||
Result GetMiiAuthorId(Out<Common::UUID> out_mii_author_id);
|
||||
Result GetAutoUpdateEnableFlag(Out<bool> out_auto_update_enable_flag);
|
||||
Result SetAutoUpdateEnableFlag(bool auto_update_enable_flag);
|
||||
Result GetBatteryPercentageFlag(Out<bool> out_battery_percentage_flag);
|
||||
Result SetBatteryPercentageFlag(bool battery_percentage_flag);
|
||||
Result SetExternalSteadyClockInternalOffset(s64 offset);
|
||||
Result GetExternalSteadyClockInternalOffset(s64& out_offset) const;
|
||||
Result GetExternalSteadyClockInternalOffset(Out<s64> out_offset);
|
||||
Result GetPushNotificationActivityModeOnSleep(
|
||||
Out<s32> out_push_notification_activity_mode_on_sleep);
|
||||
Result SetPushNotificationActivityModeOnSleep(s32 push_notification_activity_mode_on_sleep);
|
||||
Result GetErrorReportSharePermission(
|
||||
Out<ErrorReportSharePermission> out_error_report_share_permission);
|
||||
Result SetErrorReportSharePermission(ErrorReportSharePermission error_report_share_permission);
|
||||
Result GetAppletLaunchFlags(Out<u32> out_applet_launch_flag);
|
||||
Result SetAppletLaunchFlags(u32 applet_launch_flag);
|
||||
Result GetKeyboardLayout(Out<KeyboardLayout> out_keyboard_layout);
|
||||
Result SetKeyboardLayout(KeyboardLayout keyboard_layout);
|
||||
Result GetDeviceTimeZoneLocationUpdatedTime(
|
||||
Service::PSC::Time::SteadyClockTimePoint& out_time_point) const;
|
||||
Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
|
||||
Result SetDeviceTimeZoneLocationUpdatedTime(
|
||||
const Service::PSC::Time::SteadyClockTimePoint& time_point);
|
||||
Result GetUserSystemClockAutomaticCorrectionUpdatedTime(
|
||||
Service::PSC::Time::SteadyClockTimePoint& out_time_point) const;
|
||||
Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
|
||||
Result SetUserSystemClockAutomaticCorrectionUpdatedTime(
|
||||
const Service::PSC::Time::SteadyClockTimePoint& time_point);
|
||||
Result GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const;
|
||||
const Service::PSC::Time::SteadyClockTimePoint& out_time_point);
|
||||
Result GetChineseTraditionalInputMethod(
|
||||
Out<ChineseTraditionalInputMethod> out_chinese_traditional_input_method);
|
||||
Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme);
|
||||
Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model);
|
||||
Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode);
|
||||
Result SetTouchScreenMode(TouchScreenMode touch_screen_mode);
|
||||
Result GetFieldTestingFlag(Out<bool> out_field_testing_flag);
|
||||
Result GetPanelCrcMode(Out<s32> out_panel_crc_mode);
|
||||
Result SetPanelCrcMode(s32 panel_crc_mode);
|
||||
|
||||
private:
|
||||
void SetLanguageCode(HLERequestContext& ctx);
|
||||
void GetFirmwareVersion(HLERequestContext& ctx);
|
||||
void GetFirmwareVersion2(HLERequestContext& ctx);
|
||||
void GetLockScreenFlag(HLERequestContext& ctx);
|
||||
void SetLockScreenFlag(HLERequestContext& ctx);
|
||||
void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
||||
void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
||||
void GetUserSystemClockContext(HLERequestContext& ctx);
|
||||
void SetUserSystemClockContext(HLERequestContext& ctx);
|
||||
void GetAccountSettings(HLERequestContext& ctx);
|
||||
void SetAccountSettings(HLERequestContext& ctx);
|
||||
void GetEulaVersions(HLERequestContext& ctx);
|
||||
void SetEulaVersions(HLERequestContext& ctx);
|
||||
void GetColorSetId(HLERequestContext& ctx);
|
||||
void SetColorSetId(HLERequestContext& ctx);
|
||||
void GetNotificationSettings(HLERequestContext& ctx);
|
||||
void SetNotificationSettings(HLERequestContext& ctx);
|
||||
void GetAccountNotificationSettings(HLERequestContext& ctx);
|
||||
void SetAccountNotificationSettings(HLERequestContext& ctx);
|
||||
void GetVibrationMasterVolume(HLERequestContext& ctx);
|
||||
void SetVibrationMasterVolume(HLERequestContext& ctx);
|
||||
void GetSettingsItemValueSize(HLERequestContext& ctx);
|
||||
void GetSettingsItemValue(HLERequestContext& ctx);
|
||||
void GetTvSettings(HLERequestContext& ctx);
|
||||
void SetTvSettings(HLERequestContext& ctx);
|
||||
void GetAudioOutputMode(HLERequestContext& ctx);
|
||||
void SetAudioOutputMode(HLERequestContext& ctx);
|
||||
void GetSpeakerAutoMuteFlag(HLERequestContext& ctx);
|
||||
void SetSpeakerAutoMuteFlag(HLERequestContext& ctx);
|
||||
void GetDebugModeFlag(HLERequestContext& ctx);
|
||||
void GetQuestFlag(HLERequestContext& ctx);
|
||||
void SetQuestFlag(HLERequestContext& ctx);
|
||||
void GetDeviceTimeZoneLocationName(HLERequestContext& ctx);
|
||||
void SetDeviceTimeZoneLocationName(HLERequestContext& ctx);
|
||||
void SetRegionCode(HLERequestContext& ctx);
|
||||
void GetNetworkSystemClockContext(HLERequestContext& ctx);
|
||||
void SetNetworkSystemClockContext(HLERequestContext& ctx);
|
||||
void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
||||
void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
||||
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
|
||||
void SetPrimaryAlbumStorage(HLERequestContext& ctx);
|
||||
void GetBatteryLot(HLERequestContext& ctx);
|
||||
void GetSerialNumber(HLERequestContext& ctx);
|
||||
void GetNfcEnableFlag(HLERequestContext& ctx);
|
||||
void SetNfcEnableFlag(HLERequestContext& ctx);
|
||||
void GetSleepSettings(HLERequestContext& ctx);
|
||||
void SetSleepSettings(HLERequestContext& ctx);
|
||||
void GetWirelessLanEnableFlag(HLERequestContext& ctx);
|
||||
void SetWirelessLanEnableFlag(HLERequestContext& ctx);
|
||||
void GetInitialLaunchSettings(HLERequestContext& ctx);
|
||||
void SetInitialLaunchSettings(HLERequestContext& ctx);
|
||||
void GetDeviceNickName(HLERequestContext& ctx);
|
||||
void SetDeviceNickName(HLERequestContext& ctx);
|
||||
void GetProductModel(HLERequestContext& ctx);
|
||||
void GetBluetoothEnableFlag(HLERequestContext& ctx);
|
||||
void SetBluetoothEnableFlag(HLERequestContext& ctx);
|
||||
void GetMiiAuthorId(HLERequestContext& ctx);
|
||||
void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
|
||||
void SetAutoUpdateEnableFlag(HLERequestContext& ctx);
|
||||
void GetBatteryPercentageFlag(HLERequestContext& ctx);
|
||||
void SetBatteryPercentageFlag(HLERequestContext& ctx);
|
||||
void SetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
|
||||
void GetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
|
||||
void GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
|
||||
void SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
|
||||
void GetErrorReportSharePermission(HLERequestContext& ctx);
|
||||
void SetErrorReportSharePermission(HLERequestContext& ctx);
|
||||
void GetAppletLaunchFlags(HLERequestContext& ctx);
|
||||
void SetAppletLaunchFlags(HLERequestContext& ctx);
|
||||
void GetKeyboardLayout(HLERequestContext& ctx);
|
||||
void SetKeyboardLayout(HLERequestContext& ctx);
|
||||
void GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
|
||||
void SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
|
||||
void GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
|
||||
void SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
|
||||
void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
|
||||
void GetHomeMenuScheme(HLERequestContext& ctx);
|
||||
void GetHomeMenuSchemeModel(HLERequestContext& ctx);
|
||||
void GetTouchScreenMode(HLERequestContext& ctx);
|
||||
void SetTouchScreenMode(HLERequestContext& ctx);
|
||||
void GetFieldTestingFlag(HLERequestContext& ctx);
|
||||
void GetPanelCrcMode(HLERequestContext& ctx);
|
||||
void SetPanelCrcMode(HLERequestContext& ctx);
|
||||
|
||||
bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func);
|
||||
bool StoreSettingsFile(std::filesystem::path& path, auto& settings);
|
||||
void SetupSettings();
|
||||
|
|
|
|||
319
src/core/hle/service/vi/application_display_service.cpp
Normal file
319
src/core/hle/service/vi/application_display_service.cpp
Normal file
|
|
@ -0,0 +1,319 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||
#include "core/hle/service/nvnflinger/parcel.h"
|
||||
#include "core/hle/service/vi/application_display_service.h"
|
||||
#include "core/hle/service/vi/hos_binder_driver.h"
|
||||
#include "core/hle/service/vi/manager_display_service.h"
|
||||
#include "core/hle/service/vi/system_display_service.h"
|
||||
#include "core/hle/service/vi/vi_results.h"
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
IApplicationDisplayService::IApplicationDisplayService(
|
||||
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||
: ServiceFramework{system_, "IApplicationDisplayService"}, m_nvnflinger{nvnflinger},
|
||||
m_hos_binder_driver_server{hos_binder_driver_server} {
|
||||
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"},
|
||||
{101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"},
|
||||
{102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"},
|
||||
{103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"},
|
||||
{1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"},
|
||||
{1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"},
|
||||
{1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"},
|
||||
{1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"},
|
||||
{1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"},
|
||||
{1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"},
|
||||
{2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"},
|
||||
{2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"},
|
||||
{2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"},
|
||||
{2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"},
|
||||
{2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"},
|
||||
{2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"},
|
||||
{2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"},
|
||||
{2451, nullptr, "GetIndirectLayerImageCropMap"},
|
||||
{2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"},
|
||||
{5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"},
|
||||
{5203, nullptr, "GetDisplayVsyncEventForDebug"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
IApplicationDisplayService::~IApplicationDisplayService() {
|
||||
for (const auto layer_id : m_stray_layer_ids) {
|
||||
m_nvnflinger.DestroyLayer(layer_id);
|
||||
}
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetRelayService(
|
||||
Out<SharedPointer<IHOSBinderDriver>> out_relay_service) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
*out_relay_service = std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetSystemDisplayService(
|
||||
Out<SharedPointer<ISystemDisplayService>> out_system_display_service) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
*out_system_display_service = std::make_shared<ISystemDisplayService>(system, m_nvnflinger);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetManagerDisplayService(
|
||||
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
*out_manager_display_service = std::make_shared<IManagerDisplayService>(system, m_nvnflinger);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
|
||||
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
*out_indirect_display_transaction_service =
|
||||
std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayName display_name) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
|
||||
display_name[display_name.size() - 1] = '\0';
|
||||
ASSERT_MSG(strcmp(display_name.data(), "Default") == 0,
|
||||
"Non-default displays aren't supported yet");
|
||||
|
||||
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
||||
if (!display_id) {
|
||||
LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data());
|
||||
R_THROW(VI::ResultNotFound);
|
||||
}
|
||||
|
||||
*out_display_id = *display_id;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::OpenDefaultDisplay(Out<u64> out_display_id) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
R_RETURN(this->OpenDisplay(out_display_id, DisplayName{"Default"}));
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::CloseDisplay(u64 display_id) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
R_SUCCEED_IF(m_nvnflinger.CloseDisplay(display_id));
|
||||
R_THROW(ResultUnknown);
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::SetDisplayEnabled(u32 state, u64 display_id) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
|
||||
// This literally does nothing internally in the actual service itself,
|
||||
// and just returns a successful result code regardless of the input.
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetDisplayResolution(Out<s64> out_width, Out<s64> out_height,
|
||||
u64 display_id) {
|
||||
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
||||
|
||||
// This only returns the fixed values of 1280x720 and makes no distinguishing
|
||||
// between docked and undocked dimensions.
|
||||
*out_width = static_cast<s64>(DisplayResolution::UndockedWidth);
|
||||
*out_height = static_cast<s64>(DisplayResolution::UndockedHeight);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::SetLayerScalingMode(NintendoScaleMode scale_mode, u64 layer_id) {
|
||||
LOG_DEBUG(Service_VI, "called. scale_mode={}, unknown=0x{:016X}", scale_mode, layer_id);
|
||||
|
||||
if (scale_mode > NintendoScaleMode::PreserveAspectRatio) {
|
||||
LOG_ERROR(Service_VI, "Invalid scaling mode provided.");
|
||||
R_THROW(VI::ResultOperationFailed);
|
||||
}
|
||||
|
||||
if (scale_mode != NintendoScaleMode::ScaleToWindow &&
|
||||
scale_mode != NintendoScaleMode::PreserveAspectRatio) {
|
||||
LOG_ERROR(Service_VI, "Unsupported scaling mode supplied.");
|
||||
R_THROW(VI::ResultNotSupported);
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::ListDisplays(
|
||||
Out<u64> out_count, OutArray<DisplayInfo, BufferAttr_HipcMapAlias> out_displays) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||
|
||||
if (out_displays.size() > 0) {
|
||||
out_displays[0] = DisplayInfo{};
|
||||
*out_count = 1;
|
||||
} else {
|
||||
*out_count = 0;
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
|
||||
OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||
DisplayName display_name, u64 layer_id,
|
||||
ClientAppletResourceUserId aruid) {
|
||||
display_name[display_name.size() - 1] = '\0';
|
||||
|
||||
LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid);
|
||||
|
||||
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
||||
if (!display_id) {
|
||||
LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
|
||||
R_THROW(VI::ResultNotFound);
|
||||
}
|
||||
|
||||
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(*display_id, layer_id);
|
||||
if (!buffer_queue_id) {
|
||||
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
|
||||
R_THROW(VI::ResultNotFound);
|
||||
}
|
||||
|
||||
if (!m_nvnflinger.OpenLayer(layer_id)) {
|
||||
LOG_WARNING(Service_VI, "Tried to open layer which was already open");
|
||||
R_THROW(VI::ResultOperationFailed);
|
||||
}
|
||||
|
||||
android::OutputParcel parcel;
|
||||
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
||||
|
||||
const auto buffer = parcel.Serialize();
|
||||
std::memcpy(out_native_window.data(), buffer.data(),
|
||||
std::min(out_native_window.size(), buffer.size()));
|
||||
*out_size = buffer.size();
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::CloseLayer(u64 layer_id) {
|
||||
LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id);
|
||||
|
||||
if (!m_nvnflinger.CloseLayer(layer_id)) {
|
||||
LOG_WARNING(Service_VI, "Tried to close layer which was not open");
|
||||
R_THROW(VI::ResultOperationFailed);
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::CreateStrayLayer(
|
||||
Out<u64> out_layer_id, Out<u64> out_size, OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||
u32 flags, u64 display_id) {
|
||||
LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id);
|
||||
|
||||
const auto layer_id = m_nvnflinger.CreateLayer(display_id);
|
||||
if (!layer_id) {
|
||||
LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
|
||||
R_THROW(VI::ResultNotFound);
|
||||
}
|
||||
|
||||
m_stray_layer_ids.push_back(*layer_id);
|
||||
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(display_id, *layer_id);
|
||||
if (!buffer_queue_id) {
|
||||
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
|
||||
R_THROW(VI::ResultNotFound);
|
||||
}
|
||||
|
||||
android::OutputParcel parcel;
|
||||
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
||||
|
||||
const auto buffer = parcel.Serialize();
|
||||
std::memcpy(out_native_window.data(), buffer.data(),
|
||||
std::min(out_native_window.size(), buffer.size()));
|
||||
|
||||
*out_layer_id = *layer_id;
|
||||
*out_size = buffer.size();
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
||||
m_nvnflinger.DestroyLayer(layer_id);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetDisplayVsyncEvent(
|
||||
OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) {
|
||||
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
||||
|
||||
const auto result = m_nvnflinger.FindVsyncEvent(out_vsync_event, display_id);
|
||||
if (result != ResultSuccess) {
|
||||
if (result == ResultNotFound) {
|
||||
LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
|
||||
}
|
||||
|
||||
R_THROW(result);
|
||||
}
|
||||
|
||||
R_UNLESS(!m_vsync_event_fetched, VI::ResultPermissionDenied);
|
||||
m_vsync_event_fetched = true;
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::ConvertScalingMode(Out<ConvertedScaleMode> out_scaling_mode,
|
||||
NintendoScaleMode mode) {
|
||||
LOG_DEBUG(Service_VI, "called mode={}", mode);
|
||||
|
||||
switch (mode) {
|
||||
case NintendoScaleMode::None:
|
||||
*out_scaling_mode = ConvertedScaleMode::None;
|
||||
R_SUCCEED();
|
||||
case NintendoScaleMode::Freeze:
|
||||
*out_scaling_mode = ConvertedScaleMode::Freeze;
|
||||
R_SUCCEED();
|
||||
case NintendoScaleMode::ScaleToWindow:
|
||||
*out_scaling_mode = ConvertedScaleMode::ScaleToWindow;
|
||||
R_SUCCEED();
|
||||
case NintendoScaleMode::ScaleAndCrop:
|
||||
*out_scaling_mode = ConvertedScaleMode::ScaleAndCrop;
|
||||
R_SUCCEED();
|
||||
case NintendoScaleMode::PreserveAspectRatio:
|
||||
*out_scaling_mode = ConvertedScaleMode::PreserveAspectRatio;
|
||||
R_SUCCEED();
|
||||
default:
|
||||
LOG_ERROR(Service_VI, "Invalid scaling mode specified, mode={}", mode);
|
||||
R_THROW(VI::ResultOperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetIndirectLayerImageMap(
|
||||
Out<u64> out_size, Out<u64> out_stride,
|
||||
OutBuffer<BufferAttr_HipcMapTransferAllowsNonSecure | BufferAttr_HipcMapAlias> out_buffer,
|
||||
s64 width, s64 height, u64 indirect_layer_consumer_handle, ClientAppletResourceUserId aruid) {
|
||||
LOG_WARNING(
|
||||
Service_VI,
|
||||
"(STUBBED) called, width={}, height={}, indirect_layer_consumer_handle={}, aruid={:#x}",
|
||||
width, height, indirect_layer_consumer_handle, aruid.pid);
|
||||
*out_size = 0;
|
||||
*out_stride = 0;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo(Out<s64> out_size,
|
||||
Out<s64> out_alignment,
|
||||
s64 width, s64 height) {
|
||||
LOG_DEBUG(Service_VI, "called width={}, height={}", width, height);
|
||||
|
||||
constexpr u64 base_size = 0x20000;
|
||||
const auto texture_size = width * height * 4;
|
||||
|
||||
*out_alignment = 0x1000;
|
||||
*out_size = (texture_size + base_size - 1) / base_size * base_size;
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
65
src/core/hle/service/vi/application_display_service.h
Normal file
65
src/core/hle/service/vi/application_display_service.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
#include "core/hle/service/vi/vi_types.h"
|
||||
|
||||
namespace Kernel {
|
||||
class KReadableEvent;
|
||||
}
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
class IHOSBinderDriver;
|
||||
class IManagerDisplayService;
|
||||
class ISystemDisplayService;
|
||||
|
||||
class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
|
||||
public:
|
||||
IApplicationDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||
~IApplicationDisplayService() override;
|
||||
|
||||
private:
|
||||
Result GetRelayService(Out<SharedPointer<IHOSBinderDriver>> out_relay_service);
|
||||
Result GetSystemDisplayService(
|
||||
Out<SharedPointer<ISystemDisplayService>> out_system_display_service);
|
||||
Result GetManagerDisplayService(
|
||||
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service);
|
||||
Result GetIndirectDisplayTransactionService(
|
||||
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service);
|
||||
Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name);
|
||||
Result OpenDefaultDisplay(Out<u64> out_display_id);
|
||||
Result CloseDisplay(u64 display_id);
|
||||
Result SetDisplayEnabled(u32 state, u64 display_id);
|
||||
Result GetDisplayResolution(Out<s64> out_width, Out<s64> out_height, u64 display_id);
|
||||
Result SetLayerScalingMode(NintendoScaleMode scale_mode, u64 layer_id);
|
||||
Result ListDisplays(Out<u64> out_count,
|
||||
OutArray<DisplayInfo, BufferAttr_HipcMapAlias> out_displays);
|
||||
Result OpenLayer(Out<u64> out_size, OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||
DisplayName display_name, u64 layer_id, ClientAppletResourceUserId aruid);
|
||||
Result CloseLayer(u64 layer_id);
|
||||
Result CreateStrayLayer(Out<u64> out_layer_id, Out<u64> out_size,
|
||||
OutBuffer<BufferAttr_HipcMapAlias> out_native_window, u32 flags,
|
||||
u64 display_id);
|
||||
Result DestroyStrayLayer(u64 layer_id);
|
||||
Result GetDisplayVsyncEvent(OutCopyHandle<Kernel::KReadableEvent> out_vsync_event,
|
||||
u64 display_id);
|
||||
Result ConvertScalingMode(Out<ConvertedScaleMode> out_scaling_mode, NintendoScaleMode mode);
|
||||
Result GetIndirectLayerImageMap(
|
||||
Out<u64> out_size, Out<u64> out_stride,
|
||||
OutBuffer<BufferAttr_HipcMapTransferAllowsNonSecure | BufferAttr_HipcMapAlias> out_buffer,
|
||||
s64 width, s64 height, u64 indirect_layer_consumer_handle,
|
||||
ClientAppletResourceUserId aruid);
|
||||
Result GetIndirectLayerImageRequiredMemoryInfo(Out<s64> out_size, Out<s64> out_alignment,
|
||||
s64 width, s64 height);
|
||||
|
||||
private:
|
||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||
std::vector<u64> m_stray_layer_ids;
|
||||
bool m_vsync_event_fetched{false};
|
||||
};
|
||||
|
||||
} // namespace Service::VI
|
||||
34
src/core/hle/service/vi/application_root_service.cpp
Normal file
34
src/core/hle/service/vi/application_root_service.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
#include "core/hle/service/vi/application_display_service.h"
|
||||
#include "core/hle/service/vi/application_root_service.h"
|
||||
#include "core/hle/service/vi/service_creator.h"
|
||||
#include "core/hle/service/vi/vi.h"
|
||||
#include "core/hle/service/vi/vi_types.h"
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
IApplicationRootService::IApplicationRootService(
|
||||
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||
: ServiceFramework{system_, "vi:u"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
||||
hos_binder_driver_server} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
|
||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
IApplicationRootService::~IApplicationRootService() = default;
|
||||
|
||||
Result IApplicationRootService::GetDisplayService(
|
||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
||||
m_hos_binder_driver_server, Permission::User, policy));
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
39
src/core/hle/service/vi/application_root_service.h
Normal file
39
src/core/hle/service/vi/application_root_service.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Nvnflinger {
|
||||
class HosBinderDriverServer;
|
||||
class Nvnflinger;
|
||||
} // namespace Service::Nvnflinger
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
class IApplicationDisplayService;
|
||||
enum class Policy : u32;
|
||||
|
||||
class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
|
||||
public:
|
||||
explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||
~IApplicationRootService() override;
|
||||
|
||||
private:
|
||||
Result GetDisplayService(
|
||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||
Policy policy);
|
||||
|
||||
private:
|
||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||
};
|
||||
|
||||
} // namespace Service::VI
|
||||
53
src/core/hle/service/vi/hos_binder_driver.cpp
Normal file
53
src/core/hle/service/vi/hos_binder_driver.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
#include "core/hle/service/nvnflinger/binder.h"
|
||||
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
||||
#include "core/hle/service/vi/hos_binder_driver.h"
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server)
|
||||
: ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server) {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
|
||||
{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
|
||||
{2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"},
|
||||
{3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
IHOSBinderDriver::~IHOSBinderDriver() = default;
|
||||
|
||||
Result IHOSBinderDriver::TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
||||
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
||||
OutBuffer<BufferAttr_HipcMapAlias> parcel_reply,
|
||||
u32 flags) {
|
||||
LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
|
||||
flags);
|
||||
m_server.TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={}, type={}", binder_id, addval, type);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
|
||||
OutCopyHandle<Kernel::KReadableEvent> out_handle) {
|
||||
LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
|
||||
*out_handle = &m_server.TryGetProducer(binder_id)->GetNativeHandle();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result IHOSBinderDriver::TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
|
||||
InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
|
||||
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply,
|
||||
u32 flags) {
|
||||
R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
30
src/core/hle/service/vi/hos_binder_driver.h
Normal file
30
src/core/hle/service/vi/hos_binder_driver.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/nvnflinger/binder.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Service::VI {
|
||||
|
||||
class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
|
||||
public:
|
||||
explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server);
|
||||
~IHOSBinderDriver() override;
|
||||
|
||||
private:
|
||||
Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
||||
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
||||
OutBuffer<BufferAttr_HipcMapAlias> parcel_reply, u32 flags);
|
||||
Result AdjustRefcount(s32 binder_id, s32 addval, s32 type);
|
||||
Result GetNativeHandle(s32 binder_id, u32 type_id,
|
||||
OutCopyHandle<Kernel::KReadableEvent> out_handle);
|
||||
Result TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
|
||||
InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
|
||||
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
|
||||
|
||||
private:
|
||||
Nvnflinger::HosBinderDriverServer& m_server;
|
||||
};
|
||||
|
||||
} // namespace Service::VI
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue