Esempio n. 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));
        }
Esempio n. 2
0
        public static async Task <LoadROMParameter> GetROMFileToPlayAsync(string fileName)
        {
            StorageFolder localFolder = ApplicationData.Current.LocalFolder;
            StorageFolder romFolder   = await localFolder.GetFolderAsync(ROM_DIRECTORY);

            StorageFile romFile = await romFolder.GetFileAsync(fileName);

            LoadROMParameter param = new LoadROMParameter()
            {
                file   = romFile,
                folder = romFolder
            };

            return(param);
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            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");

            if (initialized && this.m_d3dBackground.IsROMLoaded() && romInfo == null)
            {
                this.m_d3dBackground.UnpauseEmulation();
            }
            else if (romInfo != null)
            {
                if (this.initialized)
                {
                    if (this.m_d3dBackground.LoadadROMFile.Name.Equals(romInfo.file.Name))
                    {
                        this.m_d3dBackground.UnpauseEmulation();
                    }
                    else
                    {
                        cache = null;
                        m_d3dBackground.LoadROMAsync(romInfo.file, romInfo.folder);
                        if (EmulatorSettings.Current.SelectLastState)
                        {
                            RestoreLastSavestate(romInfo.file.Name);
                        }
                        ROMLoaded = true;
                    }
                }
                else
                {
                    this.cache = romInfo;
                }
            }

            base.OnNavigatedTo(e);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            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");

            if (initialized && this.m_d3dBackground.IsROMLoaded() && romInfo == null)
            {
                this.m_d3dBackground.UnpauseEmulation();
            }
            else if (romInfo != null)
            {
                if (this.initialized)
                {
                    if (this.m_d3dBackground.LoadadROMFile.Name.Equals(romInfo.file.Name))
                    {
                        this.m_d3dBackground.UnpauseEmulation();
                    }
                    else
                    {
                        cache = null;
                        m_d3dBackground.LoadROMAsync(romInfo.file, romInfo.folder);
                        if (EmulatorSettings.Current.SelectLastState)
                        {
                            RestoreLastSavestate(romInfo.file.Name);
                        }
                        ROMLoaded = true;
                    }
                }
                else
                {
                    this.cache = romInfo;
                }
            }

            base.OnNavigatedTo(e);
        }
Esempio n. 8
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");


            param = null;
            PhoneApplicationService.Current.State.TryGetValue("parameter2", out param);
            LoadROMParameter romInfo2 = param as LoadROMParameter;

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

            ROMDatabase db = ROMDatabase.Current;

            //if (initialized && 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 (romInfo != null && romInfo2 != 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
                //        m_d3dBackground.LoadROMAsync(romInfo.file, romInfo.folder);
                //        if (EmulatorSettings.Current.SelectLastState)
                //        {
                //            RestoreLastSavestate(romInfo.file.Name);
                //        }
                //        ROMLoaded = true;
                //    }
                //}
                //else
                {
                    this.cache  = romInfo;
                    this.cache2 = romInfo2;
                }
            }

            base.OnNavigatedTo(e);
        }
Esempio n. 9
0
 public static async Task<LoadROMParameter> GetROMFileToPlayAsync(string fileName)
 {
     StorageFolder localFolder = ApplicationData.Current.LocalFolder;
     StorageFolder romFolder = await localFolder.GetFolderAsync(ROM_DIRECTORY);
     StorageFile romFile = await romFolder.GetFileAsync(fileName);
     LoadROMParameter param = new LoadROMParameter()
     {
         file = romFile,
         folder = romFolder
     };
     return param;
 }