Add version display

This commit is contained in:
chinosk 2025-03-18 12:03:52 +00:00
parent 3fe2d1775b
commit 4a77a4fc06
Signed by: chinosk
GPG Key ID: 00610B08C1BF7BE9
4 changed files with 39 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include "GUII18n.hpp"
#include "GakumasLocalify/config/Config.hpp"
#include "resourceUpdate/resourceUpdate.hpp"
#include "platformDefine.hpp"
extern void* SetResolution_orig;
extern std::function<void()> g_reload_all_data;
@ -150,6 +151,7 @@ namespace GkmsGUILoop {
using namespace GakumasLocal;
if (ImGui::Begin("Gakumas Plugin Config")) {
ImGui::Text("Plugin Version: %s", PLUGIN_VERSION);
ImGui::Text("Resource Version: %s", GkmsResourceUpdate::GetCurrentResourceVersion(true).c_str());
if (ImGui::Button("Reload Config And Translation Data")) {

View File

@ -11,6 +11,7 @@
#define LogMinVersion ANDROID_LOG_DEBUG
#define PLUGIN_VERSION "3.0.0"
#define ADD_HOOK(name, addr) \
name##_Addr = reinterpret_cast<name##_Type>(addr); \

View File

@ -165,7 +165,8 @@ namespace GkmsResourceUpdate {
if (localVersion == remoteVersion) {
if (isManual) {
auto check = MessageBoxA(NULL, GkmsGUII18n::ts("local_file_already_latest"), "Check Update", MB_OKCANCEL);
auto check = MessageBoxW(NULL, utility::conversions::to_string_t(GkmsGUII18n::ts("local_file_already_latest")).c_str(),
L"Check Update", MB_OKCANCEL);
if (check != IDOK) {
return;
}

View File

@ -14,6 +14,7 @@
#include "deps/UnityResolve/UnityResolve.hpp"
#include <cpprest/details/basic_types.h>
#include <cpprest/details/http_helpers.h>
#include <windowsx.h>
bool mh_inited;
extern std::filesystem::path gakumasLocalPath;
@ -326,6 +327,30 @@ namespace GakumasLocal::WinHooks {
case WM_CLOSE: {
if (g_on_close) g_on_close();
}; break;
case WM_NCHITTEST:
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
ScreenToClient(hWnd, &pt);
RECT rcClient;
GetClientRect(hWnd, &rcClient);
const int borderWidth = 8; // 根据需要调整边缘宽度
bool left = pt.x < borderWidth;
bool right = pt.x >= rcClient.right - borderWidth;
bool top = pt.y < borderWidth;
bool bottom = pt.y >= rcClient.bottom - borderWidth;
if (top && left) return HTTOPLEFT;
if (top && right) return HTTOPRIGHT;
if (bottom && left) return HTBOTTOMLEFT;
if (bottom && right) return HTBOTTOMRIGHT;
if (left) return HTLEFT;
if (right) return HTRIGHT;
if (top) return HTTOP;
if (bottom) return HTBOTTOM;
return HTCLIENT;
} break;
default: break;
}
@ -335,6 +360,15 @@ namespace GakumasLocal::WinHooks {
void InstallWndProcHook() {
g_pfnOldWndProc = (WNDPROC)GetWindowLongPtr(FindWindowW(L"UnityWndClass", L"gakumas"), GWLP_WNDPROC);
SetWindowLongPtr(FindWindowW(L"UnityWndClass", L"gakumas"), GWLP_WNDPROC, (LONG_PTR)WndProcCallback);
HWND hwnd = FindWindowW(L"UnityWndClass", L"gakumas");
LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
// 加上可调整大小、标题栏、系统菜单等样式
style |= WS_OVERLAPPEDWINDOW;
SetWindowLongPtr(hwnd, GWL_STYLE, style);
// 通知系统样式已改变
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
void UninstallWndProcHook(HWND hWnd)