mirror of
https://github.com/XorTroll/uLaunch
synced 2024-11-10 06:24:12 +00:00
Add new files
This commit is contained in:
parent
d905b1e008
commit
330634ab74
4 changed files with 84 additions and 0 deletions
28
uDaemon/include/ipc/ipc_IPrivateService.hpp
Normal file
28
uDaemon/include/ipc/ipc_IPrivateService.hpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include <ul_Include.hpp>
|
||||||
|
|
||||||
|
namespace ipc
|
||||||
|
{
|
||||||
|
class IPrivateService : public ams::sf::IServiceObject
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum class CommandId
|
||||||
|
{
|
||||||
|
GetLatestMessage = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ams::Result GetLatestMessage(ams::sf::Out<u32> msg, const ams::sf::ClientProcessId &client_pid);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DEFINE_SERVICE_DISPATCH_TABLE
|
||||||
|
{
|
||||||
|
MAKE_SERVICE_COMMAND_META(GetLatestMessage)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
24
uDaemon/include/ipc/ipc_IPublicService.hpp
Normal file
24
uDaemon/include/ipc/ipc_IPublicService.hpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include <ul_Include.hpp>
|
||||||
|
|
||||||
|
namespace ipc
|
||||||
|
{
|
||||||
|
class IPublicService : public ams::sf::IServiceObject
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum class CommandId
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DEFINE_SERVICE_DISPATCH_TABLE
|
||||||
|
{
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
26
uDaemon/source/ipc/ipc_IPrivateService.cpp
Normal file
26
uDaemon/source/ipc/ipc_IPrivateService.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <ipc/ipc_IPrivateService.hpp>
|
||||||
|
#include <am/am_DaemonMenuInteraction.hpp>
|
||||||
|
#include <am/am_LibraryApplet.hpp>
|
||||||
|
|
||||||
|
extern ams::os::Mutex g_last_menu_msg_lock;
|
||||||
|
extern am::MenuMessage g_last_menu_msg;
|
||||||
|
|
||||||
|
namespace ipc
|
||||||
|
{
|
||||||
|
ams::Result IPrivateService::GetLatestMessage(ams::sf::Out<u32> msg, const ams::sf::ClientProcessId &client_pid)
|
||||||
|
{
|
||||||
|
u64 program_id = 0;
|
||||||
|
UL_ASSERT(pminfoGetProgramId(&program_id, client_pid.process_id.value));
|
||||||
|
|
||||||
|
auto last_menu_program_id = am::LibraryAppletGetProgramIdForAppletId(am::LibraryAppletGetMenuAppletId());
|
||||||
|
// If Menu hasn't been launched it's program ID will be 0/invalid, thus a != check wouldn't be enough
|
||||||
|
// If any of the IDs is invalid, something unexpected is happening...
|
||||||
|
if((last_menu_program_id == 0) || (program_id == 0) || (program_id != last_menu_program_id)) return RES_VALUE(Daemon, PrivateServiceInvalidProcess);
|
||||||
|
|
||||||
|
std::scoped_lock _lock(g_last_menu_msg_lock);
|
||||||
|
msg.SetValue((u32)g_last_menu_msg);
|
||||||
|
g_last_menu_msg = am::MenuMessage::Invalid;
|
||||||
|
|
||||||
|
return ams::ResultSuccess();
|
||||||
|
}
|
||||||
|
}
|
6
uDaemon/source/ipc/ipc_IPublicService.cpp
Normal file
6
uDaemon/source/ipc/ipc_IPublicService.cpp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <ipc/ipc_IPublicService.hpp>
|
||||||
|
|
||||||
|
namespace ipc
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue