Esempio n. 1
0
        public async Task <bool> SaveGameStateAsync(uint slotID)
        {
            var success = false;

            if (CoreRunner == null)
            {
                return(success);
            }

            SaveStateService.SetGameId(GameID);
            using (var stream = await SaveStateService.GetStreamForSlotAsync(slotID, FileAccess.ReadWrite))
            {
                if (stream == null)
                {
                    return(success);
                }

                success = await CoreRunner.SaveGameStateAsync(stream);

                await stream.FlushAsync();
            }

            if (success)
            {
                var notificationTitle = LocalizationService.GetLocalizedString(StateSavedToSlotMessageTitleKey);
                var notificationBody  = string.Format(LocalizationService.GetLocalizedString(StateSavedToSlotMessageBodyKey), slotID);
                NotificationService.Show(notificationTitle, notificationBody);
            }

            return(success);
        }
Esempio n. 2
0
        private async void SaveState(uint slotID)
        {
            CoreOperationsAllowed = false;

            var data = await EmulationService.SaveGameStateAsync();

            if (data != null)
            {
                SaveStateService.SetGameId(EmulationService.GameID);
                await SaveStateService.SaveStateAsync(slotID, data);
            }

            CoreOperationsAllowed = true;

            if (GameIsPaused)
            {
                await TogglePause(true);
            }
        }