update and move ngcft1 plug to sub
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled

This commit is contained in:
Green Sky 2024-12-08 14:05:31 +01:00
parent 2fac28d6a7
commit f38c39343e
No known key found for this signature in database
5 changed files with 3 additions and 101 deletions

View File

@ -29,6 +29,7 @@ add_subdirectory(./solanaceae_tox_upnp)
set(SOLANACEAE_TOX_P2PRNG_BUILD_PLUGINS ON CACHE BOOL "") set(SOLANACEAE_TOX_P2PRNG_BUILD_PLUGINS ON CACHE BOOL "")
add_subdirectory(./solanaceae_tox_p2prng) add_subdirectory(./solanaceae_tox_p2prng)
set(SOLANACEAE_NGCFT1_BUILD_PLUGINS ON CACHE BOOL "")
set(SOLANACEAE_NGCFT1_SHA1_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "") set(SOLANACEAE_NGCFT1_SHA1_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
set(SOLANACEAE_NGCHS2_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "") set(SOLANACEAE_NGCHS2_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
add_subdirectory(./solanaceae_ngc_ft1) add_subdirectory(./solanaceae_ngc_ft1)

@ -1 +1 @@
Subproject commit ba809eda431156c87ef0869980bdd7a9a38a69ab Subproject commit 7bbaa9b929b523fbcb9bff95d0eab2049aaaee6c

@ -1 +1 @@
Subproject commit 013fb45cf9d30c91578538d63a1bdd8e77cbeab8 Subproject commit 09f9c01e682acda734ce9a93db96fc96ff2455c4

View File

@ -1,23 +1,5 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR) cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
add_library(plugin_ngcft1 MODULE
./plugin_ngcft1.cpp
)
set_target_properties(plugin_ngcft1 PROPERTIES
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON # do we need this?
)
target_compile_definitions(plugin_ngcft1 PUBLIC ENTT_API_IMPORT)
target_link_libraries(plugin_ngcft1 PUBLIC
solanaceae_plugin
solanaceae_ngcext
solanaceae_ngcft1
solanaceae_sha1_ngcft1
)
########################################
add_library(plugin_transfer_auto_accept MODULE add_library(plugin_transfer_auto_accept MODULE
./plugin_transfer_auto_accept.cpp ./plugin_transfer_auto_accept.cpp
./transfer_auto_accept.hpp ./transfer_auto_accept.hpp

View File

@ -1,81 +0,0 @@
#include <solanaceae/plugin/solana_plugin_v1.h>
#include <solanaceae/ngc_ext/ngcext.hpp>
#include <solanaceae/ngc_ft1/ngcft1.hpp>
#include <solanaceae/ngc_ft1_sha1/sha1_ngcft1.hpp>
#include <entt/entt.hpp>
#include <entt/fwd.hpp>
#include <memory>
#include <iostream>
static std::unique_ptr<NGCEXTEventProvider> g_ngcextep = nullptr;
// TODO: make sep plug
static std::unique_ptr<NGCFT1> g_ngcft1 = nullptr;
static std::unique_ptr<SHA1_NGCFT1> g_sha1_ngcft1 = nullptr;
constexpr const char* plugin_name = "NGCEXT";
extern "C" {
SOLANA_PLUGIN_EXPORT const char* solana_plugin_get_name(void) {
return plugin_name;
}
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_get_version(void) {
return SOLANA_PLUGIN_VERSION;
}
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api) {
std::cout << "PLUGIN " << plugin_name << " START()\n";
if (solana_api == nullptr) {
return 1;
}
try {
auto* os = PLUG_RESOLVE_INSTANCE(ObjectStore2);
auto* tox_i = PLUG_RESOLVE_INSTANCE(ToxI);
auto* tox_event_provider_i = PLUG_RESOLVE_INSTANCE(ToxEventProviderI);
auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModelI);
auto* tcm = PLUG_RESOLVE_INSTANCE(ToxContactModel2);
// static store, could be anywhere tho
// construct with fetched dependencies
g_ngcextep = std::make_unique<NGCEXTEventProvider>(*tox_i, *tox_event_provider_i);
g_ngcft1 = std::make_unique<NGCFT1>(*tox_i, *tox_event_provider_i, *g_ngcextep.get());
g_sha1_ngcft1 = std::make_unique<SHA1_NGCFT1>(*os, *cr, *rmm, *g_ngcft1.get(), *tcm, *tox_event_provider_i, *g_ngcextep.get());
// register types
PLUG_PROVIDE_INSTANCE(NGCEXTEventProviderI, plugin_name, g_ngcextep.get());
PLUG_PROVIDE_INSTANCE(NGCFT1EventProviderI, plugin_name, g_ngcft1.get());
PLUG_PROVIDE_INSTANCE(NGCFT1, plugin_name, g_ngcft1.get());
PLUG_PROVIDE_INSTANCE(SHA1_NGCFT1, plugin_name, g_sha1_ngcft1.get());
} catch (const ResolveException& e) {
std::cerr << "PLUGIN " << plugin_name << " " << e.what << "\n";
return 2;
}
return 0;
}
SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) {
std::cout << "PLUGIN " << plugin_name << " STOP()\n";
g_sha1_ngcft1.reset();
g_ngcft1.reset();
g_ngcextep.reset();
}
SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) {
const float ft_interval = g_ngcft1->iterate(delta);
const float sha_interval = g_sha1_ngcft1->iterate(delta);
return std::min<float>(ft_interval, sha_interval);
}
} // extern C