Merge commit '01d9c403f2' into torzu-merging

This commit is contained in:
marius david 2025-01-01 18:16:47 +01:00
commit ad61f5f432
9 changed files with 96 additions and 7 deletions

View File

@ -54,6 +54,7 @@ constexpr u32 GetRevisionNum(u32 user_revision) {
user_revision -= Common::MakeMagic('R', 'E', 'V', '0');
user_revision >>= 24;
}
return user_revision;
};

View File

@ -24,6 +24,7 @@ enum class ErrorModule : u32 {
HTCS = 4,
NCM = 5,
DD = 6,
OSDBG = 7,
LR = 8,
Loader = 9,
CMIF = 10,
@ -51,6 +52,7 @@ enum class ErrorModule : u32 {
Util = 33,
TIPC = 35,
ANIF = 37,
CRT = 39,
ETHC = 100,
I2C = 101,
GPIO = 102,
@ -106,6 +108,7 @@ enum class ErrorModule : u32 {
Audio = 153,
NPNS = 154,
NPNSHTTPSTREAM = 155,
IDLE = 156,
ARP = 157,
SWKBD = 158,
BOOT = 159,
@ -115,6 +118,7 @@ enum class ErrorModule : u32 {
Fatal = 163,
NIMShop = 164,
SPSM = 165,
AOC = 166,
BGTC = 167,
UserlandCrash = 168,
SASBUS = 169,
@ -176,13 +180,22 @@ enum class ErrorModule : u32 {
DP2HDMI = 244,
Cradle = 245,
SProfile = 246,
Icm42607p = 248,
NDRM = 250,
Fst2 = 251,
Nex = 306,
NPLN = 321,
TSPM = 499,
DevMenu = 500,
Nverpt = 520,
Am_StuckMonitor = 521,
Pia = 618,
Eagle = 623,
GeneralWebApplet = 800,
WifiWebAuthApplet = 809,
WhitelistedApplet = 810,
ShopN = 811,
Coral = 815
};
/// Encapsulates a Horizon OS error code, allowing it to be separated into its constituent fields.

View File

@ -9,7 +9,7 @@ namespace Service::AM {
LifecycleManager::LifecycleManager(Core::System& system, KernelHelpers::ServiceContext& context,
bool is_application)
: m_system_event(context), m_operation_mode_changed_system_event(context),
m_is_application(is_application) {}
m_hdcp_state_changed_event(context), m_is_application(is_application) {}
LifecycleManager::~LifecycleManager() = default;
@ -21,6 +21,10 @@ Event& LifecycleManager::GetOperationModeChangedSystemEvent() {
return m_operation_mode_changed_system_event;
}
Event& LifecycleManager::GetHDCPStateChangedEvent() {
return m_hdcp_state_changed_event;
}
void LifecycleManager::PushUnorderedMessage(AppletMessage message) {
m_unordered_messages.push_back(message);
this->SignalSystemEventIfNeeded();

View File

@ -42,6 +42,7 @@ public:
public:
Event& GetSystemEvent();
Event& GetOperationModeChangedSystemEvent();
Event& GetHDCPStateChangedEvent();
public:
bool IsApplication() {
@ -145,12 +146,14 @@ private:
private:
Event m_system_event;
Event m_operation_mode_changed_system_event;
Event m_hdcp_state_changed_event;
std::list<AppletMessage> m_unordered_messages{};
bool m_is_application{};
bool m_focus_state_changed_notification_enabled{true};
bool m_operation_mode_changed_notification_enabled{true};
bool m_hdcp_state_changed_notification_enabled{true};
bool m_performance_mode_changed_notification_enabled{true};
bool m_resume_notification_enabled{};

View File

@ -48,8 +48,8 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap
{59, nullptr, "SetVrPositionForDebug"},
{60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"},
{61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"},
{62, nullptr, "GetHdcpAuthenticationState"},
{63, nullptr, "GetHdcpAuthenticationStateChangeEvent"},
{62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"},
{63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"},
{64, nullptr, "SetTvPowerStateMatchingMode"},
{65, nullptr, "GetApplicationIdByContentActionName"},
{66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
@ -140,6 +140,19 @@ Result ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(
R_SUCCEED();
}
Result ICommonStateGetter::GetHdcpAuthenticationState(Out<s32> out_state) {
LOG_DEBUG(Service_AM, "called");
*out_state = 1;
R_SUCCEED();
}
Result ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->lifecycle_manager.GetHDCPStateChangedEvent().GetHandle();
R_SUCCEED();
}
Result ICommonStateGetter::GetOperationMode(Out<OperationMode> out_operation_mode) {
const bool use_docked_mode{Settings::IsDockedMode()};
LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);

View File

@ -35,6 +35,8 @@ private:
Result GetWriterLockAccessorEx(Out<SharedPointer<ILockAccessor>> out_lock_accessor,
u32 button_type);
Result GetDefaultDisplayResolutionChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetHdcpAuthenticationState(Out<s32> out_state);
Result GetHdcpAuthenticationStateChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetOperationMode(Out<OperationMode> out_operation_mode);
Result GetPerformanceMode(Out<APM::PerformanceMode> out_performance_mode);
Result GetBootMode(Out<PM::SystemBootMode> out_boot_mode);

View File

@ -41,6 +41,7 @@ enum class IoMode : u32 {
enum class OptionType : u32 {
DoNotCloseSocket = 0,
GetServerCertChain = 1,
EnableAlpn = 3,
};
// This is nn::ssl::sf::SslVersion
@ -96,8 +97,8 @@ public:
{23, nullptr, "GetOption"},
{24, nullptr, "GetVerifyCertErrors"},
{25, nullptr, "GetCipherInfo"},
{26, nullptr, "SetNextAlpnProto"},
{27, nullptr, "GetNextAlpnProto"},
{26, &ISslConnection::SetNextAlpnProto, "SetNextAlpnProto"},
{27, &ISslConnection::GetNextAlpnProto, "GetNextAlpnProto"},
{28, nullptr, "SetDtlsSocketDescriptor"},
{29, nullptr, "GetDtlsHandshakeTimeout"},
{30, nullptr, "SetPrivateOption"},
@ -142,6 +143,7 @@ private:
bool get_server_cert_chain = false;
std::shared_ptr<Network::SocketBase> socket;
bool did_handshake = false;
bool enable_alpn = false;
Result SetSocketDescriptorImpl(s32* out_fd, s32 fd) {
LOG_DEBUG(Service_SSL, "called, fd={}", fd);
@ -381,6 +383,10 @@ private:
case OptionType::GetServerCertChain:
get_server_cert_chain = static_cast<bool>(parameters.value);
break;
case OptionType::EnableAlpn:
LOG_ERROR(Service_SSL, "Called with option={}, value={} (STUBBED)", parameters.option, parameters.value);
enable_alpn = static_cast<bool>(parameters.value);
break;
default:
LOG_WARNING(Service_SSL, "Unknown option={}, value={}", parameters.option,
parameters.value);
@ -389,6 +395,20 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SetNextAlpnProto(HLERequestContext& ctx) {
LOG_ERROR(Service_SSL, "(STUBBED) called.");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void GetNextAlpnProto(HLERequestContext& ctx) {
LOG_ERROR(Service_SSL, "(STUBBED) called.");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
}
};
class ISslContext final : public ServiceFramework<ISslContext> {

View File

@ -1204,7 +1204,19 @@ void RasterizerOpenGL::SyncLogicOpState() {
}
flags[Dirty::LogicOp] = false;
const auto& regs = maxwell3d->regs;
auto regs = maxwell3d->regs;
if (device.IsAmd()) {
auto IsFloat = [] (Tegra::Engines::Maxwell3D::Regs::VertexAttribute n) {
return n.type == Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type::Float;
};
bool has_float =
std::any_of(regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(),
IsFloat);
regs.logic_op.enable = static_cast<u32>(!has_float);
}
if (regs.logic_op.enable) {
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.op));

View File

@ -952,7 +952,28 @@ void RasterizerVulkan::UpdateDynamicStates() {
UpdateDepthBiasEnable(regs);
}
if (device.IsExtExtendedDynamicState3EnablesSupported()) {
UpdateLogicOpEnable(regs);
const auto old = regs.logic_op.enable;
if (device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE ||
device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR) {
struct In {
const Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type d;
In(Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type n) : d(n) {}
bool operator()(Tegra::Engines::Maxwell3D::Regs::VertexAttribute n) const {
return n.type == d;
}
};
auto has_float = std::any_of(
regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(),
In(Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type::Float));
regs.logic_op.enable = static_cast<u32>(!has_float);
UpdateLogicOpEnable(regs);
regs.logic_op.enable = old;
} else {
UpdateLogicOpEnable(regs);
}
UpdateDepthClampEnable(regs);
}
}