Ddraw::Unlock no longer calls present, Device_Present needs to be manually called. This helps performance and visuals.

This commit is contained in:
Justin Marshall
2020-06-05 08:24:07 -07:00
parent ca88e13be0
commit 56b557727b
13 changed files with 41 additions and 12 deletions
+4
View File
@@ -416,6 +416,8 @@ void Main_Game(int argc, char * argv[])
break; break;
} }
} }
Device_Present();
} }
#endif #endif
@@ -502,6 +504,8 @@ void Main_Game(int argc, char * argv[])
} }
#endif //WIN32 #endif //WIN32
#endif // !WOLAPI_INTEGRATION #endif // !WOLAPI_INTEGRATION
Device_Present();
} }
/* /*
+1
View File
@@ -1073,6 +1073,7 @@ template <>class DynamicVectorClass<EgoClass *>;
extern DynamicVectorClass<EgoClass *> whatever; extern DynamicVectorClass<EgoClass *> whatever;
void WWSDL_ProcessEvents(KeyNumType& key, int& flags); void WWSDL_ProcessEvents(KeyNumType& key, int& flags);
void Device_Present(void);
/* /*
** Debug output. ST - 6/27/2019 10:00PM ** Debug output. ST - 6/27/2019 10:00PM
+1
View File
@@ -265,6 +265,7 @@ void GameOptionsClass::Process(void)
bool process = true; bool process = true;
pressed = false; pressed = false;
while (process) { while (process) {
Device_Present();
/* /*
** Invoke game callback. ** Invoke game callback.
+2
View File
@@ -1017,6 +1017,8 @@ int Main_Menu(unsigned long )
default: default:
break; break;
} }
Device_Present();
} }
Options.Set_Score_Volume(oldvolume, false); Options.Set_Score_Volume(oldvolume, false);
+2
View File
@@ -252,6 +252,8 @@ GameType Select_MPlayer_Game (void)
process = true; process = true;
pressed = false; pressed = false;
while (process) { while (process) {
Device_Present();
#ifdef WIN32 #ifdef WIN32
/* /*
** If we have just received input focus again after running in the background then ** If we have just received input focus again after running in the background then
+2
View File
@@ -254,6 +254,8 @@ int WWMessageBox::Process(const char * msg, const char * b1txt, const char * b2t
pressed = false; pressed = false;
while (process) { while (process) {
Device_Present();
#ifdef WIN32 #ifdef WIN32
/* /*
** If we have just received input focus again after running in the background then ** If we have just received input focus again after running in the background then
+1
View File
@@ -617,6 +617,7 @@ int Com_Scenario_Dialog(bool skirmish)
oh_dear_its_a_label: oh_dear_its_a_label:
while (process) { while (process) {
Device_Present();
#if(SHOW_MONO) #if(SHOW_MONO)
if (!skirmish) { if (!skirmish) {
NullModem.Mono_Debug_Print(0); NullModem.Mono_Debug_Print(0);
+4 -1
View File
@@ -898,10 +898,13 @@ void Do_Win(void)
Fancy_Text_Print(TXT_HACKHACK, x, 110*RESFACTOR, &ColorRemaps[PCOLOR_RED], TBLACK, TPF_CENTER|TPF_VCR|TPF_USE_GRAD_PAL|TPF_DROPSHADOW); Fancy_Text_Print(TXT_HACKHACK, x, 110*RESFACTOR, &ColorRemaps[PCOLOR_RED], TBLACK, TPF_CENTER|TPF_VCR|TPF_USE_GRAD_PAL|TPF_DROPSHADOW);
#endif #endif
CountDownTimer = TIMER_SECOND * 3; CountDownTimer = TIMER_SECOND * 3;
while (Is_Speaking()) {}; while (Is_Speaking()) {
Device_Present();
};
Speak(VOX_ACCOMPLISHED); Speak(VOX_ACCOMPLISHED);
while (CountDownTimer || Is_Speaking()) { while (CountDownTimer || Is_Speaking()) {
Call_Back(); Call_Back();
Device_Present();
} }
} }
+5 -5
View File
@@ -1705,8 +1705,8 @@ void Draw_Bar_Graphs(int i, int gkilled, int nkilled)
*=========================================================================*/ *=========================================================================*/
void Call_Back_Delay(int time) void Call_Back_Delay(int time)
{ {
time; Device_Present();
#if (0)//PG
if (time < 0 ) time = 0; if (time < 0 ) time = 0;
if (time > 60) time = 60; if (time > 60) time = 60;
CDTimerClass<SystemTimerClass> cd; CDTimerClass<SystemTimerClass> cd;
@@ -1721,16 +1721,16 @@ void Call_Back_Delay(int time)
if (ControlQ) time=0; if (ControlQ) time=0;
cd = time; cd = time;
StreamLowImpact = true; // StreamLowImpact = true;
do { do {
if (callbackcd == 0) { if (callbackcd == 0) {
Call_Back(); Call_Back();
callbackcd = TIMER_SECOND/4; callbackcd = TIMER_SECOND/4;
} }
Animate_Score_Objs(); Animate_Score_Objs();
Device_Present();
} while (cd); } while (cd);
StreamLowImpact = false; //StreamLowImpact = false;
#endif
} }
+2
View File
@@ -567,6 +567,8 @@ int Fetch_Difficulty(void)
*/ */
Call_Back(); Call_Back();
Device_Present();
#ifdef WIN32 #ifdef WIN32
/* /*
** Handle possible surface loss due to a focus switch ** Handle possible surface loss due to a focus switch
+2
View File
@@ -143,6 +143,8 @@ long VQA_Play(_VQAHandle* vqaHandle) {
Buffer_To_Page(0, 0, ScreenWidth, ScreenHeight, vqa_output_buffer, *vqaHandle->video_graphics_buffer); Buffer_To_Page(0, 0, ScreenWidth, ScreenHeight, vqa_output_buffer, *vqaHandle->video_graphics_buffer);
vqaHandle->video_graphics_buffer->Unlock(); vqaHandle->video_graphics_buffer->Unlock();
Device_Present();
if (clock() - curTime >= 30) { if (clock() - curTime >= 30) {
currentFrame++; currentFrame++;
+3 -1
View File
@@ -719,7 +719,7 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
Keyboard->MouseQY = mousey; Keyboard->MouseQY = mousey;
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE) // if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
// flags = 0; // flags = 0;
SDL_Event event; SDL_Event event;
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
@@ -749,6 +749,8 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
break; break;
} }
} }
Device_Present();
} }
@@ -1041,6 +1041,11 @@ HRESULT __stdcall IDirectDrawSurfaceWrapper::SetPalette(LPDIRECTDRAWPALETTE lpDD
*/ */
} }
IDirectDrawWrapper* currentddrawParent = nullptr;
void Device_Present(void) {
currentddrawParent->Present();
}
// Notifies DirectDraw that the direct surface manipulations are complete. // Notifies DirectDraw that the direct surface manipulations are complete.
HRESULT __stdcall IDirectDrawSurfaceWrapper::Unlock(LPVOID lpRect) HRESULT __stdcall IDirectDrawSurfaceWrapper::Unlock(LPVOID lpRect)
{ {
@@ -1094,12 +1099,14 @@ HRESULT __stdcall IDirectDrawSurfaceWrapper::Unlock(LPVOID lpRect)
IDirectDrawSurface7::Lock and IDirectDrawSurface7::Unlock methods. IDirectDrawSurface7::Lock and IDirectDrawSurface7::Unlock methods.
*/ */
currentddrawParent = ddrawParent;
// Present the surface // Present the surface
if(!ddrawParent->Present()) //if(!ddrawParent->Present())
{ //{
// Failed to presnt the surface, error reporting handled previously // // Failed to presnt the surface, error reporting handled previously
return DDERR_GENERIC; // return DDERR_GENERIC;
} //}
// Success // Success
return DD_OK; return DD_OK;