Raised This Month: $12 Target: $400
 3% 

Store reference to a plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 06-28-2014 , 19:25   Store reference to a plugin?
Reply With Quote #1

How do I store a reference to a plugin?
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-29-2014 , 04:21   Re: Store reference to a plugin?
Reply With Quote #2

Your extension is an IPluginsListener, right?

You'd store the plugin's IPlugin pointer.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-29-2014 at 04:22.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 06-29-2014 , 07:41   Re: Store reference to a plugin?
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Your extension is an IPluginsListener, right?

You'd store the plugin's IPlugin pointer.
ya, but once the plugin is unloaded, it's IPlugin pointer is lost, so I'm wondering if there is an alternative to that?
Atm, I have a work around where all data associated with the unloaded ff2 subplugin(as my extension is for my ff2-alpha).

Last edited by WildCard65; 06-29-2014 at 07:45.
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-29-2014 , 11:32   Re: Store reference to a plugin?
Reply With Quote #4

Quote:
Originally Posted by WildCard65 View Post
ya, but once the plugin is unloaded, it's IPlugin pointer is lost, so I'm wondering if there is an alternative to that?
Atm, I have a work around where all data associated with the unloaded ff2 subplugin(as my extension is for my ff2-alpha).
Store it by its pathname using IPlugin's GetFileName()?

But yes, since the plugin was unloaded its IPlugin reference would be invalid because it's no longer in memory.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-29-2014 at 11:33.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 06-29-2014 , 11:42   Re: Store reference to a plugin?
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
Store it by its pathname using IPlugin's GetFileName()?

But yes, since the plugin was unloaded its IPlugin reference would be invalid because it's no longer in memory.
I could use filename if it doesn't involve using iterators to get the IPlugin back.
Like what I like is some sort of class that allows extensions to get the IPlugin pointer.
Something like this:
Code:
class IPluginReference
{
    virtual bool IsPluginLoaded() =0; //Gets if the plugin reference is for is loaded into memory.
    virtual IPlugin *GetPlugin() =0; Returns the IPlugin pointer that reference is for, null if plugin isn't mapped into memory.
    //Other functions here.
}
May look redundant to make a class for just 2 functions, but it'll open ALOT of possibilities for extension coders.

Last edited by WildCard65; 06-29-2014 at 11:44.
WildCard65 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-29-2014 , 12:09   Re: Store reference to a plugin?
Reply With Quote #6

As Powerlord hinted at already, add an IPluginListener. You then get notified of all plugin loads and unloads.
psychonic is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 06-29-2014 , 12:33   Re: Store reference to a plugin?
Reply With Quote #7

Quote:
Originally Posted by psychonic View Post
As Powerlord hinted at already, add an IPluginListener. You then get notified of all plugin loads and unloads.
I know, that is what I'm doing now.
WildCard65 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode