mirror of
https://git.chinosk6.cn/chinosk/gkms-local.git
synced 2026-02-04 09:04:52 +00:00
Add plugin initialization progress (#2)
* add plugin init progress * add lazy initializing * fix: lazy initializing - can't get class from `*` namespace * fix: lazy mode - can't get class with empty namespace * update build.yml - Adapt to Gitea Actions
This commit is contained in:
@@ -39,7 +39,8 @@ std::unordered_set<void*> hookedStubs{};
|
||||
GakumasLocal::Log::InfoFmt("ADD_HOOK: %s at %p", #name, addr); \
|
||||
} \
|
||||
} \
|
||||
else GakumasLocal::Log::ErrorFmt("Hook failed: %s is NULL", #name, addr)
|
||||
else GakumasLocal::Log::ErrorFmt("Hook failed: %s is NULL", #name, addr); \
|
||||
if (Config::lazyInit) UnityResolveProgress::classProgress.current++
|
||||
|
||||
void UnHookAll() {
|
||||
for (const auto i: hookedStubs) {
|
||||
@@ -97,7 +98,7 @@ namespace GakumasLocal::HookMain {
|
||||
UnityResolve::UnityType::Transform* cameraTransformCache = nullptr;
|
||||
void CheckAndUpdateMainCamera() {
|
||||
if (!Config::enableFreeCamera) return;
|
||||
if (IsNativeObjectAlive(mainCameraCache)) return;
|
||||
if (IsNativeObjectAlive(mainCameraCache) && IsNativeObjectAlive(cameraTransformCache)) return;
|
||||
|
||||
mainCameraCache = UnityResolve::UnityType::Camera::GetMain();
|
||||
cameraTransformCache = mainCameraCache->GetTransform();
|
||||
@@ -827,7 +828,8 @@ namespace GakumasLocal::HookMain {
|
||||
|
||||
void StartInjectFunctions() {
|
||||
const auto hookInstaller = Plugin::GetInstance().GetHookInstaller();
|
||||
UnityResolve::Init(xdl_open(hookInstaller->m_il2cppLibraryPath.c_str(), RTLD_NOW), UnityResolve::Mode::Il2Cpp);
|
||||
UnityResolve::Init(xdl_open(hookInstaller->m_il2cppLibraryPath.c_str(), RTLD_NOW),
|
||||
UnityResolve::Mode::Il2Cpp, Config::lazyInit);
|
||||
|
||||
ADD_HOOK(AssetBundle_LoadAssetAsync, Il2cppUtils::il2cpp_resolve_icall(
|
||||
"UnityEngine.AssetBundle::LoadAssetAsync_Internal(System.String,System.Type)"));
|
||||
@@ -959,10 +961,30 @@ namespace GakumasLocal::HookMain {
|
||||
|
||||
Log::Info("Start init plugin...");
|
||||
|
||||
if (Config::lazyInit) {
|
||||
UnityResolveProgress::startInit = true;
|
||||
UnityResolveProgress::assembliesProgress.total = 2;
|
||||
UnityResolveProgress::assembliesProgress.current = 1;
|
||||
UnityResolveProgress::classProgress.total = 36;
|
||||
UnityResolveProgress::classProgress.current = 0;
|
||||
}
|
||||
|
||||
StartInjectFunctions();
|
||||
GKCamera::initCameraSettings();
|
||||
|
||||
if (Config::lazyInit) {
|
||||
UnityResolveProgress::assembliesProgress.current = 2;
|
||||
UnityResolveProgress::classProgress.total = 1;
|
||||
UnityResolveProgress::classProgress.current = 0;
|
||||
}
|
||||
|
||||
Local::LoadData();
|
||||
|
||||
if (Config::lazyInit) {
|
||||
UnityResolveProgress::classProgress.current = 1;
|
||||
UnityResolveProgress::startInit = false;
|
||||
}
|
||||
|
||||
Log::Info("Plugin init finished.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user