early-access version 3792

This commit is contained in:
pineappleEA 2023-08-05 20:52:55 +02:00
parent 10e28227cd
commit fab0978825
4 changed files with 102 additions and 15 deletions

View file

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

View file

@ -75,6 +75,16 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type)
} }
} // Anonymous namespace } // Anonymous namespace
void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
language_code_setting = rp.PopEnum<LanguageCode>();
LOG_INFO(Service_SET, "called, language_code={}", language_code_setting);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called"); LOG_DEBUG(Service_SET, "called");
GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1);
@ -103,6 +113,33 @@ void SET_SYS::SetAccountSettings(HLERequestContext& ctx) {
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void SET_SYS::GetEulaVersions(HLERequestContext& ctx) {
LOG_INFO(Service_SET, "called");
ctx.WriteBuffer(eula_versions);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(eula_versions.size()));
}
void SET_SYS::SetEulaVersions(HLERequestContext& ctx) {
const auto elements = ctx.GetReadBufferNumElements<EulaVersion>();
const auto buffer_data = ctx.ReadBuffer();
LOG_INFO(Service_SET, "called, elements={}", elements);
eula_versions.resize(elements);
for (std::size_t index = 0; index < elements; index++) {
const std::size_t start_index = index * sizeof(EulaVersion);
memcpy(eula_versions.data() + start_index, buffer_data.data() + start_index,
sizeof(EulaVersion));
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SET_SYS::GetColorSetId(HLERequestContext& ctx) { void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called"); LOG_DEBUG(Service_SET, "called");
@ -149,7 +186,7 @@ void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.Push(account_notifications.size()); rb.Push(static_cast<u32>(account_notifications.size()));
} }
void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) { void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) {
@ -275,6 +312,16 @@ void SET_SYS::GetQuestFlag(HLERequestContext& ctx) {
rb.PushEnum(QuestFlag::Retail); rb.PushEnum(QuestFlag::Retail);
} }
void SET_SYS::SetRegionCode(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
region_code = rp.PopEnum<RegionCode>();
LOG_INFO(Service_SET, "called, region_code={}", region_code);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) { void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
LOG_WARNING(Service_SET, "(STUBBED) called"); LOG_WARNING(Service_SET, "(STUBBED) called");
@ -286,7 +333,7 @@ void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
void SET_SYS::GetSleepSettings(HLERequestContext& ctx) { void SET_SYS::GetSleepSettings(HLERequestContext& ctx) {
LOG_INFO(Service_SET, "called"); LOG_INFO(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 7}; IPC::ResponseBuilder rb{ctx, 5};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushRaw(sleep_settings); rb.PushRaw(sleep_settings);
} }
@ -434,10 +481,18 @@ void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
} }
void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) {
LOG_WARNING(Service_SET, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(false);
}
SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "SetLanguageCode"}, {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"},
{1, nullptr, "SetNetworkSettings"}, {1, nullptr, "SetNetworkSettings"},
{2, nullptr, "GetNetworkSettings"}, {2, nullptr, "GetNetworkSettings"},
{3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"},
@ -457,8 +512,8 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{18, &SET_SYS::SetAccountSettings, "SetAccountSettings"}, {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"},
{19, nullptr, "GetAudioVolume"}, {19, nullptr, "GetAudioVolume"},
{20, nullptr, "SetAudioVolume"}, {20, nullptr, "SetAudioVolume"},
{21, nullptr, "GetEulaVersions"}, {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"},
{22, nullptr, "SetEulaVersions"}, {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"},
{23, &SET_SYS::GetColorSetId, "GetColorSetId"}, {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
{24, &SET_SYS::SetColorSetId, "SetColorSetId"}, {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
{25, nullptr, "GetConsoleInformationUploadFlag"}, {25, nullptr, "GetConsoleInformationUploadFlag"},
@ -491,7 +546,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{54, nullptr, "SetDeviceTimeZoneLocationName"}, {54, nullptr, "SetDeviceTimeZoneLocationName"},
{55, nullptr, "GetWirelessCertificationFileSize"}, {55, nullptr, "GetWirelessCertificationFileSize"},
{56, nullptr, "GetWirelessCertificationFile"}, {56, nullptr, "GetWirelessCertificationFile"},
{57, nullptr, "SetRegionCode"}, {57, &SET_SYS::SetRegionCode, "SetRegionCode"},
{58, nullptr, "GetNetworkSystemClockContext"}, {58, nullptr, "GetNetworkSystemClockContext"},
{59, nullptr, "SetNetworkSystemClockContext"}, {59, nullptr, "SetNetworkSystemClockContext"},
{60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"},
@ -635,7 +690,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
{199, nullptr, "GetButtonConfigRegisteredSettings"}, {199, nullptr, "GetButtonConfigRegisteredSettings"},
{200, nullptr, "SetButtonConfigRegisteredSettings"}, {200, nullptr, "SetButtonConfigRegisteredSettings"},
{201, nullptr, "GetFieldTestingFlag"}, {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"},
{202, nullptr, "SetFieldTestingFlag"}, {202, nullptr, "SetFieldTestingFlag"},
{203, nullptr, "GetPanelCrcMode"}, {203, nullptr, "GetPanelCrcMode"},
{204, nullptr, "SetPanelCrcMode"}, {204, nullptr, "SetPanelCrcMode"},

View file

@ -118,6 +118,22 @@ private:
Never, Never,
}; };
/// This is nn::settings::system::RegionCode
enum class RegionCode : u32 {
Japan,
Usa,
Europe,
Australia,
HongKongTaiwanKorea,
China,
};
/// This is nn::settings::system::EulaVersionClockType
enum class EulaVersionClockType : u32 {
NetworkSystemClock,
SteadyClock,
};
/// This is nn::settings::system::SleepFlag /// This is nn::settings::system::SleepFlag
struct SleepFlag { struct SleepFlag {
union { union {
@ -242,10 +258,24 @@ private:
}; };
static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size");
/// This is nn::settings::system::InitialLaunchSettings
struct EulaVersion {
u32 version;
RegionCode region_code;
EulaVersionClockType clock_type;
INSERT_PADDING_BYTES(0x4);
s64 posix_time;
Time::Clock::SteadyClockTimePoint timestamp;
};
static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
void SetLanguageCode(HLERequestContext& ctx);
void GetFirmwareVersion(HLERequestContext& ctx); void GetFirmwareVersion(HLERequestContext& ctx);
void GetFirmwareVersion2(HLERequestContext& ctx); void GetFirmwareVersion2(HLERequestContext& ctx);
void GetAccountSettings(HLERequestContext& ctx); void GetAccountSettings(HLERequestContext& ctx);
void SetAccountSettings(HLERequestContext& ctx); void SetAccountSettings(HLERequestContext& ctx);
void GetEulaVersions(HLERequestContext& ctx);
void SetEulaVersions(HLERequestContext& ctx);
void GetColorSetId(HLERequestContext& ctx); void GetColorSetId(HLERequestContext& ctx);
void SetColorSetId(HLERequestContext& ctx); void SetColorSetId(HLERequestContext& ctx);
void GetNotificationSettings(HLERequestContext& ctx); void GetNotificationSettings(HLERequestContext& ctx);
@ -257,6 +287,7 @@ private:
void GetTvSettings(HLERequestContext& ctx); void GetTvSettings(HLERequestContext& ctx);
void SetTvSettings(HLERequestContext& ctx); void SetTvSettings(HLERequestContext& ctx);
void GetQuestFlag(HLERequestContext& ctx); void GetQuestFlag(HLERequestContext& ctx);
void SetRegionCode(HLERequestContext& ctx);
void GetPrimaryAlbumStorage(HLERequestContext& ctx); void GetPrimaryAlbumStorage(HLERequestContext& ctx);
void GetSleepSettings(HLERequestContext& ctx); void GetSleepSettings(HLERequestContext& ctx);
void SetSleepSettings(HLERequestContext& ctx); void SetSleepSettings(HLERequestContext& ctx);
@ -273,6 +304,7 @@ private:
void SetAppletLaunchFlags(HLERequestContext& ctx); void SetAppletLaunchFlags(HLERequestContext& ctx);
void GetKeyboardLayout(HLERequestContext& ctx); void GetKeyboardLayout(HLERequestContext& ctx);
void GetChineseTraditionalInputMethod(HLERequestContext& ctx); void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
void GetFieldTestingFlag(HLERequestContext& ctx);
AccountSettings account_settings{ AccountSettings account_settings{
.flags = {}, .flags = {},
@ -312,6 +344,12 @@ private:
}; };
u32 applet_launch_flag{}; u32 applet_launch_flag{};
std::vector<EulaVersion> eula_versions{};
RegionCode region_code;
LanguageCode language_code_setting;
}; };
} // namespace Service::Set } // namespace Service::Set

View file

@ -73,13 +73,7 @@ protected:
std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs{}; std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs{};
std::span<Shader::Environment* const> Span() const noexcept { std::span<Shader::Environment* const> Span() const noexcept {
size_t size{}; return std::span(env_ptrs.begin(), std::ranges::find(env_ptrs, nullptr));
for (; size < NUM_PROGRAMS; size++) {
if (!env_ptrs[size]) {
break;
}
}
return std::span(env_ptrs.begin(), size);
} }
}; };