예제 #1
0
파일: GBSystem.cs 프로젝트: Silenthal/gbemu
 public void Stop()
 {
     state = GBSystemState.Stopped;
 }
예제 #2
0
파일: GBSystem.cs 프로젝트: Silenthal/gbemu
 public void TogglePause()
 {
     if (state == GBSystemState.Paused)
     {
         state = GBSystemState.Running;
     }
     else if (state == GBSystemState.Running)
     {
         state = GBSystemState.Paused;
     }
 }
예제 #3
0
파일: GBSystem.cs 프로젝트: Silenthal/gbemu
 public void StartSystem()
 {
     state = GBSystemState.Running;
     var frameInput = new KeyState();
     while (state != GBSystemState.Stopped)
     {
         if (frameInput.IsPauseToggled)
         {
             TogglePause();
         }
         if (frameInput.IsFrameLimitToggled)
         {
             ToggleFrameSpeed();
         }
         if (state == GBSystemState.Paused)
         {
             continue;
         }
         Profiler.GetInstance().Restart("Main CPU");
         frameTimer.Start();
         cpu.RunFor(video.TimeToNextVBlank());
         if (isFocused)
         {
             frameInput = inputHandler.PollInput();
             input.UpdateInput(frameInput);
         }
         cpu.RunFor(video.TimeToTopOfLCD());
         while (frameTimer.ElapsedSeconds() < SpeedLimits[frameLimitIndex])
         {
         }
         GBMonitor.CPUTime = Profiler.GetInstance().StopAndGetTimeAsFrameTimePercent("Main CPU");
     }
 }