Feat: Update Remapper configuration to include JuiceRemapperJarPath

This commit is contained in:
xiaozhou233 committed 2026-05-06 14:15:11 +08:00
1 parent b3ec5b6eb5
commit 30ecc82ca2
3 files changed
+23 -3

No files matched your search

+7 -2
View File
@@ -18,7 +18,8 @@ void JNICALL ClassFileLoadHook(
}
auto& agent = JuiceAgent::Agent::instance();
agent.get_eventbus().post(EventClassFileLoadHook{
EventClassFileLoadHook event{
.jvmti_env = jvmti_env,
.jni_env = jni_env,
.class_being_redefined = class_being_redefined,
@@ -29,5 +30,9 @@ void JNICALL ClassFileLoadHook(
.classbytes = classbytes,
.new_class_data_len = new_class_data_len,
.new_classbytes = new_classbytes
});
};
agent.get_eventbus().post(event);
agent.get_eventbus().post_mutable(event);
}
+14
View File
@@ -16,6 +16,7 @@ namespace JuiceAgent::Core::Modules {
struct RemapperConfig {
bool enabled = false;
std::string JuiceRemapperJarPath;
};
struct RemapperBridge {
@@ -100,11 +101,24 @@ protected:
false
);
config.JuiceRemapperJarPath = cfg.get<std::string>(
"JuiceAgent.Modules.Remapper.JuiceRemapperJarPath",
"./JuiceRemapper.jar",
true
);
if (!config.enabled) {
return true;
}
JNIEnv* env = agent.get_env();
jvmtiEnv* jvmti = agent.get_jvmti();
// Load JuiceRemapper
if (jvmti->AddToSystemClassLoaderSearch(config.JuiceRemapperJarPath.c_str()) != JNI_OK) {
PLOGE << "Failed to add JuiceRemapper to system class loader search";
return false;
}
jclass local_class = env->FindClass(
"cn/xiaozhou233/juiceremapper/bridge/JuiceAgentBridge"