Skip to content

Commit cd3af46

Browse files
authored
core: pm: Add DebugNextApplicationByForce (azahar-emu#2640)
1 parent f7adb2d commit cd3af46

3 files changed

Lines changed: 34 additions & 11 deletions

File tree

‎src/core/hle/service/pm/pm.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2018-2026 Citra Emulator Project / Azahar Emulator Project
2-
// Licensed under GPLv2 or any later version
3-
// Refer to the misc/licenses/gplv2.txt file included.
2+
// Licensed under GPLv3 or any later version
3+
// Refer to the LICENSE.txt file included.
44

55
#include "core/core.h"
66
#include "core/hle/service/pm/pm.h"
@@ -12,7 +12,7 @@ namespace Service::PM {
1212
void InstallInterfaces(Core::System& system) {
1313
auto& service_manager = system.ServiceManager();
1414
std::make_shared<PM_APP>(system)->InstallAsService(service_manager);
15-
std::make_shared<PM_DBG>()->InstallAsService(service_manager);
15+
std::make_shared<PM_DBG>(system)->InstallAsService(service_manager);
1616
}
1717

1818
} // namespace Service::PM

‎src/core/hle/service/pm/pm_dbg.cpp‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
1-
// Copyright 2018 Citra Emulator Project
2-
// Licensed under GPLv2 or any later version
3-
// Refer to the misc/licenses/gplv2.txt file included.
1+
// Copyright 2018-2026 Citra Emulator Project / Azahar Emulator Project
2+
// Licensed under GPLv3 or any later version
3+
// Refer to the LICENSE.txt file included.
44

55
#include "common/archives.h"
6+
#include "core/core.h"
67
#include "core/hle/ipc_helpers.h"
78
#include "core/hle/service/pm/pm_dbg.h"
89

10+
SERVICE_CONSTRUCT_IMPL(Service::PM::PM_DBG)
911
SERIALIZE_EXPORT_IMPL(Service::PM::PM_DBG)
1012

1113
namespace Service::PM {
1214

13-
PM_DBG::PM_DBG() : ServiceFramework("pm:dbg", 3) {
15+
PM_DBG::PM_DBG(Core::System& _system) : ServiceFramework("pm:dbg", 3), system(_system) {
1416
static const FunctionInfo functions[] = {
1517
// clang-format off
1618
{0x0001, nullptr, "LaunchAppDebug"},
1719
{0x0002, nullptr, "LaunchApp"},
1820
{0x0003, nullptr, "RunQueuedProcess"},
21+
// Custom
22+
{0x0101, &PM_DBG::DebugNextApplicationByForce, "DebugNextApplicationByForce"},
1923
// clang-format on
2024
};
2125

2226
RegisterHandlers(functions);
2327
}
2428

29+
void PM_DBG::DebugNextApplicationByForce(Kernel::HLERequestContext& ctx) {
30+
IPC::RequestParser rp(ctx);
31+
bool enable = rp.Pop<bool>();
32+
33+
if (enable) {
34+
system.SetDebugNextProcessFlag();
35+
} else {
36+
system.ClearDebugNextProcessFlag();
37+
}
38+
39+
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
40+
rb.Push(ResultSuccess);
41+
}
42+
2543
} // namespace Service::PM

‎src/core/hle/service/pm/pm_dbg.h‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright 2018 Citra Emulator Project
2-
// Licensed under GPLv2 or any later version
3-
// Refer to the misc/licenses/gplv2.txt file included.
1+
// Copyright 2018-2026 Citra Emulator Project / Azahar Emulator Project
2+
// Licensed under GPLv3 or any later version
3+
// Refer to the LICENSE.txt file included.
44

55
#pragma once
66

@@ -10,13 +10,18 @@ namespace Service::PM {
1010

1111
class PM_DBG final : public ServiceFramework<PM_DBG> {
1212
public:
13-
PM_DBG();
13+
explicit PM_DBG(Core::System& system);
1414
~PM_DBG() = default;
1515

1616
private:
17+
Core::System& system;
18+
19+
void DebugNextApplicationByForce(Kernel::HLERequestContext& ctx);
20+
1721
SERVICE_SERIALIZATION_SIMPLE
1822
};
1923

2024
} // namespace Service::PM
2125

26+
SERVICE_CONSTRUCT(Service::PM::PM_DBG)
2227
BOOST_CLASS_EXPORT_KEY(Service::PM::PM_DBG)

0 commit comments

Comments
 (0)