mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
[Add] toml11 library [Refactor] Config [Refactor] Data Struct [Refactor] Loader
31 lines
729 B
C++
31 lines
729 B
C++
#pragma once
|
|
|
|
#include <JuiceAgent/JuiceAgent.hpp>
|
|
#include <string>
|
|
#include <JuiceAgent/Logger.hpp>
|
|
#include <jvm/jni.h>
|
|
#include <jvm/jvmti.h>
|
|
|
|
namespace JuiceAgent::Loader
|
|
{
|
|
void entrypoint(const char* runtime_dir);
|
|
|
|
bool invoke_juiceagent_init(JNIEnv* env, const LoaderConfig& info);
|
|
} // namespace JuiceAgent::Loader
|
|
|
|
namespace {
|
|
// RAII wrapper for local JNI references
|
|
template<typename T>
|
|
class LocalRef {
|
|
private:
|
|
JNIEnv* env;
|
|
T ref;
|
|
public:
|
|
LocalRef(JNIEnv* env, T ref) : env(env), ref(ref) {}
|
|
~LocalRef() {
|
|
if (ref) env->DeleteLocalRef(ref);
|
|
}
|
|
T get() const { return ref; }
|
|
operator T() const { return ref; }
|
|
};
|
|
} |