1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

Revert "remove "handlemouse" setting"

This reverts commit f1bcff220deee72552ea26c7695195409714f8e3.
This commit is contained in:
FunkyFr3sh 2021-06-16 07:47:15 +02:00
parent 6043bc9061
commit abdb74942b
10 changed files with 181 additions and 175 deletions

View File

@ -104,6 +104,7 @@ typedef struct CNCDDRAW
BOOL fullscreen;
BOOL maintas;
BOOL noactivateapp;
BOOL handlemouse;
char shader[MAX_PATH];
BOOL wine;
BOOL altenter;
@ -130,7 +131,6 @@ typedef struct CNCDDRAW
int mouse_y_adjust;
void* last_freed_palette; /* Dungeon Keeper hack */
BOOL child_window_exists;
BOOL got_child_windows;
DWORD last_set_window_pos_tick; /* WINE hack */
BOOL show_driver_warning;
SPEEDLIMITER ticks_limiter;

View File

@ -40,7 +40,7 @@ void cfg_load()
g_ddraw->border = cfg_get_bool("border", TRUE);
g_ddraw->boxing = cfg_get_bool("boxing", FALSE);
g_ddraw->maintas = cfg_get_bool("maintas", FALSE);
g_ddraw->adjmouse = cfg_get_bool("adjmouse", TRUE);
g_ddraw->adjmouse = cfg_get_bool("adjmouse", FALSE);
g_ddraw->devmode = cfg_get_bool("devmode", FALSE);
g_ddraw->vsync = cfg_get_bool("vsync", FALSE);
g_ddraw->noactivateapp = cfg_get_bool("noactivateapp", FALSE);
@ -112,6 +112,11 @@ void cfg_load()
g_config.window_rect.left = g_config.window_rect.top = -32000;
}
if (!(g_ddraw->handlemouse = cfg_get_bool("handlemouse", TRUE)))
{
g_ddraw->adjmouse = TRUE;
}
if (cfg_get_bool("singlecpu", TRUE))
{
SetProcessAffinityMask(GetCurrentProcess(), 1);
@ -239,10 +244,10 @@ static void cfg_create_ini()
"; Run in windowed mode rather than going fullscreen\n"
"windowed=false\n"
"\n"
"; Maintain aspect ratio\n"
"; Maintain aspect ratio - (Requires 'handlemouse=true')\n"
"maintas=false\n"
"\n"
"; Windowboxing / Integer Scaling\n"
"; Windowboxing / Integer Scaling - (Requires 'handlemouse=true')\n"
"boxing=false\n"
"\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
@ -253,9 +258,9 @@ static void cfg_create_ini()
"; Note: vsync=true can fix tearing but it will cause input lag\n"
"vsync=false\n"
"\n"
"; Automatic mouse sensitivity scaling\n"
"; Automatic mouse sensitivity scaling - (Requires 'handlemouse=true')\n"
"; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n"
"adjmouse=true\n"
"adjmouse=false\n"
"\n"
"; Preliminary libretro shader support - (Requires 'renderer=opengl') https://github.com/libretro/glsl-shaders\n"
"; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV\n"
@ -301,6 +306,10 @@ static void cfg_create_ini()
"; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)\n"
"maxgameticks=0\n"
"\n"
"; Gives cnc-ddraw full control over the mouse cursor (required for adjmouse/boxing/maintas)\n"
"; Note: Set this to 'false' if your cursor becomes invisible at some places in the game\n"
"handlemouse=true\n"
"\n"
"; Windows API Hooking, Possible values: 0 = disabled, 1 = IAT Hooking, 2 = Microsoft Detours, 3 = IAT+Detours Hooking (All Modules), 4 = IAT Hooking (All Modules)\n"
"; Note: Change this value if windowed mode or upscaling isn't working properly\n"
"; Note: 'hook=2' will usually work for problematic games, but 'hook=2' should be combined with renderer=gdi\n"
@ -336,7 +345,7 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"resolutions=2\n"
"\n"
"; Age of Empires: The Rise of Rome\n"
@ -344,7 +353,7 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"resolutions=2\n"
"\n"
"; Age of Empires II\n"
@ -352,14 +361,14 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Age of Empires II: The Conquerors\n"
"[age2_x1]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; American Conquest\n"
"[DMCR]\n"
@ -382,17 +391,17 @@ static void cfg_create_ini()
"; Anstoss 3\n"
"[anstoss3]\n"
"renderer=gdi\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Anno 1602\n"
"[1602]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
"; Alien Nations\n"
"[AN]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Atlantis\n"
"[ATLANTIS]\n"
@ -453,125 +462,107 @@ static void cfg_create_ini()
"[game]\n"
"checkfile=.\\blowfish.dll\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Tiberian Sun Demo\n"
"[SUN]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Tiberian Sun - CnCNet\n"
"[ts-spawn]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2 - XWIS\n"
"[ra2]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2 - XWIS\n"
"[Red Alert 2]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge\n"
"[gamemd]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe?\n"
"[ra2md]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet\n"
"[gamemd-spawn]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS\n"
"[Yuri's Revenge]\n"
"noactivateapp=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Caesar III\n"
"[c3]\n"
"nonexclusive=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Chris Sawyer's Locomotion\n"
"[LOCO]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Cultures 2\n"
"[Cultures2]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Cultures 2 MP\n"
"[Cultures2MP]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Close Combat 2: A Bridge Too Far\n"
"[cc2]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 3: The Russian Front\n"
"[cc3]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 4: The Battle of the Bulge\n"
"[cc4]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 5: Invasion: Normandy\n"
"[cc5]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
@ -586,7 +577,7 @@ static void cfg_create_ini()
"\n"
"; Corsairs Gold\n"
"[corsairs]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
@ -609,12 +600,10 @@ static void cfg_create_ini()
"\n"
"; Future Cop - L.A.P.D.\n"
"[FCopLAPD]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=gdi\n"
"hook=2\n"
"passthrough=false\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; G-Police\n"
"[GPOLICE]\n"
@ -622,7 +611,7 @@ static void cfg_create_ini()
"\n"
"; Gangsters: Organized Crime\n"
"[gangsters]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
@ -646,7 +635,7 @@ static void cfg_create_ini()
"\n"
"; Heroes of Might and Magic II: The Succession Wars\n"
"[HEROES2W]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Hard Truck: Road to Victory\n"
"[htruck]\n"
@ -656,13 +645,13 @@ static void cfg_create_ini()
"\n"
"; Invictus\n"
"[Invictus]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixwndprochook=true\n"
"renderer=opengl\n"
"\n"
"; Interstate 76\n"
"[i76]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=opengl\n"
"\n"
"; Jagged Alliance 2\n"
@ -699,11 +688,11 @@ static void cfg_create_ini()
"\n"
"; Majesty Gold HD\n"
"[MajestyHD]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Majesty Gold HD\n"
"[MajestyHD - Old]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Moorhuhn\n"
"[Moorhuhn]\n"
@ -718,12 +707,12 @@ static void cfg_create_ini()
"[olwin]\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"adjmouse=true\n"
"handlemouse=false\n"
"renderer=gdi\n"
"\n"
"; Pharaoh\n"
"[Pharaoh]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Pacific General\n"
"[PACGEN]\n"
@ -736,42 +725,40 @@ static void cfg_create_ini()
"\n"
"; Railroad Tycoon II\n"
"[RT2]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; ROAD RASH\n"
"[RoadRash]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Star Trek - Armada\n"
"[Armada]\n"
"armadahack=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"adjmouse=true\n"
"maintas=false\n"
"boxing=false\n"
"handlemouse=false\n"
"\n"
"; Star Wars: Galactic Battlegrounds\n"
"[battlegrounds]\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Star Wars: Galactic Battlegrounds: Clone Campaigns\n"
"[battlegrounds_x1]\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Stronghold Crusader HD\n"
"[Stronghold Crusader]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Stronghold Crusader Extreme HD\n"
"[Stronghold_Crusader_Extreme]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Stronghold HD\n"
"[Stronghold]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Steel Panthers: World At War\n"
"[MECH]\n"
@ -780,15 +767,13 @@ static void cfg_create_ini()
"; Shadow Watch\n"
"[sw]\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Shadow Flare\n"
"[ShadowFlare]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"adjmouse=true\n"
"maintas=false\n"
"boxing=false\n"
"handlemouse=false\n"
"\n"
"; Three Kingdoms: Fate of the Dragon\n"
"[sanguo]\n"
@ -808,26 +793,24 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"maxgameticks=60\n"
"adjmouse=true\n"
"handlemouse=false\n"
"fixchildwindows=false\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Tzar: The Burden of the Crown\n"
"; Note: Must set 'DIRECTXDEVICE=0' in 'Tzar.ini'\n"
"[Tzar]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Uprising\n"
"[uprising]\n"
"renderer=opengl\n"
"fixpitch=true\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Uprising 2\n"
"[Uprising 2]\n"
"renderer=opengl\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
"; Warlords 3\n"
"[Darklord]\n"
@ -839,7 +822,7 @@ static void cfg_create_ini()
"\n"
"; Worms Armageddon\n"
"[WA]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"width=0\n"
"height=0\n"
"resizable=false\n"
@ -855,7 +838,7 @@ static void cfg_create_ini()
"\n"
"; Zeus and Poseidon\n"
"[Zeus]\n"
"adjmouse=true\n"
"handlemouse=false\n"
"\n"
, fh);

View File

@ -513,6 +513,8 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.mode.dmBitsPerPel = g_ddraw->render.bpp;
}
BOOL maintas = g_ddraw->maintas;
if (!g_ddraw->windowed)
{
/* Making sure the chosen resolution is valid */
@ -562,6 +564,9 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
old_height,
g_ddraw->mode.dmPelsWidth,
g_ddraw->mode.dmPelsHeight);
if (found_res)
maintas = TRUE;
}
g_ddraw->render.width = res.cx;
@ -590,6 +595,8 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->windowed = TRUE;
}
else
maintas = TRUE;
}
}
}
@ -601,6 +608,11 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.height++;
}
if (!g_ddraw->handlemouse)
{
g_ddraw->boxing = maintas = FALSE;
}
g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height = g_ddraw->render.height;
g_ddraw->render.viewport.x = 0;
@ -624,7 +636,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.viewport.y = g_ddraw->render.height / 2 - g_ddraw->render.viewport.height / 2;
g_ddraw->render.viewport.x = g_ddraw->render.width / 2 - g_ddraw->render.viewport.width / 2;
}
else if (g_ddraw->maintas)
else if (maintas)
{
g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height =
@ -819,19 +831,14 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
SetPixelFormat(g_ddraw->render.hdc, ChoosePixelFormat(g_ddraw->render.hdc, &pfd), &pfd);
}
/* Make sure the cursor is visible in windowed mode initially */
if (g_ddraw->windowed)
if (g_ddraw->handlemouse && g_ddraw->windowed)
{
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
}
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
while (real_ShowCursor(FALSE) > 0); /* workaround for direct input games */
while (real_ShowCursor(TRUE) < 0);
}
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
GetWindowText(g_ddraw->hwnd, (LPTSTR)&g_ddraw->title, sizeof(g_ddraw->title));
g_ddraw->isredalert = strcmp(g_ddraw->title, "Red Alert") == 0;

View File

@ -12,23 +12,27 @@ void mouse_lock()
return;
if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(FALSE) >= 0);
return;
}
if (g_hook_active && !g_ddraw->locked)
{
/* Get the window client area */
real_GetClientRect(g_ddraw->hwnd, &rc);
if (g_ddraw->adjmouse)
{
rc.top = g_ddraw->render.viewport.y;
rc.left = g_ddraw->render.viewport.x;
rc.right = g_ddraw->render.viewport.width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->render.viewport.height + g_ddraw->render.viewport.y;
rc.right = g_ddraw->render.viewport.width;
rc.bottom = g_ddraw->render.viewport.height;
}
else
{
rc.top = g_ddraw->render.viewport.y;
rc.left = g_ddraw->render.viewport.x;
rc.right = g_ddraw->width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->height + g_ddraw->render.viewport.y;
rc.right = g_ddraw->width;
rc.bottom = g_ddraw->height;
}
/* Convert the client area to screen coordinates */
@ -53,15 +57,23 @@ void mouse_lock()
real_SetCursorPos(rc.left + g_ddraw->cursor.x, rc.top + g_ddraw->cursor.y - g_ddraw->mouse_y_adjust);
}
real_SetCursor(g_ddraw->old_cursor);
if (g_ddraw->hidecursor)
if (g_ddraw->handlemouse)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
real_ClipCursor(&rc);
while (real_ShowCursor(FALSE) >= 0);
}
else
{
real_SetCursor(g_ddraw->old_cursor);
real_ClipCursor(&rc);
if (g_ddraw->hidecursor)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
}
real_ClipCursor(&rc);
}
g_ddraw->locked = TRUE;
}
@ -72,10 +84,17 @@ void mouse_unlock()
RECT rc;
if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(TRUE) < 0);
return;
}
if (!g_hook_active)
{
return;
}
if (g_ddraw->locked)
{
@ -93,11 +112,19 @@ void mouse_unlock()
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
if (g_ddraw->handlemouse)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
}
else
{
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
}
}
real_SetCursor(LoadCursor(NULL, IDC_ARROW));

View File

@ -391,22 +391,25 @@ DWORD WINAPI d3d9_render_main(void)
}
}
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
if (!g_ddraw->handlemouse)
{
if (g_ddraw->child_window_exists)
{
IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (!needs_update && d3d9_update_vertices(FALSE, FALSE))
needs_update = TRUE;
}
else if (needs_update)
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{
if (d3d9_update_vertices(FALSE, TRUE))
needs_update = FALSE;
if (g_ddraw->child_window_exists)
{
IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
if (!needs_update && d3d9_update_vertices(FALSE, FALSE))
needs_update = TRUE;
}
else if (needs_update)
{
if (d3d9_update_vertices(FALSE, TRUE))
needs_update = FALSE;
}
}
}
}

View File

@ -72,8 +72,11 @@ DWORD WINAPI gdi_render_main(void)
if (g_ddraw->vhack)
InterlockedExchange(&g_ddraw->upscale_hack_active, upscale_hack);
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (!g_ddraw->handlemouse)
{
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
}
if (g_ddraw->primary->palette)
{

View File

@ -664,28 +664,31 @@ static void ogl_render()
glClear(GL_COLOR_BUFFER_BIT);
}
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
if (!g_ddraw->handlemouse)
{
if (g_ddraw->child_window_exists)
{
glClear(GL_COLOR_BUFFER_BIT);
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (!needs_update)
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{
if (g_ddraw->child_window_exists)
{
glViewport(0, g_ddraw->render.height - g_ddraw->height, g_ddraw->width, g_ddraw->height);
needs_update = TRUE;
}
}
else if (needs_update)
{
glViewport(
g_ddraw->render.viewport.x, g_ddraw->render.viewport.y,
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
glClear(GL_COLOR_BUFFER_BIT);
needs_update = FALSE;
if (!needs_update)
{
glViewport(0, g_ddraw->render.height - g_ddraw->height, g_ddraw->width, g_ddraw->height);
needs_update = TRUE;
}
}
else if (needs_update)
{
glViewport(
g_ddraw->render.viewport.x, g_ddraw->render.viewport.y,
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
needs_update = FALSE;
}
}
}
}

View File

@ -325,7 +325,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
if (real_GetClientRect(hwnd, &size) && real_GetWindowRect(hwnd, &pos) && size.right > 1 && size.bottom > 1)
{
g_ddraw->got_child_windows = g_ddraw->child_window_exists = TRUE;
g_ddraw->child_window_exists = TRUE;
if (g_ddraw->fixchildwindows)
{

View File

@ -28,9 +28,6 @@ BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
int max_width = g_ddraw->adjmouse ? g_ddraw->render.viewport.width : g_ddraw->width;
int max_height = g_ddraw->adjmouse ? g_ddraw->render.viewport.height : g_ddraw->height;
pt.x -= g_ddraw->render.viewport.x;
pt.y -= g_ddraw->render.viewport.y;
if (pt.x < 0)
{
diffx = pt.x;
@ -116,7 +113,7 @@ int WINAPI fake_ShowCursor(BOOL bShow)
{
static int count;
if (g_ddraw)
if (g_ddraw && !g_ddraw->handlemouse)
return real_ShowCursor(bShow);
return bShow ? ++count : --count;
@ -127,7 +124,7 @@ HCURSOR WINAPI fake_SetCursor(HCURSOR hCursor)
if (g_ddraw)
g_ddraw->old_cursor = hCursor;
if (g_ddraw && (g_ddraw->locked || g_ddraw->devmode))
if (g_ddraw && !g_ddraw->handlemouse && (g_ddraw->locked || g_ddraw->devmode))
return real_SetCursor(hCursor);
return NULL;
@ -304,18 +301,12 @@ BOOL WINAPI fake_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BO
LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_MOUSEMOVE)
if (g_ddraw && g_ddraw->hwnd == hWnd && g_ddraw->adjmouse && Msg == WM_MOUSEMOVE)
{
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
int x = (int)(GET_X_LPARAM(lParam) * g_ddraw->render.scale_w);
int y = (int)(GET_Y_LPARAM(lParam) * g_ddraw->render.scale_h);
if (g_ddraw->adjmouse)
{
x = (int)(x * g_ddraw->render.scale_w);
y = (int)(y * g_ddraw->render.scale_h);
}
lParam = MAKELPARAM(x + g_ddraw->render.viewport.x, y + g_ddraw->render.viewport.y);
lParam = MAKELPARAM(x, y);
}
if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_SIZE && g_hook_method != 2)

View File

@ -374,7 +374,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
}
if (g_ddraw->got_child_windows)
if (!g_ddraw->handlemouse)
{
redraw_count = 2;
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
@ -404,7 +404,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
}
if (g_ddraw->got_child_windows)
if (!g_ddraw->handlemouse)
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
@ -483,7 +483,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)
{
if (g_ddraw->got_child_windows)
if (!g_ddraw->handlemouse)
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
}
@ -530,7 +530,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
/* let it pass through once (tiberian sun) */
static BOOL one_time;
if (wParam && !one_time && g_ddraw->noactivateapp)
if (wParam && !one_time && !g_ddraw->handlemouse && g_ddraw->noactivateapp)
{
one_time = TRUE;
break;
@ -664,17 +664,6 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
case WM_MBUTTONDOWN:
case WM_MOUSEMOVE:
{
int x = GET_X_LPARAM(lParam) - g_ddraw->render.viewport.x;
int y = GET_Y_LPARAM(lParam) - g_ddraw->render.viewport.y;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
lParam = MAKELPARAM(x, y);
if (!g_ddraw->devmode)
{
if (!g_ddraw->locked)
@ -748,7 +737,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
case WM_PAINT:
{
if (redraw_count > 0)
if (!g_ddraw->handlemouse && redraw_count > 0)
{
redraw_count--;
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);