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

Function FCEUD_Update

src/drivers/win/main.cpp:1030–1099  ·  view source on GitHub ↗

Update the game and gamewindow with a new frame

Source from the content-addressed store, hash-verified

1028
1029// Update the game and gamewindow with a new frame
1030void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
1031{
1032 win_SoundSetScale(fps_scale); //If turboing and mute turbo is true, bypass this
1033
1034 //write all the sound we generated.
1035 if(soundo && Buffer && Count && !(muteTurbo && turbo)) {
1036 win_SoundWriteData(Buffer,Count); //If turboing and mute turbo is true, bypass this
1037 }
1038
1039 //blit the framebuffer
1040 if(XBuf)
1041 FCEUD_BlitScreen(XBuf);
1042
1043 //update debugging displays
1044 _updateWindow();
1045 // update TAS Editor
1046 updateTASEditor();
1047
1048 extern bool JustFrameAdvanced;
1049
1050 //MBG TODO - think about this logic
1051 //throttle
1052
1053 bool throttle = true;
1054 if( (eoptions&EO_NOTHROTTLE) )
1055 {
1056 if(!soundo) throttle = false;
1057 }
1058
1059 if(throttle) //if throttling is enabled..
1060 if(!turbo) //and turbo is disabled..
1061 if(!FCEUI_EmulationPaused()
1062 ||JustFrameAdvanced
1063 )
1064 //then throttle
1065 while(SpeedThrottle()) {
1066 FCEUD_UpdateInput();
1067 _updateWindow();
1068 }
1069
1070
1071 //sleep just to be polite
1072 if(!JustFrameAdvanced && FCEUI_EmulationPaused()) {
1073 Sleep(50);
1074 }
1075
1076 //while(EmulationPaused==1 && inDebugger)
1077 //{
1078 // Sleep(50);
1079 // BlockingCheck();
1080 // FCEUD_UpdateInput(); //should this update the CONTROLS??? or only the hotkeys etc?
1081 //}
1082
1083 ////so, we're not paused anymore.
1084
1085 ////something of a hack, but straightforward:
1086 ////if we were paused, but not in the debugger, then unpause ourselves and step.
1087 ////this is so that the cpu won't cut off execution due to being paused, but the debugger _will_

Callers 1

mainFunction · 0.70

Calls 8

win_SoundSetScaleFunction · 0.85
win_SoundWriteDataFunction · 0.85
FCEUD_BlitScreenFunction · 0.85
_updateWindowFunction · 0.85
updateTASEditorFunction · 0.85
FCEUI_EmulationPausedFunction · 0.85
SpeedThrottleFunction · 0.70
FCEUD_UpdateInputFunction · 0.70

Tested by

no test coverage detected