diff --git a/GolemHelper/Automation/CoordinateUtils.cpp b/GolemHelper/Automation/CoordinateUtils.cpp index 4a08f24..90f88ac 100644 --- a/GolemHelper/Automation/CoordinateUtils.cpp +++ b/GolemHelper/Automation/CoordinateUtils.cpp @@ -10,44 +10,81 @@ void CoordinateUtils::GetScaledCoordinates(int baseX, int baseY, int* scaledX, i if (g_nexusLink && g_nexusLink->Width > 0 && g_nexusLink->Height > 0) { float uiScale = g_nexusLink->Scaling; - float dpiScale = (float)g_nexusLink->Width / 1920.0f; + float dpiScaleX, dpiScaleY; - char valuesBuffer[200]; - sprintf_s(valuesBuffer, "GetScaled INPUT: uiScale=%.3f, base=%d,%d", uiScale, baseX, baseY); + // Ultrawide 5120x1440 + if (g_nexusLink->Width == 5120 && g_nexusLink->Height == 1440) { + if (uiScale >= 0.89f && uiScale <= 0.91f) { + dpiScaleX = 2.814f; + dpiScaleY = 0.888f; + g_api->Log(ELogLevel_INFO, "GolemHelper", "ULTRAWIDE 5120x1440: APPLIED SMALL UI OFFSET"); + } + else if (uiScale >= 1.09f && uiScale <= 1.15f) { + dpiScaleX = 2.746f; + dpiScaleY = 1.104f; + g_api->Log(ELogLevel_INFO, "GolemHelper", "ULTRAWIDE 5120x1440: APPLIED LARGE UI OFFSET"); + } + else if (uiScale >= 1.21f && uiScale <= 1.25f) { + dpiScaleX = 2.713f; + dpiScaleY = 1.208f; + g_api->Log(ELogLevel_INFO, "GolemHelper", "ULTRAWIDE 5120x1440: APPLIED LARGER UI OFFSET"); + } + else { + dpiScaleX = 2.779f; + dpiScaleY = 1.000f; + g_api->Log(ELogLevel_INFO, "GolemHelper", "ULTRAWIDE 5120x1440: APPLIED NORMAL UI OFFSET"); + } + } + else { + dpiScaleX = (float)g_nexusLink->Width / 1920.0f; + dpiScaleY = 1.0f; + + char normalBuffer[150]; + sprintf_s(normalBuffer, "NORMAL MONITOR: Width=%d, Height=%d, scaleX=%.3f", + g_nexusLink->Width, g_nexusLink->Height, dpiScaleX); + g_api->Log(ELogLevel_INFO, "GolemHelper", normalBuffer); + } + + char valuesBuffer[250]; + sprintf_s(valuesBuffer, "GetScaled INPUT: uiScale=%.3f, scaleX=%.3f, scaleY=%.3f, base=%d,%d", + uiScale, dpiScaleX, dpiScaleY, baseX, baseY); g_api->Log(ELogLevel_INFO, "GolemHelper", valuesBuffer); - int scaledForResolutionX = (int)(baseX * dpiScale); - int scaledForResolutionY = baseY; + int scaledForResolutionX = (int)(baseX * dpiScaleX); + int scaledForResolutionY = (int)(baseY * dpiScaleY); int finalX = scaledForResolutionX; int finalY = scaledForResolutionY; - if (uiScale >= 0.89f && uiScale <= 0.91f) { - finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.029f); - finalY = scaledForResolutionY - (int)(scaledForResolutionY * 0.103f); - g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED SMALL OFFSET"); - } - else if (uiScale >= 1.09f && uiScale <= 1.15f) { - finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.053f); - finalY = scaledForResolutionY + (int)(scaledForResolutionY * 0.095f); - g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED LARGE OFFSET"); - } - else if (uiScale >= 1.21f && uiScale <= 1.25f) { - finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.097f); - finalY = scaledForResolutionY + (int)(scaledForResolutionY * 0.206f); - g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED LARGER OFFSET"); - } - else { - char buffer[100]; - sprintf_s(buffer, "NO OFFSET - uiScale %.3f", uiScale); - g_api->Log(ELogLevel_INFO, "GolemHelper", buffer); + if (!(g_nexusLink->Width == 5120 && g_nexusLink->Height == 1440)) { + if (uiScale >= 0.89f && uiScale <= 0.91f) { + finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.029f); + finalY = scaledForResolutionY - (int)(scaledForResolutionY * 0.103f); + g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED SMALL UI OFFSET"); + } + else if (uiScale >= 1.09f && uiScale <= 1.15f) { + finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.053f); + finalY = scaledForResolutionY + (int)(scaledForResolutionY * 0.095f); + g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED LARGE UI OFFSET"); + } + else if (uiScale >= 1.21f && uiScale <= 1.25f) { + finalX = scaledForResolutionX - (int)(scaledForResolutionX * 0.097f); + finalY = scaledForResolutionY + (int)(scaledForResolutionY * 0.206f); + g_api->Log(ELogLevel_INFO, "GolemHelper", "APPLIED LARGER UI OFFSET"); + } + else { + char buffer[100]; + sprintf_s(buffer, "NO UI OFFSET - uiScale %.3f", uiScale); + g_api->Log(ELogLevel_INFO, "GolemHelper", buffer); + } } *scaledX = finalX; *scaledY = finalY; - char resultBuffer[200]; - sprintf_s(resultBuffer, "GetScaled RESULT: %d,%d -> %d,%d", scaledForResolutionX, scaledForResolutionY, finalX, finalY); + char resultBuffer[250]; + sprintf_s(resultBuffer, "GetScaled RESULT: base=%d,%d -> scaled=%d,%d -> final=%d,%d", + baseX, baseY, scaledForResolutionX, scaledForResolutionY, finalX, finalY); g_api->Log(ELogLevel_INFO, "GolemHelper", resultBuffer); } else { diff --git a/GolemHelper/GolemHelper.cpp b/GolemHelper/GolemHelper.cpp index 7d3c334..fc8773b 100644 --- a/GolemHelper/GolemHelper.cpp +++ b/GolemHelper/GolemHelper.cpp @@ -36,7 +36,7 @@ void Load(AddonAPI* aApi) { "Toggle GolemHelper UI" ); - g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.2.3.0 Loaded ==="); + g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.2.4.0 Loaded ==="); g_api->Log(ELogLevel_INFO, "GolemHelper", "GolemHelper addon loaded successfully!"); } @@ -59,7 +59,7 @@ extern "C" __declspec(dllexport) AddonDefinition* GetAddonDef() { def.Signature = -424248; def.APIVersion = NEXUS_API_VERSION; def.Name = "GolemHelper"; - def.Version = { 1, 2, 3, 0 }; + def.Version = { 1, 2, 4, 0 }; def.Author = "Azrub"; def.Description = "Automates the process of setting optimal boon and golem configurations in the training area"; def.Load = Load; diff --git a/GolemHelper/UI/UIManager.cpp b/GolemHelper/UI/UIManager.cpp index d969fb0..5c39c5e 100644 --- a/GolemHelper/UI/UIManager.cpp +++ b/GolemHelper/UI/UIManager.cpp @@ -13,7 +13,7 @@ void UIManager::RenderUI() { if (ImGui::Begin("GolemHelper", &g_state.showUI, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.2.3.0"); + ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.2.4.0"); ImGui::Separator(); ImGui::Text("Status:");