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:
deadman96385 2026-03-01 12:47:50 -06:00
parent 287d43a255
commit 6e736ebff3
2 changed files with 86 additions and 0 deletions

View file

@ -83,6 +83,7 @@ UIScene_AbstractContainerMenu::UIScene_AbstractContainerMenu(int iPad, UILayer *
ui.OverrideSFX(m_iPad,ACTION_MENU_DOWN,true);
m_bIgnoreInput=false;
m_bMouseDragSlider=false;
}
UIScene_AbstractContainerMenu::~UIScene_AbstractContainerMenu()
@ -280,6 +281,56 @@ void UIScene_AbstractContainerMenu::tick()
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;
S32 width, height;
m_parentLayer->getRenderDimensions(width, height);

View file

@ -395,6 +395,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEWHEEL:
KMInput.OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
break;
case WM_MOUSEMOVE:
KMInput.OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
break;
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE)
KMInput.SetCapture(false);
@ -404,6 +407,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
KMInput.ClearAllState();
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:
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);
D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;
ZeroMemory(&descDSView, sizeof(descDSView));
descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
descDSView.Texture2D.MipSlice = 0;
@ -702,6 +715,28 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance);
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
SetProcessDPIAware();
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);