diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/UCommandLine.pas | 1 | ||||
-rw-r--r-- | src/base/UCoreModule.pas | 7 | ||||
-rw-r--r-- | src/base/UCovers.pas | 2 | ||||
-rw-r--r-- | src/base/UDLLManager.pas | 5 | ||||
-rw-r--r-- | src/base/UDataBase.pas | 9 | ||||
-rw-r--r-- | src/base/UFiles.pas | 23 | ||||
-rw-r--r-- | src/base/UHooks.pas | 134 | ||||
-rw-r--r-- | src/base/ULanguage.pas | 22 | ||||
-rw-r--r-- | src/base/UParty.pas | 5 | ||||
-rw-r--r-- | src/base/UPlatform.pas | 3 | ||||
-rw-r--r-- | src/base/UPlaylist.pas | 1 | ||||
-rw-r--r-- | src/base/UPluginInterface.pas | 7 | ||||
-rw-r--r-- | src/base/URecord.pas | 15 | ||||
-rw-r--r-- | src/base/UServices.pas | 5 | ||||
-rw-r--r-- | src/base/USingNotes.pas | 2 | ||||
-rw-r--r-- | src/base/USingScores.pas | 7 | ||||
-rw-r--r-- | src/base/USong.pas | 38 | ||||
-rw-r--r-- | src/base/USongs.pas | 46 | ||||
-rw-r--r-- | src/base/UThemes.pas | 10 |
19 files changed, 178 insertions, 164 deletions
diff --git a/src/base/UCommandLine.pas b/src/base/UCommandLine.pas index 68095346..17ea1a19 100644 --- a/src/base/UCommandLine.pas +++ b/src/base/UCommandLine.pas @@ -33,7 +33,6 @@ interface {$I switches.inc} - type TScreenMode = (scmDefault, scmFullscreen, scmWindowed); diff --git a/src/base/UCoreModule.pas b/src/base/UCoreModule.pas index 8fda6dc2..b87fec85 100644 --- a/src/base/UCoreModule.pas +++ b/src/base/UCoreModule.pas @@ -35,10 +35,11 @@ interface {********************* TCoreModule - Dummy Class that has Methods that will be called from Core - In the Best case every Piece of this Software is a Module + Dummy class that has methods that will be called from core + In the best case every piece of this software is a module *********************} -uses UPluginDefs; +uses + UPluginDefs; type PCoreModule = ^TCoreModule; diff --git a/src/base/UCovers.pas b/src/base/UCovers.pas index 3ed2b633..d4b4e471 100644 --- a/src/base/UCovers.pas +++ b/src/base/UCovers.pas @@ -44,7 +44,7 @@ interface {$I switches.inc} uses - sdl, + SDL, SQLite3, SQLiteTable3, SysUtils, diff --git a/src/base/UDLLManager.pas b/src/base/UDLLManager.pas index b332d3be..5e64f221 100644 --- a/src/base/UDLLManager.pas +++ b/src/base/UDLLManager.pas @@ -33,8 +33,9 @@ interface {$I switches.inc} -uses ModiSDK, - UFiles; +uses + ModiSDK, + UFiles; type TDLLMan = class diff --git a/src/base/UDataBase.pas b/src/base/UDataBase.pas index d2e0cbd0..1b9e432c 100644 --- a/src/base/UDataBase.pas +++ b/src/base/UDataBase.pas @@ -33,10 +33,11 @@ interface {$I switches.inc} -uses USongs, - USong, - Classes, - SQLiteTable3; +uses + USongs, + USong, + Classes, + SQLiteTable3; //-------------------- //DataBaseSystem - Class including all DB Methods diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index eb7f2cad..add81f23 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -32,13 +32,15 @@ interface {$ENDIF} {$I switches.inc} -uses SysUtils, - ULog, - UMusic, - USongs, - USong; +uses + SysUtils, + ULog, + UMusic, + USongs, + USong; procedure ResetSingTemp; + function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; var @@ -53,11 +55,12 @@ var implementation -uses TextGL, - UIni, - UPlatform, - UMain; - +uses + TextGL, + UIni, + UPlatform, + UMain; + //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables //-------------------- diff --git a/src/base/UHooks.pas b/src/base/UHooks.pas index ba948e6b..ab830090 100644 --- a/src/base/UHooks.pas +++ b/src/base/UHooks.pas @@ -27,7 +27,7 @@ unit UHooks; {********************* THookManager - Class for saving, managing and calling of Hooks. + Class for saving, managing and calling of hooks. Saves all hookable events and their subscribers *********************} interface @@ -38,28 +38,29 @@ interface {$I switches.inc} -uses uPluginDefs, - SysUtils; +uses + uPluginDefs, + SysUtils; type //Record that saves info from Subscriber PSubscriberInfo = ^TSubscriberInfo; TSubscriberInfo = record - Self: THandle; //ID of this Subscription (First Word: ID of Subscription; 2nd Word: ID of Hook) + Self: THandle; //ID of this Subscription (First word: ID of Subscription; 2nd word: ID of Hook) Next: PSubscriberInfo; //Pointer to next Item in HookChain - Owner: Integer; //For Error Handling and Plugin Unloading. + Owner: integer; //For Error Handling and Plugin Unloading. //Here is s/t tricky //To avoid writing of Wrapping Functions to Hook an Event with a Class //We save a Normal Proc or a Method of a Class - Case isClass: boolean of + case isClass: boolean of False: (Proc: TUS_Hook); //Proc that will be called on Event True: (ProcOfClass: TUS_Hook_of_Object); end; TEventInfo = record - Name: String[60]; //Name of Event + Name: string[60]; //Name of Event FirstSubscriber: PSubscriberInfo; //First subscriber in chain LastSubscriber: PSubscriberInfo; //Last " (for easier subscriber adding end; @@ -67,22 +68,22 @@ type THookManager = class private Events: array of TEventInfo; - SpaceinEvents: Word; //Number of empty Items in Events Array. (e.g. Deleted Items) + SpaceinEvents: word; //Number of empty Items in Events Array. (e.g. Deleted Items) - Procedure FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); + procedure FreeSubscriber(const EventIndex: word; const Last, Cur: PSubscriberInfo); public - constructor Create(const SpacetoAllocate: Word); + constructor Create(const SpacetoAllocate: word); - Function AddEvent (const EventName: PChar): THandle; - Function DelEvent (hEvent: THandle): Integer; + function AddEvent (const EventName: Pchar): THandle; + function DelEvent (hEvent: THandle): integer; - Function AddSubscriber (const EventName: PChar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; - Function DelSubscriber (const hSubscriber: THandle): Integer; + function AddSubscriber (const EventName: Pchar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; + function DelSubscriber (const hSubscriber: THandle): integer; - Function CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): Integer; - Function EventExists (const EventName: PChar): Integer; + function CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): integer; + function EventExists (const EventName: Pchar): integer; - Procedure DelbyOwner(const Owner: Integer); + procedure DelbyOwner(const Owner: integer); end; function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall; @@ -91,6 +92,7 @@ var HookManager: THookManager; implementation + uses ULog, UCore; @@ -98,14 +100,14 @@ uses //------------ // Create - Creates Class and Set Standard Values //------------ -constructor THookManager.Create(const SpacetoAllocate: Word); -var I: Integer; +constructor THookManager.Create(const SpacetoAllocate: word); +var I: integer; begin inherited Create(); //Get the Space and "Zero" it SetLength (Events, SpacetoAllocate); - For I := 0 to SpacetoAllocate-1 do + for I := 0 to SpacetoAllocate-1 do Events[I].Name[1] := chr(0); SpaceinEvents := SpacetoAllocate; @@ -118,19 +120,19 @@ end; //------------ // AddEvent - Adds an Event and return the Events Handle or 0 on Failure //------------ -Function THookManager.AddEvent (const EventName: PChar): THandle; -var I: Integer; +function THookManager.AddEvent (const EventName: Pchar): THandle; +var I: integer; begin Result := 0; if (EventExists(EventName) = 0) then begin - If (SpaceinEvents > 0) then + if (SpaceinEvents > 0) then begin //There is already Space available //Go Search it! - For I := 0 to High(Events) do - If (Events[I].Name[1] = chr(0)) then + for I := 0 to High(Events) do + if (Events[I].Name[1] = chr(0)) then begin //Found Space Result := I; Dec(SpaceinEvents); @@ -168,7 +170,7 @@ end; //------------ // DelEvent - Deletes an Event by Handle Returns False on Failure //------------ -Function THookManager.DelEvent (hEvent: THandle): Integer; +function THookManager.DelEvent (hEvent: THandle): integer; var Cur, Last: PSubscriberInfo; begin @@ -176,12 +178,12 @@ begin Result := -1; - If (Length(Events) > hEvent) AND (Events[hEvent].Name[1] <> chr(0)) then + if (Length(Events) > hEvent) and (Events[hEvent].Name[1] <> chr(0)) then begin //Event exists //Free the Space for all Subscribers Cur := Events[hEvent].FirstSubscriber; - While (Cur <> nil) do + while (Cur <> nil) do begin Last := Cur; Cur := Cur.Next; @@ -207,7 +209,7 @@ end; // AddSubscriber - Adds an Subscriber to the Event by Name // Returns Handle of the Subscribtion or 0 on Failure //------------ -Function THookManager.AddSubscriber (const EventName: PChar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle; +function THookManager.AddSubscriber (const EventName: Pchar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle; var EventHandle: THandle; EventIndex: Cardinal; @@ -215,11 +217,11 @@ var begin Result := 0; - If (@Proc <> nil) or (@ProcOfClass <> nil) then + if (@Proc <> nil) or (@ProcOfClass <> nil) then begin EventHandle := EventExists(EventName); - If (EventHandle <> 0) then + if (EventHandle <> 0) then begin EventIndex := EventHandle - 1; @@ -232,7 +234,7 @@ begin //Add Owner Cur.Owner := Core.CurExecuted; - If (@Proc = nil) then + if (@Proc = nil) then begin //Use the ProcofClass Method Cur.isClass := True; Cur.ProcOfClass := ProcofClass; @@ -243,20 +245,20 @@ begin Cur.Proc := Proc; end; - //Create Handle (1st Word: Handle of Event; 2nd Word: unique ID - If (Events[EventIndex].LastSubscriber = nil) then + //Create Handle (1st word: Handle of Event; 2nd word: unique ID + if (Events[EventIndex].LastSubscriber = nil) then begin - If (Events[EventIndex].FirstSubscriber = nil) then + if (Events[EventIndex].FirstSubscriber = nil) then begin Result := (EventHandle SHL 16); Events[EventIndex].FirstSubscriber := Cur; end - Else + else begin Result := Events[EventIndex].FirstSubscriber.Self + 1; end; end - Else + else begin Result := Events[EventIndex].LastSubscriber.Self + 1; Events[EventIndex].LastSubscriber.Next := Cur; @@ -277,10 +279,10 @@ end; //------------ // FreeSubscriber - Helper for DelSubscriber. Prevents Loss of Chain Items. Frees Memory. //------------ -Procedure THookManager.FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); +procedure THookManager.FreeSubscriber(const EventIndex: word; const Last, Cur: PSubscriberInfo); begin //Delete from Chain - If (Last <> nil) then + if (Last <> nil) then begin Last.Next := Cur.Next; end @@ -290,7 +292,7 @@ begin end; //Was this Last subscription ? - If (Cur = Events[EventIndex].LastSubscriber) then + if (Cur = Events[EventIndex].LastSubscriber) then begin //Change Last Subscriber Events[EventIndex].LastSubscriber := Last; end; @@ -302,16 +304,16 @@ end; //------------ // DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure //------------ -Function THookManager.DelSubscriber (const hSubscriber: THandle): Integer; +function THookManager.DelSubscriber (const hSubscriber: THandle): integer; var EventIndex: Cardinal; Cur, Last: PSubscriberInfo; begin Result := -1; - EventIndex := ((hSubscriber AND (High(THandle) xor High(Word))) SHR 16) - 1; + EventIndex := ((hSubscriber and (High(THandle) xor High(word))) SHR 16) - 1; //Existing Event ? - If (EventIndex < Length(Events)) AND (Events[EventIndex].Name[1] <> chr(0)) then + if (EventIndex < Length(Events)) and (Events[EventIndex].Name[1] <> chr(0)) then begin Result := -2; //Return -1 on not existing Event, -2 on not existing Subscription @@ -320,9 +322,9 @@ begin Last := nil; //go through the chain ... - While (Cur <> nil) do + while (Cur <> nil) do begin - If (Cur.Self = hSubscriber) then + if (Cur.Self = hSubscriber) then begin //Found Subscription we searched for FreeSubscriber(EventIndex, Last, Cur); @@ -347,16 +349,16 @@ end; // CallEventChain - Calls the Chain of a specified EventHandle // Returns: -1: Handle doesn't Exist, 0 Chain is called until the End //------------ -Function THookManager.CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): Integer; +function THookManager.CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): integer; var EventIndex: Cardinal; Cur: PSubscriberInfo; - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute + CurExecutedBackup: integer; //backup of Core.CurExecuted Attribute begin Result := -1; EventIndex := hEvent - 1; - If ((EventIndex <= High(Events)) AND (Events[EventIndex].Name[1] <> chr(0))) then + if ((EventIndex <= High(Events)) and (Events[EventIndex].Name[1] <> chr(0))) then begin //Existing Event //Backup CurExecuted CurExecutedBackup := Core.CurExecuted; @@ -365,7 +367,7 @@ begin Cur := Events[EventIndex].FirstSubscriber; Result := 0; //Call Hooks until the Chain is at the End or breaked - While ((Cur <> nil) AND (Result = 0)) do + while ((Cur <> nil) and (Result = 0)) do begin //Set CurExecuted Core.CurExecuted := Cur.Owner; @@ -389,21 +391,21 @@ end; //------------ // EventExists - Returns non Zero if an Event with the given Name exists //------------ -Function THookManager.EventExists (const EventName: PChar): Integer; +function THookManager.EventExists (const EventName: Pchar): integer; var - I: Integer; - Name: String[60]; + I: integer; + Name: string[60]; begin Result := 0; - //If (Length(EventName) < - Name := String(EventName); + //if (Length(EventName) < + Name := string(EventName); //Sure not to search for empty space - If (Name[1] <> chr(0)) then + if (Name[1] <> chr(0)) then begin //Search for Event - For I := 0 to High(Events) do - If (Events[I].Name = Name) then + for I := 0 to High(Events) do + if (Events[I].Name = Name) then begin //Event found Result := I + 1; Break; @@ -414,31 +416,31 @@ end; //------------ // DelbyOwner - Dels all Subscriptions by a specific Owner. (For Clean Plugin/Module unloading) //------------ -Procedure THookManager.DelbyOwner(const Owner: Integer); +procedure THookManager.DelbyOwner(const Owner: integer); var - I: Integer; + I: integer; Cur, Last: PSubscriberInfo; begin //Search for Owner in all Hooks Chains - For I := 0 to High(Events) do + for I := 0 to High(Events) do begin - If (Events[I].Name[1] <> chr(0)) then + if (Events[I].Name[1] <> chr(0)) then begin Last := nil; Cur := Events[I].FirstSubscriber; //Went Through Chain - While (Cur <> nil) do + while (Cur <> nil) do begin - If (Cur.Owner = Owner) then + if (Cur.Owner = Owner) then begin //Found Subscription by Owner -> Delete FreeSubscriber(I, Last, Cur); - If (Last <> nil) then + if (Last <> nil) then Cur := Last.Next else Cur := Events[I].FirstSubscriber; end - Else + else begin //Next Item: Last := Cur; @@ -453,7 +455,7 @@ end; function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall; begin Result := 0; //Don't break the chain - Core.ShowMessage(CORE_SM_INFO, PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam))))); + Core.ShowMessage(CORE_SM_INFO, Pchar(string(Pchar(Pointer(lParam))) + ': ' + string(Pchar(Pointer(wParam))))); end; end. diff --git a/src/base/ULanguage.pas b/src/base/ULanguage.pas index 38a32f7d..31840f5f 100644 --- a/src/base/ULanguage.pas +++ b/src/base/ULanguage.pas @@ -32,7 +32,6 @@ interface {$ENDIF} {$I switches.inc} - type TLanguageEntry = record @@ -68,16 +67,17 @@ var implementation -uses UMain, - // UFiles, - UIni, - IniFiles, - Classes, - SysUtils, - {$IFDEF win32} - windows, - {$ENDIF} - ULog; +uses + UMain, + // UFiles, + UIni, + IniFiles, + Classes, + SysUtils, + {$IFDEF win32} + windows, + {$ENDIF} + ULog; //---------- //Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues diff --git a/src/base/UParty.pas b/src/base/UParty.pas index 27c2fd44..cf19e46e 100644 --- a/src/base/UParty.pas +++ b/src/base/UParty.pas @@ -33,7 +33,10 @@ interface {$I switches.inc} -uses UPartyDefs, UCoreModule, UPluginDefs; +uses + UPartyDefs, + UCoreModule, + UPluginDefs; type ARounds = Array [0..252] of Integer; //0..252 needed for diff --git a/src/base/UPlatform.pas b/src/base/UPlatform.pas index a43b7e50..e4cb6f0c 100644 --- a/src/base/UPlatform.pas +++ b/src/base/UPlatform.pas @@ -38,7 +38,8 @@ interface {$I switches.inc} -uses Classes; +uses + Classes; type TDirectoryEntry = record diff --git a/src/base/UPlaylist.pas b/src/base/UPlaylist.pas index 409e8dbe..11ed84de 100644 --- a/src/base/UPlaylist.pas +++ b/src/base/UPlaylist.pas @@ -32,7 +32,6 @@ interface {$ENDIF} {$I switches.inc} - uses USong; diff --git a/src/base/UPluginInterface.pas b/src/base/UPluginInterface.pas index a8b4a789..f299796f 100644 --- a/src/base/UPluginInterface.pas +++ b/src/base/UPluginInterface.pas @@ -26,8 +26,8 @@ unit uPluginInterface; {********************* uPluginInterface - Unit fills a TPluginInterface Structur with Method Pointers - Unit Contains all Functions called directly by Plugins + Unit fills a TPluginInterface structure with method pointers + Unit contains all functions called directly by plugins *********************} interface @@ -38,7 +38,8 @@ interface {$I switches.inc} -uses uPluginDefs; +uses + uPluginDefs; //--------------- // Methods for Plugin diff --git a/src/base/URecord.pas b/src/base/URecord.pas index 022b6945..3946c87c 100644 --- a/src/base/URecord.pas +++ b/src/base/URecord.pas @@ -33,13 +33,14 @@ interface {$I switches.inc} -uses Classes, - Math, - SysUtils, - sdl, - UCommon, - UMusic, - UIni; +uses + Classes, + Math, + SysUtils, + sdl, + UCommon, + UMusic, + UIni; const BaseToneFreq = 65.4064; // lowest (half-)tone to analyze (C2 = 65.4064 Hz) diff --git a/src/base/UServices.pas b/src/base/UServices.pas index c82b27d4..3783c543 100644 --- a/src/base/UServices.pas +++ b/src/base/UServices.pas @@ -33,8 +33,9 @@ interface {$I switches.inc} -uses uPluginDefs, - SysUtils; +uses + uPluginDefs, + SysUtils; {********************* TServiceManager Class for saving, managing and calling of Services. diff --git a/src/base/USingNotes.pas b/src/base/USingNotes.pas index f6b81e3e..dcfaff9f 100644 --- a/src/base/USingNotes.pas +++ b/src/base/USingNotes.pas @@ -34,7 +34,7 @@ interface {$I switches.inc} { Dummy Unit atm - For further expantation + For further explanation Placeholder for Class that will handle the Notes Drawing} implementation diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas index 9469d5b5..cf00b776 100644 --- a/src/base/USingScores.pas +++ b/src/base/USingScores.pas @@ -33,9 +33,10 @@ interface {$I switches.inc} -uses UThemes, - gl, - UTexture; +uses + UThemes, + gl, + UTexture; ////////////////////////////////////////////////////////////// // ATTENTION: // diff --git a/src/base/USong.pas b/src/base/USong.pas index 66288503..0f36662b 100644 --- a/src/base/USong.pas +++ b/src/base/USong.pas @@ -34,29 +34,29 @@ interface {$I switches.inc} uses - {$IFDEF MSWINDOWS} + {$IFDEF MSWINDOWS} Windows, - {$ELSE} - {$IFNDEF DARWIN} - syscall, - {$ENDIF} - baseunix, - UnixType, + {$ELSE} + {$IFNDEF DARWIN} + syscall, {$ENDIF} - SysUtils, - Classes, - UPlatform, - ULog, - UTexture, - UCommon, - {$IFDEF DARWIN} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} cthreads, - {$ENDIF} - {$IFDEF USE_PSEUDO_THREAD} + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} PseudoThread, - {$ENDIF} - UCatCovers, - UXMLSong; + {$ENDIF} + UCatCovers, + UXMLSong; type diff --git a/src/base/USongs.pas b/src/base/USongs.pas index d6f016bf..6f1f7c51 100644 --- a/src/base/USongs.pas +++ b/src/base/USongs.pas @@ -40,30 +40,30 @@ interface {$ENDIF} uses - {$IFDEF MSWINDOWS} - Windows, - DirWatch, - {$ELSE} - {$IFNDEF DARWIN} - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - UPlatform, - ULog, - UTexture, - UCommon, - {$IFDEF DARWIN} - cthreads, - {$ENDIF} - {$IFDEF USE_PSEUDO_THREAD} - PseudoThread, + {$IFDEF MSWINDOWS} + Windows, + DirWatch, + {$ELSE} + {$IFNDEF DARWIN} + syscall, {$ENDIF} - USong, - UCatCovers; + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} + USong, + UCatCovers; type diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index 790cbf1f..38bd3ca4 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -34,11 +34,11 @@ interface {$I switches.inc} uses - ULog, - IniFiles, - SysUtils, - Classes, - UTexture; + ULog, + IniFiles, + SysUtils, + Classes, + UTexture; type TRGB = record |