aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/SDK
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SDK')
-rw-r--r--plugins/SDK/Hooks.txt20
-rw-r--r--plugins/SDK/ModiSDK.pas156
-rw-r--r--plugins/SDK/Plugin DLL Exports.txt11
-rw-r--r--plugins/SDK/Services.txt22
-rw-r--r--plugins/SDK/StrUtils.pas73
-rw-r--r--plugins/SDK/UPartyDefs.pas189
-rw-r--r--plugins/SDK/UPluginDefs.pas195
7 files changed, 666 insertions, 0 deletions
diff --git a/plugins/SDK/Hooks.txt b/plugins/SDK/Hooks.txt
new file mode 100644
index 00000000..999f552f
--- /dev/null
+++ b/plugins/SDK/Hooks.txt
@@ -0,0 +1,20 @@
+Ultrastar Deluxe Hook List
+-----------------------------------
+Here you can find the Events the Core offers to you:
+
+--------------------
+Core:
+--------------------
+Core/LoadingFinished <- Hook is called after all Modules and Plugins are loaded completely, before MainLoop
+Core/MainLoop <- Hook is called once in MainLoop before Drawing
+Core/Translate <- Hook is called when Strings should be translated. If this is Retranslating lParam is Non Zero
+Core/LoadTextures <- Hook is called when Textures should be Loaded. This will be called in Ogl Thread. If Textures are Reloaded (e.g. on Display ReInit) LParam is non Zero.
+Core/ExitQuery <- Hook is called if someone querys an exit. (e.g. X is pressed). Not called on ForcedExit. If Chain is breaked the exit will be aborted.
+Core/Exit <- Hook is called before Module a. Plugin unload.
+Core/NewDebugInfo <- Hook is called everytime there is Debug Info to Output(only if Debug Mode is enabled). wParam: Pchar(Message), lParam: PChar(Reportername)
+Core/NewError <- Hook is called everytime an error is reported. wParam: Pchar(Message), lParam: PChar(Reportername)
+
+--------------------
+Display
+--------------------
+Display/onScreenChange <-Hook is called when there is an attemp to change Screen. wParam is address to Screens Name(Null Terminated). If Chain is breaked Screenchange will be aborted. \ No newline at end of file
diff --git a/plugins/SDK/ModiSDK.pas b/plugins/SDK/ModiSDK.pas
new file mode 100644
index 00000000..76dcf8ea
--- /dev/null
+++ b/plugins/SDK/ModiSDK.pas
@@ -0,0 +1,156 @@
+unit ModiSDK;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+type //PluginInfo, for Init
+ TPluginInfo = record
+ //Info
+ Name : Array [0..32] of Char; //Modi to Register for the Plugin
+ Creator : Array [0..32] of Char; //Name of the Author
+ PluginDesc : Array [0..64] of Char; //Plugin Description
+
+ //Plugin Typ, atm: 8 only for PartyMode Modi
+ Case Typ: byte of
+ 8: (
+ //Options
+ LoadSong: boolean; //Whether or not a Song should be Loaded
+ //Only When Song is Loaded:
+ ShowNotes: boolean; //Whether the Note Lines should be displayed
+ LoadVideo: boolean; //Should the Video be loaded ?
+ LoadBack: boolean; //Should the Background be loaded ?
+
+ ShowRateBar: boolean; //Whether the Bar that shows how good the player was sould be displayed
+ ShowRateBar_O: boolean; //Load from Ini whether the Bar should be Displayed
+
+ EnLineBonus: boolean; //Whether LineBonus Should be enabled
+ EnLineBonus_O: boolean; //Load from Ini whether LineBonus Should be enabled
+
+ BGShowFull: boolean; //Whether the Background or the Video should be shown Fullsize
+ BGShowFull_O: boolean; //Whether the Background or the Video should be shown Fullsize
+
+ //Options -> everytime
+ ShowScore: boolean; //Whether or not the Score should be shown
+ ShowBars: boolean; //Whether the White Bars on Top and Bottom should be Drawn
+ TeamModeOnly: boolean; //If True the Plugin can only be Played in Team Mode
+ GetSoundData: boolean; //If True the RData Procedure is called when new SoundData is available
+ Dummy: boolean; //Should be Set to False... for Updateing Plugin Interface
+
+ NumPlayers: Byte //Number of Available Players for Modi
+ //Set different Bits
+ //1 -> One Player
+ //2 -> Two Players
+ //4 -> Three Players
+ //8 -> Four Players
+ //16-> Six Players
+ //e.g. : 10 -> Playable with 2 and 4 Players
+ );
+
+ end;
+
+ TPlayerInfo = record
+ NumPlayers: Byte;
+ Playerinfo: array[0..5] of record
+ Name: PChar; //Name of the Player
+ Score:Word; //Players Score
+ Bar: Byte; //Percentage of the SingBar filled
+ PosX: Real; //PosX of Players SingBar
+ PosY: Real; //PosY "
+ Enabled: Boolean; //Whether the Player could get Points
+ Percentage: Byte; //Percentage Shown on the Score Screen
+ end;
+ end;
+
+ TTeamInfo = record
+ NumTeams: Byte;
+ Teaminfo: array[0..5] of record
+ Name: PChar;
+ Score: Word;
+ Joker: Byte;
+ CurPlayer: Byte;
+ NumPlayers: Byte;
+ Playerinfo: array[0..3] of record
+ Name: PChar;
+ TimesPlayed: Byte;
+
+ end;
+ end;
+ end;
+
+ TsmallTexture = record
+ TexNum: integer;
+ W: real;
+ H: real;
+ end;
+
+ TSentences = record
+ Current: integer; // aktualna czesc utworu do rysowania
+ High: integer;
+ Number: integer;
+ Resolution: integer;
+ NotesGAP: integer;
+ TotalLength:integer;
+ Sentence: array of record
+ Start: integer;
+ StartNote: integer;
+ Lyric: string;
+ LyricWidth: real;
+ End_: integer;
+ BaseNote: integer;
+ HighNote: integer;
+ IlNut: integer;
+ TotalNotes: integer;
+ Note: array of record
+ Color: integer;
+ Start: integer;
+ Length: integer;
+ Tone: integer;
+ //Text: string;
+ FreeStyle: boolean;
+ Typ: integer; // zwykla nuta x1, zlota nuta x2
+ end;
+ end;
+ end;
+
+ DWORD = Longword;
+ HSTREAM = DWORD;
+
+ TTextureType = (
+ TEXTURE_TYPE_PLAIN, // Plain (alpha = 1)
+ TEXTURE_TYPE_TRANSPARENT, // Alpha is used
+ TEXTURE_TYPE_COLORIZED // Alpha is used; Hue of the HSV color-model will be replaced by a new value
+ );
+
+ //Routines to gave to the Plugin
+ fModi_LoadTex = function (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; //Pointer to Texture Loader
+ //fModi_Translate = function (const Name, Translation: AChar): Integer; stdcall; //Pointer to Translator
+ fModi_Print = procedure (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text //Now translated automatically
+ fModi_LoadSound = function (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
+ pModi_PlaySound = procedure (const Index: Cardinal); stdcall; //Plays a Custom Sound
+
+ TMethodRec = record
+ LoadTex: fModi_LoadTex;
+ Print: fModi_Print;
+ LoadSound: fModi_LoadSound;
+ PlaySound: pModi_PlaySound;
+ end;
+ //DLL Funktionen
+ //Gave the Plugins Info
+ pModi_PluginInfo = procedure (var Info: TPluginInfo); stdcall;
+ //Executed on Game Start //If True Game begins, else Failure
+ fModi_Init = function (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall;
+ //Executed everytime the Screen is Drawed //If False The Game finishes
+ fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall;
+ //Is Executed on Finish, Returns the Playernum of the Winner
+ fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; stdcall;
+ //Procedure called when new Sound Data is available
+ pModi_RData = procedure (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); stdcall;
+
+implementation
+
+end.
diff --git a/plugins/SDK/Plugin DLL Exports.txt b/plugins/SDK/Plugin DLL Exports.txt
new file mode 100644
index 00000000..930e18ac
--- /dev/null
+++ b/plugins/SDK/Plugin DLL Exports.txt
@@ -0,0 +1,11 @@
+Ultrastar Plugin DLL(Libary) Exports
+-----------------------------------
+This are the Procedurs and Functions that a UsDx Plugin has to export to get Loaded.
+
+
+USPlugin_Info(PInfo: PUS_PluginInfo); stdcall;
+-----------------------------------
+Ultrastar uses this Procedure to identify the Plugins.
+At the given Address there is a PUS_PluginInfo Record. cbSize
+attribut is already set. Please asure not to overwrite this assigned
+memory amount.
diff --git a/plugins/SDK/Services.txt b/plugins/SDK/Services.txt
new file mode 100644
index 00000000..8db031d8
--- /dev/null
+++ b/plugins/SDK/Services.txt
@@ -0,0 +1,22 @@
+Ultrastar Deluxe Service List
+-----------------------------------
+Here you can find the Services the Core offers to you:
+
+--------------------
+Core:
+--------------------
+Core/ReportError <- Calls the 'Core/NewError' Chain. wParam: Pchar(Message), lParam: PChar(Reportername)
+Core/ReportDebug <- Calls the 'Core/NewDebugInfo' Chain. wParam: Pchar(Message), lParam: PChar(Reportername)
+Core/ShowMessage <- Shows a Message Dialog. (lParam: PChar Text, wParam: Symbol)
+Core/Retranslate <- Calls Translate Hook
+Core/ReloadTextures <- Calls LoadTextures Hook
+Core/GetModuleInfo <- If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam
+Core/GetApplicationHandle <- Returns Main-Applications Handle (Win32 Only)
+
+--------------------
+PluginLoader
+--------------------
+PluginLoader/GetPluginInfo <- If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam)
+PluginLoader/GetPluginState <- If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam))
+PluginLoader/LoadPlugin <- wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin
+PluginLoader/UnloadPlugin <- wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin \ No newline at end of file
diff --git a/plugins/SDK/StrUtils.pas b/plugins/SDK/StrUtils.pas
new file mode 100644
index 00000000..a5735b8f
--- /dev/null
+++ b/plugins/SDK/StrUtils.pas
@@ -0,0 +1,73 @@
+unit StrUtils;
+
+interface
+
+{$I switches.inc}
+
+uses ModiSDK;
+
+//function StrToAChar(Str: String): AChar;
+function CreateStr(Str: PChar): PChar;
+procedure FreeStr(Str: PChar);
+
+implementation
+
+{function StrToAChar(Str: String): AChar;
+var
+ L, I: Integer;
+begin
+ L := Length(Str);
+ For I := 0 to L-1 do
+ AChar[I] := Str[I+1];
+
+ For I := L to 254 do
+ AChar[I] := #0;
+end; }
+
+function StrCopy(Dest, Source: PChar): PChar; assembler;
+asm
+ PUSH EDI
+ PUSH ESI
+ MOV ESI,EAX
+ MOV EDI,EDX
+ MOV ECX,0FFFFFFFFH
+ XOR AL,AL
+ REPNE SCASB
+ NOT ECX
+ MOV EDI,ESI
+ MOV ESI,EDX
+ MOV EDX,ECX
+ MOV EAX,EDI
+ SHR ECX,2
+ REP MOVSD
+ MOV ECX,EDX
+ AND ECX,3
+ REP MOVSB
+ POP ESI
+ POP EDI
+end;
+
+function StrLen(Str: PChar): Cardinal; assembler;
+asm
+ MOV EDX,EDI
+ MOV EDI,EAX
+ MOV ECX,0FFFFFFFFH
+ XOR AL,AL
+ REPNE SCASB
+ MOV EAX,0FFFFFFFEH
+ SUB EAX,ECX
+ MOV EDI,EDX
+end;
+
+function CreateStr(Str: PChar): PChar;
+begin
+ GetMem(Result, StrLen(Str) + 1);
+ StrCopy(Result, Str);
+end;
+
+procedure FreeStr(Str: PChar);
+begin
+ FreeMem(Str);
+end;
+
+end. \ No newline at end of file
diff --git a/plugins/SDK/UPartyDefs.pas b/plugins/SDK/UPartyDefs.pas
new file mode 100644
index 00000000..09f97812
--- /dev/null
+++ b/plugins/SDK/UPartyDefs.pas
@@ -0,0 +1,189 @@
+unit UPartyDefs;
+{*********************
+ uPluginDefs
+ Some Basic Structures and Functions used to communicate with Plugins
+ Usable as Delphi Plugin SDK
+*********************}
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses UPluginDefs;
+
+type
+ //----------------
+ // TUS_Party_Proc_Init - Structure of the Party Init Proc
+ // This Function is called on SingScreen Init Everytime this Modi should be sung
+ // Return Non Zero to Abort Party Modi Loading... In this Case another Plugin will be loaded
+ //----------------
+ TUS_Party_Proc_Init = Function (ID: Integer): integer; stdcall;
+
+ //----------------
+ // TUS_Party_Proc_Draw - Structure of the Party Draw Proc
+ // This Function is called on SingScreen Draw (Not when Paused). You should draw in this Proc
+ // Return Non Zero to Finish Song... In this Case Score Screen is loaded
+ //----------------
+ TUS_Party_Proc_Draw = Function (ID: Integer): integer; stdcall;
+
+ //----------------
+ // TUS_Party_Proc_DeInit - Structure of the Party DeInit Proc
+ // This Function is called on SingScreen DeInit When Plugin abort Song or Song finishes
+ // Return Winner
+ //----------------
+ TUS_Party_Proc_DeInit = Function (ID: Integer): integer; stdcall;
+
+ //----------------
+ // TUS_ModiInfo - Some Infos from Plugin to Partymode.
+ // Used to register party modi to Party manager
+ // ---
+ // Version Structure:
+ // First Byte: Head Revison
+ // Second Byte: Sub Revison
+ // Third Byte: Sub Revision 2
+ // Fourth Byte: Letter (For Bug Fix releases. 0 or 'a' .. 'z')
+ //----------------
+ TModiInfo_Name = Array [0..31] of Char;
+ TModiInfo_Desc = Array [0..63] of Char;
+
+ PUS_ModiInfo = ^TUS_ModiInfo;
+ TUS_ModiInfo = record
+ //Size of this record (usefull if record will be extended in the future)
+ cbSize: Integer; //Don't forget to set this as Plugin!
+
+ //Infos about the Modi
+ Name : TModiInfo_Name; //Modiname to Register for the Plugin
+ Description: TModiInfo_Desc; //Plugin Description
+
+ //------------
+ // Loading Settings
+ // ---
+ // Bit to Set | Triggered Option
+ // 1 | Song should be loaded
+ // 2 | Song has to be Non Duett
+ // 4 | Song has to be Duett (If 2 and 4 is set, both will be ignored)
+ // 8 | Only Playable with 2 and more players
+ // 16 | Restrict Background Loading
+ // 32 | Restrict Video Loading
+ // 64 | Increase TimesPlayed for Cur. Player
+ // 128 | Not in Use, Don't set it!
+ LoadingSettings: Byte;
+
+ // SingScreen Settings
+ // ---
+ // Bit to Set | Triggered Option
+ // 1 | ShowNotes
+ // 2 | ShowScores
+ // 4 | ShowTime
+ // 8 | Start Audio Playback automaticaly
+ // 16 | Not in Use, Don't set it!
+ // 32 | Not in Use, Don't set it!
+ // 64 | Not in Use, Don't set it!
+ // 128 | Not in Use, Don't set it!
+ SingScreenSettings: Byte;
+
+ // With which count of players can this modi be played
+ // ---
+ //Set different Bits
+ //1 -> One Player
+ //2 -> Two Players
+ //4 -> Three Players
+ //8 -> Four Players
+ //16-> Six Players
+ //e.g. : 10 -> Playable with 2 and 4 Players
+ NumPlayers: Byte;
+
+ // ID that is given to the Party Procs when they are called
+ // If this Modi is running
+ // (e.g. to register Until 2000 and Until 5000 with the same Procs
+ // ID is the Max Point Count in this example)
+ ID: Integer;
+
+ // Party Procs called on Party
+ // ---
+ // Set to nil(C: NULL) if u don't want to use this method
+ ModiInit: TUS_Party_Proc_Init;
+ ModiDraw: TUS_Party_Proc_Draw;
+ ModiDeInit: TUS_Party_Proc_DeInit;
+ end;
+
+ //--------------
+ // Team Info Record. Used by "Party/GetTeamInfo" and "Party/SetTeamInfo"
+ //--------------
+ TTeamInfo = record
+ NumTeams: Byte;
+ Teaminfo: array[0..5] of record
+ Name: PChar; //Teamname
+ Score: Word; //TeamScore
+ Joker: Byte; //Team Jokers available
+ CurPlayer: Byte; //Id of Cur. Playing Player
+ NumPlayers: Byte;
+ Playerinfo: array[0..3] of record
+ Name: PChar; //Playername
+ TimesPlayed: Byte; //How often this Player has Sung
+ end;
+ end;
+ end;
+
+//----------------
+// Some Default Constants
+//----------------
+const
+ // to use for TUS_ModiInfo.LoadingSettings
+ MLS_LoadSong = 1; //Song should be loaded
+ MLS_NotDuett = 2; //Song has to be Non Duett
+ MLS_ForceDuett = 4; //Song has to be Duett (If 2 and 4 is set, both will be ignored)
+ MLS_TeamOnly = 8; //Only Playable with 2 and more players
+ MLS_RestrictBG = 16; //Restrict Background Loading
+ MLS_RestrictVid = 32; //Restrict Video Loading
+ MLS_IncTP = 64; //Increase TimesPlayed for Cur. Player
+
+ // to use with TUS_ModiInfo.SingScreenSettings
+ MSS_ShowNotes = 1; //ShowNotes
+ MSS_ShowScores = 2; //ShowScores
+ MSS_ShowTime = 4; //ShowTime
+ MSS_AutoPlayback= 8; //Start Audio Playback automaticaly
+
+ //Standard (Duell) for TUS_ModiInfo.LoadingSettings and TUS_ModiInfo.SingScreenSettings
+ MLS_Standard = MLS_LoadSong or MLS_IncTP;
+ MSS_Standard = MSS_ShowNotes or MSS_ShowScores or MSS_ShowTime or MSS_AutoPlayback;
+
+//-------------
+// Some helper functions to register Party Modi
+//-------------
+Function RegisterModi(const PluginInterface: PUS_PluginInterface; const Name: TModiInfo_Name; const Description: TModiInfo_Desc; const LoadingSettings, SingScreenSettings, NumPlayers: Byte; const ID: Integer; const ModiInit: TUS_Party_Proc_Init = nil; const ModiDeInit: TUS_Party_Proc_DeInit = nil; const ModiDraw: TUS_Party_Proc_Draw = nil): THandle;
+
+
+
+implementation
+
+//-------------
+// Function that Prepares the ModiInfo Record and Calls Party/RegisterModi
+//-------------
+Function RegisterModi(const PluginInterface: PUS_PluginInterface; const Name: TModiInfo_Name; const Description: TModiInfo_Desc; const LoadingSettings, SingScreenSettings, NumPlayers: Byte; const ID: Integer; const ModiInit: TUS_Party_Proc_Init; const ModiDeInit: TUS_Party_Proc_DeInit; const ModiDraw: TUS_Party_Proc_Draw): THandle;
+var
+ ModiInfo: TUS_ModiInfo;
+begin
+ //Init Record
+ ModiInfo.cbSize := SizeOf(TUS_ModiInfo);
+
+ ModiInfo.Name := Name;
+ ModiInfo.Description := Description;
+ ModiInfo.LoadingSettings := LoadingSettings;
+ ModiInfo.SingScreenSettings := SingScreenSettings;
+ ModiInfo.NumPlayers := NumPlayers;
+
+ ModiInfo.ID := ID;
+ ModiInfo.ModiInit := ModiInit;
+ ModiInfo.ModiDraw := ModiDraw;
+ ModiInfo.ModiDeInit := ModiDeInit;
+
+ //Call Service
+ Result := PluginInterface.CallService('Party/RegisterModi', Integer(@ModiInfo), nil);
+end;
+
+end. \ No newline at end of file
diff --git a/plugins/SDK/UPluginDefs.pas b/plugins/SDK/UPluginDefs.pas
new file mode 100644
index 00000000..4cd094f7
--- /dev/null
+++ b/plugins/SDK/UPluginDefs.pas
@@ -0,0 +1,195 @@
+unit uPluginDefs;
+{*********************
+ uPluginDefs
+ Some Basic Structures and Functions used to communicate with Plugins
+ Usable as Delphi Plugin SDK
+*********************}
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+type
+ DWORD = LongWord;
+
+ //Compatibility with 64 Bit Systems
+ {$IFDEF CPU32}
+ TwParam = Integer;
+ TlParam = Pointer; //lParam is Used for 32 Bit addresses DWord is large enough
+ {$ELSE}
+ TwParam = Int64;
+ TlParam = Pointer; //lParam used for 64Bit addresses in 64 Bit Systems(FreePascal)
+ {$ENDIF}
+ //wParam is mainly used for Ordninals
+ //lParam is mainly used for Pointers
+
+ //----------------
+ // TUS_PluginInfo - Some Infos from Plugin to Core.
+ // Send when Plugininfo procedure is Called
+ // ---
+ // Version Structure:
+ // First Byte: Head Revison
+ // Second Byte: Sub Revison
+ // Third Byte: Sub Revision 2
+ // Fourth Byte: Letter (For Bug Fix releases. 0 or 'a' .. 'z')
+ //----------------
+ PUS_PluginInfo = ^TUS_PluginInfo;
+ TUS_PluginInfo = record
+ cbSize: Integer; //Size of this record (usefull if record will be extended in the future)
+
+ Name: Array [0..31] of Char; //Name of the Plugin
+ Version: DWord; //Version of the Plugin
+ Description: Array [0..127] of Char; //Description, what does this Plugin do
+ Author: Array [0..31] of Char; //Author of this Plugin
+ AuthorEmail: Array [0..63] of Char; //Authors Email
+ Homepage: Array [0..63] of Char; //Homepage of Plugin/Author
+ end;
+ AUS_PluginInfo = Array of TUS_PluginInfo;
+ PAUS_PluginInfo = ^AUS_PluginInfo;
+
+ //----------------
+ // TUS_Hook - Structure of the Hook Function
+ // Return 0 if the Hook should be continue,
+ // or a non zero Value, if the Hook should be Interuped
+ // In this Case the Caller of the Notifier gets the Return Value
+ // Return Value Should not be -1
+ //----------------
+ TUS_Hook = Function (wParam: TwParam; lParam: TlParam): integer; stdcall;
+ TUS_Hook_of_Object = Function (wParam: TwParam; lParam: TlParam): integer of Object;
+
+ //----------------
+ // TUS_Service - Structure of the Service Function
+ // This Function is called if the Registered Service is Called
+ // Return Value Should not be SERVICE_NOT_FOUND
+ //----------------
+ TUS_Service = Function (wParam: TwParam; lParam: TlParam): integer; stdcall;
+ TUS_Service_of_Object = Function (wParam: TwParam; lParam: TlParam): integer of Object;
+
+ //----------------
+ // TUS_PluginInterface - Structure that Includes all Methods callable
+ // from the Plugins
+ //----------------
+ PUS_PluginInterface = ^TUS_PluginInterface;
+ TUS_PluginInterface = record
+ {******** Hook specific Methods ********}
+ {Function Creates a new Hookable Event and Returns the Handle
+ or 0 on Failure. (Name already exists)}
+ CreateHookableEvent: Function (EventName: PChar): THandle; stdcall;
+
+ {Function Destroys an Event and Unhooks all Hooks to this Event.
+ 0 on success, not 0 on Failure}
+ DestroyHookableEvent: Function (hEvent: THandle): integer; stdcall;
+
+ {Function start calling the Hook Chain
+ 0 if Chain is called until the End, -1 if Event Handle is not valid
+ otherwise Return Value of the Hook that breaks the Chain}
+ NotivyEventHooks: Function (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall;
+
+ {Function Hooks an Event by Name.
+ Returns Hook Handle on Success, otherwise 0}
+ HookEvent: Function (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
+
+ {Function Removes the Hook from the Chain
+ Returns 0 on Success}
+ UnHookEvent: Function (hHook: THandle): Integer; stdcall;
+
+ {Function Returns Non Zero if a Event with the given Name Exists,
+ otherwise 0}
+ EventExists: Function (EventName: PChar): Integer; stdcall;
+
+ {******** Service specific Methods ********}
+ {Function Creates a new Service and Returns the Services Handle
+ or 0 on Failure. (Name already exists)}
+ CreateService: Function (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
+
+ {Function Destroys a Service.
+ 0 on success, not 0 on Failure}
+ DestroyService: Function (hService: THandle): integer; stdcall;
+
+ {Function Calls a Services Proc
+ Returns Services Return Value or SERVICE_NOT_FOUND on Failure}
+ CallService: Function (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall;
+
+ {Function Returns Non Zero if a Service with the given Name Exists,
+ otherwise 0}
+ ServiceExists: Function (ServiceName: PChar): Integer; stdcall;
+ end;
+
+ //----------------
+ //TModuleInfo: Info about Modules. Result of Core/GetModuleInfo
+ //----------------
+ PModuleInfo = ^TModuleInfo;
+ TModuleInfo = record
+ Name: String;
+ Version: LongWord;
+ Description: String;
+ end;
+ AModuleInfo = array of TModuleInfo;
+
+ //----------------
+ // Procs that should be exported by Plugin Dlls
+ //----------------
+ //Procedure is called to check if this is USDx Plugin
+ //Info is Pointer to this Plugins Info. Size is already set. Don't write over this limit
+ Proc_PluginInfo = procedure (Info: PUS_PluginInfo); stdcall;
+
+ //Called on Plugins Load. If Non Zero is Returned => abort Loading
+ //PInterface is Pointer to PluginInterface
+ Func_Load = function (const PInterface: PUS_PluginInterface): Integer; stdcall;
+
+ //Called on Plugins Init. If Non Zero is Returned => abort Loading
+ //PInterface is Pointer to PluginInterface
+ Func_Init = function (const PInterface: PUS_PluginInterface): Integer; stdcall;
+
+ //Called on Plugins Deinit.
+ //PInterface is Pointer to PluginInterface
+ Proc_DeInit = procedure (const PInterface: PUS_PluginInterface); stdcall;
+
+//----------------
+// Some Default Constants
+//----------------
+const
+ {Returned if Service is not found from CallService}
+ SERVICE_NOT_FOUND = LongInt($80000000);
+
+ //for use in Service 'Core/ShowMessage' lParam(Symbol)
+ CORE_SM_NOSYMBOL= 0;
+ CORE_SM_ERROR = 1;
+ CORE_SM_WARNING = 2;
+ CORE_SM_INFO = 3;
+
+
+//----------------
+// Some Functions to Handle Version DWords
+//----------------
+Function MakeVersion(const HeadRevision, SubVersion, SubVersion2: Byte; Letter: Char): DWord;
+Function VersiontoSting(const Version: DWord): String;
+
+
+implementation
+
+//--------------
+// MakeVersion - Converts 4 Values to a valid Version DWord
+//--------------
+Function MakeVersion(const HeadRevision, SubVersion, SubVersion2: Byte; Letter: Char): DWord;
+begin
+ If (letter < 'a') or (Letter > 'z') then
+ letter := chr(0);
+
+ Result := (HeadRevision shl 24) or (SubVersion shl 16) or (SubVersion2 shl 8) or Ord(Letter);
+end;
+
+//--------------
+// VersiontoString - Returns some beauty '1.0.2a' like String
+//--------------
+Function VersiontoSting(const Version: DWord): String;
+begin // to-do : Write VersiontoString without SysUtils depencies
+ //Result := InttoStr((ver and $FF000000) shr 24);
+ Result := '1.0.1'
+end;
+
+end.