Пример #1
0
 public async Task Resume()
 {
     this.emulator.GameController.SetHIDChannel(
         HIDInputWrapper.FromChannel(await HIDManager.Current.ReconnectAsync())
         );
     this.emulator.Resume(this.mainView.IsOnGameView);
 }
Пример #2
0
        private async Task InitAsync(Window window, IMainView mainView, Settings settings)
        {
            this.window         = window;
            this.settings       = settings;
            this.mainView       = mainView;
            this.messageService = new UWPMessageService(mainView.Dispatcher);
            this.resources      = new ResourceLoader();

            UWPServiceProvider serviceProvider = new UWPServiceProvider(this.mainView.Dispatcher);

            this.emulator = new EmulatorComponent.EmulatorComponent(
                this.settings,
                this.mainView.SwapChainPanel,
                this.mainView.Dispatcher,
                PlatformProperties.DeviceType
                );

            await StorageManager.InitializeAsync(
                serviceProvider,
                new SaveInfoWrapper(this.emulator.SaveInfo)
                );

            this.emulator.SaveProvider = new SaveProviderWrapper();

            this.storage = StorageManager.Current;

            await this.emulator.LoadConfigAsync(
                await storage.ReadFileToStringAsync(
                    await storage.GetAssetFileAsync("Config/vba-over.ini")
                    ));

            KeyboardInputChannel keyboard        = new KeyboardInputChannel(new CoreWindowKeyProvider(this.window.CoreWindow), this.settings);
            KeyInputWrapper      keyboardWrapper = new KeyInputWrapper(keyboard, this.window.CoreWindow);

            this.emulator.GameController.AddInputChannel(keyboardWrapper);

            this.window.VisibilityChanged += Window_VisibilityChanged;

            if (this.settings.FirstLaunch)
            {
                await this.storage.CopyDemoROM("Demos/Bunny Advance (Demo).gba");

                await this.storage.CopyDemoROM("Demos/Pong.gb");

                this.settings.FirstLaunch = false;
            }

            HIDManager.Current.ServiceProvider = serviceProvider;

            this.emulator.GameController.SetHIDChannel(
                HIDInputWrapper.FromChannel(await HIDManager.Current.ReconnectAsync())
                );
        }