sm: reimplement using tipc instead of cmif (probably broken, untested)

This commit is contained in:
Michael Scire
2021-04-10 01:58:26 -07:00
committed by SciresM
parent 58776f5ba8
commit 57c8bc432d
27 changed files with 904 additions and 735 deletions

View File

@@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
@@ -22,32 +21,37 @@ namespace ams::sm {
/* Service definition. */
class UserService {
private:
os::ProcessId process_id = os::InvalidProcessId;
bool has_initialized = false;
os::ProcessId m_process_id;
bool m_initialized;
public:
constexpr UserService() : m_process_id{os::InvalidProcessId}, m_initialized{false} { /* ... */ }
virtual ~UserService();
private:
Result EnsureInitialized();
public:
virtual ~UserService();
public:
/* Official commands. */
Result RegisterClient(const sf::ClientProcessId &client_process_id);
Result GetServiceHandle(sf::OutMoveHandle out_h, ServiceName service);
Result RegisterService(sf::OutMoveHandle out_h, ServiceName service, u32 max_sessions, bool is_light);
Result RegisterClient(const tipc::ClientProcessId client_process_id);
Result GetServiceHandle(tipc::OutMoveHandle out_h, ServiceName service);
Result RegisterService(tipc::OutMoveHandle out_h, ServiceName service, u32 max_sessions, bool is_light);
Result UnregisterService(ServiceName service);
Result DetachClient(const sf::ClientProcessId &client_process_id);
Result DetachClient(const tipc::ClientProcessId client_process_id);
/* Atmosphere commands. */
Result AtmosphereInstallMitm(sf::OutMoveHandle srv_h, sf::OutMoveHandle qry_h, ServiceName service);
Result AtmosphereInstallMitm(tipc::OutMoveHandle srv_h, tipc::OutMoveHandle qry_h, ServiceName service);
Result AtmosphereUninstallMitm(ServiceName service);
Result AtmosphereAcknowledgeMitmSession(sf::Out<MitmProcessInfo> client_info, sf::OutMoveHandle fwd_h, ServiceName service);
Result AtmosphereHasMitm(sf::Out<bool> out, ServiceName service);
Result AtmosphereAcknowledgeMitmSession(tipc::Out<MitmProcessInfo> client_info, tipc::OutMoveHandle fwd_h, ServiceName service);
Result AtmosphereHasMitm(tipc::Out<bool> out, ServiceName service);
Result AtmosphereWaitMitm(ServiceName service);
Result AtmosphereDeclareFutureMitm(ServiceName service);
Result AtmosphereClearFutureMitm(ServiceName service);
Result AtmosphereHasService(sf::Out<bool> out, ServiceName service);
Result AtmosphereHasService(tipc::Out<bool> out, ServiceName service);
Result AtmosphereWaitService(ServiceName service);
public:
/* Backwards compatibility layer for cmif. */
Result ProcessDefaultServiceCommand(const svc::ipc::MessageBuffer &message_buffer);
};
static_assert(sm::impl::IsIUserInterface<UserService>);
/* TODO: static assert that this is a tipc interface with default prototyping. */
}