Stratosphere: Fix IServer constructors. SM is fully functional on hardware now.

This commit is contained in:
Michael Scire 2018-04-22 05:13:33 -06:00
parent d772b823c6
commit 309a4607dd
5 changed files with 11 additions and 22 deletions

View File

@ -4,10 +4,6 @@
template <typename T>
class ExistingPortServer : public IServer<T> {
private:
virtual Result register_self(const char *service_name) {
return 0;
}
public:
ExistingPortServer(Handle port_h, unsigned int max_s) : IServer<T>(NULL, max_s) {
this->port_handle = port_h;

View File

@ -17,15 +17,9 @@ class IServer : public IWaitable {
unsigned int max_sessions;
unsigned int num_sessions;
ServiceSession<T> **sessions;
virtual Result register_self(const char *service_name) {
return smRegisterService(&this->port_handle, service_name, false, this->max_sessions);
}
public:
IServer(const char *service_name, unsigned int max_s) : max_sessions(max_s) {
if (R_FAILED(register_self(service_name))) {
/* TODO: Panic. */
}
this->sessions = new ServiceSession<T> *[this->max_sessions];
for (unsigned int i = 0; i < this->max_sessions; i++) {
this->sessions[i] = NULL;

View File

@ -4,10 +4,10 @@
template <typename T>
class ManagedPortServer : public IServer<T> {
private:
virtual Result register_self(const char *service_name) {
return svcManageNamedPort(&this->port_handle, service_name, this->max_sessions);
}
public:
ManagedPortServer(const char *service_name, unsigned int max_s) : IServer<T>(service_name, max_s) { }
ManagedPortServer(const char *service_name, unsigned int max_s) : IServer<T>(service_name, max_s) {
if (R_FAILED(svcManageNamedPort(&this->port_handle, service_name, this->max_sessions))) {
/* TODO: panic */
}
}
};

View File

@ -4,10 +4,10 @@
template <typename T>
class ServiceServer : public IServer<T> {
private:
virtual Result register_self(const char *service_name) {
return smRegisterService(&this->port_handle, service_name, false, this->max_sessions);
}
public:
ServiceServer(const char *service_name, unsigned int max_s) : IServer<T>(service_name, max_s) { }
ServiceServer(const char *service_name, unsigned int max_s) : IServer<T>(service_name, max_s) {
if (R_FAILED(smRegisterService(&this->port_handle, service_name, false, this->max_sessions))) {
/* TODO: Panic. */
}
}
};

View File

@ -1,7 +1,6 @@
#include <switch.h>
#include <algorithm>
#include <cstdio>
#include <stratosphere/waitablemanager.hpp>