Refine zygisk api

This commit is contained in:
LoveSy 2023-04-01 20:47:07 +08:00
parent cf0e552715
commit 5eaec4596a
No known key found for this signature in database
1 changed files with 5 additions and 9 deletions

View File

@ -273,17 +273,13 @@ void zygisk_companion_entry(int client) { func(client); }
template <class T>
void entry_impl(api_table *table, JNIEnv *env) {
static T module{};
static Api api;
api.impl = table;
static T module;
ModuleBase *m = &module;
static module_abi abi(m);
static bool loaded = table->registerModule(table, &abi);
if (!loaded) return;
[[maybe_unused]] static Api api = [&] {
Api api;
api.impl = table;
m->onLoad(&api, env);
return api;
}();
if (!table->registerModule(table, &abi)) return;
m->onLoad(&api, env);
}
} // namespace internal