From b120acabfe14e70ca63a5ef01fe467151bf53064 Mon Sep 17 00:00:00 2001 From: chinosk <2248589280@qq.com> Date: Thu, 23 May 2024 21:27:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E5=99=A8=E6=97=A0=E6=95=88/=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cpp/GakumasLocalify/camera/baseCamera.cpp | 2 +- .../cpp/deps/UnityResolve/UnityResolve.hpp | 18 +++++++++++++++++- .../gakumas/localify/hookUtils/FilesChecker.kt | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/GakumasLocalify/camera/baseCamera.cpp b/app/src/main/cpp/GakumasLocalify/camera/baseCamera.cpp index 0c7b837..beb4a8e 100644 --- a/app/src/main/cpp/GakumasLocalify/camera/baseCamera.cpp +++ b/app/src/main/cpp/GakumasLocalify/camera/baseCamera.cpp @@ -7,7 +7,7 @@ namespace BaseCamera { float moveStep = 0.05; float look_radius = 5; // 转向半径 - float moveAngel = 1.5; // 转向角度 + float moveAngel = 1; // 转向角度 int smoothLevel = 1; unsigned long sleepTime = 0; diff --git a/app/src/main/cpp/deps/UnityResolve/UnityResolve.hpp b/app/src/main/cpp/deps/UnityResolve/UnityResolve.hpp index 7aacda4..3bb6631 100644 --- a/app/src/main/cpp/deps/UnityResolve/UnityResolve.hpp +++ b/app/src/main/cpp/deps/UnityResolve/UnityResolve.hpp @@ -526,7 +526,10 @@ public: if (!address_.contains(funcName) || !address_[funcName]) address_[funcName] = static_cast(GetProcAddress(static_cast(hmodule_), funcName.c_str())); #elif ANDROID_MODE || LINUX_MODE if (address_.find(funcName) == address_.end() || !address_[funcName]) { - address_[funcName] = xdl_sym(hmodule_, funcName.c_str(), NULL); + auto xdlAddr = xdl_sym(hmodule_, funcName.c_str(), NULL); + if (!xdlAddr) { + address_[funcName] = dlsym(hmodule_, funcName.c_str()); + } } #endif @@ -1797,6 +1800,19 @@ public: if (method) return method->Invoke(this); return {}; } + + auto GetPixelRect() -> Rect { + if (!this) return {}; + static Method* method; + if (!method) method = Get("UnityEngine.CoreModule.dll")->Get("Camera")->Get("get_pixelRect"); + return method->Invoke(this); + } + auto GetOrthographicSize() -> float { + if (!this) return {}; + static Method* method; + if (!method) method = Get("UnityEngine.CoreModule.dll")->Get("Camera")->Get("get_orthographicSize"); + return method->Invoke(this); + } }; struct Transform : Component { diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt index 13369cc..055ed2f 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt @@ -33,6 +33,10 @@ object FilesChecker { fun updateFiles() { Log.i("GakumasLocal", "Updating files...") + val pluginBasePath = File(filesDir, localizationFilesDir) + if (!pluginBasePath.exists()) { + pluginBasePath.mkdirs() + } val assets = XModuleResources.createInstance(modulePath, null).assets fun forAllAssetFiles(