mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
add support for woms 2 high resolution patch zoom
This commit is contained in:
parent
8326407a64
commit
54d6ff5112
1
inc/dd.h
1
inc/dd.h
@ -123,6 +123,7 @@ typedef struct CNCDDRAW
|
||||
BOOL isredalert;
|
||||
BOOL iscnc1;
|
||||
BOOL iskkndx;
|
||||
BOOL isworms2;
|
||||
LONG upscale_hack_active;
|
||||
HCURSOR old_cursor;
|
||||
int show_cursor_count;
|
||||
|
5
src/dd.c
5
src/dd.c
@ -1190,8 +1190,9 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
|
||||
g_ddraw.isredalert = strcmp(g_ddraw.title, "Red Alert") == 0;
|
||||
g_ddraw.iscnc1 = strcmp(g_ddraw.title, "Command & Conquer") == 0;
|
||||
g_ddraw.iskkndx = strcmp(g_ddraw.title, "KKND Xtreme") == 0;
|
||||
g_ddraw.isworms2 = strcmp(g_ddraw.title, "worms2") == 0;
|
||||
|
||||
if (g_ddraw.iskkndx)
|
||||
if (g_ddraw.iskkndx || g_ddraw.isworms2)
|
||||
{
|
||||
g_ddraw.upscale_hack_width = 640;
|
||||
g_ddraw.upscale_hack_height = 480;
|
||||
@ -1202,7 +1203,7 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
|
||||
g_ddraw.upscale_hack_height = 400;
|
||||
}
|
||||
|
||||
if (g_config.vhack && !g_ddraw.isredalert && !g_ddraw.iscnc1 && !g_ddraw.iskkndx)
|
||||
if (g_config.vhack && !g_ddraw.isredalert && !g_ddraw.iscnc1 && !g_ddraw.iskkndx && !g_ddraw.isworms2)
|
||||
{
|
||||
g_config.vhack = 0;
|
||||
}
|
||||
|
@ -174,13 +174,15 @@ static void ogl_build_programs()
|
||||
|
||||
if (!is_upscaler ||
|
||||
g_ddraw.render.viewport.width != g_ddraw.width ||
|
||||
g_ddraw.render.viewport.height != g_ddraw.height)
|
||||
g_ddraw.render.viewport.height != g_ddraw.height ||
|
||||
g_config.vhack)
|
||||
{
|
||||
g_ogl.scale_program = oglu_build_program_from_file(shader_path, core_profile);
|
||||
|
||||
if (!g_ogl.scale_program &&
|
||||
(g_ddraw.render.viewport.width != g_ddraw.width ||
|
||||
g_ddraw.render.viewport.height != g_ddraw.height))
|
||||
g_ddraw.render.viewport.height != g_ddraw.height ||
|
||||
g_config.vhack))
|
||||
{
|
||||
g_ogl.scale_program =
|
||||
oglu_build_program(
|
||||
|
34
src/utils.c
34
src/utils.c
@ -635,9 +635,29 @@ static unsigned char util_get_pixel(int x, int y)
|
||||
|
||||
BOOL util_detect_low_res_screen()
|
||||
{
|
||||
/* struct Copied from wkReSolution */
|
||||
typedef struct
|
||||
{
|
||||
PVOID UnkTable1;
|
||||
DWORD Unk1, Unk2, Unk3, Unk4;
|
||||
PVOID UnkDD, UnkTable2;
|
||||
DWORD Unk5;
|
||||
DWORD RenderWidth, RenderHeight;
|
||||
DWORD Unk6, Unk7;
|
||||
DWORD WidthRT, HeightRT;
|
||||
DWORD HalfWidth, HalfHeight;
|
||||
DWORD Unk8;
|
||||
PCHAR UnkC;
|
||||
LPDIRECTDRAW lpDD;
|
||||
} W2DDSTRUCT, * LPW2DDSTRUCT;
|
||||
|
||||
static int* in_movie = (int*)0x00665F58;
|
||||
static int* is_vqa_640 = (int*)0x0065D7BC;
|
||||
static BYTE* should_stretch = (BYTE*)0x00607D78;
|
||||
static LPW2DDSTRUCT* pW2DS;
|
||||
|
||||
if (!pW2DS)
|
||||
pW2DS = (char*)GetModuleHandleA(NULL) + 0x799C4;
|
||||
|
||||
if (g_ddraw.width <= g_ddraw.upscale_hack_width || g_ddraw.height <= g_ddraw.upscale_hack_height)
|
||||
{
|
||||
@ -663,6 +683,20 @@ BOOL util_detect_low_res_screen()
|
||||
{
|
||||
return util_get_pixel(g_ddraw.width - 3, 3) == 0;
|
||||
}
|
||||
else if (g_ddraw.isworms2)
|
||||
{
|
||||
if ((*pW2DS)->RenderWidth < g_ddraw.width && (*pW2DS)->RenderHeight < g_ddraw.height)
|
||||
{
|
||||
if (g_ddraw.upscale_hack_width != (*pW2DS)->RenderWidth || g_ddraw.upscale_hack_height != (*pW2DS)->RenderHeight)
|
||||
{
|
||||
g_ddraw.upscale_hack_width = (*pW2DS)->RenderWidth;
|
||||
g_ddraw.upscale_hack_height = (*pW2DS)->RenderHeight;
|
||||
InterlockedExchange(&g_ddraw.upscale_hack_active, FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
|
||||
y = min(pt.y, g_ddraw.height - 1);
|
||||
}
|
||||
|
||||
if (g_config.vhack && InterlockedExchangeAdd(&g_ddraw.upscale_hack_active, 0))
|
||||
if (g_config.vhack && !g_ddraw.isworms2 && InterlockedExchangeAdd(&g_ddraw.upscale_hack_active, 0))
|
||||
{
|
||||
diffx = 0;
|
||||
diffy = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user