Esempio n. 1
0
        public static void Start()
        {
            if (!Started)
            {
                Started = true;

                FsView = new FSView();

                int count = 0;
                FsView.Ready += (source) =>
                {
                    if (source == TitleSource.SD)
                    {
                        StatusService.SDStatus = StatusService.Status.OK;
                    }
                    else if (source == TitleSource.NAND)
                    {
                        count++;
                        if (count == 2)
                        {
                            StatusService.NANDStatus = StatusService.Status.OK;
                            Update();
                            count = 0;
                        }
                        return;
                    }
                    Update();
                };

                SDService.OnSDPluggedIn += (_) =>
                {
                    FsView.LoadFileSystemAsync("Opening SD filesystem...", () => SwitchFs.OpenSdCard(HACGUIKeyset.Keyset, new LocalFileSystem(SDService.SDEffectiveRoot.FullName)), TitleSource.SD, true);

                    StatusService.SDStatus = StatusService.Status.Progress;
                };

                SDService.OnSDRemoved += (drive) =>
                {
                    StatusService.SDStatus = StatusService.Status.Incorrect;
                    FsView.IndexedFilesystems[TitleSource.SD].Clear();
                    Update();
                };

                NANDService.OnNANDPluggedIn += () =>
                {
                    FsView.LoadFileSystemAsync("Opening NAND user filesystem...", () => SwitchFs.OpenNandPartition(HACGUIKeyset.Keyset, NANDService.NAND.OpenUserPartition()), TitleSource.NAND, false);
                    FsView.LoadFileSystemAsync("Opening NAND system filesystem...", () => SwitchFs.OpenNandPartition(HACGUIKeyset.Keyset, NANDService.NAND.OpenSystemPartition()), TitleSource.NAND, true);
                    TaskManagerPage.Current.Queue.Submit(new DecryptTicketsTask(Preferences.Current.DefaultConsoleName));
                    TaskManagerPage.Current.Queue.Submit(new SaveKeysetTask(Preferences.Current.DefaultConsoleName)); // TODO
                    TaskManagerPage.Current.Queue.Submit(new CopyAccountDataTask());

                    StatusService.NANDStatus = StatusService.Status.Progress;
                };

                NANDService.OnNANDRemoved += () =>
                {
                    StatusService.NANDStatus = StatusService.Status.Incorrect;
                    FsView.IndexedFilesystems[TitleSource.NAND].Clear();
                    Update();
                };

                SDService.Start();
                NANDService.Start();
            }
        }
Esempio n. 2
0
        public static void Start()
        {
            if (!Started)
            {
                Started = true;

                NANDSystemTitleView = new FSView(TitleSource.NAND);
                NANDUserTitleView   = new FSView(TitleSource.NAND);
                SDTitleView         = new FSView(TitleSource.SD);

                Applications = new Dictionary <ulong, Application>();
                Titles       = new Dictionary <ulong, Title>();
                Saves        = new Dictionary <string, SaveDataFileSystem>();

                SDService.OnSDPluggedIn += (drive) =>
                {
                    SDTitleView.Ready += (_, __) =>
                    {
                        StatusService.SDStatus = StatusService.Status.OK;
                    };

                    SDTitleView.LoadFileSystemAsync("Opening SD filesystem...", () => SwitchFs.OpenSdCard(HACGUIKeyset.Keyset, new LocalFileSystem(drive.RootDirectory.FullName)), true);
                    Update();

                    StatusService.SDStatus = StatusService.Status.Progress;
                };

                SDService.OnSDRemoved += (drive) =>
                {
                    StatusService.SDStatus = StatusService.Status.Incorrect;
                    SDTitleView.FS         = null;
                    Update();
                };

                NANDService.OnNANDPluggedIn += () =>
                {
                    void onComplete()
                    {
                        StatusService.NANDStatus = StatusService.Status.OK;
                        Update();
                    };

                    int count = 0;
                    NANDSystemTitleView.Ready += (_, __) =>
                    {
                        count++;
                        if (count >= 2)
                        {
                            onComplete();
                        }
                    };
                    NANDUserTitleView.Ready += (_, __) =>
                    {
                        count++;
                        if (count >= 2)
                        {
                            onComplete();
                        }
                    };

                    NANDUserTitleView.LoadFileSystemAsync("Opening NAND user filesystem...", () => SwitchFs.OpenNandPartition(HACGUIKeyset.Keyset, NANDService.NAND.OpenUserPartition()), false);
                    NANDSystemTitleView.LoadFileSystemAsync("Opening NAND system filesystem...", () => SwitchFs.OpenNandPartition(HACGUIKeyset.Keyset, NANDService.NAND.OpenSystemPartition()), true);
                    TaskManagerPage.Current.Queue.Submit(new DecryptTicketsTask());

                    StatusService.NANDStatus = StatusService.Status.Progress;
                };

                NANDService.OnNANDRemoved += () =>
                {
                    StatusService.NANDStatus = StatusService.Status.Incorrect;

                    NANDSystemTitleView.FS = null;
                    NANDUserTitleView.FS   = null;

                    Update();
                };

                SDService.Start();
                NANDService.Start();

                Update();
            }
        }