Пример #1
0
        public static IApplet Create(AppletId applet, Horizon system)
        {
            if (_appletMapping.TryGetValue(applet, out Type appletClass))
            {
                return((IApplet)Activator.CreateInstance(appletClass, system));
            }

            throw new NotImplementedException($"{applet} applet is not implemented.");
        }
Пример #2
0
        // CreateLibraryApplet(u32, u32) -> object<nn::am::service::ILibraryAppletAccessor>
        public ResultCode CreateLibraryApplet(ServiceCtx context)
        {
            AppletId appletId          = (AppletId)context.RequestData.ReadInt32();
            int      libraryAppletMode = context.RequestData.ReadInt32();

            MakeObject(context, new ILibraryAppletAccessor(appletId, context.Device.System));

            return(ResultCode.Success);
        }
Пример #3
0
        public ILibraryAppletAccessor(AppletId appletId, Horizon system)
        {
            _stateChangedEvent = new KEvent(system);

            _applet  = AppletManager.Create(appletId, system);
            _inData  = new AppletFifo <byte[]>();
            _outData = new AppletFifo <byte[]>();

            _applet.AppletStateChanged += OnAppletStateChanged;

            Logger.PrintInfo(LogClass.ServiceAm, $"Applet '{appletId}' created.");
        }
Пример #4
0
        public ILibraryAppletAccessor(AppletId appletId, Horizon system)
        {
            _stateChangedEvent       = new KEvent(system.KernelContext);
            _normalOutDataEvent      = new KEvent(system.KernelContext);
            _interactiveOutDataEvent = new KEvent(system.KernelContext);

            _applet = AppletManager.Create(appletId, system);

            _normalSession      = new AppletSession();
            _interactiveSession = new AppletSession();

            _applet.AppletStateChanged        += OnAppletStateChanged;
            _normalSession.DataAvailable      += OnNormalOutData;
            _interactiveSession.DataAvailable += OnInteractiveOutData;

            Logger.PrintInfo(LogClass.ServiceAm, $"Applet '{appletId}' created.");
        }