fix red alert 1 video stretching for my patch and add GDI renderer video stretching
This commit is contained in:
parent
0a4aa43722
commit
b91be078fd
16 changed files with 6392 additions and 30 deletions
|
@ -20,6 +20,35 @@
|
|||
#include "main.h"
|
||||
#include "surface.h"
|
||||
|
||||
#define CUTSCENE_WIDTH 640
|
||||
#define CUTSCENE_HEIGHT 400
|
||||
|
||||
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*)0x00711015;
|
||||
|
||||
BOOL detect_cutscene()
|
||||
{
|
||||
if (ddraw->isredalert == TRUE)
|
||||
{
|
||||
if ((*InMovie && !*IsVQA640) || *ShouldStretch)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
else if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
|
||||
return FALSE;
|
||||
|
||||
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI render_soft_main(void)
|
||||
{
|
||||
PBITMAPINFO bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
|
||||
|
@ -73,8 +102,6 @@ DWORD WINAPI render_soft_main(void)
|
|||
tick_start = GetTickCount();
|
||||
}
|
||||
|
||||
EnterCriticalSection(&ddraw->cs);
|
||||
|
||||
if (ddraw->primary && (ddraw->primary->palette || ddraw->bpp == 16))
|
||||
{
|
||||
if (ddraw->primary->palette && ddraw->primary->palette->data_rgb == NULL)
|
||||
|
@ -86,11 +113,19 @@ DWORD WINAPI render_soft_main(void)
|
|||
{
|
||||
StretchDIBits(ddraw->render.hDC, dst_left, dst_top, dst_width, dst_height, 0, 0, ddraw->width, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDIBitsToDevice(ddraw->render.hDC, 0, 0, ddraw->width, ddraw->height, 0, 0, 0, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS);
|
||||
}
|
||||
else if (!detect_cutscene())
|
||||
{
|
||||
SetDIBitsToDevice(ddraw->render.hDC, 0, 0, ddraw->width, ddraw->height, 0, 0, 0, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS);
|
||||
}
|
||||
|
||||
}
|
||||
if (ddraw->primary && detect_cutscene()) // for vhack
|
||||
{
|
||||
// for 800 x 600:
|
||||
//StretchDIBits(ddraw->render.hDC, 0, 0, ddraw->render.width, ddraw->render.height, 0, 200, CUTSCENE_WIDTH, CUTSCENE_HEIGHT, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||
StretchDIBits(ddraw->render.hDC, 0, 0, ddraw->render.width, ddraw->render.height, 0, ddraw->render.height-400, CUTSCENE_WIDTH, CUTSCENE_HEIGHT, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&ddraw->cs);
|
||||
|
||||
if(ddraw->render.maxfps > 0)
|
||||
|
@ -102,7 +137,6 @@ DWORD WINAPI render_soft_main(void)
|
|||
Sleep( frame_len - (tick_end - tick_start) );
|
||||
}
|
||||
}
|
||||
|
||||
SetEvent(ddraw->render.ev);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue