-
Notifications
You must be signed in to change notification settings - Fork 5
/
wbInterface.pas
14166 lines (12396 loc) · 533 KB
/
wbInterface.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{******************************************************************************
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
*******************************************************************************}
unit wbInterface;
{$I wbDefines.inc}
interface
uses
Classes,
SysUtils,
Graphics;
const
VersionString = '3.1.1';
clOrange = $004080FF;
wbFloatDigits = 6;
wbHardcodedDat = '.Hardcoded.keep.this.with.the.exe.and.otherwise.ignore.it.I.really.mean.it.dat';
type
TwbProgressCallback = procedure(const aStatus: string);
TwbPointerArray = array [0..Pred(High(Integer) div SizeOf(Pointer))] of Pointer;
PwbPointerArray = ^TwbPointerArray; {General array of pointer}
threadvar
wbProgressCallback : TwbProgressCallback;
wbCurrentTick : Integer;
wbCurrentAction : string;
wbStartTime : TDateTime;
wbShowStartTime : Integer;
var
wbDisplayLoadOrderFormID : Boolean = False;
wbSimpleRecords : Boolean = True;
wbFixupPGRD : Boolean = False;
wbIKnowWhatImDoing : Boolean = False;
wbHideUnused : Boolean = True;
wbHideIgnored : Boolean = True;
wbHideNeverShow : Boolean = True;
wbShowFormVersion : Boolean = False;
wbShowFlagEnumValue : Boolean = False;
wbDisplayShorterNames : Boolean = False;
wbSortSubRecords : Boolean = False;
wbSortFLST : Boolean = True;
wbSortGroupRecord : Boolean = False;
wbRemoveOffsetData : Boolean = True;
wbEditAllowed : Boolean = False;
wbFlagsAsArray : Boolean = False;
wbDelayLoadRecords : Boolean = True;
wbMoreInfoForUnknown : Boolean = False;
wbMoreInfoForIndex : Boolean = False;
wbTranslationMode : Boolean = False;
wbTestWrite : Boolean = False;
wbForceNewHeader : Boolean = False; // add wbNewHeaderAddon value to the headers of mainrecords and GRUP records
wbNewHeaderAddon : Cardinal = 40; // 4 additional bytes, 40 - new form version field
wbRequireLoadOrder : Boolean = False;
wbVWDInTemporary : Boolean = False;
wbResolveAlias : Boolean = True;
wbActorTemplateHide : Boolean = True;
wbClampFormID : Boolean = True;
wbDoNotBuildRefsFor : TStringList;
wbUDRSetXESP : Boolean = True;
wbUDRSetScale : Boolean = False;
wbUDRSetScaleValue : Single = 0.0;
wbUDRSetZ : Boolean = True;
wbUDRSetZValue : Single = -30000;
wbUDRSetMSTT : Boolean = True;
wbUDRSetMSTTValue : Int64 = $0000001B; { AshPile01 }
wbMasterUpdateFilterONAM : Boolean = False;
wbMasterUpdateFixPersistence : Boolean = True;
wbAllowInternalEdit : Boolean = True;
wbShowInternalEdit : Boolean = False;
wbReportMode : Boolean = False;
wbReportUnused : Boolean = False;
wbReportRequired : Boolean = True;
wbReportUnusedData : Boolean = True;
wbReportUnknownFormIDs : Boolean = True;
wbReportUnknownFloats : Boolean = True;
wbReportUnknownStrings : Boolean = True;
wbReportEmpty : Boolean = True;
wbReportSometimesEmpty : Boolean = True;
wbReportFormIDs : Boolean = True;
wbReportNotFoundButAllowedFormIDs : Boolean = True;
wbReportUnknownFlags : Boolean = True;
wbReportUnknownEnums : Boolean = True;
wbReportFormIDNotAllowedReferences : Boolean = True;
wbReportUnknown : Boolean = True;
wbMoreInfoForRequired : Boolean = False;
wbMoreInfoForDecider : Boolean = False;
wbTrackAllEditorID : Boolean = False;
wbCheckExpectedBytes : Boolean = True;
wbRotationFactor : Extended = 180/Pi;
wbRotationScale : Integer = 4;
wbDumpOffset : Integer = 0; // 1= starting offset, 2 = Count, 3 = Offsets, size and count
wbBaseOffset : Cardinal = 0;
wbProgramPath : string;
wbDataPath : string;
wbOutputPath : string;
wbTheGameIniFileName : string;
wbShouldLoadMOHookFile : Boolean;
wbMOProfile : string;
wbMOHookFile : string;
wbSpeedOverMemory : Boolean = False;
{$IFDEF USE_CODESITE}
type
TwbLoggingArea = (
laAddIfMissing,
laElementAssign,
laElementCanAssign,
laElementSetToDefault,
laElementWriteToStream,
laElementMergeStorage,
laDummy
);
TwbLoggingAreas = set of TwbLoggingArea;
var
wbLoggingAreas : TwbLoggingAreas = [
laAddIfMissing,
laElementAssign,
laElementCanAssign,
laElementSetToDefault,
//laElementWriteToStream,
//laElementMergeStorage,
laDummy
];
function wbCodeSiteLoggingEnabled: Boolean;
function wbBeginCodeSiteLogging: Integer;
function wbEndCodeSiteLogging: Integer;
{$ENDIF}
type
TConflictAll = (
caUnknown,
caOnlyOne,
caNoConflict,
caConflictBenign,
caOverride,
caConflict,
caConflictCritical
);
TByteSet = set of Byte;
TConflictAllSet = set of TConflictAll;
TConflictAllColors = array[TConflictAll] of TColor;
TConflictThis = (
ctUnknown,
ctIgnored,
ctNotDefined,
ctIdenticalToMaster,
ctOnlyOne,
ctHiddenByModGroup,
ctMaster,
ctConflictBenign,
ctOverride,
ctIdenticalToMasterWinsConflict,
ctConflictWins,
ctConflictLoses
);
TConflictThisSet = set of TConflictThis;
TConflictThisColors = array[TConflictThis] of TColor;
var
wbColorConflictAll: TConflictAllColors = (
clDefault, // caUnknown
clDefault, // caOnlyOne
clLime, // caNoConflict
clYellow, // caConflictBenign
clYellow, // caOverride
clRed, // caConflict
clFuchsia // caConflictCritical
);
wbColorConflictThis: TConflictThisColors = (
clWindowText, // ctUnknown
clWindowText, // ctIgnored
clMedGray, // ctNotDefined
clDkGray, // ctIdenticalToMaster
clWindowText, // ctOnlyOne
clLtGray, // ctHiddenByModGroup
clPurple, // ctMaster
clWindowText, // ctConflictBenign
clGreen, // ctOverride
clOlive, // ctIdenticalToMasterWinsConflict
clOrange, // ctConflictWins
clRed // ctConflictLoses
);
type
TwbConflictPriority = (
cpIgnore,
cpBenignIfAdded,
cpBenign,
cpTranslate,
cpNormal,
cpNormalIgnoreEmpty,
cpCritical,
cpFormID
);
LongRecSmall = packed record
Lo, Hi: Smallint;
end;
PwbSignature = ^TwbSignature;
TwbSignature = array[0..3] of AnsiChar;
TwbSignatures = array of TwbSignature;
TwbFileMagic = string;
TwbIntType = (
it0,
itU8,
itS8,
itU16,
itS16,
itU32,
itS32,
itU64,
itS64,
itU24,
itU6to30
);
TwbDefType = (
dtRecord,
dtSubRecord,
dtSubRecordArray,
dtSubRecordStruct,
dtSubRecordUnion,
dtString,
dtLString,
dtLenString,
dtByteArray,
dtInteger,
dtIntegerFormater,
dtIntegerFormaterUnion,
dtFlag,
dtFloat,
dtArray,
dtStruct,
dtUnion,
dtEmpty,
dtStructChapter
);
var
dtNonValues : set of TwbDefType = [
dtRecord,
dtSubRecord,
dtSubRecordArray,
dtSubRecordStruct,
dtSubRecordUnion,
dtArray,
dtStruct,
dtUnion,
dtStructChapter
];
type
IwbDef = interface;
TwbDefs = array of IwbDef;
TwbDefPath = array of record
Def : IwbDef;
Index : Integer;
end;
IwbElement = interface;
IwbDef = interface
['{C7739FBD-3B58-48A2-9DD0-8057D3496892}']
function GetDefType: TwbDefType;
function GetDefTypeName: string;
function CanAssign(const aElement: IwbElement; aIndex: Integer; const aDef: IwbDef): Boolean;
function Assign(const aTarget: IwbElement; aIndex: Integer; const aSource: IwbElement; aOnlySK: Boolean): IwbElement;
function GetDefID: Cardinal;
function Equals(const aDef: IwbDef): Boolean;
function GetConflictPriority(const aElement: IwbElement): TwbConflictPriority;
function GetConflictPriorityCanChange: Boolean;
function GetRequired: Boolean;
function CanContainFormIDs: Boolean;
function GetDontShow(const aElement: IwbElement): Boolean;
function GetHasDontShow: Boolean;
function GetRoot: IwbDef;
function GetNoReach: Boolean;
function GetParent: IwbDef;
procedure Report(const aParents: TwbDefPath);
procedure Used(const aElement: IwbElement = nil; const s: string = '');
procedure PossiblyRequired;
procedure NotRequired;
function IsNotRequired: Boolean;
property DefType: TwbDefType
read GetDefType;
property DefTypeName: string
read GetDefTypeName;
property DefID: Cardinal
read GetDefID;
property ConflictPriority[const aElement: IwbElement]: TwbConflictPriority
read GetConflictPriority;
property ConflictPriorityCanChange: Boolean
read GetConflictPriorityCanChange;
property Required: Boolean
read GetRequired;
property DontShow[const aElement: IwbElement]: Boolean
read GetDontShow;
property HasDontShow: Boolean
read GetHasDontShow;
property Root: IwbDef
read GetRoot;
property NoReach: Boolean
read GetNoReach;
property Parent: IwbDef
read GetParent;
end;
TwbElementType = (
etFile,
etMainRecord,
etGroupRecord,
etSubRecord,
etSubRecordStruct,
etSubRecordArray,
etSubRecordUnion,
etArray,
etStruct,
etValue,
etFlag,
etStringListTerminator,
etUnion,
etStructChapter
);
TwbElementTypes = set of TwbElementType;
IwbContainer = interface;
IwbFile = interface;
IwbNamedDef = interface;
IwbValueDef = interface;
IwbMainRecord = interface;
TwbElementState = (
esModified,
esInternalModified,
esUnsaved,
esSortKeyValid,
esExtendedSortKeyValid,
esHidden,
esParentHidden,
esParentHiddenChecked,
esNotReachable,
esReachable,
esTagged,
esDeciding,
esNotSuitableToAddTo,
esDummy, {Used in wbScriptAdapter as a default value}
esConstructionComplete,
esDestroying,
esChangeNotified,
esModifiedUpdated
);
TwbElementStates = set of TwbElementState;
TwbEditType = (
etDefault,
etComboBox,
etCheckComboBox
);
TDynFiles = array of IwbFile;
IwbElement = interface
['{F4B4637D-C794-415F-B5C7-587EAA4095B3}']
function GetElementID: Cardinal;
function GetElementStates: TwbElementStates;
procedure SetElementState(aState: TwbElementState; Clear: Boolean = false);
function Equals(const aElement: IwbElement): Boolean;
function GetValue: string;
function GetCheck: string;
function GetSortKey(aExtended: Boolean): string;
function GetSortPriority: Integer;
function GetName: string;
function GetBaseName: string;
function GetDisplayName: string;
function GetShortName: string;
function GetPath: string;
function GetFullPath: string;
function GetPathName: string;
function GetSkipped: Boolean;
function GetDef: IwbNamedDef;
function GetValueDef: IwbValueDef;
function GetResolvedValueDef: IwbValueDef;
function GetElementType: TwbElementType;
function GetContainer: IwbContainer;
function GetContainingMainRecord: IwbMainRecord;
function GetFile: IwbFile;
function GetReferenceFile: IwbFile;
function GetSortOrder: Integer;
procedure SetSortOrder(aSortOrder: Integer);
function GetMemoryOrder: Integer;
procedure SetMemoryOrder(aSortOrder: Integer);
procedure BuildRef;
function CompareExchangeFormID(aOldFormID: Cardinal; aNewFormID: Cardinal): Boolean;
function GetEditValue: string;
procedure SetEditValue(const aValue: string);
function GetNativeValue: Variant;
procedure SetNativeValue(const aValue: Variant);
function GetIsEditable: Boolean;
function GetIsRemoveable: Boolean;
procedure RequestStorageChange(var aBasePtr, aEndPtr: Pointer; aNewSize: Cardinal);
function GetConflictPriority: TwbConflictPriority;
function GetConflictPriorityCanChange: Boolean;
function GetModified: Boolean;
procedure MarkModifiedRecursive;
function GetIsInjected: Boolean;
function GetReferencesInjected: Boolean;
function GetInjectionSourceFiles: TDynFiles;
function GetIsNotReachable: Boolean;
function GetDataSize: Integer;
procedure SetDataSize(aSize: Integer);
procedure MergeStorage(var aBasePtr: Pointer; aEndPtr: Pointer);
procedure InformStorage(var aBasePtr: Pointer; aEndPtr: Pointer);
procedure AddReferencedFromID(aFormID: Cardinal);
function CanContainFormIDs: Boolean;
function GetLinksTo: IwbElement;
function GetNoReach: Boolean;
procedure ReportRequiredMasters(aStrings: TStrings; aAsNew: Boolean; recursive: Boolean = True; initial: Boolean = false);
function AddIfMissing(const aElement: IwbElement; aAsNew, aDeepCopy : Boolean; const aPrefixRemove, aPrefix, aSuffix: string): IwbElement;
procedure ResetConflict;
procedure ResetReachable;
function RemoveInjected(aCanRemove: Boolean): Boolean;
function GetEditType: TwbEditType;
function GetEditInfo: string;
function GetDontShow: Boolean;
procedure SetToDefault;
procedure NotifyChanged(aContainer: Pointer);
function CanAssign(aIndex: Integer; const aElement: IwbElement; aCheckDontShow: Boolean): Boolean;
function Assign(aIndex: Integer; const aElement: IwbElement; aOnlySK: Boolean): IwbElement;
procedure Remove;
function HasErrors: Boolean;
procedure Hide;
procedure Show;
function GetIsHidden: Boolean;
procedure MoveUp;
procedure MoveDown;
function CanMoveUp: Boolean;
function CanMoveDown: Boolean;
procedure NextMember;
procedure PreviousMember;
function CanChangeMember: Boolean;
procedure Tag;
procedure ResetTags;
function IsTagged: Boolean;
property IsHidden: Boolean
read GetIsHidden;
procedure WriteToStream(aStream: TStream; aResetModified: Boolean);
function CopyInto(const aFile: IwbFile; AsNew, DeepCopy: Boolean; const aPrefixRemove, aPrefix, aSuffix: string): IwbElement;
property ElementID: Cardinal
read GetElementID;
property ElementStates: TwbElementStates
read GetElementStates;
property Container: IwbContainer
read GetContainer;
property ContainingMainRecord: IwbMainRecord
read GetContainingMainRecord;
property _File: IwbFile
read GetFile;
property ReferenceFile: IwbFile
read GetReferenceFile;
property InjectionSourceFiles: TDynFiles
read GetInjectionSourceFiles;
property ElementType: TwbElementType
read GetElementType;
property Name: string
read GetName;
property BaseName: string
read GetBaseName;
property DisplayName: string
read GetDisplayName;
property ShortName: string
read GetShortName;
property Path: string
read GetPath;
property FullPath: string
read GetFullPath;
property PathName: string
read GetPathName;
property Skipped: Boolean
read GetSkipped;
property Value: string
read GetValue;
property SortKey[aExtended: Boolean]: string
read GetSortKey;
property Check: string
read GetCheck;
property Modified: Boolean
read GetModified;
property IsInjected: Boolean
read GetIsInjected;
property IsNotReachable: Boolean
read GetIsNotReachable;
property ReferencesInjected: Boolean
read GetReferencesInjected;
property IsEditable: Boolean
read GetIsEditable;
property EditValue: string
read GetEditValue
write SetEditValue;
property NativeValue: Variant
read GetNativeValue
write SetNativeValue;
property IsRemoveable: Boolean
read GetIsRemoveable;
property Def: IwbNamedDef
read GetDef;
property ValueDef: IwbValueDef
read GetValueDef;
property ResolvedValueDef: IwbValueDef
read GetResolvedValueDef;
property MemoryOrder: Integer
read GetMemoryOrder
write SetMemoryOrder;
property SortPriority: Integer
read GetSortPriority;
property SortOrder: Integer
read GetSortOrder
write SetSortOrder;
property ConflictPriority: TwbConflictPriority
read GetConflictPriority;
property ConflictPriorityCanChange: Boolean
read GetConflictPriorityCanChange;
property DataSize: Integer
read GetDataSize
write SetDataSize;
property LinksTo: IwbElement
read GetLinksTo;
property NoReach: Boolean
read GetNoReach;
property EditType: TwbEditType
read GetEditType;
property EditInfo: string
read GetEditInfo;
property DontShow: Boolean
read GetDontShow;
end;
IwbRecord = interface;
TwbContainerState = (
csInit,
csInitOnce,
csInitDone,
csInitializing,
csReseting,
csRefsBuild,
csAsCreatedEmpty
);
TwbContainerStates = set of TwbContainerState;
TDynStrings = array of string;
IwbContainerBase = interface(IwbElement)
['{1484D26A-0F67-41FA-9044-8772E68CBA56}']
function GetElement(aIndex: Integer): IwbElement;
function GetElementCount: Integer;
function GetElementByName(const aName: string): IwbElement;
function GetRecordBySignature(const aSignature: TwbSignature): IwbRecord;
function GetElementByMemoryOrder(aSortOrder: Integer): IwbElement;
function GetElementBySignature(const aSignature: TwbSignature): IwbElement;
function GetElementBySortOrder(aSortOrder: Integer): IwbElement;
function GetAdditionalElementCount: Integer;
function GetContainerStates: TwbContainerStates;
function GetElementByPath(const aPath: string): IwbElement;
function GetElementValue(const aName: string): string;
function GetElementExists(const aName: string): Boolean;
function GetElementEditValue(const aName: string): string;
procedure SetElementEditValue(const aName, aValue: string);
function GetElementNativeValue(const aName: string): Variant;
procedure SetElementNativeValue(const aName: string; const aValue: Variant);
function GetElementLinksTo(const aName: string): IwbElement;
function GetElementSortKey(const aName: string; aExtended: Boolean): string;
procedure AddElement(const aElement: IwbElement);
procedure InsertElement(aPos: Integer; const aElement: IwbElement);
function RemoveElement(aPos: Integer; aMarkModified: Boolean = False): IwbElement; overload;
function RemoveElement(const aElement: IwbElement; aMarkModified: Boolean = False): IwbElement; overload;
function RemoveElement(const aName: string): IwbElement; overload;
procedure ReverseElements;
function LastElement: IwbElement;
function IsElementRemoveable(const aElement: IwbElement): Boolean;
function IsElementEditable(const aElement: IwbElement): Boolean;
function IndexOf(const aElement: IwbElement): Integer;
function CanElementReset: Boolean;
function GetAddList: TDynStrings;
function Add(const aName: string; aSilent: Boolean = True): IwbElement;
property Elements[aIndex: Integer]: IwbElement
read GetElement; default;
property ElementCount: Integer
read GetElementCount;
property AdditionalElementCount: Integer
read GetAdditionalElementCount;
property ElementByPath[const aPath: string]: IwbElement
read GetElementByPath;
property ElementValues[const aName: string]: string
read GetElementValue;
property ElementEditValues[const aName: string]: string
read GetElementEditValue
write SetElementEditValue;
property ElementNativeValues[const aName: string]: Variant
read GetElementNativeValue
write SetElementNativeValue;
property ElementLinksTo[const aName: string]: IwbElement
read GetElementLinksTo;
property ElementExists[const aName: string]: Boolean
read GetElementExists;
property ElementSortKeys[const aName: string; aExtended: Boolean]: string
read GetElementSortKey;
property ContainerStates: TwbContainerStates
read GetContainerStates;
property ElementByName[const aName: string]: IwbElement
read GetElementByName;
property RecordBySignature[const aSignature: TwbSignature]: IwbRecord
read GetRecordBySignature;
property ElementByMemoryOrder[aSortOrder: Integer]: IwbElement
read GetElementByMemoryOrder;
property ElementBySignature[const aSignature: TwbSignature]: IwbElement
read GetElementBySignature;
property ElementBySortOrder[aSortOrder: Integer]: IwbElement
read GetElementBySortOrder;
end;
IwbContainer = interface(IwbContainerBase)
['{4C4FCDD0-C885-458A-B8F2-EA3EFF8B5EEE}']
procedure Bar;
end;
IwbContainerElementRef= interface(IwbContainerBase)
['{4066BCCF-01AA-4638-9C3D-3475CD8D5749}']
function ReleaseKeepAlive: IwbContainerElementRef;
end;
IwbKeepAliveRoot = interface(IInterface)
['{D1D2C080-CE73-428F-B88F-BF9503CB8619}']
procedure Done;
end;
IwbSortableContainer = interface(IwbContainer)
['{A8A65D99-507C-4D2D-86EF-57BC99E09964}']
function GetSorted: Boolean;
property Sorted: Boolean
read GetSorted;
end;
IwbGroupRecord = interface;
TwbFileState = (
fsIsNew,
fsIsCompareLoad,
fsOnlyHeader,
fsIsHardcoded,
fsIsGameMaster,
fsIsTemporary
);
TwbFileStates = set of TwbFileState;
TwbPluginExtensions = TDynStrings;
IwbFile = interface(IwbContainer)
['{38AA15A6-F652-45C7-B875-9CB502E5DA92}']
function GetFileName: string;
function GetUnsavedSince: TDateTime;
function GetMaster(aIndex: Integer): IwbFile;
function GetMasterCount: Integer;
function GetRecordByFormID(aFormID: Cardinal; aAllowInjected: Boolean): IwbMainRecord;
function GetRecordByEditorID(const aEditorID: string): IwbMainRecord;
function GetLoadOrder: Integer;
function GetGroupBySignature(const aSignature: TwbSignature): IwbGroupRecord;
function HasGroup(const aSignature: TwbSignature): Boolean;
function GetFileStates: TwbFileStates;
procedure BuildReachable;
function LoadOrderFormIDtoFileFormID(aFormID: Cardinal): Cardinal;
function FileFormIDtoLoadOrderFormID(aFormID: Cardinal): Cardinal;
function LoadOrderFileIDtoFileFileID(aFileID: Byte): Byte;
function FileFileIDtoLoadOrderFileID(aFileID: Byte): Byte;
function NewFormID: Cardinal;
procedure AddMasters(aMasters: TStrings);
procedure AddMasterIfMissing(const aMaster: string);
procedure SortMasters;
procedure CleanMasters;
function GetRecord(aIndex: Integer): IwbMainRecord;
function GetRecordCount: Integer;
function GetHeader: IwbMainRecord;
function GetIsESM: Boolean;
procedure SetIsESM(Value: Boolean);
function GetIsLocalized: Boolean;
procedure SetIsLocalized(Value: Boolean);
function GetIsNotPlugin: Boolean;
property FileName: string
read GetFileName;
property UnsavedSince: TDateTime
read GetUnsavedSince;
function HasMaster(const aFileName: string): Boolean;
property Masters[aIndex: Integer]: IwbFile
read GetMaster;
property MasterCount: Integer
read GetMasterCount;
property RecordByFormID[aFormID: Cardinal; aAllowInjected: Boolean]: IwbMainRecord
read GetRecordByFormID;
property RecordByEditorID[const aEditorID: string]: IwbMainRecord
read GetRecordByEditorID;
property GroupBySignature[const aSignature: TwbSignature]: IwbGroupRecord
read GetGroupBySignature;
property Records[aIndex: Integer]: IwbMainRecord
read GetRecord;
property RecordCount: Integer
read GetRecordCount;
property Header: IwbMainRecord
read GetHeader;
property LoadOrder: Integer
read GetLoadOrder;
property FileStates: TwbFileStates
read GetFileStates;
property IsESM: Boolean
read GetIsESM
write SetIsESM;
property IsLocalized: Boolean
read GetIsLocalized
write SetIsLocalized;
property IsNotPlugin: Boolean // Save or other file to display.
read GetIsNotPlugin;
end;
IwbDataContainer = interface(IwbContainer)
['{6E547F7C-87E4-4917-8F43-4D3CEE5AFE8C}']
function GetDataBasePtr: Pointer;
function GetDataEndPtr: Pointer;
function GetDataSize: Integer;
function GetDontCompare: Boolean;
function GetDontSave: Boolean;
function IsValidOffset(aBasePtr, aEndPtr: Pointer; anOffset: Integer): Boolean;
property DataBasePtr: Pointer
read GetDataBasePtr;
property DataEndPtr: Pointer
read GetDataEndPtr;
property DataSize: Integer
read GetDataSize;
property DontCompare: Boolean
read GetDontCompare;
property DontSave: Boolean
read GetDontSave;
end;
IwbRecord = interface(IwbDataContainer)
['{4FC53881-25E2-421D-8AF6-F589979767E6}']
function GetSignature: TwbSignature;
property Signature: TwbSignature
read GetSignature;
end;
IwbHasSignature = interface(IwbElement)
['{DF563D7C-A441-4864-B47A-49F3A96508F7}']
function GetSignature: TwbSignature;
property Signature: TwbSignature
read GetSignature;
end;
PwbMainRecordStructFlags = ^TwbMainRecordStructFlags;
TwbMainRecordStructFlags = packed record
_Flags: Cardinal;
function IsESM: Boolean; inline;
function IsDeleted: Boolean; inline;
function IsLocalized: Boolean; inline;
function CastsShadows: Boolean; inline;
function IsPersistent: Boolean; inline;
function IsInitiallyDisabled: Boolean; inline;
function IsIgnored: Boolean; inline;
function IsVisibleWhenDistant: Boolean; inline;
function IsDangerous: Boolean; inline;
function IsCompressed: Boolean; inline;
function CantWait: Boolean; inline;
function HasLODtree: Boolean; inline;
procedure SetESM(aValue: Boolean);
procedure SetDeleted(aValue: Boolean);
procedure SetLocalized(aValue: Boolean);
procedure SetPersistent(aValue: Boolean);
procedure SetCompressed(aValue: Boolean);
procedure SetInitiallyDisabled(aValue: Boolean);
procedure SetVisibleWhenDistant(aValue: Boolean);
end;
PwbMainRecordStructFlags3 = ^TwbMainRecordStructFlags3;
TwbMainRecordStructFlags3 = packed record
_Flags: Cardinal;
end;
TwbVector = packed record
x: Single;
y: Single;
z: Single;
end;
TwbGridCell = record
x, y: Integer;
end;
TDynMainRecords = array of IwbMainRecord;
IwbMainRecord = interface(IwbRecord)
['{F06FD5E2-621D-4422-BA00-CB3CA72B3691}']
function GetFormID: Cardinal;
function GetFixedFormID: Cardinal;
function GetLoadOrderFormID: Cardinal;
procedure SetLoadOrderFormID(aFormID: Cardinal);
function GetEditorID: string;
function GetCanHaveEditorID: Boolean;
procedure SetEditorID(const aValue: string);
function GetFullName: string;
function GetDisplayNameKey: string;
function GetMaster: IwbMainRecord;
function GetIsMaster: Boolean;
function GetMasterOrSelf: IwbMainRecord;
function GetOverride(aIndex: Integer): IwbMainRecord;
function GetOverrideCount: Integer;
procedure AddReferencedBy(aMainRecord: IwbMainRecord);
procedure RemoveReferencedBy(aMainRecord: IwbMainRecord);
function GetReferencedBy(aIndex: Integer): IwbMainRecord;
function GetReferencedByCount: Integer;
function GetIsWinningOverride: Boolean;
function GetWinningOverride: IwbMainRecord;
function GetHighestOverrideOrSelf(aMaxLoadOrder: Integer): IwbMainRecord;
function GetFlags: TwbMainRecordStructFlags;
function GetChildGroup: IwbGroupRecord;
function EnsureChildGroup: IwbGroupRecord;
function GetBaseRecord: IwbMainRecord;
function GetBaseRecordID: Cardinal;
function GetConflictAll: TConflictAll;
procedure SetConflictAll(aValue: TConflictAll);
function GetConflictThis: TConflictThis;
procedure SetConflictThis(aValue: TConflictThis);
function GetIsESM: Boolean;
procedure SetIsESM(aValue: Boolean);
function GetIsPersistent: Boolean;
procedure SetIsPersistent(aValue: Boolean);
function GetIsDeleted: Boolean;
procedure SetIsDeleted(aValue: Boolean);
function GetIsLocalized: Boolean;
procedure SetIsLocalized(aValue: Boolean);
function GetIsCompressed: Boolean;
procedure SetIsCompressed(aValue: Boolean);
function GetIsVisibleWhenDistant: Boolean;
procedure SetIsVisibleWhenDistant(aValue: Boolean);
function GetHasVisibleWhenDistantMesh: Boolean;
function GetHasMesh: Boolean;
function GetIsInitiallyDisabled: Boolean;
procedure SetIsInitiallyDisabled(aValue: Boolean);
procedure UpdateRefs;
function GetPosition(out aPosition: TwbVector): Boolean;
function SetPosition(const aPosition: TwbVector): Boolean;
function GetRotation(out aRotation: TwbVector): Boolean;
function GetScale(out aScale: Single): Boolean;
function GetGridCell(out aGridCell: TwbGridCell): Boolean;
procedure Delete;
procedure DeleteInto(const aFile: IwbFile);
function MasterRecordsFromMasterFilesAndSelf: TDynMainRecords;
function GetFormVersion: Cardinal;
procedure SetFormVersion(aFormVersion: Cardinal);
procedure ChangeFormSignature(aSignature: TwbSignature);
procedure ClampFormID(aIndex: Cardinal);
property Version: Cardinal
read GetFormVersion
write SetFormVersion;
property BaseRecord: IwbMainRecord
read GetBaseRecord;
property BaseRecordID: Cardinal
read GetBaseRecordID;
property FormID: Cardinal
read GetFormID;
property FixedFormID: Cardinal
read GetFixedFormID;
property LoadOrderFormID: Cardinal
read GetLoadOrderFormID
write SetLoadOrderFormID;
property EditorID: string
read GetEditorID
write SetEditorID;
property CanHaveEditorID: Boolean
read GetCanHaveEditorID;
property FullName: string
read GetFullName;
property DisplayNameKey: string
read GetDisplayNameKey;
property Flags: TwbMainRecordStructFlags
read GetFlags;
property Master: IwbMainRecord
read GetMaster;