mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
fix: restore Windows input hooks lost during rebase
Reinstate Win32 mouse message handling, startup working-directory setup, and container mouse action dispatch so post-rebase keyboard/mouse behavior matches pre-rebase functionality.
This commit is contained in:
parent
287d43a255
commit
6e736ebff3
|
|
@ -83,6 +83,7 @@ UIScene_AbstractContainerMenu::UIScene_AbstractContainerMenu(int iPad, UILayer *
|
||||||
ui.OverrideSFX(m_iPad,ACTION_MENU_DOWN,true);
|
ui.OverrideSFX(m_iPad,ACTION_MENU_DOWN,true);
|
||||||
|
|
||||||
m_bIgnoreInput=false;
|
m_bIgnoreInput=false;
|
||||||
|
m_bMouseDragSlider=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIScene_AbstractContainerMenu::~UIScene_AbstractContainerMenu()
|
UIScene_AbstractContainerMenu::~UIScene_AbstractContainerMenu()
|
||||||
|
|
@ -280,6 +281,56 @@ void UIScene_AbstractContainerMenu::tick()
|
||||||
|
|
||||||
onMouseTick();
|
onMouseTick();
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
if (getPad() == 0 && m_bMousePointerControl)
|
||||||
|
{
|
||||||
|
if (KMInput.ConsumeMousePress(0))
|
||||||
|
{
|
||||||
|
if (m_eCurrSection == eSectionInventoryCreativeSlider)
|
||||||
|
{
|
||||||
|
m_bMouseDragSlider = true;
|
||||||
|
handleOtherClicked(m_iPad, eSectionInventoryCreativeSlider, 0, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_A, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_bMouseDragSlider && KMInput.IsMouseDown(0))
|
||||||
|
{
|
||||||
|
handleOtherClicked(m_iPad, eSectionInventoryCreativeSlider, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!KMInput.IsMouseDown(0))
|
||||||
|
m_bMouseDragSlider = false;
|
||||||
|
|
||||||
|
if (KMInput.ConsumeMousePress(1))
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_X, false);
|
||||||
|
}
|
||||||
|
if (KMInput.ConsumeMousePress(2))
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_Y, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int scrollDelta = KMInput.ConsumeScrollDelta();
|
||||||
|
if (scrollDelta > 0)
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_OTHER_STICK_UP, false);
|
||||||
|
}
|
||||||
|
else if (scrollDelta < 0)
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_OTHER_STICK_DOWN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KMInput.ConsumeKeyPress(VK_ESCAPE))
|
||||||
|
{
|
||||||
|
handleKeyDown(m_iPad, ACTION_MENU_B, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
IggyEvent mouseEvent;
|
IggyEvent mouseEvent;
|
||||||
S32 width, height;
|
S32 width, height;
|
||||||
m_parentLayer->getRenderDimensions(width, height);
|
m_parentLayer->getRenderDimensions(width, height);
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
KMInput.OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
|
KMInput.OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
|
||||||
break;
|
break;
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
KMInput.OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||||
|
break;
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
if (LOWORD(wParam) == WA_INACTIVE)
|
if (LOWORD(wParam) == WA_INACTIVE)
|
||||||
KMInput.SetCapture(false);
|
KMInput.SetCapture(false);
|
||||||
|
|
@ -404,6 +407,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
KMInput.ClearAllState();
|
KMInput.ClearAllState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
// Hide the OS cursor when an Iggy/Flash menu is displayed (it has its own Flash cursor)
|
||||||
|
if (LOWORD(lParam) == HTCLIENT && !KMInput.IsCaptured() && ui.GetMenuDisplayed(0))
|
||||||
|
{
|
||||||
|
SetCursor(NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
@ -609,6 +621,7 @@ app.DebugPrintf("width: %d, height: %d\n", width, height);
|
||||||
hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer);
|
hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer);
|
||||||
|
|
||||||
D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;
|
D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;
|
||||||
|
ZeroMemory(&descDSView, sizeof(descDSView));
|
||||||
descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||||
descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||||
descDSView.Texture2D.MipSlice = 0;
|
descDSView.Texture2D.MipSlice = 0;
|
||||||
|
|
@ -702,6 +715,28 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
WCHAR exePath[MAX_PATH] = { 0 };
|
||||||
|
GetModuleFileNameW(NULL, exePath, MAX_PATH);
|
||||||
|
WCHAR* lastSlash = wcsrchr(exePath, L'\\');
|
||||||
|
if (lastSlash)
|
||||||
|
{
|
||||||
|
*lastSlash = L'\0';
|
||||||
|
|
||||||
|
WCHAR devCheckPath[MAX_PATH] = { 0 };
|
||||||
|
swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath);
|
||||||
|
|
||||||
|
if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
WCHAR projectPath[MAX_PATH] = { 0 };
|
||||||
|
swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath);
|
||||||
|
SetCurrentDirectoryW(projectPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCurrentDirectoryW(exePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue