From c3fe0e1ccb82981ba7f1383333c0e4053697024e Mon Sep 17 00:00:00 2001 From: ianpatt Date: Fri, 1 Sep 2023 14:49:53 -0700 Subject: [PATCH] plugin mgr cleanup --- sfse/PluginAPI.h | 19 ++++++++++--------- sfse/PluginManager.cpp | 8 ++++---- sfse/PluginManager.h | 6 +++--- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sfse/PluginAPI.h b/sfse/PluginAPI.h index c0dbef3..cb1d7ba 100644 --- a/sfse/PluginAPI.h +++ b/sfse/PluginAPI.h @@ -40,11 +40,12 @@ enum struct SFSEInterface { - enum { + enum + { kInterfaceVersion = 1 }; - std::uint32_t skseVersion; + std::uint32_t sfseVersion; std::uint32_t runtimeVersion; std::uint32_t interfaceVersion; void * (* QueryInterface)(std::uint32_t id); @@ -54,7 +55,7 @@ struct SFSEInterface PluginHandle (* GetPluginHandle)(void); // returns the plugin info structure for a plugin by name, only valid to be called after PostLoad message - const PluginInfo* (* GetPluginInfo)(const char* name); + const PluginInfo* (* GetPluginInfo)(const char * name); }; /**** Messaging API docs ******************************************************************** @@ -120,11 +121,11 @@ struct SFSETrampolineInterface std::uint32_t interfaceVersion; - void* (*AllocateFromBranchPool)(PluginHandle plugin, size_t size); - void* (*AllocateFromLocalPool)(PluginHandle plugin, size_t size); + void * (* AllocateFromBranchPool)(PluginHandle plugin, size_t size); + void * (* AllocateFromLocalPool)(PluginHandle plugin, size_t size); }; -typedef bool(*_SFSEPlugin_Load)(const SFSEInterface * skse); +typedef bool (* _SFSEPlugin_Load)(const SFSEInterface * sfse); /**** plugin versioning ******************************************************** * @@ -192,7 +193,7 @@ struct SFSEPluginVersionData char author[256]; // null-terminated ASCII plugin author name // version compatibility - std::uint32_t addressIndependence; // describe how you find your addressese using the kAddressIndependence_ enums + std::uint32_t addressIndependence; // describe how you find your addresses using the kAddressIndependence_ enums std::uint32_t structureIndependence; // describe how you handle structure layout using the kStructureIndependence_ enums std::uint32_t compatibleVersions[16]; // zero-terminated list of RUNTIME_VERSION_ defines your plugin is compatible with @@ -207,7 +208,7 @@ struct SFSEPluginVersionData * The base API is pretty simple. Add version data as shown in the * SFSEPluginVersionData docs above, and export this function: * - * void SFSEPlugin_Load(const SFSEInterface * skse) + * void SFSEPlugin_Load(const SFSEInterface * sfse) * * In this function, use the interfaces above to register your commands, patch * memory, generally do whatever you need to for integration with the runtime. @@ -224,7 +225,7 @@ struct SFSEPluginVersionData * If your plugin needs to make modifications before global initializers, add * and export this: * - * void SFSEPlugin_Preload(const SFSEInterface * skse) + * void SFSEPlugin_Preload(const SFSEInterface * sfse) * * Game and SFSE functionality may be limited during preload. * diff --git a/sfse/PluginManager.cpp b/sfse/PluginManager.cpp index 9cc5099..0815268 100644 --- a/sfse/PluginManager.cpp +++ b/sfse/PluginManager.cpp @@ -288,7 +288,7 @@ bool PluginManager::findPluginDirectory(void) { bool result = false; - // find the path /data/skse/ + // find the path /data/sfse/ std::string runtimeDirectory = getRuntimeDirectory(); if(!runtimeDirectory.empty()) @@ -392,11 +392,11 @@ const char * PluginManager::checkAddressLibrary(void) return s_status; } -const char * PluginManager::safeCallLoadPlugin(LoadedPlugin * plugin, const SFSEInterface * skse, u32 phase) +const char * PluginManager::safeCallLoadPlugin(LoadedPlugin * plugin, const SFSEInterface * sfse, u32 phase) { __try { - if(!plugin->load[phase](skse)) + if(!plugin->load[phase](sfse)) { return "reported as incompatible during load"; } @@ -616,7 +616,7 @@ void PluginManager::updateAddressLibraryPrompt() if(result == IDYES) { -// ShellExecute(0, nullptr, "https://www.nexusmods.com/skyrimspecialedition/mods/32444", nullptr, nullptr, 0); +// ShellExecute(0, nullptr, "https://www.nexusmods.com/starfield/mods/123456789", nullptr, nullptr, 0); TerminateProcess(GetCurrentProcess(), 0); } } diff --git a/sfse/PluginManager.h b/sfse/PluginManager.h index 1179be2..68638cf 100644 --- a/sfse/PluginManager.h +++ b/sfse/PluginManager.h @@ -68,7 +68,7 @@ class PluginManager bool findPluginDirectory(void); void scanPlugins(void); - const char * safeCallLoadPlugin(LoadedPlugin * plugin, const SFSEInterface * skse, u32 phase); + const char * safeCallLoadPlugin(LoadedPlugin * plugin, const SFSEInterface * sfse, u32 phase); void sanitize(SFSEPluginVersionData * version); const char * checkPluginCompatibility(const SFSEPluginVersionData & version); @@ -109,7 +109,7 @@ class BranchTrampolineManager extern BranchTrampolineManager g_branchTrampolineManager; extern BranchTrampolineManager g_localTrampolineManager; -void* AllocateFromSFSEBranchPool(PluginHandle plugin, size_t size); -void* AllocateFromSFSELocalPool(PluginHandle plugin, size_t size); +void * AllocateFromSFSEBranchPool(PluginHandle plugin, size_t size); +void * AllocateFromSFSELocalPool(PluginHandle plugin, size_t size); extern PluginManager g_pluginManager;