Если кому из программистов интересно пощупать, то вот библиотека:
Скачать 150 КБ
Все экспортируемые функции работают по соглашению STDCALL. Если в конце имени нет суффикса A (Ansi), то с UCS16-строками (L"строка" в C++).
Если с суффиксом А, то с Ansi-строками.
Примеры использования:
// Отображаем все моды из папки Mods и присутствующие в list.txt на корневую папку с игрой
MapModsFromListA('D:\Heroes 3', 'D:\Heroes 3\Mods', 'D:\Heroes 3\Mods\list.txt')
// Запускаем VFS
VfsControl.RunVfs(0); // 0 - SORT_FIFO, содержимое папок более приоритетных модов будет выводиться ДО менее приоритетных
// Читаю файл из Феникса по виртуальному пути:
ReadFileContents('D:\Heroes 3\Data\s\pHoenix.erm', s);
API:
Code:
(* Maps real directory contents to virtual path. Target must exist for success *)
function MapDir (const VirtPath, RealPath: PWideChar; OverwriteExisting: boolean; Flags: integer = 0): LONGBOOL; stdcall;
(* Maps real directory contents to virtual path. Target must exist for success *)
function MapDirA (const VirtPath, RealPath: PAnsiChar; OverwriteExisting: boolean; Flags: integer = 0): LONGBOOL; stdcall;
(* Loads mod list from file and maps each mod directory to specified root directory.
File with mod list is treated as (BOM or BOM-less) UTF-8 plain text file, where each mod name is separated
from another one via Line Feed (#10) character. Each mod named is trimmed, converted to UCS16 and validated before
adding to list. Invalid or empty mods will be skipped.
Returns true if root and mods directory existed and file with mod list was loaded successfully *)
function MapModsFromList (const RootDir, ModsDir, ModListFile: PWideChar; Flags: integer = 0): LONGBOOL; stdcall;
(* Loads mod list from file and maps each mod directory to specified root directory.
File with mod list is treated as (BOM or BOM-less) UTF-8 plain text file, where each mod name is separated
from another one via Line Feed (#10) character. Each mod named is trimmed, converted to UCS16 and validated before
adding to list. Invalid or empty mods will be skipped.
Returns true if root and mods directory existed and file with mod list was loaded successfully *)
function MapModsFromListA (const RootDir, ModsDir, ModListFile: PAnsiChar; Flags: integer = 0): LONGBOOL; stdcall;
(* Runs all VFS subsystems, unless VFS is already running *)
function RunVfs (DirListingOrder: TDirListingSortType): LONGBOOL;
(* Temporarily pauses VFS, but does not reset existing mappings *)
function PauseVfs: LONGBOOL; stdcall;
(* Stops VFS and clears all mappings *)
function ResetVfs: LONGBOOL; stdcall;
(* Calls specified function with a single argument and returns its result. VFS is disabled for current thread during function exection *)
function CallWithoutVfs (Func: TSingleArgExternalFunc; Arg: pointer = nil): integer; stdcall;
(*
Specifies the order, in which files from different mapped directories will be listed in virtual directory.
Virtual directory sorting is performed by priorities firstly and lexicographically secondly.
SORT_FIFO - Items of the first mapped directory will be listed before the second mapped directory items.
SORT_LIFO - Items of The last mapped directory will be listed before all other mapped directory items.
*)
TDirListingSortType = (SORT_FIFO = 0, SORT_LIFO = 1);