aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/ULog.pas16
-rw-r--r--Game/Code/Classes/UPluginInterface.pas179
-rw-r--r--Game/Code/UltraStar.dpr10
-rw-r--r--Game/Code/switches.inc29
4 files changed, 217 insertions, 17 deletions
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 7c93c6e9..7e464b57 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -188,6 +188,11 @@ begin
FileErrorO := false;
end;
end;
+ {$DEFINE DEBUG} //How can i check if this is set in *.dpr file o0
+ //If Debug => Write to Console Output
+ {$IFDEF DEBUG}
+ WriteLn('Error: ' + Text);
+ {$ENDIF}
end;
procedure TLog.LogVoice(SoundNr: integer);
@@ -219,10 +224,13 @@ end;
procedure TLog.LogStatus(Log1, Log2: string);
begin
//Just for Debugging
- //Comment for Release
- //LogAnalyze (Log2 + ': ' + Log1);
-
- LogError(Log2 + ': ' + Log1);
+ //Comment for Release
+ //LogError(Log2 + ': ' + Log1);
+
+ //If Debug => Write to Console Output
+ {$IFDEF DEBUG}
+ WriteLn(Log2 + ': ' + Log1);
+ {$ENDIF}
end;
procedure TLog.LogError(Log1, Log2: string);
diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas
new file mode 100644
index 00000000..6d17d51d
--- /dev/null
+++ b/Game/Code/Classes/UPluginInterface.pas
@@ -0,0 +1,179 @@
+unit uPluginInterface;
+{*********************
+ uPluginInterface
+ Unit fills a TPluginInterface Structur with Method Pointers
+ Unit Contains all Functions called directly by Plugins
+*********************}
+
+interface
+uses uPluginDefs;
+
+//---------------
+// Procedure that Sets the PluginInterface Record
+//---------------
+ Procedure Init_PluginInterface;
+
+//---------------
+// Methods for Plugin
+//---------------
+ {******** Hook specific Methods ********}
+ {Function Creates a new Hookable Event and Returns the Handle
+ or 0 on Failure. (Name already exists)}
+ Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
+
+ {Function Destroys an Event and Unhooks all Hooks to this Event.
+ 0 on success, not 0 on Failure}
+ Function DestroyHookableEvent (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}
+ Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall;
+
+ {Function Hooks an Event by Name.
+ Returns Hook Handle on Success, otherwise 0}
+ Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
+
+ {Function Removes the Hook from the Chain
+ Returns 0 on Success}
+ Function UnHookEvent (hHook: THandle): Integer; stdcall;
+
+ {Function Returns Non Zero if a Event with the given Name Exists,
+ otherwise 0}
+ Function EventExists (EventName: PChar): Integer; stdcall;
+
+ {******** Service specific Methods ********}
+ {Function Creates a new Service and Returns the Services Handle
+ or 0 on Failure. (Name already exists)}
+ Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
+
+ {Function Destroys a Service.
+ 0 on success, not 0 on Failure}
+ Function DestroyService (hService: THandle): integer; stdcall;
+
+ {Function Calls a Services Proc
+ Returns Services Return Value or SERVICE_NOT_FOUND on Failure}
+ Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall;
+
+ {Function Returns Non Zero if a Service with the given Name Exists,
+ otherwise 0}
+ Function ServiceExists (ServiceName: PChar): Integer; stdcall;
+
+var
+ PluginInterface: TUS_PluginInterface;
+
+implementation
+
+//---------------
+// Procedure that Sets the PluginInterface Record
+//---------------
+Procedure Init_PluginInterface;
+begin
+ PluginInterface.CreateHookableEvent := CreateHookableEvent;
+ PluginInterface.DestroyHookableEvent := DestroyHookableEvent;
+ PluginInterface.NotivyEventHooks := NotivyEventHooks;
+ PluginInterface.HookEvent := HookEvent;
+ PluginInterface.UnHookEvent := UnHookEvent;
+ PluginInterface.EventExists := EventExists;
+
+ PluginInterface.CreateService := CreateService;
+ PluginInterface.DestroyService := DestroyService;
+ PluginInterface.CallService := CallService;
+ PluginInterface.ServiceExists := ServiceExists;
+end;
+
+
+{******** Hook specific Methods ********}
+//---------------
+// Function Creates a new Hookable Event and Returns the Handle
+// or 0 on Failure. (Name already exists)
+//---------------
+Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Destroys an Event and Unhooks all Hooks to this Event.
+// 0 on success, not 0 on Failure
+//---------------
+Function DestroyHookableEvent (hEvent: THandle): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// 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
+//---------------
+Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Hooks an Event by Name.
+// Returns Hook Handle on Success, otherwise 0
+//---------------
+Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Removes the Hook from the Chain
+// Returns 0 on Success
+//---------------
+Function UnHookEvent (hHook: THandle): Integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Returns Non Zero if a Event with the given Name Exists,
+// otherwise 0
+//---------------
+Function EventExists (EventName: PChar): Integer; stdcall;
+begin
+
+end;
+
+ {******** Service specific Methods ********}
+//---------------
+// Function Creates a new Service and Returns the Services Handle
+// or 0 on Failure. (Name already exists)
+//---------------
+Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Destroys a Service.
+// 0 on success, not 0 on Failure
+//---------------
+Function DestroyService (hService: THandle): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Calls a Services Proc
+// Returns Services Return Value or SERVICE_NOT_FOUND on Failure
+//---------------
+Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Returns Non Zero if a Service with the given Name Exists,
+// otherwise 0
+//---------------
+Function ServiceExists (ServiceName: PChar): Integer; stdcall;
+begin
+
+end;
+
+end.
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index ea1ccdf4..b9fa0530 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -1,6 +1,7 @@
program UltraStar;
{$DEFINE TRANSLATE}
+{$DEFINE DEBUG} //Remove b4 release
{$R 'UltraStar.res' 'UltraStar.rc'}
{$I switches.inc}
@@ -97,6 +98,14 @@ uses
USingScores in 'Classes\USingScores.pas',
USingNotes in 'Classes\USingNotes.pas',
+ //New Plugin and Core Management
+ {ULists in 'Classes\ULists.pas', //maybe drop this
+ UHooks in 'Classes\UHooks.pas', //80 % - Whiteshark is about to work on this
+ UServices in 'Classes\UServices.pas', //20 % - Whiteshark is about to work on this
+ UCore in 'Classes\UCore.pas',
+ UCoreModule in 'Classes\UCoreModule.pas', }
+ UPluginInterface in 'Classes\UPluginInterface.pas', //Some changes to work with unwriten classes, need to be done
+
//------------------------------
//Includes - Video Support
//------------------------------
@@ -148,6 +157,7 @@ uses
//Includes - Modi SDK
//------------------------------
ModiSDK in '..\..\Modis\SDK\ModiSDK.pas',
+ UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New Plugin SDK
//------------------------------
//Includes - Delphi
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
index a895712a..fda3cd75 100644
--- a/Game/Code/switches.inc
+++ b/Game/Code/switches.inc
@@ -1,13 +1,16 @@
-{$IFDEF FPC}
- {$UNDEF UseSerialPort}
- {$UNDEF UseMIDIPort}
-{$ELSE}
- {$UNDEF UseSerialPort}
- {$DEFINE UseMIDIPort}
-{$ENDIF}
-
-{$IFDEF win32}
- {$DEFINE UseBASS}
-{$ELSE}
- {$UNDEF UseBASS}
-{$ENDIF}
+{$IFDEF FPC}
+ {$UNDEF UseSerialPort}
+ {$UNDEF UseMIDIPort}
+{$ELSE}
+ {$DEFINE UseSerialPort}
+ {$DEFINE UseMIDIPort}
+{$ENDIF}
+
+{$IFDEF win32}
+ {$DEFINE UseBASS}
+ {$IFDEF DEBUG}
+ {$APPTYPE CONSOLE}
+ {$ENDIF}
+{$ELSE}
+ {$UNDEF UseBASS}
+{$ENDIF} \ No newline at end of file