Skip to content

Commit

Permalink
plugin mgr cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ianpatt committed Sep 1, 2023
1 parent 3680f62 commit c3fe0e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
19 changes: 10 additions & 9 deletions sfse/PluginAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ********************************************************************
Expand Down Expand Up @@ -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 ********************************************************
*
Expand Down Expand Up @@ -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

Expand All @@ -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.
Expand All @@ -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.
*
Expand Down
8 changes: 4 additions & 4 deletions sfse/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ bool PluginManager::findPluginDirectory(void)
{
bool result = false;

// find the path <runtime directory>/data/skse/
// find the path <runtime directory>/data/sfse/
std::string runtimeDirectory = getRuntimeDirectory();

if(!runtimeDirectory.empty())
Expand Down Expand Up @@ -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";
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions sfse/PluginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

0 comments on commit c3fe0e1

Please sign in to comment.