From a6505aa3a055c806a7c85fa6795d59b50a39e137 Mon Sep 17 00:00:00 2001 From: Hugues92 Date: Sun, 24 Jan 2016 21:10:48 +0100 Subject: [PATCH] [FO4 Saves] Corrected Object Table Data There is an issue with Stack Data. To Be Corrected --- wbDefinitionsFO4Saves.pas | 27 +++++++++++++++++++-------- wbSaveInterface.pas | 11 +++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/wbDefinitionsFO4Saves.pas b/wbDefinitionsFO4Saves.pas index 8d8786813..3e7544d2d 100644 --- a/wbDefinitionsFO4Saves.pas +++ b/wbDefinitionsFO4Saves.pas @@ -536,8 +536,9 @@ procedure RefIDTableAfterLoad(const aElement: IwbElement); end; var - VMObjectArrayCount : Integer = -1; - VMObjectDetachedArrayCount : Integer = -1; + VMObjectArrayCount : Integer = -1; + VMSupplementObjectArrayCount : Integer = -1; + VMObjectDetachedArrayCount : Integer = -1; procedure ObjectTableAfterLoad(const aElement: IwbElement); begin @@ -547,6 +548,16 @@ procedure ObjectTableAfterLoad(const aElement: IwbElement); end; end; +procedure SupplementObjectTableAfterLoad(const aElement: IwbElement); +begin + if VMSupplementObjectArrayCount < 0 then begin + VMSupplementObjectArrayCount := (aElement as IwbContainer).ElementCount; + InitializeVMObjectArray(aElement as IwbContainer); + if VMObjectArrayCount >= 0 then + VMObjectArrayCount := VMObjectArrayCount + VMSupplementObjectArrayCount; + end; +end; + procedure ObjectDetachedTableAfterLoad(const aElement: IwbElement); begin if VMObjectDetachedArrayCount < 0 then begin @@ -2590,8 +2601,8 @@ procedure DefineFO4SavesS; // This is all based on current UESP, and HexDump, T ]), -1) ]); - wbObjectTableEntry := wbStruct('Object Table Entry', [ // UESP : reference - wbInteger('Object Handle', itU64), + wbObjectTableEntry := wbStruct('Full Object Table Entry', [ // UESP : reference + wbInteger('Object Handle', itU64, wbVMHandle), wbInteger('Name', itU16, wbVMType), wbStruct('Grouped', [ wbInteger('Flag2bits', itU16, wbDumpInteger), @@ -2601,8 +2612,8 @@ procedure DefineFO4SavesS; // This is all based on current UESP, and HexDump, T wbInteger('Unknown', itU8, wbDumpInteger) ]); - wbObjectDetachedTableEntry := wbStruct('Object Table Entry', [ // UESP : detachedReference - wbInteger('Object Handle', itU64), + wbObjectDetachedTableEntry := wbStruct('Simple Object Table Entry', [ // UESP : detachedReference + wbInteger('Object Handle', itU64, wbVMHandle), wbInteger('Name', itU16, wbVMType) ]); @@ -2758,7 +2769,7 @@ procedure DefineFO4SavesS; // This is all based on current UESP, and HexDump, T ]); wbArrayElementsTableEntry := wbStruct(ArrayContentEntryData, [ // UESP: arrayData - wbInteger('Array Handle', itU64, wbVMArrayHandle), + wbInteger('Array Handle', itU64, wbVMHandle), wbArrayS('Elements', wbvariable, ArrayElementsTableElementCounter) ]); @@ -3226,7 +3237,7 @@ procedure DefineFO4SavesS; // This is all based on current UESP, and HexDump, T wbArray('Type table 1', wbTypeData1, TypeTable1Counter) // Type table for internal VM save data USEP:script ]) ,wbArray('Object Table', wbObjectTableEntry, -1, ObjectTableAfterLoad) // UESP: scriptInstance - ,wbByteArray('Tempo correction', 4) + ,wbArray('Supplement Object Table', wbObjectDetachedTableEntry, -1, SupplementObjectTableAfterLoad) // UESP: scriptInstance ,wbArray('Detached Object Table', wbObjectDetachedTableEntry, -1, ObjectDetachedTableAfterLoad) // UESP: reference ,wbArrayS('Array Table', wbArrayTableEntry, -1, ArrayTableAfterLoad) // UESP: arrayInfo ,wbStruct('Stacks', [ diff --git a/wbSaveInterface.pas b/wbSaveInterface.pas index dc79ee800..1740bec69 100644 --- a/wbSaveInterface.pas +++ b/wbSaveInterface.pas @@ -13,6 +13,7 @@ interface ]; function wbVMType : IwbIntegerDefFormater; +function wbVMHandle : IwbIntegerDefFormater; function wbVMObjectHandle : IwbIntegerDefFormater; function wbVMArrayHandle : IwbIntegerDefFormater; function wbSaveWorldspaceIndex : IwbIntegerDefFormater; @@ -142,6 +143,11 @@ function ReadObjectName(aInt: Int64): String; Result := '[' + IntToHex64(aInt, 8) + '] '+ sifVMTypeArray[VMType]; end; +function TwbHandleFormaterToString(aInt: Int64; const aElement: IwbElement; aType: TwbCallbackType): string; +begin + Result := IntToHex64(aInt, 16) +end; + function TwbObjectHandleFormaterToString(aInt: Int64; const aElement: IwbElement; aType: TwbCallbackType): string; begin if aType = ctToSortKey then @@ -262,6 +268,11 @@ function wbVMType : IwbIntegerDefFormater; Result := wbCallback(@TwbVMTypeFormaterToString, nil); end; +function wbVMHandle : IwbIntegerDefFormater; overload; +begin + Result := wbCallback(@TwbHandleFormaterToString, nil); +end; + function wbVMObjectHandle : IwbIntegerDefFormater; overload; begin Result := wbCallback(@TwbObjectHandleFormaterToString, nil);