Beispiel #1
0
        public Switch(IGalRenderer Renderer, IAalOutput AudioOut)
        {
            if (Renderer == null)
            {
                throw new ArgumentNullException(nameof(Renderer));
            }

            if (AudioOut == null)
            {
                throw new ArgumentNullException(nameof(AudioOut));
            }

            this.AudioOut = AudioOut;

            Log = new Logger();

            Gpu = new NvGpu(Renderer);

            VFs = new VirtualFileSystem();

            Os = new Horizon(this);

            Settings = new SystemSettings();

            Statistics = new PerformanceStatistics();

            Hid = new Hid(Log);

            Font = new SharedFontManager(Log, VFs.GetSystemPath());

            Os.HidSharedMem.MemoryMapped   += Hid.ShMemMap;
            Os.HidSharedMem.MemoryUnmapped += Hid.ShMemUnmap;

            Os.FontSharedMem.MemoryMapped   += Font.ShMemMap;
            Os.FontSharedMem.MemoryUnmapped += Font.ShMemUnmap;
        }
Beispiel #2
0
        public Switch(VirtualFileSystem fileSystem, ContentManager contentManager, UserChannelPersistence userChannelPersistence, IRenderer renderer, IHardwareDeviceDriver audioDeviceDriver)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }

            if (audioDeviceDriver == null)
            {
                throw new ArgumentNullException(nameof(audioDeviceDriver));
            }

            if (userChannelPersistence == null)
            {
                throw new ArgumentNullException(nameof(userChannelPersistence));
            }

            UserChannelPersistence = userChannelPersistence;

            AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(audioDeviceDriver);

            Memory = new MemoryBlock(1UL << 32);

            Gpu = new GpuContext(renderer);

            MemoryAllocator = new NvMemoryAllocator();

            Host1x = new Host1xDevice(Gpu.Synchronization);
            var nvdec = new NvdecDevice(Gpu.MemoryManager);
            var vic   = new VicDevice(Gpu.MemoryManager);

            Host1x.RegisterDevice(ClassId.Nvdec, nvdec);
            Host1x.RegisterDevice(ClassId.Vic, vic);

            nvdec.FrameDecoded += (FrameDecodedEventArgs e) =>
            {
                // FIXME:
                // Figure out what is causing frame ordering issues on H264.
                // For now this is needed as workaround.
                if (e.CodecId == CodecId.H264)
                {
                    vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0);
                }
                else
                {
                    vic.DisableSurfaceOverride();
                }
            };

            FileSystem = fileSystem;

            System = new Horizon(this, contentManager);
            System.InitializeServices();

            Statistics = new PerformanceStatistics();

            Hid = new Hid(this, System.HidBaseAddress);
            Hid.InitDevices();

            Application = new ApplicationLoader(this, fileSystem, contentManager);
        }