MCPcopy Create free account
hub / github.com/TASEmulators/fceux / FCEUI_Emulate

Function FCEUI_Emulate

src/fceu.cpp:737–902  ·  view source on GitHub ↗

Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame

Source from the content-addressed store, hash-verified

735
736///Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame
737void 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 {

Callers 4

mainFunction · 0.85
DoFunFunction · 0.85
DoFunFunction · 0.85
DoFunFunction · 0.85

Calls 15

FCEU_PutImageFunction · 0.85
AutoFireFunction · 0.85
UpdateAutosaveFunction · 0.85
FCEU_StateRecorderUpdateFunction · 0.85
FCEU_LuaFrameBoundaryFunction · 0.85
FCEU_UpdateInputFunction · 0.85
FCEU_ApplyPeriodicCheatsFunction · 0.85
FCEUPPU_LoopFunction · 0.85
FlushEmulateSoundFunction · 0.85
UpdateCheatListFunction · 0.85
UpdateTextHookerFunction · 0.85

Tested by

no test coverage detected