예제 #1
0
        private async Task StartROM(ROMDBEntry entry)
        {
            LoadROMParameter param = await FileHandler.GetROMFileToPlayAsync(entry.FileName);

            entry.LastPlayed = DateTime.Now;
            this.db.CommitChanges();

            PhoneApplicationService.Current.State["parameter"] = param;
            this.NavigationService.Navigate(new Uri("/EmulatorPage.xaml", UriKind.Relative));
        }
예제 #2
0
        private async void linkStartButton_Click(object sender, RoutedEventArgs e)
        {
            ROMDBEntry       firstEntry = (ROMDBEntry)firstGamePicker.SelectedItem;
            LoadROMParameter param      = await FileHandler.GetROMFileToPlayAsync(firstEntry.FileName);

            firstEntry.LastPlayed = DateTime.Now;
            ROMDatabase.Current.CommitChanges();



            ROMDBEntry       secondEntry = (ROMDBEntry)firstGamePicker.SelectedItem;
            LoadROMParameter param2      = await FileHandler.GetROMFileToPlayAsync(secondEntry.FileName);

            PhoneApplicationService.Current.State["parameter"]  = param;
            PhoneApplicationService.Current.State["parameter2"] = param2;

            this.NavigationService.Navigate(new Uri("/LinkedEmulatorPage.xaml", UriKind.Relative));
        }
예제 #3
0
        protected override async void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //disable lock screen
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            CameraButtons.ShutterKeyPressed     += CameraButtons_ShutterKeyPressed;
            CameraButtons.ShutterKeyHalfPressed += CameraButtons_ShutterKeyHalfPressed;
            CameraButtons.ShutterKeyReleased    += CameraButtons_ShutterKeyReleased;

            object param = null;

            PhoneApplicationService.Current.State.TryGetValue("parameter", out param);
            LoadROMParameter romInfo = param as LoadROMParameter;

            PhoneApplicationService.Current.State.Remove("parameter");


            ROMDatabase db = ROMDatabase.Current;

            if (romInfo != null)
            {
                EmulatorPage.cache = romInfo;
            }
            else if (IsTombstoned) //return after tombstone, need to restore state
            {
                romInfo = (LoadROMParameter)State["LoadROMParameter"];
                romInfo = await FileHandler.GetROMFileToPlayAsync(romInfo.RomFileName);

                //load all information again
                EmulatorPage.cache           = romInfo;
                EmulatorPage.currentROMEntry = ROMDatabase.Current.GetROM(romInfo.RomFileName);
                MainPage.LoadInitialSettings();

                //set IsTombstoned to false
                IsTombstoned = false;
                RestoreSaveStateAfterTombstoned = true;
            }



            base.OnNavigatedTo(e);
        }
예제 #4
0
        protected override async void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //disable lock screen
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            CameraButtons.ShutterKeyPressed     += CameraButtons_ShutterKeyPressed;
            CameraButtons.ShutterKeyHalfPressed += CameraButtons_ShutterKeyHalfPressed;
            CameraButtons.ShutterKeyReleased    += CameraButtons_ShutterKeyReleased;

            object param = null;

            PhoneApplicationService.Current.State.TryGetValue("parameter", out param);
            LoadROMParameter romInfo = param as LoadROMParameter;

            PhoneApplicationService.Current.State.Remove("parameter");


            ROMDatabase db = ROMDatabase.Current;

            if (romInfo != null)
            {
                EmulatorPage.cache = romInfo;
            }
            else if (IsTombstoned) //return after tombstone, need to restore state
            {
                romInfo = (LoadROMParameter)State["LoadROMParameter"];
                romInfo = await FileHandler.GetROMFileToPlayAsync(romInfo.RomFileName);

                //load all information again
                EmulatorPage.cache           = romInfo;
                EmulatorPage.currentROMEntry = ROMDatabase.Current.GetROM(romInfo.RomFileName);
                MainPage.LoadInitialSettings();

                //set IsTombstoned to false
                IsTombstoned = false;
                RestoreSaveStateAfterTombstoned = true;
            }



            //if (initialized && this.m_d3dBackground.IsROMLoaded() && romInfo == null)
            //if (m_d3dBackground != null && this.m_d3dBackground.IsROMLoaded() && romInfo == null)
            //{
            //var entry = db.GetROM(this.m_d3dBackground.LoadadROMFile.Name);
            //var cheats = await FileHandler.LoadCheatCodes(entry);
            //this.m_d3dBackground.LoadCheats(cheats);

            //this.m_d3dBackground.UnpauseEmulation(); //if LoadCheats was not called first, this produced access violation exception, why???
            //}
            //else if (romInfo != null)
            //{
            //if (this.initialized)
            //{
            //    if (this.m_d3dBackground.LoadadROMFile.Name.Equals(romInfo.file.Name))
            //    {
            //        var entry = db.GetROM(this.m_d3dBackground.LoadadROMFile.Name);
            //        var cheats = await FileHandler.LoadCheatCodes(entry);
            //        this.m_d3dBackground.LoadCheats(cheats);

            //        this.m_d3dBackground.UnpauseEmulation();
            //    }
            //    else
            //    {
            //        var entry = db.GetROM(romInfo.file.Name);
            //        var cheats = await FileHandler.LoadCheatCodes(entry);
            //        this.m_d3dBackground.LoadCheatsOnROMLoad(cheats);

            //        cache = null;
            //        // Load new ROM
            //        await m_d3dBackground.LoadROMAsync(romInfo.file, romInfo.folder);
            //        //if (EmulatorSettings.Current.SelectLastState)
            //        {
            //            RestoreLastSavestate(romInfo.file.Name);
            //        }

            //        ROMLoaded = true;
            //    }
            //}
            //else
            //{
            //    this.cache = romInfo;
            //}
            //}

            base.OnNavigatedTo(e);
        }