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

remove "handlemouse" setting

This commit is contained in:
FunkyFr3sh 2021-06-16 05:57:19 +02:00
parent abdb74942b
commit 684224b833
10 changed files with 175 additions and 181 deletions

View File

@ -104,7 +104,6 @@ typedef struct CNCDDRAW
BOOL fullscreen;
BOOL maintas;
BOOL noactivateapp;
BOOL handlemouse;
char shader[MAX_PATH];
BOOL wine;
BOOL altenter;
@ -131,6 +130,7 @@ 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", FALSE);
g_ddraw->adjmouse = cfg_get_bool("adjmouse", TRUE);
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,11 +112,6 @@ 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);
@ -244,10 +239,10 @@ static void cfg_create_ini()
"; Run in windowed mode rather than going fullscreen\n"
"windowed=false\n"
"\n"
"; Maintain aspect ratio - (Requires 'handlemouse=true')\n"
"; Maintain aspect ratio\n"
"maintas=false\n"
"\n"
"; Windowboxing / Integer Scaling - (Requires 'handlemouse=true')\n"
"; Windowboxing / Integer Scaling\n"
"boxing=false\n"
"\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
@ -258,9 +253,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 - (Requires 'handlemouse=true')\n"
"; Automatic mouse sensitivity scaling\n"
"; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n"
"adjmouse=false\n"
"adjmouse=true\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"
@ -306,10 +301,6 @@ 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"
@ -345,7 +336,7 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"resolutions=2\n"
"\n"
"; Age of Empires: The Rise of Rome\n"
@ -353,7 +344,7 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"resolutions=2\n"
"\n"
"; Age of Empires II\n"
@ -361,14 +352,14 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Age of Empires II: The Conquerors\n"
"[age2_x1]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; American Conquest\n"
"[DMCR]\n"
@ -391,17 +382,17 @@ static void cfg_create_ini()
"; Anstoss 3\n"
"[anstoss3]\n"
"renderer=gdi\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Anno 1602\n"
"[1602]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
"; Alien Nations\n"
"[AN]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Atlantis\n"
"[ATLANTIS]\n"
@ -462,107 +453,125 @@ static void cfg_create_ini()
"[game]\n"
"checkfile=.\\blowfish.dll\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\n"
"maxfps=60\n"
"minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Caesar III\n"
"[c3]\n"
"nonexclusive=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Chris Sawyer's Locomotion\n"
"[LOCO]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Cultures 2\n"
"[Cultures2]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Cultures 2 MP\n"
"[Cultures2MP]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Close Combat 2: A Bridge Too Far\n"
"[cc2]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 3: The Russian Front\n"
"[cc3]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 4: The Battle of the Bulge\n"
"[cc4]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
"; Close Combat 5: Invasion: Normandy\n"
"[cc5]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"fixpitch=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
@ -577,7 +586,7 @@ static void cfg_create_ini()
"\n"
"; Corsairs Gold\n"
"[corsairs]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
@ -600,10 +609,12 @@ static void cfg_create_ini()
"\n"
"; Future Cop - L.A.P.D.\n"
"[FCopLAPD]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=gdi\n"
"hook=2\n"
"passthrough=false\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; G-Police\n"
"[GPOLICE]\n"
@ -611,7 +622,7 @@ static void cfg_create_ini()
"\n"
"; Gangsters: Organized Crime\n"
"[gangsters]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"\n"
@ -635,7 +646,7 @@ static void cfg_create_ini()
"\n"
"; Heroes of Might and Magic II: The Succession Wars\n"
"[HEROES2W]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Hard Truck: Road to Victory\n"
"[htruck]\n"
@ -645,13 +656,13 @@ static void cfg_create_ini()
"\n"
"; Invictus\n"
"[Invictus]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"fixwndprochook=true\n"
"renderer=opengl\n"
"\n"
"; Interstate 76\n"
"[i76]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=opengl\n"
"\n"
"; Jagged Alliance 2\n"
@ -688,11 +699,11 @@ static void cfg_create_ini()
"\n"
"; Majesty Gold HD\n"
"[MajestyHD]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Majesty Gold HD\n"
"[MajestyHD - Old]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Moorhuhn\n"
"[Moorhuhn]\n"
@ -707,12 +718,12 @@ static void cfg_create_ini()
"[olwin]\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"handlemouse=false\n"
"adjmouse=true\n"
"renderer=gdi\n"
"\n"
"; Pharaoh\n"
"[Pharaoh]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Pacific General\n"
"[PACGEN]\n"
@ -725,40 +736,42 @@ static void cfg_create_ini()
"\n"
"; Railroad Tycoon II\n"
"[RT2]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; ROAD RASH\n"
"[RoadRash]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Star Trek - Armada\n"
"[Armada]\n"
"armadahack=true\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Star Wars: Galactic Battlegrounds\n"
"[battlegrounds]\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Star Wars: Galactic Battlegrounds: Clone Campaigns\n"
"[battlegrounds_x1]\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Stronghold Crusader HD\n"
"[Stronghold Crusader]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Stronghold Crusader Extreme HD\n"
"[Stronghold_Crusader_Extreme]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Stronghold HD\n"
"[Stronghold]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Steel Panthers: World At War\n"
"[MECH]\n"
@ -767,13 +780,15 @@ static void cfg_create_ini()
"; Shadow Watch\n"
"[sw]\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Shadow Flare\n"
"[ShadowFlare]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"maintas=false\n"
"boxing=false\n"
"\n"
"; Three Kingdoms: Fate of the Dragon\n"
"[sanguo]\n"
@ -793,24 +808,26 @@ static void cfg_create_ini()
"renderer=opengl\n"
"nonexclusive=true\n"
"maxgameticks=60\n"
"handlemouse=false\n"
"adjmouse=true\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"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Uprising\n"
"[uprising]\n"
"renderer=opengl\n"
"fixpitch=true\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Uprising 2\n"
"[Uprising 2]\n"
"renderer=opengl\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
"; Warlords 3\n"
"[Darklord]\n"
@ -822,7 +839,7 @@ static void cfg_create_ini()
"\n"
"; Worms Armageddon\n"
"[WA]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"width=0\n"
"height=0\n"
"resizable=false\n"
@ -838,7 +855,7 @@ static void cfg_create_ini()
"\n"
"; Zeus and Poseidon\n"
"[Zeus]\n"
"handlemouse=false\n"
"adjmouse=true\n"
"\n"
, fh);

View File

@ -513,8 +513,6 @@ 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 */
@ -564,9 +562,6 @@ 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;
@ -595,8 +590,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->windowed = TRUE;
}
else
maintas = TRUE;
}
}
}
@ -608,11 +601,6 @@ 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;
@ -636,7 +624,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 (maintas)
else if (g_ddraw->maintas)
{
g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height =
@ -831,13 +819,18 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
SetPixelFormat(g_ddraw->render.hdc, ChoosePixelFormat(g_ddraw->render.hdc, &pfd), &pfd);
}
if (g_ddraw->handlemouse && g_ddraw->windowed)
/* Make sure the cursor is visible in windowed mode initially */
if (g_ddraw->windowed)
{
while (real_ShowCursor(FALSE) > 0); /* workaround for direct input games */
while (real_ShowCursor(TRUE) < 0);
}
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));
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
}
GetWindowText(g_ddraw->hwnd, (LPTSTR)&g_ddraw->title, sizeof(g_ddraw->title));

View File

@ -12,27 +12,23 @@ 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.right = g_ddraw->render.viewport.width;
rc.bottom = g_ddraw->render.viewport.height;
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;
}
else
{
rc.right = g_ddraw->width;
rc.bottom = g_ddraw->height;
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;
}
/* Convert the client area to screen coordinates */
@ -57,24 +53,16 @@ void mouse_lock()
real_SetCursorPos(rc.left + g_ddraw->cursor.x, rc.top + g_ddraw->cursor.y - g_ddraw->mouse_y_adjust);
}
if (g_ddraw->handlemouse)
{
real_ClipCursor(&rc);
while (real_ShowCursor(FALSE) >= 0);
}
else
{
real_SetCursor(g_ddraw->old_cursor);
real_SetCursor(g_ddraw->old_cursor);
if (g_ddraw->hidecursor)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
}
real_ClipCursor(&rc);
if (g_ddraw->hidecursor)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
}
real_ClipCursor(&rc);
g_ddraw->locked = TRUE;
}
}
@ -84,17 +72,10 @@ 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)
{
@ -112,19 +93,11 @@ void mouse_unlock()
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);
if (g_ddraw->handlemouse)
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));
}
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,25 +391,22 @@ DWORD WINAPI d3d9_render_main(void)
}
}
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->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{
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->child_window_exists)
{
if (g_ddraw->child_window_exists)
{
IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
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;
}
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,11 +72,8 @@ DWORD WINAPI gdi_render_main(void)
if (g_ddraw->vhack)
InterlockedExchange(&g_ddraw->upscale_hack_active, upscale_hack);
if (!g_ddraw->handlemouse)
{
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
}
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,32 +664,29 @@ static void ogl_render()
glClear(GL_COLOR_BUFFER_BIT);
}
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->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{
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->child_window_exists)
{
if (g_ddraw->child_window_exists)
{
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT);
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)
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;
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->child_window_exists = TRUE;
g_ddraw->got_child_windows = g_ddraw->child_window_exists = TRUE;
if (g_ddraw->fixchildwindows)
{

View File

@ -28,6 +28,9 @@ 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;
@ -113,7 +116,7 @@ int WINAPI fake_ShowCursor(BOOL bShow)
{
static int count;
if (g_ddraw && !g_ddraw->handlemouse)
if (g_ddraw)
return real_ShowCursor(bShow);
return bShow ? ++count : --count;
@ -124,7 +127,7 @@ HCURSOR WINAPI fake_SetCursor(HCURSOR hCursor)
if (g_ddraw)
g_ddraw->old_cursor = hCursor;
if (g_ddraw && !g_ddraw->handlemouse && (g_ddraw->locked || g_ddraw->devmode))
if (g_ddraw && (g_ddraw->locked || g_ddraw->devmode))
return real_SetCursor(hCursor);
return NULL;
@ -301,12 +304,18 @@ 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 && g_ddraw->adjmouse && Msg == WM_MOUSEMOVE)
if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_MOUSEMOVE)
{
int x = (int)(GET_X_LPARAM(lParam) * g_ddraw->render.scale_w);
int y = (int)(GET_Y_LPARAM(lParam) * g_ddraw->render.scale_h);
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
lParam = MAKELPARAM(x, y);
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);
}
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->handlemouse)
if (g_ddraw->got_child_windows)
{
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->handlemouse)
if (g_ddraw->got_child_windows)
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->handlemouse)
if (g_ddraw->got_child_windows)
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->handlemouse && g_ddraw->noactivateapp)
if (wParam && !one_time && g_ddraw->noactivateapp)
{
one_time = TRUE;
break;
@ -664,6 +664,17 @@ 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)
@ -737,7 +748,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
case WM_PAINT:
{
if (!g_ddraw->handlemouse && redraw_count > 0)
if (redraw_count > 0)
{
redraw_count--;
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);