feat:bugfix

This commit is contained in:
jiqiu2021
2025-06-28 20:25:17 +08:00
parent e02a3df7fc
commit 6110216556
2 changed files with 9 additions and 6 deletions

View File

@@ -88,12 +88,8 @@ void load_so_file_custom_linker(const char *game_data_dir, const Config::SoFile
void hack_thread_func(const char *game_data_dir, const char *package_name, JavaVM *vm) { void hack_thread_func(const char *game_data_dir, const char *package_name, JavaVM *vm) {
LOGI("Hack thread started for package: %s", package_name); LOGI("Hack thread started for package: %s", package_name);
// Get injection delay from config // Note: Delay is now handled in main thread before this thread is created
int delay = Config::getInjectionDelay(); LOGI("Starting injection immediately (delay already applied in main thread)");
LOGI("Waiting %d seconds before injection", delay);
// Wait for app to initialize and files to be copied
sleep(delay);
// Get injection method for this app // Get injection method for this app
Config::InjectionMethod method = Config::getAppInjectionMethod(package_name); Config::InjectionMethod method = Config::getAppInjectionMethod(package_name);

View File

@@ -45,6 +45,13 @@ public:
// Get JavaVM // Get JavaVM
JavaVM *vm = nullptr; JavaVM *vm = nullptr;
if (env->GetJavaVM(&vm) == JNI_OK) { if (env->GetJavaVM(&vm) == JNI_OK) {
// Get injection delay from config
int delay = Config::getInjectionDelay();
LOGI("Main thread blocking for %d seconds before injection", delay);
// Block main thread for the delay period
sleep(delay);
// Then start hack thread with JavaVM // Then start hack thread with JavaVM
std::thread hack_thread(hack_prepare, _data_dir, _package_name, data, length, vm); std::thread hack_thread(hack_prepare, _data_dir, _package_name, data, length, vm);
hack_thread.detach(); hack_thread.detach();