Difference between revisions of "PlugIn Development:GameEx Initialize Function"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
You can return <span style="color:red;">'''TRUE'''</span> to continue processing the event or return <span style="color:red;">'''FALSE'''</span> and GameEx will not initialize your plugin. | You can return <span style="color:red;">'''TRUE'''</span> to continue processing the event or return <span style="color:red;">'''FALSE'''</span> and GameEx will not initialize your plugin. | ||
== | ==Code Examples== | ||
<span style="font-size:125%; color:#003300;"><b>VB.NET syntax:</b></span> | <span style="font-size:125%; color:#003300;"><b>VB.NET syntax:</b></span> | ||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style: | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | ||
<StructLayout(LayoutKind.Sequential)> _ | <StructLayout(LayoutKind.Sequential)> _ | ||
Public Structure GameExInfo | Public Structure GameExInfo | ||
Line 21: | Line 21: | ||
<span style="font-size:125%; color:#003300;"><b>C# syntax:</b></span> | <span style="font-size:125%; color:#003300;"><b>C# syntax:</b></span> | ||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style: | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | ||
[ StructLayout( LayoutKind.Sequential )] | [ StructLayout( LayoutKind.Sequential )] | ||
public struct GameExInfo | public struct GameExInfo |
Revision as of 10:12, 26 April 2014
Initialize Plugin Function
This function is called when GameEx initializes. Using this function call, you can run code to do various things, like set up your log files or load your settings. I often use this function to run a thread when I need to download something on a thread (or check for updates) and I don't need to wait for it to finish prior to GameEx launching. You can return TRUE to continue processing the event or return FALSE and GameEx will not initialize your plugin.
Code Examples
VB.NET syntax:
<StructLayout(LayoutKind.Sequential)> _ Public Structure GameExInfo Public GameExVersion As String End Structure
Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean Dim Info As GameExInfo = DirectCast(Marshal.PtrToStructure(InfoPtr, GetType(GameExInfo)), GameExInfo)) 'This will output the current version of GameEx: Dim GameEx_Version As String = Info.GameExVersion Return True End Function
C# syntax:
[ StructLayout( LayoutKind.Sequential )] public struct GameExInfo { public string GameExVersion; }
public bool Initialize(IntPtr InfoPtr) { GameExInfo Info = (GameExInfo) Marshal.PtrToStructure(InfoPtr, typeof(GameExInfo)); //This will output the current version of GameEx as a string: string GameEx_Version = Info.GameExVersion; return true; }