1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-22 18:32:05 +00:00

Stratosphere: Implement sm:->Initialize()

This commit is contained in:
Michael Scire 2018-04-21 21:40:26 -06:00
parent d0ef3b1c71
commit 61cbb0f86e
3 changed files with 15 additions and 4 deletions

View file

@ -41,7 +41,8 @@ void __appInit(void) {
}
void __appExit(void) {
/* Nothing to clean up, because we're sm. */
/* Disconnect from ourselves. */
smExit();
}
int main(int argc, char **argv)
@ -51,8 +52,13 @@ int main(int argc, char **argv)
/* TODO: What's a good timeout value to use here? */
WaitableManager *server_manager = new WaitableManager(U64_MAX);
/* Add services to manager. */
/* Create sm:, (and thus allow things to register to it). */
server_manager->add_waitable(new ManagedPortServer<UserService>("sm:", 0x40));
/* Initialize, connecting to ourself. */
smInitialize();
/* Create sm:m, using libnx to talk to ourself. */
server_manager->add_waitable(new ServiceServer<ManagerService>("sm:m", 1));
/* Loop forever, servicing our services. */

View file

@ -25,8 +25,8 @@ Result UserService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id,
std::tuple<Result> UserService::initialize(PidDescriptor pid) {
/* TODO */
return std::make_tuple(0xF601);
this->pid = pid.pid;
return std::make_tuple(0);
}
std::tuple<Result, MovedHandle> UserService::get_service(u64 service) {

View file

@ -10,8 +10,13 @@ enum UserServiceCmd {
};
class UserService : IServiceObject {
u64 pid;
public:
Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size);
UserService() {
this->pid = U64_MAX;
}
private:
/* Actual commands. */