Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame
| 735 | |
| 736 | ///Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame |
| 737 | void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int skip) { |
| 738 | FCEU_PROFILE_FUNC(prof, "Emulate Single Frame"); |
| 739 | //skip initiates frame skip if 1, or frame skip and sound skip if 2 |
| 740 | FCEU_MAYBE_UNUSED int r; |
| 741 | int ssize; |
| 742 | |
| 743 | JustFrameAdvanced = false; |
| 744 | |
| 745 | if (frameAdvanceRequested) |
| 746 | { |
| 747 | #ifdef __QT_DRIVER__ |
| 748 | uint32_t frameAdvanceDelayScaled = frameAdvance_Delay * (PAL ? 20 : 16); |
| 749 | |
| 750 | if ( frameAdvanceDelayScaled < 1 ) |
| 751 | { |
| 752 | frameAdvanceDelayScaled = 1; |
| 753 | } |
| 754 | if ( (frameAdvance_Delay_count == 0) || (frameAdvHoldTimer >= frameAdvanceDelayScaled) ) |
| 755 | { |
| 756 | EmulationPaused = EMULATIONPAUSED_FA; |
| 757 | } |
| 758 | if ( static_cast<unsigned int>(frameAdvance_Delay_count) < frameAdvanceDelayScaled) |
| 759 | { |
| 760 | frameAdvance_Delay_count++; |
| 761 | } |
| 762 | #else |
| 763 | if (frameAdvance_Delay_count == 0 || frameAdvance_Delay_count >= frameAdvance_Delay) |
| 764 | EmulationPaused = EMULATIONPAUSED_FA; |
| 765 | if (frameAdvance_Delay_count < frameAdvance_Delay) |
| 766 | frameAdvance_Delay_count++; |
| 767 | #endif |
| 768 | } |
| 769 | |
| 770 | if (EmulationPaused & EMULATIONPAUSED_TIMER) |
| 771 | { |
| 772 | if (pauseTimer > 0) |
| 773 | { |
| 774 | pauseTimer--; |
| 775 | } |
| 776 | else |
| 777 | { |
| 778 | EmulationPaused &= ~EMULATIONPAUSED_TIMER; |
| 779 | } |
| 780 | if (EmulationPaused & EMULATIONPAUSED_PAUSED) |
| 781 | { |
| 782 | EmulationPaused &= ~EMULATIONPAUSED_TIMER; |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | if (EmulationPaused & EMULATIONPAUSED_FA) |
| 787 | { |
| 788 | // the user is holding Frame Advance key |
| 789 | // clear paused flag temporarily |
| 790 | EmulationPaused &= ~EMULATIONPAUSED_PAUSED; |
| 791 | #ifdef __WIN_DRIVER__ |
| 792 | // different emulation speed when holding Frame Advance |
| 793 | if (fps_scale_frameadvance > 0) |
| 794 | { |
no test coverage detected