summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp44
-rw-r--r--src/core/hle/service/am/am.h30
-rw-r--r--src/core/hle/service/am/applet_ae.cpp8
-rw-r--r--src/core/hle/service/audio/audctl.cpp46
-rw-r--r--src/core/hle/service/audio/audctl.h22
-rw-r--r--src/core/hle/service/set/set.cpp60
-rw-r--r--src/core/hle/service/set/set.h61
-rw-r--r--src/core/hle/service/set/set_sys.cpp375
-rw-r--r--src/core/hle/service/set/set_sys.h322
-rw-r--r--src/shader_recompiler/environment.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp10
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp12
-rw-r--r--src/video_core/shader_cache.cpp5
-rw-r--r--src/video_core/shader_cache.h2
-rw-r--r--src/video_core/shader_environment.cpp31
-rw-r--r--src/video_core/shader_environment.h6
16 files changed, 884 insertions, 152 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 4f400d341..585675718 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1317,6 +1317,50 @@ void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) {
1317 rb.PushIpcInterface<IStorage>(system, std::move(memory)); 1317 rb.PushIpcInterface<IStorage>(system, std::move(memory));
1318} 1318}
1319 1319
1320ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_)
1321 : ServiceFramework{system_, "ILibraryAppletSelfAccessor"} {
1322 static const FunctionInfo functions[] = {
1323 {0, nullptr, "PopInData"},
1324 {1, nullptr, "PushOutData"},
1325 {2, nullptr, "PopInteractiveInData"},
1326 {3, nullptr, "PushInteractiveOutData"},
1327 {5, nullptr, "GetPopInDataEvent"},
1328 {6, nullptr, "GetPopInteractiveInDataEvent"},
1329 {10, nullptr, "ExitProcessAndReturn"},
1330 {11, nullptr, "GetLibraryAppletInfo"},
1331 {12, nullptr, "GetMainAppletIdentityInfo"},
1332 {13, nullptr, "CanUseApplicationCore"},
1333 {14, nullptr, "GetCallerAppletIdentityInfo"},
1334 {15, nullptr, "GetMainAppletApplicationControlProperty"},
1335 {16, nullptr, "GetMainAppletStorageId"},
1336 {17, nullptr, "GetCallerAppletIdentityInfoStack"},
1337 {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"},
1338 {19, nullptr, "GetDesirableKeyboardLayout"},
1339 {20, nullptr, "PopExtraStorage"},
1340 {25, nullptr, "GetPopExtraStorageEvent"},
1341 {30, nullptr, "UnpopInData"},
1342 {31, nullptr, "UnpopExtraStorage"},
1343 {40, nullptr, "GetIndirectLayerProducerHandle"},
1344 {50, nullptr, "ReportVisibleError"},
1345 {51, nullptr, "ReportVisibleErrorWithErrorContext"},
1346 {60, nullptr, "GetMainAppletApplicationDesiredLanguage"},
1347 {70, nullptr, "GetCurrentApplicationId"},
1348 {80, nullptr, "RequestExitToSelf"},
1349 {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"},
1350 {100, nullptr, "CreateGameMovieTrimmer"},
1351 {101, nullptr, "ReserveResourceForMovieOperation"},
1352 {102, nullptr, "UnreserveResourceForMovieOperation"},
1353 {110, nullptr, "GetMainAppletAvailableUsers"},
1354 {120, nullptr, "GetLaunchStorageInfoForDebug"},
1355 {130, nullptr, "GetGpuErrorDetectedSystemEvent"},
1356 {140, nullptr, "SetApplicationMemoryReservation"},
1357 {150, nullptr, "ShouldSetGpuTimeSliceManually"},
1358 };
1359 RegisterHandlers(functions);
1360}
1361
1362ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default;
1363
1320IApplicationFunctions::IApplicationFunctions(Core::System& system_) 1364IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1321 : ServiceFramework{system_, "IApplicationFunctions"}, service_context{system, 1365 : ServiceFramework{system_, "IApplicationFunctions"}, service_context{system,
1322 "IApplicationFunctions"} { 1366 "IApplicationFunctions"} {
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index d4fd163da..d68998f04 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -22,30 +22,6 @@ class Nvnflinger;
22 22
23namespace Service::AM { 23namespace Service::AM {
24 24
25// This is nn::settings::Language
26enum SystemLanguage {
27 Japanese = 0,
28 English = 1, // en-US
29 French = 2,
30 German = 3,
31 Italian = 4,
32 Spanish = 5,
33 Chinese = 6,
34 Korean = 7,
35 Dutch = 8,
36 Portuguese = 9,
37 Russian = 10,
38 Taiwanese = 11,
39 BritishEnglish = 12, // en-GB
40 CanadianFrench = 13,
41 LatinAmericanSpanish = 14, // es-419
42 // 4.0.0+
43 SimplifiedChinese = 15,
44 TraditionalChinese = 16,
45 // 10.1.0+
46 BrazilianPortuguese = 17,
47};
48
49class AppletMessageQueue { 25class AppletMessageQueue {
50public: 26public:
51 // This is nn::am::AppletMessage 27 // This is nn::am::AppletMessage
@@ -314,6 +290,12 @@ private:
314 void CreateHandleStorage(HLERequestContext& ctx); 290 void CreateHandleStorage(HLERequestContext& ctx);
315}; 291};
316 292
293class ILibraryAppletSelfAccessor final : public ServiceFramework<ILibraryAppletSelfAccessor> {
294public:
295 explicit ILibraryAppletSelfAccessor(Core::System& system_);
296 ~ILibraryAppletSelfAccessor() override;
297};
298
317class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { 299class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
318public: 300public:
319 explicit IApplicationFunctions(Core::System& system_); 301 explicit IApplicationFunctions(Core::System& system_);
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index 2764f7ceb..ee9d99a54 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -26,8 +26,10 @@ public:
26 {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"}, 26 {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
27 {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"}, 27 {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"},
28 {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, 28 {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
29 {20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"}, 29 {20, &ILibraryAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"},
30 {21, nullptr, "GetAppletCommonFunctions"}, 30 {21, nullptr, "GetAppletCommonFunctions"},
31 {22, nullptr, "GetHomeMenuFunctions"},
32 {23, nullptr, "GetGlobalStateController"},
31 {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"}, 33 {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
32 }; 34 };
33 // clang-format on 35 // clang-format on
@@ -100,12 +102,12 @@ private:
100 rb.PushIpcInterface<ILibraryAppletCreator>(system); 102 rb.PushIpcInterface<ILibraryAppletCreator>(system);
101 } 103 }
102 104
103 void GetApplicationFunctions(HLERequestContext& ctx) { 105 void OpenLibraryAppletSelfAccessor(HLERequestContext& ctx) {
104 LOG_DEBUG(Service_AM, "called"); 106 LOG_DEBUG(Service_AM, "called");
105 107
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 108 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
107 rb.Push(ResultSuccess); 109 rb.Push(ResultSuccess);
108 rb.PushIpcInterface<IApplicationFunctions>(system); 110 rb.PushIpcInterface<ILibraryAppletSelfAccessor>(system);
109 } 111 }
110 112
111 Nvnflinger::Nvnflinger& nvnflinger; 113 Nvnflinger::Nvnflinger& nvnflinger;
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp
index 7ad93be6b..66dd64fd1 100644
--- a/src/core/hle/service/audio/audctl.cpp
+++ b/src/core/hle/service/audio/audctl.cpp
@@ -22,13 +22,13 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
22 {9, nullptr, "GetAudioOutputMode"}, 22 {9, nullptr, "GetAudioOutputMode"},
23 {10, nullptr, "SetAudioOutputMode"}, 23 {10, nullptr, "SetAudioOutputMode"},
24 {11, nullptr, "SetForceMutePolicy"}, 24 {11, nullptr, "SetForceMutePolicy"},
25 {12, nullptr, "GetForceMutePolicy"}, 25 {12, &AudCtl::GetForceMutePolicy, "GetForceMutePolicy"},
26 {13, nullptr, "GetOutputModeSetting"}, 26 {13, &AudCtl::GetOutputModeSetting, "GetOutputModeSetting"},
27 {14, nullptr, "SetOutputModeSetting"}, 27 {14, nullptr, "SetOutputModeSetting"},
28 {15, nullptr, "SetOutputTarget"}, 28 {15, nullptr, "SetOutputTarget"},
29 {16, nullptr, "SetInputTargetForceEnabled"}, 29 {16, nullptr, "SetInputTargetForceEnabled"},
30 {17, nullptr, "SetHeadphoneOutputLevelMode"}, 30 {17, nullptr, "SetHeadphoneOutputLevelMode"},
31 {18, nullptr, "GetHeadphoneOutputLevelMode"}, 31 {18, &AudCtl::GetHeadphoneOutputLevelMode, "GetHeadphoneOutputLevelMode"},
32 {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, 32 {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"},
33 {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, 33 {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"},
34 {21, nullptr, "GetAudioOutputTargetForPlayReport"}, 34 {21, nullptr, "GetAudioOutputTargetForPlayReport"},
@@ -41,7 +41,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
41 {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, 41 {28, nullptr, "GetAudioOutputChannelCountForPlayReport"},
42 {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, 42 {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"},
43 {30, nullptr, "SetSpeakerAutoMuteEnabled"}, 43 {30, nullptr, "SetSpeakerAutoMuteEnabled"},
44 {31, nullptr, "IsSpeakerAutoMuteEnabled"}, 44 {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"},
45 {32, nullptr, "GetActiveOutputTarget"}, 45 {32, nullptr, "GetActiveOutputTarget"},
46 {33, nullptr, "GetTargetDeviceInfo"}, 46 {33, nullptr, "GetTargetDeviceInfo"},
47 {34, nullptr, "AcquireTargetNotification"}, 47 {34, nullptr, "AcquireTargetNotification"},
@@ -96,4 +96,42 @@ void AudCtl::GetTargetVolumeMax(HLERequestContext& ctx) {
96 rb.Push(target_max_volume); 96 rb.Push(target_max_volume);
97} 97}
98 98
99void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) {
100 LOG_WARNING(Audio, "(STUBBED) called");
101
102 IPC::ResponseBuilder rb{ctx, 3};
103 rb.Push(ResultSuccess);
104 rb.PushEnum(ForceMutePolicy::Disable);
105}
106
107void AudCtl::GetOutputModeSetting(HLERequestContext& ctx) {
108 IPC::RequestParser rp{ctx};
109 const auto value = rp.Pop<u32>();
110
111 LOG_WARNING(Audio, "(STUBBED) called, value={}", value);
112
113 IPC::ResponseBuilder rb{ctx, 3};
114 rb.Push(ResultSuccess);
115 rb.PushEnum(AudioOutputMode::PcmAuto);
116}
117
118void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) {
119 LOG_WARNING(Audio, "(STUBBED) called");
120
121 IPC::ResponseBuilder rb{ctx, 3};
122 rb.Push(ResultSuccess);
123 rb.PushEnum(HeadphoneOutputLevelMode::Normal);
124}
125
126void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
127 const bool is_speaker_auto_mute_enabled = false;
128
129 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
130 is_speaker_auto_mute_enabled);
131
132 IPC::ResponseBuilder rb{ctx, 3};
133 rb.Push(ResultSuccess);
134 rb.Push<u8>(is_speaker_auto_mute_enabled);
135}
136
99} // namespace Service::Audio 137} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h
index 8e31ac237..d57abb383 100644
--- a/src/core/hle/service/audio/audctl.h
+++ b/src/core/hle/service/audio/audctl.h
@@ -17,8 +17,30 @@ public:
17 ~AudCtl() override; 17 ~AudCtl() override;
18 18
19private: 19private:
20 enum class AudioOutputMode {
21 Invalid,
22 Pcm1ch,
23 Pcm2ch,
24 Pcm6ch,
25 PcmAuto,
26 };
27
28 enum class ForceMutePolicy {
29 Disable,
30 SpeakerMuteOnHeadphoneUnplugged,
31 };
32
33 enum class HeadphoneOutputLevelMode {
34 Normal,
35 HighPower,
36 };
37
20 void GetTargetVolumeMin(HLERequestContext& ctx); 38 void GetTargetVolumeMin(HLERequestContext& ctx);
21 void GetTargetVolumeMax(HLERequestContext& ctx); 39 void GetTargetVolumeMax(HLERequestContext& ctx);
40 void GetForceMutePolicy(HLERequestContext& ctx);
41 void GetOutputModeSetting(HLERequestContext& ctx);
42 void GetHeadphoneOutputLevelMode(HLERequestContext& ctx);
43 void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx);
22}; 44};
23 45
24} // namespace Service::Audio 46} // namespace Service::Audio
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index 83f888c54..2082b8ef7 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -11,66 +11,6 @@
11 11
12namespace Service::Set { 12namespace Service::Set {
13namespace { 13namespace {
14constexpr std::array<LanguageCode, 18> available_language_codes = {{
15 LanguageCode::JA,
16 LanguageCode::EN_US,
17 LanguageCode::FR,
18 LanguageCode::DE,
19 LanguageCode::IT,
20 LanguageCode::ES,
21 LanguageCode::ZH_CN,
22 LanguageCode::KO,
23 LanguageCode::NL,
24 LanguageCode::PT,
25 LanguageCode::RU,
26 LanguageCode::ZH_TW,
27 LanguageCode::EN_GB,
28 LanguageCode::FR_CA,
29 LanguageCode::ES_419,
30 LanguageCode::ZH_HANS,
31 LanguageCode::ZH_HANT,
32 LanguageCode::PT_BR,
33}};
34
35enum class KeyboardLayout : u64 {
36 Japanese = 0,
37 EnglishUs = 1,
38 EnglishUsInternational = 2,
39 EnglishUk = 3,
40 French = 4,
41 FrenchCa = 5,
42 Spanish = 6,
43 SpanishLatin = 7,
44 German = 8,
45 Italian = 9,
46 Portuguese = 10,
47 Russian = 11,
48 Korean = 12,
49 ChineseSimplified = 13,
50 ChineseTraditional = 14,
51};
52
53constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{
54 {LanguageCode::JA, KeyboardLayout::Japanese},
55 {LanguageCode::EN_US, KeyboardLayout::EnglishUs},
56 {LanguageCode::FR, KeyboardLayout::French},
57 {LanguageCode::DE, KeyboardLayout::German},
58 {LanguageCode::IT, KeyboardLayout::Italian},
59 {LanguageCode::ES, KeyboardLayout::Spanish},
60 {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified},
61 {LanguageCode::KO, KeyboardLayout::Korean},
62 {LanguageCode::NL, KeyboardLayout::EnglishUsInternational},
63 {LanguageCode::PT, KeyboardLayout::Portuguese},
64 {LanguageCode::RU, KeyboardLayout::Russian},
65 {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional},
66 {LanguageCode::EN_GB, KeyboardLayout::EnglishUk},
67 {LanguageCode::FR_CA, KeyboardLayout::FrenchCa},
68 {LanguageCode::ES_419, KeyboardLayout::SpanishLatin},
69 {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified},
70 {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional},
71 {LanguageCode::PT_BR, KeyboardLayout::Portuguese},
72}};
73
74constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; 14constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF;
75constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; 15constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40;
76 16
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h
index 7fd3a7654..b61a3560d 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/set.h
@@ -32,6 +32,67 @@ enum class LanguageCode : u64 {
32 ZH_HANT = 0x00746E61482D687A, 32 ZH_HANT = 0x00746E61482D687A,
33 PT_BR = 0x00000052422D7470, 33 PT_BR = 0x00000052422D7470,
34}; 34};
35
36enum class KeyboardLayout : u64 {
37 Japanese = 0,
38 EnglishUs = 1,
39 EnglishUsInternational = 2,
40 EnglishUk = 3,
41 French = 4,
42 FrenchCa = 5,
43 Spanish = 6,
44 SpanishLatin = 7,
45 German = 8,
46 Italian = 9,
47 Portuguese = 10,
48 Russian = 11,
49 Korean = 12,
50 ChineseSimplified = 13,
51 ChineseTraditional = 14,
52};
53
54constexpr std::array<LanguageCode, 18> available_language_codes = {{
55 LanguageCode::JA,
56 LanguageCode::EN_US,
57 LanguageCode::FR,
58 LanguageCode::DE,
59 LanguageCode::IT,
60 LanguageCode::ES,
61 LanguageCode::ZH_CN,
62 LanguageCode::KO,
63 LanguageCode::NL,
64 LanguageCode::PT,
65 LanguageCode::RU,
66 LanguageCode::ZH_TW,
67 LanguageCode::EN_GB,
68 LanguageCode::FR_CA,
69 LanguageCode::ES_419,
70 LanguageCode::ZH_HANS,
71 LanguageCode::ZH_HANT,
72 LanguageCode::PT_BR,
73}};
74
75static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{
76 {LanguageCode::JA, KeyboardLayout::Japanese},
77 {LanguageCode::EN_US, KeyboardLayout::EnglishUs},
78 {LanguageCode::FR, KeyboardLayout::French},
79 {LanguageCode::DE, KeyboardLayout::German},
80 {LanguageCode::IT, KeyboardLayout::Italian},
81 {LanguageCode::ES, KeyboardLayout::Spanish},
82 {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified},
83 {LanguageCode::KO, KeyboardLayout::Korean},
84 {LanguageCode::NL, KeyboardLayout::EnglishUsInternational},
85 {LanguageCode::PT, KeyboardLayout::Portuguese},
86 {LanguageCode::RU, KeyboardLayout::Russian},
87 {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional},
88 {LanguageCode::EN_GB, KeyboardLayout::EnglishUk},
89 {LanguageCode::FR_CA, KeyboardLayout::FrenchCa},
90 {LanguageCode::ES_419, KeyboardLayout::SpanishLatin},
91 {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified},
92 {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional},
93 {LanguageCode::PT_BR, KeyboardLayout::Portuguese},
94}};
95
35LanguageCode GetLanguageCodeFromIndex(std::size_t idx); 96LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
36 97
37class SET final : public ServiceFramework<SET> { 98class SET final : public ServiceFramework<SET> {
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index 2e38d1cfc..165b97dad 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -4,10 +4,12 @@
4#include "common/assert.h" 4#include "common/assert.h"
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "common/settings.h" 6#include "common/settings.h"
7#include "common/string_util.h"
7#include "core/file_sys/errors.h" 8#include "core/file_sys/errors.h"
8#include "core/file_sys/system_archive/system_version.h" 9#include "core/file_sys/system_archive/system_version.h"
9#include "core/hle/service/filesystem/filesystem.h" 10#include "core/hle/service/filesystem/filesystem.h"
10#include "core/hle/service/ipc_helpers.h" 11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/set/set.h"
11#include "core/hle/service/set/set_sys.h" 13#include "core/hle/service/set/set_sys.h"
12 14
13namespace Service::Set { 15namespace Service::Set {
@@ -73,6 +75,16 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type)
73} 75}
74} // Anonymous namespace 76} // Anonymous namespace
75 77
78void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
79 IPC::RequestParser rp{ctx};
80 language_code_setting = rp.PopEnum<LanguageCode>();
81
82 LOG_INFO(Service_SET, "called, language_code={}", language_code_setting);
83
84 IPC::ResponseBuilder rb{ctx, 2};
85 rb.Push(ResultSuccess);
86}
87
76void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { 88void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
77 LOG_DEBUG(Service_SET, "called"); 89 LOG_DEBUG(Service_SET, "called");
78 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); 90 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1);
@@ -83,21 +95,113 @@ void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) {
83 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); 95 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2);
84} 96}
85 97
98void SET_SYS::GetAccountSettings(HLERequestContext& ctx) {
99 LOG_INFO(Service_SET, "called");
100
101 IPC::ResponseBuilder rb{ctx, 3};
102 rb.Push(ResultSuccess);
103 rb.PushRaw(account_settings);
104}
105
106void SET_SYS::SetAccountSettings(HLERequestContext& ctx) {
107 IPC::RequestParser rp{ctx};
108 account_settings = rp.PopRaw<AccountSettings>();
109
110 LOG_INFO(Service_SET, "called, account_settings_flags={}", account_settings.flags);
111
112 IPC::ResponseBuilder rb{ctx, 2};
113 rb.Push(ResultSuccess);
114}
115
116void SET_SYS::GetEulaVersions(HLERequestContext& ctx) {
117 LOG_INFO(Service_SET, "called");
118
119 ctx.WriteBuffer(eula_versions);
120
121 IPC::ResponseBuilder rb{ctx, 3};
122 rb.Push(ResultSuccess);
123 rb.Push(static_cast<u32>(eula_versions.size()));
124}
125
126void SET_SYS::SetEulaVersions(HLERequestContext& ctx) {
127 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>();
128 const auto buffer_data = ctx.ReadBuffer();
129
130 LOG_INFO(Service_SET, "called, elements={}", elements);
131
132 eula_versions.resize(elements);
133 for (std::size_t index = 0; index < elements; index++) {
134 const std::size_t start_index = index * sizeof(EulaVersion);
135 memcpy(eula_versions.data() + start_index, buffer_data.data() + start_index,
136 sizeof(EulaVersion));
137 }
138
139 IPC::ResponseBuilder rb{ctx, 2};
140 rb.Push(ResultSuccess);
141}
142
86void SET_SYS::GetColorSetId(HLERequestContext& ctx) { 143void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
87 LOG_DEBUG(Service_SET, "called"); 144 LOG_DEBUG(Service_SET, "called");
88 145
89 IPC::ResponseBuilder rb{ctx, 3}; 146 IPC::ResponseBuilder rb{ctx, 3};
90
91 rb.Push(ResultSuccess); 147 rb.Push(ResultSuccess);
92 rb.PushEnum(color_set); 148 rb.PushEnum(color_set);
93} 149}
94 150
95void SET_SYS::SetColorSetId(HLERequestContext& ctx) { 151void SET_SYS::SetColorSetId(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_SET, "called");
97
98 IPC::RequestParser rp{ctx}; 152 IPC::RequestParser rp{ctx};
99 color_set = rp.PopEnum<ColorSet>(); 153 color_set = rp.PopEnum<ColorSet>();
100 154
155 LOG_DEBUG(Service_SET, "called, color_set={}", color_set);
156
157 IPC::ResponseBuilder rb{ctx, 2};
158 rb.Push(ResultSuccess);
159}
160
161void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) {
162 LOG_INFO(Service_SET, "called");
163
164 IPC::ResponseBuilder rb{ctx, 8};
165 rb.Push(ResultSuccess);
166 rb.PushRaw(notification_settings);
167}
168
169void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) {
170 IPC::RequestParser rp{ctx};
171 notification_settings = rp.PopRaw<NotificationSettings>();
172
173 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
174 notification_settings.flags.raw, notification_settings.volume,
175 notification_settings.start_time.hour, notification_settings.start_time.minute,
176 notification_settings.stop_time.hour, notification_settings.stop_time.minute);
177
178 IPC::ResponseBuilder rb{ctx, 2};
179 rb.Push(ResultSuccess);
180}
181
182void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) {
183 LOG_INFO(Service_SET, "called");
184
185 ctx.WriteBuffer(account_notifications);
186
187 IPC::ResponseBuilder rb{ctx, 3};
188 rb.Push(ResultSuccess);
189 rb.Push(static_cast<u32>(account_notifications.size()));
190}
191
192void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) {
193 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>();
194 const auto buffer_data = ctx.ReadBuffer();
195
196 LOG_INFO(Service_SET, "called, elements={}", elements);
197
198 account_notifications.resize(elements);
199 for (std::size_t index = 0; index < elements; index++) {
200 const std::size_t start_index = index * sizeof(AccountNotificationSettings);
201 memcpy(account_notifications.data() + start_index, buffer_data.data() + start_index,
202 sizeof(AccountNotificationSettings));
203 }
204
101 IPC::ResponseBuilder rb{ctx, 2}; 205 IPC::ResponseBuilder rb{ctx, 2};
102 rb.Push(ResultSuccess); 206 rb.Push(ResultSuccess);
103} 207}
@@ -177,17 +281,218 @@ void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) {
177 rb.Push(response); 281 rb.Push(response);
178} 282}
179 283
284void SET_SYS::GetTvSettings(HLERequestContext& ctx) {
285 LOG_INFO(Service_SET, "called");
286
287 IPC::ResponseBuilder rb{ctx, 10};
288 rb.Push(ResultSuccess);
289 rb.PushRaw(tv_settings);
290}
291
292void SET_SYS::SetTvSettings(HLERequestContext& ctx) {
293 IPC::RequestParser rp{ctx};
294 tv_settings = rp.PopRaw<TvSettings>();
295
296 LOG_INFO(Service_SET,
297 "called, flags={}, cmu_mode={}, constrast_ratio={}, hdmi_content_type={}, "
298 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
299 tv_settings.flags.raw, tv_settings.cmu_mode, tv_settings.constrast_ratio,
300 tv_settings.hdmi_content_type, tv_settings.rgb_range, tv_settings.tv_gama,
301 tv_settings.tv_resolution, tv_settings.tv_underscan);
302
303 IPC::ResponseBuilder rb{ctx, 2};
304 rb.Push(ResultSuccess);
305}
306
307void SET_SYS::GetQuestFlag(HLERequestContext& ctx) {
308 LOG_WARNING(Service_SET, "(STUBBED) called");
309
310 IPC::ResponseBuilder rb{ctx, 3};
311 rb.Push(ResultSuccess);
312 rb.PushEnum(QuestFlag::Retail);
313}
314
315void SET_SYS::SetRegionCode(HLERequestContext& ctx) {
316 IPC::RequestParser rp{ctx};
317 region_code = rp.PopEnum<RegionCode>();
318
319 LOG_INFO(Service_SET, "called, region_code={}", region_code);
320
321 IPC::ResponseBuilder rb{ctx, 2};
322 rb.Push(ResultSuccess);
323}
324
325void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
326 LOG_WARNING(Service_SET, "(STUBBED) called");
327
328 IPC::ResponseBuilder rb{ctx, 3};
329 rb.Push(ResultSuccess);
330 rb.PushEnum(PrimaryAlbumStorage::SdCard);
331}
332
333void SET_SYS::GetSleepSettings(HLERequestContext& ctx) {
334 LOG_INFO(Service_SET, "called");
335
336 IPC::ResponseBuilder rb{ctx, 5};
337 rb.Push(ResultSuccess);
338 rb.PushRaw(sleep_settings);
339}
340
341void SET_SYS::SetSleepSettings(HLERequestContext& ctx) {
342 IPC::RequestParser rp{ctx};
343 sleep_settings = rp.PopRaw<SleepSettings>();
344
345 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
346 sleep_settings.flags.raw, sleep_settings.handheld_sleep_plan,
347 sleep_settings.console_sleep_plan);
348
349 IPC::ResponseBuilder rb{ctx, 2};
350 rb.Push(ResultSuccess);
351}
352
353void SET_SYS::GetInitialLaunchSettings(HLERequestContext& ctx) {
354 LOG_INFO(Service_SET, "called");
355 IPC::ResponseBuilder rb{ctx, 10};
356 rb.Push(ResultSuccess);
357 rb.PushRaw(launch_settings);
358}
359
360void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) {
361 IPC::RequestParser rp{ctx};
362 launch_settings = rp.PopRaw<InitialLaunchSettings>();
363
364 LOG_INFO(Service_SET, "called, flags={}, timestamp={}", launch_settings.flags.raw,
365 launch_settings.timestamp.time_point);
366
367 IPC::ResponseBuilder rb{ctx, 2};
368 rb.Push(ResultSuccess);
369}
370
180void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { 371void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) {
181 LOG_DEBUG(Service_SET, "called"); 372 LOG_DEBUG(Service_SET, "called");
373
374 ctx.WriteBuffer(::Settings::values.device_name.GetValue());
375
182 IPC::ResponseBuilder rb{ctx, 2}; 376 IPC::ResponseBuilder rb{ctx, 2};
183 rb.Push(ResultSuccess); 377 rb.Push(ResultSuccess);
184 ctx.WriteBuffer(::Settings::values.device_name.GetValue()); 378}
379
380void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) {
381 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer());
382
383 LOG_INFO(Service_SET, "called, device_name={}", device_name);
384
385 ::Settings::values.device_name = device_name;
386
387 IPC::ResponseBuilder rb{ctx, 2};
388 rb.Push(ResultSuccess);
389}
390
391void SET_SYS::GetProductModel(HLERequestContext& ctx) {
392 const u32 product_model = 1;
393
394 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model);
395 IPC::ResponseBuilder rb{ctx, 3};
396 rb.Push(ResultSuccess);
397 rb.Push(product_model);
398}
399
400void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) {
401 const auto author_id = Common::UUID::MakeDefault();
402
403 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString());
404
405 IPC::ResponseBuilder rb{ctx, 6};
406 rb.Push(ResultSuccess);
407 rb.PushRaw(author_id);
408}
409
410void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
411 u8 auto_update_flag{};
412
413 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
414
415 IPC::ResponseBuilder rb{ctx, 3};
416 rb.Push(ResultSuccess);
417 rb.Push(auto_update_flag);
418}
419
420void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) {
421 u8 battery_percentage_flag{1};
422
423 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
424 battery_percentage_flag);
425
426 IPC::ResponseBuilder rb{ctx, 3};
427 rb.Push(ResultSuccess);
428 rb.Push(battery_percentage_flag);
429}
430
431void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) {
432 LOG_WARNING(Service_SET, "(STUBBED) called");
433
434 IPC::ResponseBuilder rb{ctx, 3};
435 rb.Push(ResultSuccess);
436 rb.PushEnum(ErrorReportSharePermission::Denied);
437}
438
439void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) {
440 LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag);
441
442 IPC::ResponseBuilder rb{ctx, 3};
443 rb.Push(ResultSuccess);
444 rb.Push(applet_launch_flag);
445}
446
447void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) {
448 IPC::RequestParser rp{ctx};
449 applet_launch_flag = rp.Pop<u32>();
450
451 LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag);
452
453 IPC::ResponseBuilder rb{ctx, 2};
454 rb.Push(ResultSuccess);
455}
456
457void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) {
458 const auto language_code =
459 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())];
460 const auto key_code =
461 std::find_if(language_to_layout.cbegin(), language_to_layout.cend(),
462 [=](const auto& element) { return element.first == language_code; });
463
464 KeyboardLayout selected_keyboard_layout = KeyboardLayout::EnglishUs;
465 if (key_code != language_to_layout.end()) {
466 selected_keyboard_layout = key_code->second;
467 }
468
469 LOG_INFO(Service_SET, "called, selected_keyboard_layout={}", selected_keyboard_layout);
470
471 IPC::ResponseBuilder rb{ctx, 3};
472 rb.Push(ResultSuccess);
473 rb.Push(static_cast<u32>(selected_keyboard_layout));
474}
475
476void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
477 LOG_WARNING(Service_SET, "(STUBBED) called");
478
479 IPC::ResponseBuilder rb{ctx, 3};
480 rb.Push(ResultSuccess);
481 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
482}
483
484void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) {
485 LOG_WARNING(Service_SET, "(STUBBED) called");
486
487 IPC::ResponseBuilder rb{ctx, 3};
488 rb.Push(ResultSuccess);
489 rb.Push<u8>(false);
185} 490}
186 491
187SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { 492SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
188 // clang-format off 493 // clang-format off
189 static const FunctionInfo functions[] = { 494 static const FunctionInfo functions[] = {
190 {0, nullptr, "SetLanguageCode"}, 495 {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"},
191 {1, nullptr, "SetNetworkSettings"}, 496 {1, nullptr, "SetNetworkSettings"},
192 {2, nullptr, "GetNetworkSettings"}, 497 {2, nullptr, "GetNetworkSettings"},
193 {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, 498 {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"},
@@ -203,35 +508,35 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
203 {14, nullptr, "SetExternalSteadyClockSourceId"}, 508 {14, nullptr, "SetExternalSteadyClockSourceId"},
204 {15, nullptr, "GetUserSystemClockContext"}, 509 {15, nullptr, "GetUserSystemClockContext"},
205 {16, nullptr, "SetUserSystemClockContext"}, 510 {16, nullptr, "SetUserSystemClockContext"},
206 {17, nullptr, "GetAccountSettings"}, 511 {17, &SET_SYS::GetAccountSettings, "GetAccountSettings"},
207 {18, nullptr, "SetAccountSettings"}, 512 {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"},
208 {19, nullptr, "GetAudioVolume"}, 513 {19, nullptr, "GetAudioVolume"},
209 {20, nullptr, "SetAudioVolume"}, 514 {20, nullptr, "SetAudioVolume"},
210 {21, nullptr, "GetEulaVersions"}, 515 {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"},
211 {22, nullptr, "SetEulaVersions"}, 516 {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"},
212 {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, 517 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
213 {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, 518 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
214 {25, nullptr, "GetConsoleInformationUploadFlag"}, 519 {25, nullptr, "GetConsoleInformationUploadFlag"},
215 {26, nullptr, "SetConsoleInformationUploadFlag"}, 520 {26, nullptr, "SetConsoleInformationUploadFlag"},
216 {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, 521 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
217 {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, 522 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
218 {29, nullptr, "GetNotificationSettings"}, 523 {29, &SET_SYS::GetNotificationSettings, "GetNotificationSettings"},
219 {30, nullptr, "SetNotificationSettings"}, 524 {30, &SET_SYS::SetNotificationSettings, "SetNotificationSettings"},
220 {31, nullptr, "GetAccountNotificationSettings"}, 525 {31, &SET_SYS::GetAccountNotificationSettings, "GetAccountNotificationSettings"},
221 {32, nullptr, "SetAccountNotificationSettings"}, 526 {32, &SET_SYS::SetAccountNotificationSettings, "SetAccountNotificationSettings"},
222 {35, nullptr, "GetVibrationMasterVolume"}, 527 {35, nullptr, "GetVibrationMasterVolume"},
223 {36, nullptr, "SetVibrationMasterVolume"}, 528 {36, nullptr, "SetVibrationMasterVolume"},
224 {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, 529 {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"},
225 {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"}, 530 {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"},
226 {39, nullptr, "GetTvSettings"}, 531 {39, &SET_SYS::GetTvSettings, "GetTvSettings"},
227 {40, nullptr, "SetTvSettings"}, 532 {40, &SET_SYS::SetTvSettings, "SetTvSettings"},
228 {41, nullptr, "GetEdid"}, 533 {41, nullptr, "GetEdid"},
229 {42, nullptr, "SetEdid"}, 534 {42, nullptr, "SetEdid"},
230 {43, nullptr, "GetAudioOutputMode"}, 535 {43, nullptr, "GetAudioOutputMode"},
231 {44, nullptr, "SetAudioOutputMode"}, 536 {44, nullptr, "SetAudioOutputMode"},
232 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"}, 537 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"},
233 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"}, 538 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"},
234 {47, nullptr, "GetQuestFlag"}, 539 {47, &SET_SYS::GetQuestFlag, "GetQuestFlag"},
235 {48, nullptr, "SetQuestFlag"}, 540 {48, nullptr, "SetQuestFlag"},
236 {49, nullptr, "GetDataDeletionSettings"}, 541 {49, nullptr, "GetDataDeletionSettings"},
237 {50, nullptr, "SetDataDeletionSettings"}, 542 {50, nullptr, "SetDataDeletionSettings"},
@@ -241,13 +546,13 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
241 {54, nullptr, "SetDeviceTimeZoneLocationName"}, 546 {54, nullptr, "SetDeviceTimeZoneLocationName"},
242 {55, nullptr, "GetWirelessCertificationFileSize"}, 547 {55, nullptr, "GetWirelessCertificationFileSize"},
243 {56, nullptr, "GetWirelessCertificationFile"}, 548 {56, nullptr, "GetWirelessCertificationFile"},
244 {57, nullptr, "SetRegionCode"}, 549 {57, &SET_SYS::SetRegionCode, "SetRegionCode"},
245 {58, nullptr, "GetNetworkSystemClockContext"}, 550 {58, nullptr, "GetNetworkSystemClockContext"},
246 {59, nullptr, "SetNetworkSystemClockContext"}, 551 {59, nullptr, "SetNetworkSystemClockContext"},
247 {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, 552 {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"},
248 {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"}, 553 {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"},
249 {62, nullptr, "GetDebugModeFlag"}, 554 {62, nullptr, "GetDebugModeFlag"},
250 {63, nullptr, "GetPrimaryAlbumStorage"}, 555 {63, &SET_SYS::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"},
251 {64, nullptr, "SetPrimaryAlbumStorage"}, 556 {64, nullptr, "SetPrimaryAlbumStorage"},
252 {65, nullptr, "GetUsb30EnableFlag"}, 557 {65, nullptr, "GetUsb30EnableFlag"},
253 {66, nullptr, "SetUsb30EnableFlag"}, 558 {66, nullptr, "SetUsb30EnableFlag"},
@@ -255,15 +560,15 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
255 {68, nullptr, "GetSerialNumber"}, 560 {68, nullptr, "GetSerialNumber"},
256 {69, nullptr, "GetNfcEnableFlag"}, 561 {69, nullptr, "GetNfcEnableFlag"},
257 {70, nullptr, "SetNfcEnableFlag"}, 562 {70, nullptr, "SetNfcEnableFlag"},
258 {71, nullptr, "GetSleepSettings"}, 563 {71, &SET_SYS::GetSleepSettings, "GetSleepSettings"},
259 {72, nullptr, "SetSleepSettings"}, 564 {72, &SET_SYS::SetSleepSettings, "SetSleepSettings"},
260 {73, nullptr, "GetWirelessLanEnableFlag"}, 565 {73, nullptr, "GetWirelessLanEnableFlag"},
261 {74, nullptr, "SetWirelessLanEnableFlag"}, 566 {74, nullptr, "SetWirelessLanEnableFlag"},
262 {75, nullptr, "GetInitialLaunchSettings"}, 567 {75, &SET_SYS::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
263 {76, nullptr, "SetInitialLaunchSettings"}, 568 {76, &SET_SYS::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
264 {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, 569 {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"},
265 {78, nullptr, "SetDeviceNickName"}, 570 {78, &SET_SYS::SetDeviceNickName, "SetDeviceNickName"},
266 {79, nullptr, "GetProductModel"}, 571 {79, &SET_SYS::GetProductModel, "GetProductModel"},
267 {80, nullptr, "GetLdnChannel"}, 572 {80, nullptr, "GetLdnChannel"},
268 {81, nullptr, "SetLdnChannel"}, 573 {81, nullptr, "SetLdnChannel"},
269 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, 574 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
@@ -274,16 +579,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
274 {87, nullptr, "SetPtmFuelGaugeParameter"}, 579 {87, nullptr, "SetPtmFuelGaugeParameter"},
275 {88, nullptr, "GetBluetoothEnableFlag"}, 580 {88, nullptr, "GetBluetoothEnableFlag"},
276 {89, nullptr, "SetBluetoothEnableFlag"}, 581 {89, nullptr, "SetBluetoothEnableFlag"},
277 {90, nullptr, "GetMiiAuthorId"}, 582 {90, &SET_SYS::GetMiiAuthorId, "GetMiiAuthorId"},
278 {91, nullptr, "SetShutdownRtcValue"}, 583 {91, nullptr, "SetShutdownRtcValue"},
279 {92, nullptr, "GetShutdownRtcValue"}, 584 {92, nullptr, "GetShutdownRtcValue"},
280 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, 585 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
281 {94, nullptr, "GetFatalDirtyFlags"}, 586 {94, nullptr, "GetFatalDirtyFlags"},
282 {95, nullptr, "GetAutoUpdateEnableFlag"}, 587 {95, &SET_SYS::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
283 {96, nullptr, "SetAutoUpdateEnableFlag"}, 588 {96, nullptr, "SetAutoUpdateEnableFlag"},
284 {97, nullptr, "GetNxControllerSettings"}, 589 {97, nullptr, "GetNxControllerSettings"},
285 {98, nullptr, "SetNxControllerSettings"}, 590 {98, nullptr, "SetNxControllerSettings"},
286 {99, nullptr, "GetBatteryPercentageFlag"}, 591 {99, &SET_SYS::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
287 {100, nullptr, "SetBatteryPercentageFlag"}, 592 {100, nullptr, "SetBatteryPercentageFlag"},
288 {101, nullptr, "GetExternalRtcResetFlag"}, 593 {101, nullptr, "GetExternalRtcResetFlag"},
289 {102, nullptr, "SetExternalRtcResetFlag"}, 594 {102, nullptr, "SetExternalRtcResetFlag"},
@@ -308,10 +613,10 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
308 {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, 613 {121, nullptr, "SetPushNotificationActivityModeOnSleep"},
309 {122, nullptr, "GetServiceDiscoveryControlSettings"}, 614 {122, nullptr, "GetServiceDiscoveryControlSettings"},
310 {123, nullptr, "SetServiceDiscoveryControlSettings"}, 615 {123, nullptr, "SetServiceDiscoveryControlSettings"},
311 {124, nullptr, "GetErrorReportSharePermission"}, 616 {124, &SET_SYS::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
312 {125, nullptr, "SetErrorReportSharePermission"}, 617 {125, nullptr, "SetErrorReportSharePermission"},
313 {126, nullptr, "GetAppletLaunchFlags"}, 618 {126, &SET_SYS::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
314 {127, nullptr, "SetAppletLaunchFlags"}, 619 {127, &SET_SYS::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
315 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, 620 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
316 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, 621 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
317 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, 622 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
@@ -320,7 +625,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
320 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, 625 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
321 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, 626 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
322 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, 627 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
323 {136, nullptr, "GetKeyboardLayout"}, 628 {136, &SET_SYS::GetKeyboardLayout, "GetKeyboardLayout"},
324 {137, nullptr, "SetKeyboardLayout"}, 629 {137, nullptr, "SetKeyboardLayout"},
325 {138, nullptr, "GetWebInspectorFlag"}, 630 {138, nullptr, "GetWebInspectorFlag"},
326 {139, nullptr, "GetAllowedSslHosts"}, 631 {139, nullptr, "GetAllowedSslHosts"},
@@ -354,7 +659,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
354 {167, nullptr, "SetUsb30DeviceEnableFlag"}, 659 {167, nullptr, "SetUsb30DeviceEnableFlag"},
355 {168, nullptr, "GetThemeId"}, 660 {168, nullptr, "GetThemeId"},
356 {169, nullptr, "SetThemeId"}, 661 {169, nullptr, "SetThemeId"},
357 {170, nullptr, "GetChineseTraditionalInputMethod"}, 662 {170, &SET_SYS::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"},
358 {171, nullptr, "SetChineseTraditionalInputMethod"}, 663 {171, nullptr, "SetChineseTraditionalInputMethod"},
359 {172, nullptr, "GetPtmCycleCountReliability"}, 664 {172, nullptr, "GetPtmCycleCountReliability"},
360 {173, nullptr, "SetPtmCycleCountReliability"}, 665 {173, nullptr, "SetPtmCycleCountReliability"},
@@ -385,12 +690,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
385 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, 690 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
386 {199, nullptr, "GetButtonConfigRegisteredSettings"}, 691 {199, nullptr, "GetButtonConfigRegisteredSettings"},
387 {200, nullptr, "SetButtonConfigRegisteredSettings"}, 692 {200, nullptr, "SetButtonConfigRegisteredSettings"},
388 {201, nullptr, "GetFieldTestingFlag"}, 693 {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"},
389 {202, nullptr, "SetFieldTestingFlag"}, 694 {202, nullptr, "SetFieldTestingFlag"},
390 {203, nullptr, "GetPanelCrcMode"}, 695 {203, nullptr, "GetPanelCrcMode"},
391 {204, nullptr, "SetPanelCrcMode"}, 696 {204, nullptr, "SetPanelCrcMode"},
392 {205, nullptr, "GetNxControllerSettingsEx"}, 697 {205, nullptr, "GetNxControllerSettingsEx"},
393 {206, nullptr, "SetNxControllerSettingsEx"}, 698 {206, nullptr, "SetNxControllerSettingsEx"},
699 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
700 {208, nullptr, "SetHearingProtectionSafeguardFlag"},
701 {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"},
702 {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"},
394 }; 703 };
395 // clang-format on 704 // clang-format on
396 705
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index 1efbcc97a..c7dba2a9e 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -3,7 +3,9 @@
3 3
4#pragma once 4#pragma once
5 5
6#include "common/uuid.h"
6#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8#include "core/hle/service/time/clock_types.h"
7 9
8namespace Core { 10namespace Core {
9class System; 11class System;
@@ -23,15 +25,331 @@ private:
23 BasicBlack = 1, 25 BasicBlack = 1,
24 }; 26 };
25 27
26 void GetSettingsItemValueSize(HLERequestContext& ctx); 28 /// Indicates the current console is a retail or kiosk unit
27 void GetSettingsItemValue(HLERequestContext& ctx); 29 enum class QuestFlag : u8 {
30 Retail = 0,
31 Kiosk = 1,
32 };
33
34 /// This is nn::settings::system::TvResolution
35 enum class TvResolution : u32 {
36 Auto,
37 Resolution1080p,
38 Resolution720p,
39 Resolution480p,
40 };
41
42 /// This is nn::settings::system::HdmiContentType
43 enum class HdmiContentType : u32 {
44 None,
45 Graphics,
46 Cinema,
47 Photo,
48 Game,
49 };
50
51 /// This is nn::settings::system::RgbRange
52 enum class RgbRange : u32 {
53 Auto,
54 Full,
55 Limited,
56 };
57
58 /// This is nn::settings::system::CmuMode
59 enum class CmuMode : u32 {
60 None,
61 ColorInvert,
62 HighContrast,
63 GrayScale,
64 };
65
66 /// This is nn::settings::system::PrimaryAlbumStorage
67 enum class PrimaryAlbumStorage : u32 {
68 Nand,
69 SdCard,
70 };
71
72 /// This is nn::settings::system::NotificationVolume
73 enum class NotificationVolume : u32 {
74 Mute,
75 Low,
76 High,
77 };
78
79 /// This is nn::settings::system::ChineseTraditionalInputMethod
80 enum class ChineseTraditionalInputMethod : u32 {
81 Unknown0 = 0,
82 Unknown1 = 1,
83 Unknown2 = 2,
84 };
85
86 /// This is nn::settings::system::ErrorReportSharePermission
87 enum class ErrorReportSharePermission : u32 {
88 NotConfirmed,
89 Granted,
90 Denied,
91 };
92
93 /// This is nn::settings::system::FriendPresenceOverlayPermission
94 enum class FriendPresenceOverlayPermission : u8 {
95 NotConfirmed,
96 NoDisplay,
97 FavoriteFriends,
98 Friends,
99 };
100
101 /// This is nn::settings::system::HandheldSleepPlan
102 enum class HandheldSleepPlan : u32 {
103 Sleep1Min,
104 Sleep3Min,
105 Sleep5Min,
106 Sleep10Min,
107 Sleep30Min,
108 Never,
109 };
110
111 /// This is nn::settings::system::ConsoleSleepPlan
112 enum class ConsoleSleepPlan : u32 {
113 Sleep1Hour,
114 Sleep2Hour,
115 Sleep3Hour,
116 Sleep6Hour,
117 Sleep12Hour,
118 Never,
119 };
120
121 /// This is nn::settings::system::RegionCode
122 enum class RegionCode : u32 {
123 Japan,
124 Usa,
125 Europe,
126 Australia,
127 HongKongTaiwanKorea,
128 China,
129 };
130
131 /// This is nn::settings::system::EulaVersionClockType
132 enum class EulaVersionClockType : u32 {
133 NetworkSystemClock,
134 SteadyClock,
135 };
136
137 /// This is nn::settings::system::SleepFlag
138 struct SleepFlag {
139 union {
140 u32 raw{};
141
142 BitField<0, 1, u32> SleepsWhilePlayingMedia;
143 BitField<1, 1, u32> WakesAtPowerStateChange;
144 };
145 };
146 static_assert(sizeof(SleepFlag) == 4, "TvFlag is an invalid size");
147
148 /// This is nn::settings::system::TvFlag
149 struct TvFlag {
150 union {
151 u32 raw{};
152
153 BitField<0, 1, u32> Allows4k;
154 BitField<1, 1, u32> Allows3d;
155 BitField<2, 1, u32> AllowsCec;
156 BitField<3, 1, u32> PreventsScreenBurnIn;
157 };
158 };
159 static_assert(sizeof(TvFlag) == 4, "TvFlag is an invalid size");
160
161 /// This is nn::settings::system::InitialLaunchFlag
162 struct InitialLaunchFlag {
163 union {
164 u32 raw{};
165
166 BitField<0, 1, u32> InitialLaunchCompletionFlag;
167 BitField<8, 1, u32> InitialLaunchUserAdditionFlag;
168 BitField<16, 1, u32> InitialLaunchTimestampFlag;
169 };
170 };
171 static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size");
172
173 /// This is nn::settings::system::NotificationFlag
174 struct NotificationFlag {
175 union {
176 u32 raw{};
177
178 BitField<0, 1, u32> RingtoneFlag;
179 BitField<1, 1, u32> DownloadCompletionFlag;
180 BitField<8, 1, u32> EnablesNews;
181 BitField<9, 1, u32> IncomingLampFlag;
182 };
183 };
184 static_assert(sizeof(NotificationFlag) == 4, "NotificationFlag is an invalid size");
185
186 /// This is nn::settings::system::AccountNotificationFlag
187 struct AccountNotificationFlag {
188 union {
189 u32 raw{};
190
191 BitField<0, 1, u32> FriendOnlineFlag;
192 BitField<1, 1, u32> FriendRequestFlag;
193 BitField<8, 1, u32> CoralInvitationFlag;
194 };
195 };
196 static_assert(sizeof(AccountNotificationFlag) == 4,
197 "AccountNotificationFlag is an invalid size");
198
199 /// This is nn::settings::system::TvSettings
200 struct TvSettings {
201 TvFlag flags;
202 TvResolution tv_resolution;
203 HdmiContentType hdmi_content_type;
204 RgbRange rgb_range;
205 CmuMode cmu_mode;
206 u32 tv_underscan;
207 f32 tv_gama;
208 f32 constrast_ratio;
209 };
210 static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size");
211
212 /// This is nn::settings::system::NotificationTime
213 struct NotificationTime {
214 u32 hour;
215 u32 minute;
216 };
217 static_assert(sizeof(NotificationTime) == 0x8, "NotificationTime is an invalid size");
218
219 /// This is nn::settings::system::NotificationSettings
220 struct NotificationSettings {
221 NotificationFlag flags;
222 NotificationVolume volume;
223 NotificationTime start_time;
224 NotificationTime stop_time;
225 };
226 static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size");
227
228 /// This is nn::settings::system::AccountSettings
229 struct AccountSettings {
230 u32 flags;
231 };
232 static_assert(sizeof(AccountSettings) == 0x4, "AccountSettings is an invalid size");
233
234 /// This is nn::settings::system::AccountNotificationSettings
235 struct AccountNotificationSettings {
236 Common::UUID uid;
237 AccountNotificationFlag flags;
238 FriendPresenceOverlayPermission friend_presence_permission;
239 FriendPresenceOverlayPermission friend_invitation_permission;
240 INSERT_PADDING_BYTES(0x2);
241 };
242 static_assert(sizeof(AccountNotificationSettings) == 0x18,
243 "AccountNotificationSettings is an invalid size");
244
245 /// This is nn::settings::system::InitialLaunchSettings
246 struct SleepSettings {
247 SleepFlag flags;
248 HandheldSleepPlan handheld_sleep_plan;
249 ConsoleSleepPlan console_sleep_plan;
250 };
251 static_assert(sizeof(SleepSettings) == 0xc, "SleepSettings is incorrect size");
252
253 /// This is nn::settings::system::InitialLaunchSettings
254 struct InitialLaunchSettings {
255 InitialLaunchFlag flags;
256 INSERT_PADDING_BYTES(0x4);
257 Time::Clock::SteadyClockTimePoint timestamp;
258 };
259 static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size");
260
261 /// This is nn::settings::system::InitialLaunchSettings
262 struct EulaVersion {
263 u32 version;
264 RegionCode region_code;
265 EulaVersionClockType clock_type;
266 INSERT_PADDING_BYTES(0x4);
267 s64 posix_time;
268 Time::Clock::SteadyClockTimePoint timestamp;
269 };
270 static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
271
272 void SetLanguageCode(HLERequestContext& ctx);
28 void GetFirmwareVersion(HLERequestContext& ctx); 273 void GetFirmwareVersion(HLERequestContext& ctx);
29 void GetFirmwareVersion2(HLERequestContext& ctx); 274 void GetFirmwareVersion2(HLERequestContext& ctx);
275 void GetAccountSettings(HLERequestContext& ctx);
276 void SetAccountSettings(HLERequestContext& ctx);
277 void GetEulaVersions(HLERequestContext& ctx);
278 void SetEulaVersions(HLERequestContext& ctx);
30 void GetColorSetId(HLERequestContext& ctx); 279 void GetColorSetId(HLERequestContext& ctx);
31 void SetColorSetId(HLERequestContext& ctx); 280 void SetColorSetId(HLERequestContext& ctx);
281 void GetNotificationSettings(HLERequestContext& ctx);
282 void SetNotificationSettings(HLERequestContext& ctx);
283 void GetAccountNotificationSettings(HLERequestContext& ctx);
284 void SetAccountNotificationSettings(HLERequestContext& ctx);
285 void GetSettingsItemValueSize(HLERequestContext& ctx);
286 void GetSettingsItemValue(HLERequestContext& ctx);
287 void GetTvSettings(HLERequestContext& ctx);
288 void SetTvSettings(HLERequestContext& ctx);
289 void GetQuestFlag(HLERequestContext& ctx);
290 void SetRegionCode(HLERequestContext& ctx);
291 void GetPrimaryAlbumStorage(HLERequestContext& ctx);
292 void GetSleepSettings(HLERequestContext& ctx);
293 void SetSleepSettings(HLERequestContext& ctx);
294 void GetInitialLaunchSettings(HLERequestContext& ctx);
295 void SetInitialLaunchSettings(HLERequestContext& ctx);
32 void GetDeviceNickName(HLERequestContext& ctx); 296 void GetDeviceNickName(HLERequestContext& ctx);
297 void SetDeviceNickName(HLERequestContext& ctx);
298 void GetProductModel(HLERequestContext& ctx);
299 void GetMiiAuthorId(HLERequestContext& ctx);
300 void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
301 void GetBatteryPercentageFlag(HLERequestContext& ctx);
302 void GetErrorReportSharePermission(HLERequestContext& ctx);
303 void GetAppletLaunchFlags(HLERequestContext& ctx);
304 void SetAppletLaunchFlags(HLERequestContext& ctx);
305 void GetKeyboardLayout(HLERequestContext& ctx);
306 void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
307 void GetFieldTestingFlag(HLERequestContext& ctx);
308
309 AccountSettings account_settings{
310 .flags = {},
311 };
33 312
34 ColorSet color_set = ColorSet::BasicWhite; 313 ColorSet color_set = ColorSet::BasicWhite;
314
315 NotificationSettings notification_settings{
316 .flags = {0x300},
317 .volume = NotificationVolume::High,
318 .start_time = {.hour = 9, .minute = 0},
319 .stop_time = {.hour = 21, .minute = 0},
320 };
321
322 std::vector<AccountNotificationSettings> account_notifications{};
323
324 TvSettings tv_settings{
325 .flags = {0xc},
326 .tv_resolution = TvResolution::Auto,
327 .hdmi_content_type = HdmiContentType::Game,
328 .rgb_range = RgbRange::Auto,
329 .cmu_mode = CmuMode::None,
330 .tv_underscan = {},
331 .tv_gama = 1.0f,
332 .constrast_ratio = 0.5f,
333 };
334
335 InitialLaunchSettings launch_settings{
336 .flags = {0x10001},
337 .timestamp = {},
338 };
339
340 SleepSettings sleep_settings{
341 .flags = {0x3},
342 .handheld_sleep_plan = HandheldSleepPlan::Sleep10Min,
343 .console_sleep_plan = ConsoleSleepPlan::Sleep1Hour,
344 };
345
346 u32 applet_launch_flag{};
347
348 std::vector<EulaVersion> eula_versions{};
349
350 RegionCode region_code;
351
352 LanguageCode language_code_setting;
35}; 353};
36 354
37} // namespace Service::Set 355} // namespace Service::Set
diff --git a/src/shader_recompiler/environment.h b/src/shader_recompiler/environment.h
index 26e8307c1..15285ab0a 100644
--- a/src/shader_recompiler/environment.h
+++ b/src/shader_recompiler/environment.h
@@ -39,7 +39,7 @@ public:
39 [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank, 39 [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank,
40 u32 offset) = 0; 40 u32 offset) = 0;
41 41
42 virtual void Dump(u64 hash) = 0; 42 virtual void Dump(u64 pipeline_hash, u64 shader_hash) = 0;
43 43
44 [[nodiscard]] const ProgramHeader& SPH() const noexcept { 44 [[nodiscard]] const ProgramHeader& SPH() const noexcept {
45 return sph; 45 return sph;
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 618cb6354..2888e0238 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -445,7 +445,8 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
445 ShaderContext::ShaderPools& pools, const GraphicsPipelineKey& key, 445 ShaderContext::ShaderPools& pools, const GraphicsPipelineKey& key,
446 std::span<Shader::Environment* const> envs, bool use_shader_workers, 446 std::span<Shader::Environment* const> envs, bool use_shader_workers,
447 bool force_context_flush) try { 447 bool force_context_flush) try {
448 LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); 448 auto hash = key.Hash();
449 LOG_INFO(Render_OpenGL, "0x{:016x}", hash);
449 size_t env_index{}; 450 size_t env_index{};
450 u32 total_storage_buffers{}; 451 u32 total_storage_buffers{};
451 std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; 452 std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs;
@@ -474,7 +475,7 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
474 Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); 475 Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0);
475 476
476 if (Settings::values.dump_shaders) { 477 if (Settings::values.dump_shaders) {
477 env.Dump(key.unique_hashes[index]); 478 env.Dump(hash, key.unique_hashes[index]);
478 } 479 }
479 480
480 if (!uses_vertex_a || index != 1) { 481 if (!uses_vertex_a || index != 1) {
@@ -566,12 +567,13 @@ std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
566std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline( 567std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
567 ShaderContext::ShaderPools& pools, const ComputePipelineKey& key, Shader::Environment& env, 568 ShaderContext::ShaderPools& pools, const ComputePipelineKey& key, Shader::Environment& env,
568 bool force_context_flush) try { 569 bool force_context_flush) try {
569 LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); 570 auto hash = key.Hash();
571 LOG_INFO(Render_OpenGL, "0x{:016x}", hash);
570 572
571 Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; 573 Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()};
572 574
573 if (Settings::values.dump_shaders) { 575 if (Settings::values.dump_shaders) {
574 env.Dump(key.Hash()); 576 env.Dump(hash, key.unique_hash);
575 } 577 }
576 578
577 auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; 579 auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)};
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 4f84d8497..c1314ca99 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -584,7 +584,8 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
584 ShaderPools& pools, const GraphicsPipelineCacheKey& key, 584 ShaderPools& pools, const GraphicsPipelineCacheKey& key,
585 std::span<Shader::Environment* const> envs, PipelineStatistics* statistics, 585 std::span<Shader::Environment* const> envs, PipelineStatistics* statistics,
586 bool build_in_parallel) try { 586 bool build_in_parallel) try {
587 LOG_INFO(Render_Vulkan, "0x{:016x}", key.Hash()); 587 auto hash = key.Hash();
588 LOG_INFO(Render_Vulkan, "0x{:016x}", hash);
588 size_t env_index{0}; 589 size_t env_index{0};
589 std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; 590 std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs;
590 const bool uses_vertex_a{key.unique_hashes[0] != 0}; 591 const bool uses_vertex_a{key.unique_hashes[0] != 0};
@@ -611,7 +612,7 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
611 const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; 612 const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))};
612 Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); 613 Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0);
613 if (Settings::values.dump_shaders) { 614 if (Settings::values.dump_shaders) {
614 env.Dump(key.unique_hashes[index]); 615 env.Dump(hash, key.unique_hashes[index]);
615 } 616 }
616 if (!uses_vertex_a || index != 1) { 617 if (!uses_vertex_a || index != 1) {
617 // Normal path 618 // Normal path
@@ -712,18 +713,19 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
712std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( 713std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
713 ShaderPools& pools, const ComputePipelineCacheKey& key, Shader::Environment& env, 714 ShaderPools& pools, const ComputePipelineCacheKey& key, Shader::Environment& env,
714 PipelineStatistics* statistics, bool build_in_parallel) try { 715 PipelineStatistics* statistics, bool build_in_parallel) try {
716 auto hash = key.Hash();
715 if (device.HasBrokenCompute()) { 717 if (device.HasBrokenCompute()) {
716 LOG_ERROR(Render_Vulkan, "Skipping 0x{:016x}", key.Hash()); 718 LOG_ERROR(Render_Vulkan, "Skipping 0x{:016x}", hash);
717 return nullptr; 719 return nullptr;
718 } 720 }
719 721
720 LOG_INFO(Render_Vulkan, "0x{:016x}", key.Hash()); 722 LOG_INFO(Render_Vulkan, "0x{:016x}", hash);
721 723
722 Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; 724 Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()};
723 725
724 // Dump it before error. 726 // Dump it before error.
725 if (Settings::values.dump_shaders) { 727 if (Settings::values.dump_shaders) {
726 env.Dump(key.Hash()); 728 env.Dump(hash, key.unique_hash);
727 } 729 }
728 730
729 auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; 731 auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)};
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp
index 01701201d..e81cd031b 100644
--- a/src/video_core/shader_cache.cpp
+++ b/src/video_core/shader_cache.cpp
@@ -51,6 +51,11 @@ bool ShaderCache::RefreshStages(std::array<u64, 6>& unique_hashes) {
51 } 51 }
52 const auto& shader_config{maxwell3d->regs.pipelines[index]}; 52 const auto& shader_config{maxwell3d->regs.pipelines[index]};
53 const auto program{static_cast<Tegra::Engines::Maxwell3D::Regs::ShaderType>(index)}; 53 const auto program{static_cast<Tegra::Engines::Maxwell3D::Regs::ShaderType>(index)};
54 if (program == Tegra::Engines::Maxwell3D::Regs::ShaderType::Pixel &&
55 !maxwell3d->regs.rasterize_enable) {
56 unique_hashes[index] = 0;
57 continue;
58 }
54 const GPUVAddr shader_addr{base_addr + shader_config.offset}; 59 const GPUVAddr shader_addr{base_addr + shader_config.offset};
55 const std::optional<VAddr> cpu_shader_addr{gpu_memory->GpuToCpuAddress(shader_addr)}; 60 const std::optional<VAddr> cpu_shader_addr{gpu_memory->GpuToCpuAddress(shader_addr)};
56 if (!cpu_shader_addr) { 61 if (!cpu_shader_addr) {
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h
index de8e08002..a76896620 100644
--- a/src/video_core/shader_cache.h
+++ b/src/video_core/shader_cache.h
@@ -70,7 +70,7 @@ public:
70protected: 70protected:
71 struct GraphicsEnvironments { 71 struct GraphicsEnvironments {
72 std::array<GraphicsEnvironment, NUM_PROGRAMS> envs; 72 std::array<GraphicsEnvironment, NUM_PROGRAMS> envs;
73 std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs; 73 std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs{};
74 74
75 std::span<Shader::Environment* const> Span() const noexcept { 75 std::span<Shader::Environment* const> Span() const noexcept {
76 return std::span(env_ptrs.begin(), std::ranges::find(env_ptrs, nullptr)); 76 return std::span(env_ptrs.begin(), std::ranges::find(env_ptrs, nullptr));
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp
index c7cb56243..4edbe5700 100644
--- a/src/video_core/shader_environment.cpp
+++ b/src/video_core/shader_environment.cpp
@@ -102,7 +102,8 @@ static std::string_view StageToPrefix(Shader::Stage stage) {
102 } 102 }
103} 103}
104 104
105static void DumpImpl(u64 hash, const u64* code, u32 read_highest, u32 read_lowest, 105static void DumpImpl(u64 pipeline_hash, u64 shader_hash, std::span<const u64> code,
106 [[maybe_unused]] u32 read_highest, [[maybe_unused]] u32 read_lowest,
106 u32 initial_offset, Shader::Stage stage) { 107 u32 initial_offset, Shader::Stage stage) {
107 const auto shader_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)}; 108 const auto shader_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)};
108 const auto base_dir{shader_dir / "shaders"}; 109 const auto base_dir{shader_dir / "shaders"};
@@ -111,13 +112,18 @@ static void DumpImpl(u64 hash, const u64* code, u32 read_highest, u32 read_lowes
111 return; 112 return;
112 } 113 }
113 const auto prefix = StageToPrefix(stage); 114 const auto prefix = StageToPrefix(stage);
114 const auto name{base_dir / fmt::format("{}{:016x}.ash", prefix, hash)}; 115 const auto name{base_dir /
115 const size_t real_size = read_highest - read_lowest + initial_offset; 116 fmt::format("{:016x}_{}_{:016x}.ash", pipeline_hash, prefix, shader_hash)};
116 const size_t padding_needed = ((32 - (real_size % 32)) % 32);
117 std::fstream shader_file(name, std::ios::out | std::ios::binary); 117 std::fstream shader_file(name, std::ios::out | std::ios::binary);
118 ASSERT(initial_offset % sizeof(u64) == 0);
118 const size_t jump_index = initial_offset / sizeof(u64); 119 const size_t jump_index = initial_offset / sizeof(u64);
119 shader_file.write(reinterpret_cast<const char*>(code + jump_index), real_size); 120 const size_t code_size = code.size_bytes() - initial_offset;
120 for (size_t i = 0; i < padding_needed; i++) { 121 shader_file.write(reinterpret_cast<const char*>(&code[jump_index]), code_size);
122
123 // + 1 instruction, due to the fact that we skip the final self branch instruction in the code,
124 // but we need to consider it for padding, otherwise nvdisasm rages.
125 const size_t padding_needed = (32 - ((code_size + INST_SIZE) % 32)) % 32;
126 for (size_t i = 0; i < INST_SIZE + padding_needed; i++) {
121 shader_file.put(0); 127 shader_file.put(0);
122 } 128 }
123} 129}
@@ -197,8 +203,8 @@ u64 GenericEnvironment::CalculateHash() const {
197 return Common::CityHash64(data.get(), size); 203 return Common::CityHash64(data.get(), size);
198} 204}
199 205
200void GenericEnvironment::Dump(u64 hash) { 206void GenericEnvironment::Dump(u64 pipeline_hash, u64 shader_hash) {
201 DumpImpl(hash, code.data(), read_highest, read_lowest, initial_offset, stage); 207 DumpImpl(pipeline_hash, shader_hash, code, read_highest, read_lowest, initial_offset, stage);
202} 208}
203 209
204void GenericEnvironment::Serialize(std::ofstream& file) const { 210void GenericEnvironment::Serialize(std::ofstream& file) const {
@@ -282,6 +288,7 @@ std::optional<u64> GenericEnvironment::TryFindSize() {
282Tegra::Texture::TICEntry GenericEnvironment::ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit, 288Tegra::Texture::TICEntry GenericEnvironment::ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit,
283 bool via_header_index, u32 raw) { 289 bool via_header_index, u32 raw) {
284 const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)}; 290 const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)};
291 ASSERT(handle.first <= tic_limit);
285 const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)}; 292 const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)};
286 Tegra::Texture::TICEntry entry; 293 Tegra::Texture::TICEntry entry;
287 gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry)); 294 gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry));
@@ -465,8 +472,8 @@ void FileEnvironment::Deserialize(std::ifstream& file) {
465 .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) 472 .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest))
466 .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state)) 473 .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state))
467 .read(reinterpret_cast<char*>(&stage), sizeof(stage)); 474 .read(reinterpret_cast<char*>(&stage), sizeof(stage));
468 code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64))); 475 code.resize(Common::DivCeil(code_size, sizeof(u64)));
469 file.read(reinterpret_cast<char*>(code.get()), code_size); 476 file.read(reinterpret_cast<char*>(code.data()), code_size);
470 for (size_t i = 0; i < num_texture_types; ++i) { 477 for (size_t i = 0; i < num_texture_types; ++i) {
471 u32 key; 478 u32 key;
472 Shader::TextureType type; 479 Shader::TextureType type;
@@ -509,8 +516,8 @@ void FileEnvironment::Deserialize(std::ifstream& file) {
509 is_propietary_driver = texture_bound == 2; 516 is_propietary_driver = texture_bound == 2;
510} 517}
511 518
512void FileEnvironment::Dump(u64 hash) { 519void FileEnvironment::Dump(u64 pipeline_hash, u64 shader_hash) {
513 DumpImpl(hash, code.get(), read_highest, read_lowest, initial_offset, stage); 520 DumpImpl(pipeline_hash, shader_hash, code, read_highest, read_lowest, initial_offset, stage);
514} 521}
515 522
516u64 FileEnvironment::ReadInstruction(u32 address) { 523u64 FileEnvironment::ReadInstruction(u32 address) {
diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h
index a0f61cbda..b90f3d44e 100644
--- a/src/video_core/shader_environment.h
+++ b/src/video_core/shader_environment.h
@@ -58,7 +58,7 @@ public:
58 58
59 [[nodiscard]] u64 CalculateHash() const; 59 [[nodiscard]] u64 CalculateHash() const;
60 60
61 void Dump(u64 hash) override; 61 void Dump(u64 pipeline_hash, u64 shader_hash) override;
62 62
63 void Serialize(std::ofstream& file) const; 63 void Serialize(std::ofstream& file) const;
64 64
@@ -188,10 +188,10 @@ public:
188 return cbuf_replacements.size() != 0; 188 return cbuf_replacements.size() != 0;
189 } 189 }
190 190
191 void Dump(u64 hash) override; 191 void Dump(u64 pipeline_hash, u64 shader_hash) override;
192 192
193private: 193private:
194 std::unique_ptr<u64[]> code; 194 std::vector<u64> code;
195 std::unordered_map<u32, Shader::TextureType> texture_types; 195 std::unordered_map<u32, Shader::TextureType> texture_types;
196 std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; 196 std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats;
197 std::unordered_map<u64, u32> cbuf_values; 197 std::unordered_map<u64, u32> cbuf_values;