Compare commits

..

4 Commits

Author SHA1 Message Date
FearlessTobi
2694f81462 Revert "Silence nifm spam"
This reverts commit 4da4ecb1ff.
2023-08-14 21:23:09 +02:00
bunnei
9d3a293a4e Merge pull request #11093 from liamwhite/result-ergonomics
core: remove ResultVal type
2023-08-09 21:24:31 -07:00
bunnei
3d6ce9dd2b Merge pull request #11247 from german77/pctl
service: pctl: Partially revert 11221
2023-08-09 21:24:06 -07:00
Narr the Reg
6a43aff745 service: pctl: Partially revert 11221 2023-08-08 16:52:21 -06:00
3 changed files with 30 additions and 11 deletions

View File

@@ -152,7 +152,7 @@ private:
if (pin_code[0] == '\0') {
return true;
}
if (!restriction_settings.is_free_communication_default_on) {
if (!settings.is_free_communication_default_on) {
return true;
}
// TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here
@@ -168,21 +168,21 @@ private:
if (pin_code[0] == '\0') {
return true;
}
if (!restriction_settings.is_stero_vision_restricted) {
if (!settings.is_stero_vision_restricted) {
return false;
}
return true;
}
void SetStereoVisionRestrictionImpl(bool is_restricted) {
if (restriction_settings.disabled) {
if (settings.disabled) {
return;
}
if (pin_code[0] == '\0') {
return;
}
restriction_settings.is_stero_vision_restricted = is_restricted;
settings.is_stero_vision_restricted = is_restricted;
}
void Initialize(HLERequestContext& ctx) {
@@ -430,7 +430,7 @@ private:
}
rb.Push(ResultSuccess);
rb.Push(restriction_settings.is_stero_vision_restricted);
rb.Push(settings.is_stero_vision_restricted);
}
void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) {
@@ -460,22 +460,28 @@ private:
bool stereo_vision{};
};
// This is nn::pctl::RestrictionSettings
struct RestrictionSettings {
struct ParentalControlSettings {
bool is_stero_vision_restricted{};
bool is_free_communication_default_on{};
bool disabled{};
};
// This is nn::pctl::RestrictionSettings
struct RestrictionSettings {
u8 rating_age;
bool sns_post_restriction;
bool free_communication_restriction;
};
static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size.");
// This is nn::pctl::PlayTimerSettings
struct PlayTimerSettings {
// TODO: RE the actual contents of this struct
std::array<u8, 0x34> settings;
std::array<u32, 13> settings;
};
static_assert(sizeof(PlayTimerSettings) == 0x34, "PlayTimerSettings has incorrect size.");
States states{};
ParentalControlSettings settings{};
RestrictionSettings restriction_settings{};
std::array<char, 8> pin_code{};
Capability capability{};

View File

@@ -476,7 +476,13 @@ NetworkInstance::~NetworkInstance() {
std::optional<IPv4Address> GetHostIPv4Address() {
const auto network_interface = Network::GetSelectedNetworkInterface();
if (!network_interface.has_value()) {
LOG_DEBUG(Network, "GetSelectedNetworkInterface returned no interface");
// Only print the error once to avoid log spam
static bool print_error = true;
if (print_error) {
LOG_ERROR(Network, "GetSelectedNetworkInterface returned no interface");
print_error = false;
}
return {};
}

View File

@@ -200,7 +200,14 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() {
});
if (res == network_interfaces.end()) {
LOG_DEBUG(Network, "Couldn't find selected interface \"{}\"", selected_network_interface);
// Only print the error once to avoid log spam
static bool print_error = true;
if (print_error) {
LOG_ERROR(Network, "Couldn't find selected interface \"{}\"",
selected_network_interface);
print_error = false;
}
return std::nullopt;
}