mirror of
https://github.com/ModOrganizer2/libbsarch.git
synced 2026-07-27 14:06:31 -07:00
Added context to FO4 DDS info callback
This commit is contained in:
+1
-1
@@ -148,6 +148,6 @@ BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags) {
|
||||
return;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc) {
|
||||
BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-1
@@ -374,9 +374,10 @@ begin
|
||||
TwbBSArchive(obj).ShareData := shareData;
|
||||
end;
|
||||
|
||||
procedure bsa_file_dds_info_callback_set(obj: Pointer; aProc: TBSFileDDSInfoProcCompat); stdcall;
|
||||
procedure bsa_file_dds_info_callback_set(obj: Pointer; aProc: TBSFileDDSInfoProcCompat; aContext: Pointer); stdcall;
|
||||
begin
|
||||
TwbBSArchive(obj).DDSInfoProc := aProc;
|
||||
TwbBSArchive(obj).DDSInfoProcContext := aContext;
|
||||
end;
|
||||
|
||||
exports
|
||||
|
||||
+2
-2
@@ -3,12 +3,12 @@
|
||||
<ProjectGuid>{381E4D59-4D34-46B3-B039-1B3C3ABEC58F}</ProjectGuid>
|
||||
<MainSource>libbsarch.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Release</Config>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Library</AppType>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<ProjectVersion>18.6</ProjectVersion>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ typedef enum bsa_archive_type_e {
|
||||
baNone, baTES3, baTES4, baFO3, baSSE, baFO4, baFO4dds
|
||||
} bsa_archive_type_t;
|
||||
|
||||
typedef void (*bsa_file_dds_info_proc_t)(bsa_archive_t archive, const wchar_t *file_path, bsa_dds_info_t *dds_info);
|
||||
typedef void (*bsa_file_dds_info_proc_t)(bsa_archive_t archive, const wchar_t *file_path, bsa_dds_info_t *dds_info, void *context);
|
||||
typedef bool (*bsa_file_iteration_proc_t)(bsa_archive_t archive, const wchar_t *file_path, bsa_file_record_t file_record, bsa_folder_record_t folder_record, void *context);
|
||||
|
||||
BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create();
|
||||
@@ -115,4 +115,4 @@ BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags);
|
||||
BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive);
|
||||
BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags);
|
||||
|
||||
BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc);
|
||||
BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context);
|
||||
|
||||
+5
-2
@@ -198,7 +198,7 @@ type
|
||||
|
||||
TDDSInfo = record Width, Height, MipMaps: Integer; end;
|
||||
TBSFileDDSInfoProcCompat = procedure(aArchive: Pointer; const aFilePath: PChar;
|
||||
var aInfo: TDDSInfo); stdcall;
|
||||
var aInfo: TDDSInfo; aContext: Pointer); stdcall;
|
||||
|
||||
TwbBSHeaderTES3 = packed record
|
||||
HashOffset: Cardinal;
|
||||
@@ -308,7 +308,9 @@ type
|
||||
fVersion: Cardinal;
|
||||
fCompress: Boolean;
|
||||
fShareData: Boolean;
|
||||
|
||||
fDDSInfoProc: TBSFileDDSInfoProcCompat;
|
||||
fDDSInfoProcContext: Pointer;
|
||||
|
||||
fHeaderTES3: TwbBSHeaderTES3;
|
||||
fFilesTES3: array of TwbBSFileTES3;
|
||||
@@ -370,6 +372,7 @@ type
|
||||
property Compress: Boolean read fCompress write fCompress;
|
||||
property ShareData: Boolean read fShareData write fShareData;
|
||||
property DDSInfoProc: TBSFileDDSInfoProcCompat read fDDSInfoProc write fDDSInfoProc;
|
||||
property DDSInfoProcContext: Pointer read fDDSInfoProcContext write fDDSInfoProcContext;
|
||||
end;
|
||||
|
||||
function SplitDirName(const aFilePath: string; var Dir, Name: string): Integer;
|
||||
@@ -1364,7 +1367,7 @@ begin
|
||||
raise Exception.Create('DDS archive requires DDS file information callback');
|
||||
|
||||
for i := 0 to Pred(aFilesList.Count) do begin
|
||||
fDDSInfoProc(Self, PChar(aFilesList[i]), ddsinfo);
|
||||
fDDSInfoProc(Self, PChar(aFilesList[i]), ddsinfo, Self.fDDSInfoProcContext);
|
||||
fDataOffset := fDataOffset + 24 {size of file record} + 24 {size of each texchunk} * GetDDSMipChunkNum(ddsinfo);
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user