diff --git a/README.md b/README.md index 38588e7..c5ab22d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ MAXWELL is an ingame ImGui overlay for the game ANIMAL WELL, featuring an inventory editor, warping map, cheats etc. -It has last been tested on the 2024-05-27 build on Windows 10, but it might work on other versions too. +It has last been tested on the 2024-05-27 version 1.0.0.15 on Windows 10, but it might work on other versions too. **Please go away if you haven't finished the game, this will spoil everything for you.** diff --git a/ui.cpp b/ui.cpp index ed552b6..6f69c4d 100644 --- a/ui.cpp +++ b/ui.cpp @@ -1,5 +1,7 @@ #define UNICODE +#include + #include #include #include @@ -17,6 +19,8 @@ #include "ui.h" #include "version.h" +#pragma comment(lib, "version.lib") + // #define STB_IMAGE_IMPLEMENTATION // #include "stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION @@ -105,6 +109,33 @@ void Flags(const std::array names_array, T *flag_field, } } +std::string GetAppVersion() { + DWORD dwHandle; + TCHAR fileName[MAX_PATH]; + + GetModuleFileName(NULL, fileName, MAX_PATH); + DWORD dwSize = GetFileVersionInfoSize(fileName, &dwHandle); + char *buffer = new char[dwSize]; + + VS_FIXEDFILEINFO *pvFileInfo = NULL; + UINT fiLen = 0; + + if ((dwSize > 0) && GetFileVersionInfo(fileName, dwHandle, dwSize, &buffer)) { + VerQueryValue(&buffer, L"\\", (LPVOID *)&pvFileInfo, &fiLen); + } + + if (fiLen > 0) { + char buf[25]; + int len = + sprintf(buf, "%hu.%hu.%hu.%hu", HIWORD(pvFileInfo->dwFileVersionMS), + LOWORD(pvFileInfo->dwFileVersionMS), + HIWORD(pvFileInfo->dwFileVersionLS), + LOWORD(pvFileInfo->dwFileVersionLS)); + return std::string(buf, len); + } + return ""; +} + ImVec2 Normalize(ImVec2 pos) { ImGuiIO &io = ImGui::GetIO(); ImVec2 res = io.DisplaySize; @@ -450,7 +481,9 @@ void UI::Draw() { ScaleWindow(); ImGuiIO &io = ImGui::GetIO(); - std::string version = fmt::format("MAXWELL {}", get_version()); + static const std::string gameversion = GetAppVersion(); + std::string version = fmt::format("MAXWELL {}", get_version()) + + (gameversion != "" ? " | GAME " + gameversion : ""); ImGui::GetBackgroundDrawList()->AddText( ImVec2(io.DisplaySize.x / 2.f - ImGui::CalcTextSize(version.c_str()).x / 2.f,