diff options
author | cat_or_not <41955154+catornot@users.noreply.github.com> | 2023-11-05 20:21:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 02:21:50 +0100 |
commit | bb822b7638d5ae9bc4499ff76edc74f3741e6518 (patch) | |
tree | 558886bd28dc53d1004e235be1c1543c5ec2fd9f /NorthstarDLL/plugins/plugin_abi.h | |
parent | 583bae6e1a7e35eec2c5cb4383bc0089f6ee6781 (diff) | |
download | NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.tar.gz NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.zip |
Plugins v3 (#472)v1.20.1-rc2v1.20.1-rc1v1.20.0-rc3v1.20.0
- nuked presence logic ( moved to the discord rpc plugin )
- more exposed sq functions
- exposed dll addresses
- `g_pCVar` is exposed
- added "userdata" to plugin's async call
- added runframe to plugins
Diffstat (limited to 'NorthstarDLL/plugins/plugin_abi.h')
-rw-r--r-- | NorthstarDLL/plugins/plugin_abi.h | 89 |
1 files changed, 38 insertions, 51 deletions
diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index c9fa9d25..16b26a1c 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -1,16 +1,7 @@ #pragma once -#include <string> #include "squirrel/squirrelclasstypes.h" -#define ABI_VERSION 2 - -enum GameState -{ - LOADING = 0, - MAINMENU = 1, - LOBBY = 2, - INGAME = 3 -}; +#define ABI_VERSION 3 enum PluginLoadDLL { @@ -33,6 +24,7 @@ struct SquirrelFunctions sq_compilebufferType __sq_compilebuffer; sq_callType __sq_call; sq_raiseerrorType __sq_raiseerror; + sq_compilefileType __sq_compilefile; sq_newarrayType __sq_newarray; sq_arrayappendType __sq_arrayappend; @@ -48,10 +40,6 @@ struct SquirrelFunctions sq_pushassetType __sq_pushasset; sq_pushvectorType __sq_pushvector; sq_pushobjectType __sq_pushobject; - sq_getthisentityType __sq_getthisentity; - sq_getobjectType __sq_getobject; - - sq_stackinfosType __sq_stackinfos; sq_getstringType __sq_getstring; sq_getintegerType __sq_getinteger; @@ -61,14 +49,22 @@ struct SquirrelFunctions sq_getassetType __sq_getasset; sq_getuserdataType __sq_getuserdata; sq_getvectorType __sq_getvector; + sq_getthisentityType __sq_getthisentity; + sq_getobjectType __sq_getobject; + + sq_stackinfosType __sq_stackinfos; sq_createuserdataType __sq_createuserdata; sq_setuserdatatypeidType __sq_setuserdatatypeid; sq_getfunctionType __sq_getfunction; sq_schedule_call_externalType __sq_schedule_call_external; + sq_getentityfrominstanceType __sq_getentityfrominstance; sq_GetEntityConstantType __sq_GetEntityConstant_CBaseEntity; + + sq_pushnewstructinstanceType __sq_pushnewstructinstance; + sq_sealstructslotType __sq_sealstructslot; }; struct MessageSource @@ -89,9 +85,28 @@ struct LogMsg int pluginHandle; }; -typedef void (*loggerfunc_t)(LogMsg* msg); -typedef void (*PLUGIN_RELAY_INVITE_TYPE)(const char* invite); -typedef void* (*CreateObjectFunc)(ObjectType type); +extern "C" +{ + typedef void (*loggerfunc_t)(LogMsg* msg); + typedef void (*PLUGIN_RELAY_INVITE_TYPE)(const char* invite); + typedef void* (*CreateObjectFunc)(ObjectType type); + + typedef void (*PluginFnCommandCallback_t)(void* command); + typedef void (*PluginConCommandConstructorType)( + void* newCommand, const char* name, PluginFnCommandCallback_t callback, const char* helpString, int flags, void* parent); + typedef void (*PluginConVarRegisterType)( + void* pConVar, + const char* pszName, + const char* pszDefaultValue, + int nFlags, + const char* pszHelpString, + bool bMin, + float fMin, + bool bMax, + float fMax, + void* pCallback); + typedef void (*PluginConVarMallocType)(void* pConVarMaloc, int a2, int a3); +} struct PluginNorthstarData { @@ -109,37 +124,12 @@ struct PluginInitFuncs struct PluginEngineData { - void* ConCommandConstructor; - void* conVarMalloc; - void* conVarRegister; + PluginConCommandConstructorType ConCommandConstructor; + PluginConVarMallocType conVarMalloc; + PluginConVarRegisterType conVarRegister; void* ConVar_Vtable; void* IConVar_Vtable; -}; - -struct PluginGameStatePresence -{ - const char* id; - const char* name; - const char* description; - const char* password; - - bool isServer; - bool isLocal; - GameState state; - - const char* map; - const char* mapDisplayname; - const char* playlist; - const char* playlistDisplayname; - - int currentPlayers; - int maxPlayers; - - int ownScore; - int otherHighestScore; // NOTE: The highest score OR the second highest score if we have the highest - int maxScore; - - int timestampEnd; + void* g_pCVar; }; /// <summary> Async communication within the plugin system @@ -157,8 +147,5 @@ typedef void (*PLUGIN_INIT_SQVM_TYPE)(SquirrelFunctions* funcs); typedef void (*PLUGIN_INFORM_SQVM_CREATED_TYPE)(ScriptContext context, CSquirrelVM* sqvm); typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); -// Async Communication types - -// Northstar -> Plugin -typedef void (*PLUGIN_PUSH_PRESENCE_TYPE)(PluginGameStatePresence* data); -typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data); +typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(const char* dll, PluginEngineData* data, void* dllPtr); +typedef void (*PLUGIN_RUNFRAME)(); |