aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UCore.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-27 09:10:29 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-27 09:10:29 +0000
commite270d3193a2a5b958e6416ce340246e790f7bd86 (patch)
tree9357c7e63dabce90bd15b437388b801d482acaf3 /Game/Code/Classes/UCore.pas
parent2b83fa1741b6b2d4c7548cd165f2158f9fdb351f (diff)
downloadusdx-e270d3193a2a5b958e6416ce340246e790f7bd86.tar.gz
usdx-e270d3193a2a5b958e6416ce340246e790f7bd86.tar.xz
usdx-e270d3193a2a5b958e6416ce340246e790f7bd86.zip
Finished pluginloader, plugininterface
Some fixes and error management (needs improvement) in Core and Service/Hook classes. "Clean Plugin Unloading on Error" finished Some debuging messages on startup. to Fix this remove old Plugins from Pluginfolder git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@535 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UCore.pas')
-rw-r--r--Game/Code/Classes/UCore.pas36
1 files changed, 34 insertions, 2 deletions
diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas
index de44fb3b..a8a29aeb 100644
--- a/Game/Code/Classes/UCore.pas
+++ b/Game/Code/Classes/UCore.pas
@@ -38,6 +38,7 @@ type
sRetranslate: THandle;
sReloadTextures: THandle;
sGetModuleInfo: THandle;
+ sGetApplicationHandle: THandle;
Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem;
@@ -86,6 +87,9 @@ type
//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown
Procedure Run;
+ //Method for other Classes to get Pointer to a specific Module
+ Function GetModulebyName(const Name: String): PCoreModule;
+
//--------------
// Hook and Service Procs:
//--------------
@@ -95,6 +99,7 @@ type
Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook
Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook
Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam
+ Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle
end;
var
@@ -354,6 +359,10 @@ begin
sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate);
sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures);
sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo);
+ sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle);
+
+ //A little Test
+ Hooks.AddSubscriber('Core/NewError', HookTest);
end;
//-------------
@@ -375,6 +384,21 @@ begin
end;
//-------------
+//Method for other Classes to get Pointer to a specific Module
+//-------------
+Function TCore.GetModulebyName(const Name: String): PCoreModule;
+var I: Integer;
+begin
+ Result := nil;
+ For I := 0 to high(Modules) do
+ If (Modules[I].Info.Name = Name) then
+ begin
+ Result := @Modules[I].Module;
+ Break;
+ end;
+end;
+
+//-------------
// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol)
//-------------
Function TCore.ShowMessage(wParam, lParam: DWord): integer;
@@ -405,11 +429,11 @@ end;
//-------------
Function TCore.ReportError(wParam, lParam: DWord): integer;
begin
- Hooks.CallEventChain(hError, wParam, lParam);
-
//Update LastErrorReporter and LastErrorString
LastErrorReporter := String(PChar(Ptr(lParam)));
LastErrorString := String(PChar(Ptr(wParam)));
+
+ Hooks.CallEventChain(hError, wParam, lParam);
end;
//-------------
@@ -460,4 +484,12 @@ begin
end;
end;
+//-------------
+// Returns Application Handle
+//-------------
+Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer;
+begin
+ Result := hInstance;
+end;
+
end. \ No newline at end of file