From 67f7f2bfe678375b40a0befd97d4ba79529dff06 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Thu, 25 Oct 2018 04:15:53 +0200 Subject: [PATCH] move detect_cutscene into main.c since it's used by all renderers --- src/main.c | 30 ++++++++++++++++++++++++++++++ src/render.c | 1 - src/render_soft.c | 30 ------------------------------ 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/main.c b/src/main.c index 4237466..88b4e91 100644 --- a/src/main.c +++ b/src/main.c @@ -110,6 +110,36 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) return TRUE; } +static unsigned char getPixel(int x, int y) +{ + return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch]; +} + +int* InMovie = (int*)0x00665F58; +int* IsVQA640 = (int*)0x0065D7BC; +BYTE* ShouldStretch = (BYTE*)0x00607D78; + +BOOL detect_cutscene() +{ + if (ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT) + return FALSE; + + if (ddraw->isredalert) + { + if ((*InMovie && !*IsVQA640) || *ShouldStretch) + { + return TRUE; + } + return FALSE; + } + else if (ddraw->iscnc1) + { + return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE; + } + + return FALSE; +} + HRESULT __stdcall ddraw_Compact(IDirectDrawImpl *This) { printf("DirectDraw::Compact(This=%p)\n", This); diff --git a/src/render.c b/src/render.c index aa2e350..58f301c 100644 --- a/src/render.c +++ b/src/render.c @@ -59,7 +59,6 @@ static void DeleteContext(HGLRC context); static BOOL TextureUploadTest(); static BOOL ShaderTest(); -BOOL detect_cutscene(); DWORD WINAPI render_soft_main(void); DWORD WINAPI render_main(void) diff --git a/src/render_soft.c b/src/render_soft.c index 544d57a..087477d 100644 --- a/src/render_soft.c +++ b/src/render_soft.c @@ -23,36 +23,6 @@ BOOL ShowDriverWarning; -static unsigned char getPixel(int x, int y) -{ - return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch]; -} - -int* InMovie = (int*)0x00665F58; -int* IsVQA640 = (int*)0x0065D7BC; -BYTE* ShouldStretch = (BYTE*)0x00607D78; - -BOOL detect_cutscene() -{ - if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT) - return FALSE; - - if (ddraw->isredalert) - { - if ((*InMovie && !*IsVQA640) || *ShouldStretch) - { - return TRUE; - } - return FALSE; - } - else if (ddraw->iscnc1) - { - return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE; - } - - return FALSE; -} - DWORD WINAPI render_soft_main(void) { DWORD warningEndTick = timeGetTime() + (15 * 1000);