aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-01 18:00:32 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-01 18:00:32 +0000
commitdbdb5b7e4fc5acd72c9283990a412fffb7bb33c3 (patch)
tree85cb55bd0482bfe09d096a08f7b7f8b50b08da05
parent04197f2b45f4d1ebe87c97c9a072c1c3f30e8596 (diff)
downloadusdx-dbdb5b7e4fc5acd72c9283990a412fffb7bb33c3.tar.gz
usdx-dbdb5b7e4fc5acd72c9283990a412fffb7bb33c3.tar.xz
usdx-dbdb5b7e4fc5acd72c9283990a412fffb7bb33c3.zip
- implement Mac specific abstract UPlatform.GetMusicPath() for win and linux
- add UPlatform.AddLibrarySearchPath() to be able to add new dll search paths - use AddLibrarySearchPath() for loading plugin dependencies (e.g. ffmpeg libs) from game/mediaplugins/deps git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2758 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--mediaplugin/src/base/UPlatform.pas19
-rw-r--r--mediaplugin/src/base/UPlatformWindows.pas10
-rw-r--r--mediaplugin/src/media/UMediaPlugin.pas6
3 files changed, 34 insertions, 1 deletions
diff --git a/mediaplugin/src/base/UPlatform.pas b/mediaplugin/src/base/UPlatform.pas
index 6d884979..4239e21a 100644
--- a/mediaplugin/src/base/UPlatform.pas
+++ b/mediaplugin/src/base/UPlatform.pas
@@ -51,9 +51,11 @@ type
procedure Halt; virtual;
function GetLogPath: IPath; virtual; abstract;
- function GetMusicPath: IPath; virtual; abstract;
+ function GetMusicPath: IPath; virtual;
function GetGameSharedPath: IPath; virtual; abstract;
function GetGameUserPath: IPath; virtual; abstract;
+
+ procedure AddLibrarySearchPath(const DLLPath: IPath); virtual;
end;
function Platform(): TPlatform;
@@ -113,6 +115,21 @@ begin
Result := ExecDir.GetAbsolutePath();
end;
+{**
+ * Dummy implementation (Mac specific)
+ *}
+function TPlatform.GetMusicPath: IPath;
+begin
+ Result := PATH_NONE;
+end;
+
+{**
+ * Dummy implementation (Windows specific)
+ *}
+procedure TPlatform.AddLibrarySearchPath(const DLLPath: IPath);
+begin
+end;
+
(**
* Default TerminateIfAlreadyRunning() implementation
*)
diff --git a/mediaplugin/src/base/UPlatformWindows.pas b/mediaplugin/src/base/UPlatformWindows.pas
index 91d3cce6..a0059687 100644
--- a/mediaplugin/src/base/UPlatformWindows.pas
+++ b/mediaplugin/src/base/UPlatformWindows.pas
@@ -51,6 +51,7 @@ type
public
procedure Init; override;
function TerminateIfAlreadyRunning(var WndTitle: String): Boolean; override;
+ procedure AddLibrarySearchPath(const DLLPath: IPath); override;
function GetLogPath: IPath; override;
function GetGameSharedPath: IPath; override;
@@ -63,6 +64,7 @@ uses
SysUtils,
ShlObj,
Windows,
+ UPathUtils,
UConfig;
procedure TPlatformWindows.Init;
@@ -206,4 +208,12 @@ begin
Result := GetSpecialPath(CSIDL_APPDATA).Append('ultrastardx', pdAppend);
end;
+function SetDllDirectory(lpPathName: PWideChar): Bool; stdcall;
+ external kernel32 name 'SetDllDirectoryW';
+
+procedure TPlatformWindows.AddLibrarySearchPath(const DLLPath: IPath);
+begin
+ SetDllDirectory(PWideChar(DLLPath.ToWide()));
+end;
+
end.
diff --git a/mediaplugin/src/media/UMediaPlugin.pas b/mediaplugin/src/media/UMediaPlugin.pas
index 4baa778a..8632b9df 100644
--- a/mediaplugin/src/media/UMediaPlugin.pas
+++ b/mediaplugin/src/media/UMediaPlugin.pas
@@ -168,6 +168,7 @@ uses
UPath,
UPathUtils,
ULog,
+ UPlatform,
UAudioDecoderPlugin,
UAudioConverterPlugin,
UVideoDecoderPlugin;
@@ -434,6 +435,11 @@ const
begin
MediaPlugins := TList.Create;
+ {$IFDEF MSWINDOWS}
+ // add an additional dll search path for plugin dependencies
+ Platform.AddLibrarySearchPath(MediaPluginPath.Append('deps'));
+ {$ENDIF}
+
LibPath := MediaPluginPath.Append('*' + ModuleExt);
Iter := FileSystem.FileFind(LibPath, faAnyFile);
while (Iter.HasNext) do