[hle] Fixes for nxident, nxmp and nxplay, remove hbl.nsp workarounds (#3996)

adds `gpio` and `i2c` services
implements `IApplicationFunctions::SetMediaPlaybackStateForApplicatio`
stubs `IBtmSystemCore::GetDiscoveredAudioDevice`
implements `nvhost_ctrl_gpu::PmuGetGpuLoad` IOCTL (0x20)
implements `PSM::GetBatteryAgePercentage`, `PSM::GetBatteryVoltageState` and `PSM::GetBatteryChargeInfoFields`
implements `ISystemSettingsServer::GetConsoleInformationUploadFlag`, `ISystemSettingsServer::SetConsoleInformationUploadFlag`, `ISystemSettingsServer::GetAutomaticApplicationDownloadFlag`, `ISystemSettingsServer::SetAutomaticApplicationDownloadFlag`, `&ISystemSettingsServer::GetUsb30EnableFlag`, `ISystemSettingsServer::SetUsb30EnableFlag`
removes `hbl.nsp` specific workarounds

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3996
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
lizzie 2026-06-12 23:48:24 +02:00 committed by crueter
parent 86895a5f6a
commit 3875093c70
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
29 changed files with 356 additions and 60 deletions

View file

@ -1121,6 +1121,10 @@ add_library(core STATIC
hle/service/vi/vi_types.h
hle/service/vi/vsync_manager.cpp
hle/service/vi/vsync_manager.h
hle/service/gpio/gpio.cpp
hle/service/gpio/gpio.h
hle/service/i2c/i2c.cpp
hle/service/i2c/i2c.h
internal_network/emu_net_state.cpp
internal_network/emu_net_state.h
internal_network/network.cpp

View file

@ -1174,8 +1174,7 @@ KProcess::KProcess(KernelCore& kernel)
KProcess::~KProcess() = default;
Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size,
KProcessAddress aslr_space_start, size_t aslr_space_offset, bool is_hbl) {
Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size, KProcessAddress aslr_space_start, size_t aslr_space_offset) {
// Create a resource limit for the process.
const auto pool = static_cast<KMemoryManager::Pool>(metadata.GetPoolPartition());
const auto physical_memory_size = m_kernel.MemoryManager().GetSize(pool);
@ -1247,7 +1246,6 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std:
aslr_space_start));
// Assign remaining properties.
m_is_hbl = is_hbl;
m_ideal_core_id = metadata.GetMainThreadCore();
// Set up emulation context.

View file

@ -133,7 +133,6 @@ private:
bool m_is_initialized : 1 = false;
bool m_is_application : 1 = false;
bool m_is_default_application_system_resource : 1 = false;
bool m_is_hbl : 1 = false;
bool m_is_suspended : 1 = false;
bool m_is_immortal : 1 = false;
bool m_is_handle_table_initialized : 1 = false;
@ -277,10 +276,6 @@ public:
return m_capabilities.CanForceDebug();
}
bool IsHbl() const {
return m_is_hbl;
}
u32 GetAllocateOption() const {
return m_page_table.GetAllocateOption();
}
@ -514,8 +509,7 @@ public:
}
public:
Result LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size,
KProcessAddress aslr_space_start, size_t aslr_space_offset, bool is_hbl);
Result LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size, KProcessAddress aslr_space_start, size_t aslr_space_offset);
void LoadModule(CodeSet code_set, KProcessAddress base_addr);

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -106,9 +109,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
system.CurrentPhysicalCore().LogBacktrace();
}
const bool is_hbl = GetCurrentProcess(system.Kernel()).IsHbl();
const bool should_break = is_hbl || !notification_only;
const bool should_break = !notification_only;
if (system.DebuggerEnabled() && should_break) {
auto* thread = system.Kernel().GetCurrentEmuThread();
system.GetDebugger().NotifyThreadStopped(thread);

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
@ -83,6 +83,7 @@ struct Applet {
// Application functions
bool game_play_recording_supported{};
bool media_playback_state{};
GamePlayRecordingState game_play_recording_state{GamePlayRecordingState::Disabled};
bool jit_service_launched{};
bool application_crash_report_enabled{};

View file

@ -11,6 +11,7 @@
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/savedata_factory.h"
#include "core/hle/kernel/k_transfer_memory.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am_results.h"
#include "core/hle/service/am/applet.h"
#include "core/hle/service/am/service/application_functions.h"
@ -56,7 +57,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_
{37, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"},
{40, D<&IApplicationFunctions::NotifyRunning>, "NotifyRunning"},
{50, D<&IApplicationFunctions::GetPseudoDeviceId>, "GetPseudoDeviceId"},
{60, nullptr, "SetMediaPlaybackStateForApplication"},
{60, D<&IApplicationFunctions::SetMediaPlaybackStateForApplication>, "SetMediaPlaybackStateForApplication"},
{65, D<&IApplicationFunctions::IsGamePlayRecordingSupported>, "IsGamePlayRecordingSupported"},
{66, D<&IApplicationFunctions::InitializeGamePlayRecording>, "InitializeGamePlayRecording"},
{67, D<&IApplicationFunctions::SetGamePlayRecordingState>, "SetGamePlayRecordingState"},
@ -364,6 +365,13 @@ Result IApplicationFunctions::InitializeGamePlayRecording(
R_SUCCEED();
}
Result IApplicationFunctions::SetMediaPlaybackStateForApplication(bool enabled) {
LOG_WARNING(Service_AM, "(stubbed) {}", enabled);
std::scoped_lock lk{m_applet->lock};
m_applet->media_playback_state = enabled;
R_SUCCEED();
}
Result IApplicationFunctions::SetGamePlayRecordingState(
GamePlayRecordingState game_play_recording_state) {
LOG_WARNING(Service_AM, "(STUBBED) called");

View file

@ -53,6 +53,7 @@ private:
Result IsGamePlayRecordingSupported(Out<bool> out_is_game_play_recording_supported);
Result InitializeGamePlayRecording(
u64 transfer_memory_size, InCopyHandle<Kernel::KTransferMemory> transfer_memory_handle);
Result SetMediaPlaybackStateForApplication(bool enabled);
Result SetGamePlayRecordingState(GamePlayRecordingState game_play_recording_state);
Result EnableApplicationCrashReport(bool enabled);
Result InitializeApplicationCopyrightFrameBuffer(

View file

@ -29,7 +29,7 @@ IBtmSystemCore::IBtmSystemCore(Core::System& system_)
{10, nullptr, "StartAudioDeviceDiscovery"},
{11, nullptr, "StopAudioDeviceDiscovery"},
{12, nullptr, "IsDiscoveryingAudioDevice"},
{13, nullptr, "GetDiscoveredAudioDevice"},
{13, C<&IBtmSystemCore::GetDiscoveredAudioDevice>, "GetDiscoveredAudioDevice"},
{14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"},
{15, nullptr, "ConnectAudioDevice"},
{16, nullptr, "IsConnectingAudioDevice"},
@ -93,6 +93,11 @@ Result IBtmSystemCore::AcquireRadioEvent(Out<bool> out_is_valid,
R_SUCCEED();
}
Result IBtmSystemCore::GetDiscoveredAudioDevice(OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out<s32> out_total) {
LOG_WARNING(Service_BTM, "(STUBBED) called");
R_SUCCEED();
}
Result IBtmSystemCore::AcquireAudioDeviceConnectionEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_WARNING(Service_BTM, "(STUBBED) called");

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
@ -34,9 +37,8 @@ private:
Result DisableRadio();
Result IsRadioEnabled(Out<bool> out_is_enabled);
Result AcquireRadioEvent(Out<bool> out_is_valid,
OutCopyHandle<Kernel::KReadableEvent> out_event);
Result AcquireRadioEvent(Out<bool> out_is_valid, OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetDiscoveredAudioDevice(OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out<s32> out_total);
Result AcquireAudioDeviceConnectionEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetConnectedAudioDevices(

View file

@ -0,0 +1,33 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/core.h"
#include "core/hle/service/gpio/gpio.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/service.h"
namespace Service::GPIO {
class GPIO final : public ServiceFramework<GPIO> {
public:
explicit GPIO(Core::System& system_)
: ServiceFramework{system_, "gpio"}
{
static const FunctionInfo functions[] = {
{0, nullptr, "Cmd0"},
};
RegisterHandlers(functions);
}
~GPIO() override = default;
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("gpio", std::make_shared<GPIO>(system));
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::GPIO

View file

@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace Core {
class System;
}
namespace Service::GPIO {
void LoopProcess(Core::System& system);
} // namespace Service::GPIO

View file

@ -0,0 +1,76 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/core.h"
#include "core/hle/result.h"
#include "core/hle/service/i2c/i2c.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
#include "core/hle/service/server_manager.h"
namespace Service::I2C {
class I2CSession final : public ServiceFramework<I2CSession> {
public:
explicit I2CSession(Core::System& system_)
: ServiceFramework{system_, "I2CSession"}
{
static const FunctionInfo functions[] = {
{0, nullptr, "SendOld"},
{1, nullptr, "ReceiveOld"},
{2, nullptr, "ExecuteCommandListOld"},
{10, C<&I2CSession::Send>, "Send"},
{11, nullptr, "Receive"},
{12, nullptr, "ExecuteCommandList"},
{13, nullptr, "SetRetryPolicy"},
};
RegisterHandlers(functions);
}
~I2CSession() override = default;
Result Send(InBuffer<BufferAttr_HipcMapAlias> in_data, u32 transaction_option) {
LOG_WARNING(Service, "(stubbed) topt={}", transaction_option);
R_THROW(ResultUnknown);
}
};
enum class I2CDevice : u32 {
ClassicController,
Ftm3bd56,
};
class I2C final : public ServiceFramework<I2C> {
public:
explicit I2C(Core::System& system_)
: ServiceFramework{system_, "i2c"}
{
static const FunctionInfo functions[] = {
{0, nullptr, "OpenSessionForDev"},
{1, C<&I2C::OpenSession>, "OpenSession"},
{2, nullptr, "HasDevice"},
{3, nullptr, "HasDeviceForDev"},
{4, nullptr, "OpenSession2"},
};
RegisterHandlers(functions);
}
~I2C() override = default;
Result OpenSession(I2CDevice device, OutInterface<I2CSession> out_session) {
LOG_DEBUG(Service, "(stubbed)");
*out_session = std::make_shared<I2CSession>(system);
R_SUCCEED();
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("i2c", std::make_shared<I2C>(system));
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::I2C

View file

@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace Core {
class System;
}
namespace Service::I2C {
void LoopProcess(Core::System& system);
} // namespace Service::I2C

View file

@ -47,6 +47,8 @@ NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8>
return WrapFixed(this, &nvhost_ctrl_gpu::FlushL2, input, output);
case 0x14:
return WrapFixed(this, &nvhost_ctrl_gpu::GetActiveSlotMask, input, output);
case 0x15:
return WrapFixed(this, &nvhost_ctrl_gpu::PmuGetGpuLoad, input, output);
case 0x1c:
return WrapFixed(this, &nvhost_ctrl_gpu::GetGpuTime, input, output);
default:
@ -234,6 +236,12 @@ NvResult nvhost_ctrl_gpu::GetActiveSlotMask(IoctlActiveSlotMask& params) {
return NvResult::Success;
}
NvResult nvhost_ctrl_gpu::PmuGetGpuLoad(IoctlPmuGetLoad& params) {
LOG_WARNING(Service_NVDRV, "(stubbed) called");
params.pmu_gpu_load = 100;
return NvResult::Success;
}
NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(IoctlZcullGetCtxSize& params) {
LOG_DEBUG(Service_NVDRV, "called");
params.size = 0x1;

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@ -184,6 +184,11 @@ private:
};
static_assert(sizeof(IoctlGetCpuTimeCorrelationInfo) == 264);
struct IoctlPmuGetLoad {
u32 pmu_gpu_load;
};
static_assert(sizeof(IoctlPmuGetLoad) == 4);
NvResult GetCharacteristics1(IoctlCharacteristics& params);
NvResult GetCharacteristics3(IoctlCharacteristics& params,
std::span<IoctlGpuCharacteristics> gpu_characteristics);
@ -192,6 +197,7 @@ private:
NvResult GetTPCMasks3(IoctlGpuGetTpcMasksArgs& params, std::span<u32> tpc_mask);
NvResult GetActiveSlotMask(IoctlActiveSlotMask& params);
NvResult PmuGetGpuLoad(IoctlPmuGetLoad& params);
NvResult ZCullGetCtxSize(IoctlZcullGetCtxSize& params);
NvResult ZCullGetInfo(IoctlNvgpuGpuZcullGetInfoArgs& params);
NvResult ZBCSetTable(IoctlZbcSetTable& params);

View file

@ -25,18 +25,20 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> in
switch (command.group) {
case 0x0:
switch (command.cmd) {
case 0x1:
case 0x01:
return WrapFixedVariable(this, &nvhost_nvdec::Submit, input, output, fd);
case 0x2:
case 0x02:
return WrapFixed(this, &nvhost_nvdec::GetSyncpoint, input, output);
case 0x3:
case 0x03:
return WrapFixed(this, &nvhost_nvdec::GetWaitbase, input, output);
case 0x7:
case 0x07:
return WrapFixed(this, &nvhost_nvdec::SetSubmitTimeout, input, output);
case 0x9:
case 0x09:
return WrapFixedVariable(this, &nvhost_nvdec::MapBuffer, input, output, fd);
case 0xa:
case 0x0a:
return WrapFixedVariable(this, &nvhost_nvdec::UnmapBuffer, input, output);
case 0x23:
return WrapFixed(this, &nvhost_nvdec::GetClkRate, input, output);
default:
break;
}

View file

@ -168,6 +168,13 @@ NvResult nvhost_nvdec_common::SetSubmitTimeout(u32 timeout) {
return NvResult::Success;
}
NvResult nvhost_nvdec_common::GetClkRate(IoctlGetClkRate& params) {
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
params.clk_rate = 614400000;
params.module_id = 0;
return NvResult::Success;
}
Kernel::KEvent* nvhost_nvdec_common::QueryEvent(u32 event_id) {
LOG_CRITICAL(Service_NVDRV, "Unknown HOSTX1 Event {}", event_id);
return nullptr;

View file

@ -111,6 +111,12 @@ protected:
};
static_assert(sizeof(IoctlMapBuffer) == 0x0C, "IoctlMapBuffer is incorrect size");
struct IoctlGetClkRate {
u32_le clk_rate{};
u32_le module_id{};
};
static_assert(sizeof(IoctlGetClkRate) == 8);
/// Ioctl command implementations
NvResult SetNVMAPfd(IoctlSetNvmapFD&);
NvResult Submit(IoctlSubmit& params, std::span<u8> input, DeviceFD fd);
@ -119,6 +125,7 @@ protected:
NvResult MapBuffer(IoctlMapBuffer& params, std::span<MapBufferEntry> entries, DeviceFD fd);
NvResult UnmapBuffer(IoctlMapBuffer& params, std::span<MapBufferEntry> entries);
NvResult SetSubmitTimeout(u32 timeout);
NvResult GetClkRate(IoctlGetClkRate& params);
Kernel::KEvent* QueryEvent(u32 event_id) override;

View file

@ -6,10 +6,12 @@
#include <memory>
#include "common/common_funcs.h"
#include "common/device_power_state.h"
#include "common/logging.h"
#include "core/core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/result.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/ptm/psm.h"
@ -134,12 +136,12 @@ PSM::PSM(Core::System& system_) : ServiceFramework{system_, "psm"} {
{9, nullptr, "DisableEnoughPowerChargeEmulation"},
{10, nullptr, "EnableFastBatteryCharging"},
{11, nullptr, "DisableFastBatteryCharging"},
{12, nullptr, "GetBatteryVoltageState"},
{12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"},
{13, nullptr, "GetRawBatteryChargePercentage"},
{14, nullptr, "IsEnoughPowerSupplied"},
{15, nullptr, "GetBatteryAgePercentage"},
{15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"},
{16, nullptr, "GetBatteryChargeInfoEvent"},
{17, nullptr, "GetBatteryChargeInfoFields"},
{17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"},
{18, nullptr, "GetBatteryChargeCalibratedEvent"},
};
// clang-format on
@ -187,4 +189,64 @@ void PSM::OpenSession(HLERequestContext& ctx) {
rb.PushIpcInterface<IPsmSession>(system);
}
void PSM::GetBatteryVoltageState(HLERequestContext& ctx) {
LOG_DEBUG(Service_PTM, "(stubbed)");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.PushRaw<u32>(0); //
}
void PSM::GetBatteryAgePercentage(HLERequestContext& ctx) {
LOG_DEBUG(Service_PTM, "(stubbed)");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.PushRaw<f64>(1.f);
}
struct BatteryChargeInfoFields {
u32 input_current_limit; //mA
u32 boost_mode_current_limit;
u32 fast_charge_current_limit;
u32 charge_voltage_limit;
u32 charger_type;
u8 hi2_mode;
u8 battery_charging;
INSERT_PADDING_BYTES_NOINIT(2);
u32 vdd50_state;
u32 temperature_celcius;
f32 battery_charge_percentage;
u32 battery_charge_milli_voltage;
f32 battery_age_percentage;
u32 usb_power_role;
u32 usb_charger_type;
u32 charger_input_voltage_limit;
u32 charger_input_current_limit;
u8 fast_battery_charging;
u8 controller_power_supply;
u8 otg_request;
INSERT_PADDING_BYTES_NOINIT(1);
INSERT_PADDING_BYTES_NOINIT(0x14); //[+17.0.0]
};
static_assert(sizeof(struct BatteryChargeInfoFields) == 0x54);
void PSM::GetBatteryChargeInfoFields(HLERequestContext& ctx) {
LOG_DEBUG(Service_PTM, "called");
Common::PowerStatus power_status = Common::GetPowerStatus();
BatteryChargeInfoFields r{};
r.battery_charge_percentage = f32(power_status.percentage); //100%
r.battery_age_percentage = f32(power_status.percentage); //100%
r.battery_charging = power_status.charging ? 1 : 0;
r.charger_type = u32(power_status.has_battery && power_status.charging
? ChargerType::RegularCharger : ChargerType::Unplugged);
r.charger_input_voltage_limit = 100;
r.charger_input_voltage_limit = 100;
r.input_current_limit = 100;
r.boost_mode_current_limit = 100;
r.fast_charge_current_limit = 100;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.PushRaw<BatteryChargeInfoFields>(r);
}
} // namespace Service::PTM

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@ -22,10 +22,12 @@ private:
LowPowerCharger = 2,
Unknown = 3,
};
void GetBatteryChargePercentage(HLERequestContext& ctx);
void GetChargerType(HLERequestContext& ctx);
void OpenSession(HLERequestContext& ctx);
void GetBatteryVoltageState(HLERequestContext& ctx);
void GetBatteryAgePercentage(HLERequestContext& ctx);
void GetBatteryChargeInfoFields(HLERequestContext& ctx);
};
} // namespace Service::PTM

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
@ -25,8 +25,10 @@
#include "core/hle/service/friend/friend.h"
#include "core/hle/service/glue/glue.h"
#include "core/hle/service/grc/grc.h"
#include "core/hle/service/gpio/gpio.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/i2c/i2c.h"
#include "core/hle/service/jit/jit.h"
#include "core/hle/service/lbl/lbl.h"
#include "core/hle/service/ldn/ldn.h"
@ -144,7 +146,9 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
{"ro", &RO::LoopProcess},
{"spl", &SPL::LoopProcess},
{"ssl", &SSL::LoopProcess},
{"usb", &USB::LoopProcess}
{"usb", &USB::LoopProcess},
{"i2c", &I2C::LoopProcess},
{"gpio", &GPIO::LoopProcess},
})
kernel.RunOnGuestCoreProcess(std::string(e.first), [&system, f = e.second] { f(system); });
}

View file

@ -142,10 +142,10 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"},
{23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"},
{24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"},
{25, nullptr, "GetConsoleInformationUploadFlag"},
{26, nullptr, "SetConsoleInformationUploadFlag"},
{27, nullptr, "GetAutomaticApplicationDownloadFlag"},
{28, nullptr, "SetAutomaticApplicationDownloadFlag"},
{25, C<&ISystemSettingsServer::GetConsoleInformationUploadFlag>, "GetConsoleInformationUploadFlag"},
{26, C<&ISystemSettingsServer::SetConsoleInformationUploadFlag>, "SetConsoleInformationUploadFlag"},
{27, C<&ISystemSettingsServer::GetAutomaticApplicationDownloadFlag>, "GetAutomaticApplicationDownloadFlag"},
{28, C<&ISystemSettingsServer::SetAutomaticApplicationDownloadFlag>, "SetAutomaticApplicationDownloadFlag"},
{29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"},
{30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"},
{31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"},
@ -160,8 +160,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{42, nullptr, "SetEdid"},
{43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"},
{44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"},
{45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag> , "GetSpeakerAutoMuteFlag"},
{46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag> , "SetSpeakerAutoMuteFlag"},
{45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag>, "GetSpeakerAutoMuteFlag"},
{46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag>, "SetSpeakerAutoMuteFlag"},
{47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"},
{48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"},
{49, nullptr, "GetDataDeletionSettings"},
@ -180,8 +180,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"},
{63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"},
{64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"},
{65, nullptr, "GetUsb30EnableFlag"},
{66, nullptr, "SetUsb30EnableFlag"},
{65, C<&ISystemSettingsServer::GetUsb30EnableFlag>, "GetUsb30EnableFlag"},
{66, C<&ISystemSettingsServer::SetUsb30EnableFlag>, "SetUsb30EnableFlag"},
{67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"},
{68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"},
{69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"},
@ -1074,6 +1074,45 @@ Result ISystemSettingsServer::SetNfcEnableFlag(bool nfc_enable_flag) {
R_SUCCEED();
}
Result ISystemSettingsServer::GetConsoleInformationUploadFlag(Out<bool> out_flag) {
LOG_INFO(Service_SET, "called {}", m_system_settings.console_information_upload_flag);
*out_flag = m_system_settings.console_information_upload_flag;
R_SUCCEED();
}
Result ISystemSettingsServer::SetConsoleInformationUploadFlag(bool flag) {
LOG_INFO(Service_SET, "called {}", flag);
m_system_settings.usb_30_enable_flag = flag;
SetSaveNeeded();
R_SUCCEED();
}
Result ISystemSettingsServer::GetAutomaticApplicationDownloadFlag(Out<bool> out_flag) {
LOG_INFO(Service_SET, "called {}", m_system_settings.usb_30_enable_flag);
*out_flag = m_system_settings.automatic_application_download_flag;
R_SUCCEED();
}
Result ISystemSettingsServer::SetAutomaticApplicationDownloadFlag(bool flag) {
LOG_INFO(Service_SET, "called {}", flag);
m_system_settings.automatic_application_download_flag = flag;
SetSaveNeeded();
R_SUCCEED();
}
Result ISystemSettingsServer::GetUsb30EnableFlag(Out<bool> out_usb30_enable_flag) {
LOG_INFO(Service_SET, "called, usb30_enable_flag={}", m_system_settings.usb_30_enable_flag);
*out_usb30_enable_flag = m_system_settings.usb_30_enable_flag;
R_SUCCEED();
}
Result ISystemSettingsServer::SetUsb30EnableFlag(bool usb30_enable_flag) {
LOG_INFO(Service_SET, "called, usb30_enable_flag={}", usb30_enable_flag);
m_system_settings.usb_30_enable_flag = usb30_enable_flag;
SetSaveNeeded();
R_SUCCEED();
}
Result ISystemSettingsServer::GetSleepSettings(Out<SleepSettings> out_sleep_settings) {
LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
m_system_settings.sleep_settings.flags.raw,

View file

@ -109,6 +109,12 @@ public:
Result SetPrimaryAlbumStorage(PrimaryAlbumStorage primary_album_storage);
Result GetBatteryLot(Out<BatteryLot> out_battery_lot);
Result GetSerialNumber(Out<SerialNumber> out_console_serial);
Result GetConsoleInformationUploadFlag(Out<bool> out_flag);
Result SetConsoleInformationUploadFlag(bool flag);
Result GetAutomaticApplicationDownloadFlag(Out<bool> out_flag);
Result SetAutomaticApplicationDownloadFlag(bool flag);
Result GetUsb30EnableFlag(Out<bool> out_usb30_enable_flag);
Result SetUsb30EnableFlag(bool usb30_enable_flag);
Result GetNfcEnableFlag(Out<bool> out_nfc_enable_flag);
Result SetNfcEnableFlag(bool nfc_enable_flag);
Result GetSleepSettings(Out<SleepSettings> out_sleep_settings);

View file

@ -71,9 +71,10 @@ struct PatchCollection {
std::array<s32, 13> module_patcher_indices{};
};
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
bool override_update_)
: AppLoader(std::move(file_)), override_update(override_update_), is_hbl(false) {
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_, bool override_update_)
: AppLoader(std::move(file_))
, override_update(override_update_)
{
const auto file_dir = file->GetContainingDirectory();
// Title ID
@ -124,9 +125,11 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
}
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
FileSys::VirtualDir directory, bool override_update_, bool is_hbl_)
: AppLoader(directory->GetFile("main")), dir(std::move(directory)),
override_update(override_update_), is_hbl(is_hbl_) {}
FileSys::VirtualDir directory, bool override_update_)
: AppLoader(directory->GetFile("main"))
, dir(std::move(directory))
, override_update(override_update_)
{}
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
@ -232,7 +235,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
// Setup the process code layout
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset, is_hbl).IsError()) {
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset).IsError()) {
return {ResultStatus::ErrorUnableToParseKernelMetadata, {}};
}

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -22,13 +25,9 @@ namespace Loader {
*/
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
public:
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file,
bool override_update_ = false);
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file, bool override_update_ = false);
// Overload to accept exefs directory. Must contain 'main' and 'main.npdm'
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory,
bool override_update_ = false,
bool is_hbl_ = false);
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory, bool override_update_ = false);
/**
* Identifies whether or not the given file is a deconstructed ROM directory.
@ -63,7 +62,6 @@ private:
std::string name;
u64 title_id{};
bool override_update;
bool is_hbl;
Modules modules;
};

View file

@ -93,7 +93,7 @@ AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process,
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
// Setup the process code layout
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset, false).IsError()) {
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset).IsError()) {
return {ResultStatus::ErrorNotInitialized, {}};
}
const VAddr base_address = GetInteger(process.GetEntryPoint());

View file

@ -247,7 +247,7 @@ static bool LoadNroImpl(Core::System& system, Kernel::KProcess& process,
// Setup the process code layout
if (process
.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), image_size, fastmem_base, aslr_offset, false)
.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), image_size, fastmem_base, aslr_offset)
.IsError()) {
return false;
}

View file

@ -34,8 +34,7 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_,
}
if (nsp->IsExtractedType()) {
secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(
nsp->GetExeFS(), false, file->GetName() == "hbl.nsp");
secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS(), false);
} else {
const auto control_nca =
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control);

View file

@ -581,7 +581,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
} else if (should_launch_hlaunch) {
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
auto const hbl_path = (sd_dir / "atmosphere" / "hbl.nsp").string();
BootGame(QString::fromStdString(hbl_path), ApplicationAppletParameters());
BootGame(QString::fromStdString(hbl_path), LibraryAppletParameters(0x010000000000100Dull, Service::AM::AppletId::QLaunch));
}
}
}