feat(runtime): retain initial Control node amounts
Docs Deploy / Build and Deploy MkDocs (push) Successful in 34s
Docs Deploy / Build and Deploy MkDocs (push) Successful in 34s
This commit is contained in:
5 files changed
+246
-2
No files matched your search
@@ -238,6 +238,12 @@ pub struct MissionControlNodeProviderRow {
|
|||||||
pub source_row_index: usize,
|
pub source_row_index: usize,
|
||||||
/// Original NDP descriptor fields and provenance for this provider row.
|
/// Original NDP descriptor fields and provenance for this provider row.
|
||||||
pub source_row: PreparedControlNodeDataRow,
|
pub source_row: PreparedControlNodeDataRow,
|
||||||
|
/// Shared initial provider amount (`+0x08` and `+0x0c`) as raw bits.
|
||||||
|
///
|
||||||
|
/// Control initializes both fields from the selector-3 result. On the
|
||||||
|
/// confirmed UnitDAT load path, the two scale factors are 1.0, so this is
|
||||||
|
/// the NDP row's `max_volume`; later mutations can change both fields.
|
||||||
|
pub initial_amount_bits: u32,
|
||||||
/// Initial native provider selector-1 value (`+0x14`) as raw bits.
|
/// Initial native provider selector-1 value (`+0x14`) as raw bits.
|
||||||
pub initial_type1_value_bits: u32,
|
pub initial_type1_value_bits: u32,
|
||||||
/// MSH state exposed at the same global ordinal, if the mesh projection exists.
|
/// MSH state exposed at the same global ordinal, if the mesh projection exists.
|
||||||
@@ -3522,6 +3528,7 @@ fn append_control_node_provider_rows(
|
|||||||
unit_component_index,
|
unit_component_index,
|
||||||
source_row_index,
|
source_row_index,
|
||||||
source_row: source_row.clone(),
|
source_row: source_row.clone(),
|
||||||
|
initial_amount_bits: source_row.max_volume.to_bits(),
|
||||||
initial_type1_value_bits: 0x3f80_0000,
|
initial_type1_value_bits: 0x3f80_0000,
|
||||||
initial_mesh_state: None,
|
initial_mesh_state: None,
|
||||||
});
|
});
|
||||||
@@ -4082,6 +4089,7 @@ mod tests {
|
|||||||
name: [0; 32],
|
name: [0; 32],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
initial_amount_bits: 100.0_f32.to_bits(),
|
||||||
initial_type1_value_bits,
|
initial_type1_value_bits,
|
||||||
initial_mesh_state: None,
|
initial_mesh_state: None,
|
||||||
}
|
}
|
||||||
@@ -5417,10 +5425,18 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn synthetic_node_provider_projection_joins_flat_mesh_metadata_by_global_ordinal() {
|
fn synthetic_node_provider_projection_joins_flat_mesh_metadata_by_global_ordinal() {
|
||||||
let controls = vec![
|
let mut controls = vec![
|
||||||
Some(control_with_synthetic_node_data(0, Vec::new(), 3)),
|
Some(control_with_synthetic_node_data(0, Vec::new(), 3)),
|
||||||
Some(control_with_synthetic_node_data(1, Vec::new(), 3)),
|
Some(control_with_synthetic_node_data(1, Vec::new(), 3)),
|
||||||
];
|
];
|
||||||
|
controls[0]
|
||||||
|
.as_mut()
|
||||||
|
.expect("root component control")
|
||||||
|
.node_data
|
||||||
|
.as_mut()
|
||||||
|
.expect("root NDP")
|
||||||
|
.rows[0]
|
||||||
|
.max_volume = 0.0;
|
||||||
let (draft, mut assets, prototypes) = synthetic_control_fixture(
|
let (draft, mut assets, prototypes) = synthetic_control_fixture(
|
||||||
// Even if the root's registry prototype is typed EXTO, its model
|
// Even if the root's registry prototype is typed EXTO, its model
|
||||||
// contributes every source node; only mounted EXTO rows skip node 0.
|
// contributes every source node; only mounted EXTO rows skip node 0.
|
||||||
@@ -5501,6 +5517,19 @@ mod tests {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
assert!(rows[..4].iter().all(|row| row.initial_mesh_state.is_some()));
|
assert!(rows[..4].iter().all(|row| row.initial_mesh_state.is_some()));
|
||||||
|
assert_eq!(
|
||||||
|
rows.iter()
|
||||||
|
.map(|row| row.initial_amount_bits)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
[
|
||||||
|
0.0_f32.to_bits(),
|
||||||
|
101.0_f32.to_bits(),
|
||||||
|
102.0_f32.to_bits(),
|
||||||
|
101.0_f32.to_bits(),
|
||||||
|
102.0_f32.to_bits(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
assert_eq!(rows[0].initial_type1_value_bits, 1.0_f32.to_bits());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -6096,6 +6125,16 @@ mod tests {
|
|||||||
assert_eq!(root_node_data.rows.len(), 22);
|
assert_eq!(root_node_data.rows.len(), 22);
|
||||||
assert_eq!(ext_node_data.rows.len(), 4);
|
assert_eq!(ext_node_data.rows.len(), 4);
|
||||||
assert_eq!(provider_rows.len(), 25);
|
assert_eq!(provider_rows.len(), 25);
|
||||||
|
assert_eq!(provider_rows[0].initial_amount_bits, 1.0_f32.to_bits());
|
||||||
|
assert_eq!(provider_rows[22].initial_amount_bits, 6000.0_f32.to_bits());
|
||||||
|
assert_eq!(
|
||||||
|
provider_rows[0].initial_amount_bits,
|
||||||
|
provider_rows[0].source_row.max_volume.to_bits()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
provider_rows[22].initial_amount_bits,
|
||||||
|
provider_rows[22].source_row.max_volume.to_bits()
|
||||||
|
);
|
||||||
let mission_assets = &engine
|
let mission_assets = &engine
|
||||||
.loaded
|
.loaded
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ internal static class BehaviorDistributorTickOracle {
|
|||||||
private const int ControlProviderInterfaceVtableRva = 0x3d254;
|
private const int ControlProviderInterfaceVtableRva = 0x3d254;
|
||||||
private const int ControlProviderType1GetterRva = 0x0dc40;
|
private const int ControlProviderType1GetterRva = 0x0dc40;
|
||||||
private const int ControlProviderRowConstructorRva = 0x0b240;
|
private const int ControlProviderRowConstructorRva = 0x0b240;
|
||||||
|
private const int ControlOwnerConstructorRva = 0x06bf0;
|
||||||
|
private const int ControlProviderInitialStateRva = 0x0f940;
|
||||||
private const int ControlProviderAmountUpdateRva = 0x10f30;
|
private const int ControlProviderAmountUpdateRva = 0x10f30;
|
||||||
private const int ControlProviderAmountDistributeRva = 0x10ba0;
|
private const int ControlProviderAmountDistributeRva = 0x10ba0;
|
||||||
private const int ControlContactRateUpdateRva = 0x12a40;
|
private const int ControlContactRateUpdateRva = 0x12a40;
|
||||||
@@ -113,6 +115,8 @@ internal static class BehaviorDistributorTickOracle {
|
|||||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlContactRateUpdate(IntPtr self, float deltaSeconds);
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlContactRateUpdate(IntPtr self, float deltaSeconds);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlTimedUpdate(IntPtr self, float inputTime);
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlTimedUpdate(IntPtr self, float inputTime);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlProviderRowConstructor(IntPtr self, IntPtr sourceNdpRow);
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlProviderRowConstructor(IntPtr self, IntPtr sourceNdpRow);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate IntPtr NativeControlOwnerConstructor(IntPtr self, IntPtr host, uint classCode);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate void NativeControlProviderInitialState(IntPtr self);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void NativeControlNodeUpdateCallback(IntPtr self, uint nodeIndex, uint selector, uint valueBits);
|
[UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void NativeControlNodeUpdateCallback(IntPtr self, uint nodeIndex, uint selector, uint valueBits);
|
||||||
|
|
||||||
private static readonly AreaMapGetter AreaMapGetterCallback = GetAreaMap;
|
private static readonly AreaMapGetter AreaMapGetterCallback = GetAreaMap;
|
||||||
@@ -617,7 +621,9 @@ internal static class BehaviorDistributorTickOracle {
|
|||||||
RunNativeAddCases(module);
|
RunNativeAddCases(module);
|
||||||
RunNativeNormalizeCases(module);
|
RunNativeNormalizeCases(module);
|
||||||
RunNativeArealMapComponentBuilderCase(arealMapModule);
|
RunNativeArealMapComponentBuilderCase(arealMapModule);
|
||||||
|
RunNativeAniMeshScaleLoadSnapshot(aniMeshModule);
|
||||||
RunNativeAniMeshNodeMetadataCases(aniMeshModule);
|
RunNativeAniMeshNodeMetadataCases(aniMeshModule);
|
||||||
|
RunNativeControlProviderInitialStateCase(controlModule, aniMeshModule);
|
||||||
RunNativeControlIntoOverrideCase(controlModule);
|
RunNativeControlIntoOverrideCase(controlModule);
|
||||||
RunNativeControlResourceDeviceCase(controlModule);
|
RunNativeControlResourceDeviceCase(controlModule);
|
||||||
RunNativeControlProviderLiveStateCase(controlModule);
|
RunNativeControlProviderLiveStateCase(controlModule);
|
||||||
@@ -1236,6 +1242,18 @@ internal static class BehaviorDistributorTickOracle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RunNativeAniMeshScaleLoadSnapshot(IntPtr module) {
|
||||||
|
uint[] actual = new uint[] {
|
||||||
|
unchecked((uint)Marshal.ReadInt32(IntPtr.Add(module, 0x26068))),
|
||||||
|
unchecked((uint)Marshal.ReadInt32(IntPtr.Add(module, 0x2606c))),
|
||||||
|
unchecked((uint)Marshal.ReadInt32(IntPtr.Add(module, 0x26070)))
|
||||||
|
};
|
||||||
|
Expect(actual[0] == 0x3f800000 && actual[1] == 0x3f800000 && actual[2] == 0x3f800000,
|
||||||
|
"AniMesh module load initializes all three runtime scale globals to 1.0");
|
||||||
|
Console.WriteLine("native-anim-mesh-scale-load-snapshot: aniMeshHash=" + ExpectedAniMeshSha256 +
|
||||||
|
" globals=[" + String.Join(",", Array.ConvertAll(actual, Hex)) + "]");
|
||||||
|
}
|
||||||
|
|
||||||
private static void RunNativeAniMeshNodeMetadataCases(IntPtr module) {
|
private static void RunNativeAniMeshNodeMetadataCases(IntPtr module) {
|
||||||
NativeAniMeshNodeMetadataQuery query = (NativeAniMeshNodeMetadataQuery)Marshal.GetDelegateForFunctionPointer(
|
NativeAniMeshNodeMetadataQuery query = (NativeAniMeshNodeMetadataQuery)Marshal.GetDelegateForFunctionPointer(
|
||||||
IntPtr.Add(module, AniMeshNodeMetadataQueryRva), typeof(NativeAniMeshNodeMetadataQuery));
|
IntPtr.Add(module, AniMeshNodeMetadataQueryRva), typeof(NativeAniMeshNodeMetadataQuery));
|
||||||
@@ -1311,6 +1329,137 @@ internal static class BehaviorDistributorTickOracle {
|
|||||||
GC.KeepAlive(stageCount);
|
GC.KeepAlive(stageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RunNativeControlProviderInitialStateCase(IntPtr controlModule, IntPtr aniMeshModule) {
|
||||||
|
const int rowCount = 4;
|
||||||
|
NativeControlOwnerConstructor constructOwner = (NativeControlOwnerConstructor)Marshal.GetDelegateForFunctionPointer(
|
||||||
|
IntPtr.Add(controlModule, ControlOwnerConstructorRva), typeof(NativeControlOwnerConstructor));
|
||||||
|
NativeControlProviderRowConstructor constructProviderRow = (NativeControlProviderRowConstructor)
|
||||||
|
Marshal.GetDelegateForFunctionPointer(IntPtr.Add(controlModule, ControlProviderRowConstructorRva),
|
||||||
|
typeof(NativeControlProviderRowConstructor));
|
||||||
|
NativeControlProviderInitialState initialize = (NativeControlProviderInitialState)
|
||||||
|
Marshal.GetDelegateForFunctionPointer(IntPtr.Add(controlModule, ControlProviderInitialStateRva),
|
||||||
|
typeof(NativeControlProviderInitialState));
|
||||||
|
using (Fixture fixture = NewFixture()) {
|
||||||
|
IntPtr owner = fixture.Allocate(0x664);
|
||||||
|
Expect(constructOwner(owner, IntPtr.Zero, 4) == owner,
|
||||||
|
"Control constructor initializes a synthetic class-4 owner without a host object");
|
||||||
|
Expect(unchecked((uint)Marshal.ReadInt32(owner, 0x548)) == 0x3f800000 &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(owner, 0x660)) == 0x3f800000,
|
||||||
|
"Control constructor starts both provider getter scale factors at 1.0");
|
||||||
|
|
||||||
|
IntPtr aniOwner = fixture.Allocate(0x1b0);
|
||||||
|
IntPtr aniVtable = fixture.Allocate(0x4c);
|
||||||
|
IntPtr meshRows = fixture.Allocate(rowCount * 0x130);
|
||||||
|
IntPtr nodeData = fixture.Allocate(rowCount * 0x26);
|
||||||
|
IntPtr slotData = fixture.Allocate(rowCount * 0x44);
|
||||||
|
IntPtr meshData = fixture.Allocate(3 * IntPtr.Size);
|
||||||
|
IntPtr providerRows = fixture.Allocate(rowCount * 0x2c);
|
||||||
|
Marshal.WriteIntPtr(meshData, 0, nodeData);
|
||||||
|
Marshal.WriteIntPtr(meshData, 2 * IntPtr.Size, slotData);
|
||||||
|
Marshal.WriteIntPtr(aniOwner, 0, aniVtable);
|
||||||
|
Marshal.WriteIntPtr(aniOwner, 0x1a8, meshRows);
|
||||||
|
Marshal.WriteInt32(aniOwner, 0x1ac, rowCount);
|
||||||
|
Marshal.WriteIntPtr(aniVtable, 0x0c, IntPtr.Add(aniMeshModule, AniMeshNodeMetadataQueryRva));
|
||||||
|
Marshal.WriteIntPtr(aniVtable, 0x34, Marshal.GetFunctionPointerForDelegate(ControlNodeUpdateCallback));
|
||||||
|
Marshal.WriteIntPtr(aniVtable, 0x48, IntPtr.Add(aniMeshModule, AniMeshNodeStageCountRva));
|
||||||
|
|
||||||
|
ushort[] headers = { 0x8201, 0x0180, 0x0400, 0x0001 };
|
||||||
|
int[] rawParents = { 3, 0, 1, 0 };
|
||||||
|
int[] runtimeParents = { -1, 22, 7, 11 };
|
||||||
|
float[] sourceMaxima = { 30.0f, 60.0f, 50.0f, 0.0f };
|
||||||
|
for (int nodeIndex = 0; nodeIndex < rowCount; nodeIndex++) {
|
||||||
|
IntPtr rawNode = IntPtr.Add(nodeData, nodeIndex * 0x26);
|
||||||
|
for (int word = 0; word < 19; word++) Marshal.WriteInt16(rawNode, word * 2, -1);
|
||||||
|
Marshal.WriteInt16(rawNode, 0, unchecked((short)headers[nodeIndex]));
|
||||||
|
Marshal.WriteInt16(rawNode, 2, unchecked((short)rawParents[nodeIndex]));
|
||||||
|
|
||||||
|
IntPtr meshRow = IntPtr.Add(meshRows, nodeIndex * 0x130);
|
||||||
|
Marshal.WriteInt32(meshRow, 8, nodeIndex);
|
||||||
|
Marshal.WriteInt32(meshRow, 0x18, runtimeParents[nodeIndex]);
|
||||||
|
Marshal.WriteIntPtr(meshRow, 0x12c, meshData);
|
||||||
|
|
||||||
|
IntPtr descriptor = fixture.Allocate(0x4c);
|
||||||
|
Marshal.WriteInt32(descriptor, 0x04, FloatBits(sourceMaxima[nodeIndex]));
|
||||||
|
constructProviderRow(IntPtr.Add(providerRows, nodeIndex * 0x2c), descriptor);
|
||||||
|
}
|
||||||
|
// Stage counts are the consecutive state-0/1/2 prefix; Control
|
||||||
|
// changes an empty prefix to one for its initial provider row.
|
||||||
|
WriteNode38Slot(nodeData, 0, 0, 0);
|
||||||
|
WriteNode38Slot(nodeData, 0, 2, 2);
|
||||||
|
WriteNode38Slot(nodeData, 1, 1, 1);
|
||||||
|
WriteNode38Slot(nodeData, 1, 2, 2);
|
||||||
|
WriteNode38Slot(nodeData, 2, 0, 0);
|
||||||
|
WriteNode38Slot(nodeData, 2, 1, 1);
|
||||||
|
WriteNode38Slot(nodeData, 2, 2, 2);
|
||||||
|
|
||||||
|
Marshal.WriteIntPtr(owner, 0x20, aniOwner);
|
||||||
|
Marshal.WriteIntPtr(owner, 0x55c, providerRows);
|
||||||
|
Marshal.WriteInt32(owner, 0x560, rowCount);
|
||||||
|
IntPtr providerVtable = Marshal.ReadIntPtr(IntPtr.Add(owner, 4));
|
||||||
|
Expect(providerVtable != IntPtr.Zero &&
|
||||||
|
Marshal.ReadIntPtr(providerVtable, 0x0c) == IntPtr.Add(controlModule, ControlProviderType1GetterRva),
|
||||||
|
"Control constructor installs the original selector-3 provider vtable");
|
||||||
|
|
||||||
|
controlNodeUpdateCount = 0;
|
||||||
|
controlNodeUpdateIndices.Clear();
|
||||||
|
initialize(owner);
|
||||||
|
uint[] expectedFlags = { 0x09, 0x02, 0x04, 0x08 };
|
||||||
|
uint[] expectedStages = { 1, 1, 3, 1 };
|
||||||
|
for (int nodeIndex = 0; nodeIndex < rowCount; nodeIndex++) {
|
||||||
|
IntPtr row = IntPtr.Add(providerRows, nodeIndex * 0x2c);
|
||||||
|
Console.WriteLine("native-control-f940-row=" + nodeIndex + " parent=" + Marshal.ReadInt32(row, 0x04) +
|
||||||
|
" amount=" + Hex(unchecked((uint)Marshal.ReadInt32(row, 0x08))) +
|
||||||
|
" processed=" + Hex(unchecked((uint)Marshal.ReadInt32(row, 0x0c))) +
|
||||||
|
" normalized=" + Hex(unchecked((uint)Marshal.ReadInt32(row, 0x14))) +
|
||||||
|
" stages=" + Hex(unchecked((uint)Marshal.ReadInt32(row, 0x1c))) +
|
||||||
|
" flags=" + Hex(unchecked((uint)Marshal.ReadInt32(row, 0x28))));
|
||||||
|
uint expectedAmount = unchecked((uint)FloatBits(sourceMaxima[nodeIndex]));
|
||||||
|
Expect(Marshal.ReadInt32(row, 0x04) == runtimeParents[nodeIndex] &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x08)) == expectedAmount &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x0c)) == expectedAmount &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x14)) == 0x3f800000 &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x1c)) == expectedStages[nodeIndex] &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x28)) == expectedFlags[nodeIndex],
|
||||||
|
"Control f940 initializes row " + nodeIndex + " from AniMesh metadata and selector-3 amount");
|
||||||
|
}
|
||||||
|
Expect(unchecked((uint)Marshal.ReadInt32(owner, 0x590)) == 0x430c0000 &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(owner, 0x58c)) == 0x430c0000,
|
||||||
|
"Control f940 stores the sum of initial row amounts in both provider aggregates");
|
||||||
|
Expect(controlNodeUpdateCount == rowCount &&
|
||||||
|
String.Join(",", controlNodeUpdateIndices.ConvertAll(index => index.ToString()).ToArray()) == "0,1,2,3" &&
|
||||||
|
controlNodeUpdateSelector == 0x200 && controlNodeUpdateValueBits == 0x3f800000,
|
||||||
|
"Control f940 notifies the host once per row in native append order");
|
||||||
|
|
||||||
|
// Selector 3 is the shared maximum getter. A non-unity owner scale
|
||||||
|
// exercises its native multiplication before the same initializer.
|
||||||
|
Marshal.WriteInt32(owner, 0x660, FloatBits(1.5f));
|
||||||
|
Marshal.WriteInt32(owner, 0x548, FloatBits(0.5f));
|
||||||
|
controlNodeUpdateCount = 0;
|
||||||
|
controlNodeUpdateIndices.Clear();
|
||||||
|
initialize(owner);
|
||||||
|
uint[] scaledAmounts = { 0x41b40000, 0x42340000, 0x42160000, 0x00000000 };
|
||||||
|
for (int nodeIndex = 0; nodeIndex < rowCount; nodeIndex++) {
|
||||||
|
IntPtr row = IntPtr.Add(providerRows, nodeIndex * 0x2c);
|
||||||
|
Expect(unchecked((uint)Marshal.ReadInt32(row, 0x08)) == scaledAmounts[nodeIndex] &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(row, 0x0c)) == scaledAmounts[nodeIndex],
|
||||||
|
"Control f940 selector-3 scaled amount row " + nodeIndex);
|
||||||
|
}
|
||||||
|
Expect(unchecked((uint)Marshal.ReadInt32(owner, 0x590)) == 0x42d20000 &&
|
||||||
|
unchecked((uint)Marshal.ReadInt32(owner, 0x58c)) == 0x42d20000,
|
||||||
|
"Control f940 aggregates its non-unity selector-3 results");
|
||||||
|
Expect(controlNodeUpdateCount == rowCount &&
|
||||||
|
String.Join(",", controlNodeUpdateIndices.ConvertAll(index => index.ToString()).ToArray()) == "0,1,2,3",
|
||||||
|
"Control f940 retains callback order for non-unity amounts");
|
||||||
|
|
||||||
|
Console.WriteLine("native-control-provider-initial-state: controlHash=" + ExpectedControlSha256 +
|
||||||
|
" rva=0xf940 selector3=0xdc40 rows=4 unity=[30,60,50,0] nonunity=[22.5,45,37.5,0]" +
|
||||||
|
" current=processed=sourceMax*owner660*owner548 ratio=1 parents=[-1,22,7,11]");
|
||||||
|
GC.KeepAlive(constructOwner);
|
||||||
|
GC.KeepAlive(constructProviderRow);
|
||||||
|
GC.KeepAlive(initialize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void WriteNode38Slot(IntPtr nodeData, int nodeIndex, int state, ushort slotIndex) {
|
private static void WriteNode38Slot(IntPtr nodeData, int nodeIndex, int state, ushort slotIndex) {
|
||||||
int wordIndex = nodeIndex * 19 + 4 + state * 5;
|
int wordIndex = nodeIndex * 19 + 4 + state * 5;
|
||||||
Marshal.WriteInt16(nodeData, wordIndex * 2, unchecked((short)slotIndex));
|
Marshal.WriteInt16(nodeData, wordIndex * 2, unchecked((short)slotIndex));
|
||||||
|
|||||||
@@ -331,10 +331,17 @@ sidecar недоступен, запрос `0xe00` сообщает это от
|
|||||||
остаётся статическим выводом по RVA `AniMesh.dll+0xa460`, а последующие
|
остаётся статическим выводом по RVA `AniMesh.dll+0xa460`, а последующие
|
||||||
изменения в полном Control/animation tick-е не проверялись.
|
изменения в полном Control/animation tick-е не проверялись.
|
||||||
|
|
||||||
|
Для provider-строки Rust также хранит одно `initial_amount_bits`. Нативный
|
||||||
|
`Control.dll` `FUN_1000f940` (RVA `0xf940`) кладёт результат selector `3` в
|
||||||
|
текущее и обработанное значения строки; при подтверждённых единичных множителях
|
||||||
|
это raw `max_volume` NDP. Последующее обновление меняет оба native поля, поэтому
|
||||||
|
снимок не моделирует вместимость или изменяемый Control amount.
|
||||||
|
|
||||||
Rust query обращается к загруженному объекту и поддерживает `0xe00` только для
|
Rust query обращается к загруженному объекту и поддерживает `0xe00` только для
|
||||||
текущего descriptor tag `26` с factory tag `26`; другие активные typed tags и
|
текущего descriptor tag `26` с factory tag `26`; другие активные typed tags и
|
||||||
factory paths остаются явными границами. Этот запрос возвращает начальный
|
factory paths остаются явными границами. Этот запрос возвращает начальный
|
||||||
снимок provider amount; дальнейшее изменение строк в Rust не реализовано.
|
type-1 provider value (`1.0`); дальнейшее изменение provider amount в Rust не
|
||||||
|
реализовано.
|
||||||
Native oracle проверил изолированные пути распределения, обновления класса `4`
|
Native oracle проверил изолированные пути распределения, обновления класса `4`
|
||||||
и начальную ветвь таймера. Активную clock-ветвь не запускали; внешний источник
|
и начальную ветвь таймера. Активную clock-ветвь не запускали; внешний источник
|
||||||
времени и порядок вызовов остаются незакрытыми. Источник контактного коэффициента
|
времени и порядок вызовов остаются незакрытыми. Источник контактного коэффициента
|
||||||
|
|||||||
@@ -707,6 +707,46 @@ Runtime временно собирает mesh-состояния в поряд
|
|||||||
также не меняет существующий `0xe00` query: он читает начальное type-1 поле
|
также не меняет существующий `0xe00` query: он читает начальное type-1 поле
|
||||||
`+0x14` provider-строки, равное `1.0` после нативного конструктора.
|
`+0x14` provider-строки, равное `1.0` после нативного конструктора.
|
||||||
|
|
||||||
|
### Начальное количество строки provider
|
||||||
|
|
||||||
|
В `Control.dll` SHA-256
|
||||||
|
`bcb86318089028548a178b03a21accdce15df0cc85ddd91674cf3c2f55012c6e`
|
||||||
|
`FUN_1000f940` (RVA `0xf940`) получает для каждой строки selector `3` через
|
||||||
|
provider getter `FUN_1000dc40` (RVA `0xdc40`). Getter берёт `max_volume` из
|
||||||
|
NDP descriptor и последовательно умножает его на поля владельца `+0x660` и
|
||||||
|
`+0x548`. Конструктор `FUN_10006bf0` (RVA `0x6bf0`) задаёт оба множителя как
|
||||||
|
`1.0`. Инициализатор записывает результат в поля строки `+0x08` и `+0x0c`, а
|
||||||
|
type-1 поле `+0x14` остаётся `1.0`. Второе поле не является постоянной
|
||||||
|
вместимостью: `FUN_10011220` (RVA `0x11220`) копирует туда текущее `+0x08` при
|
||||||
|
завершении обновления.
|
||||||
|
|
||||||
|
Native oracle вызывает оригинальные `f940`, `dc40`, `b240` и AniMesh getters
|
||||||
|
`FUN_100051f0`/`FUN_10005840` на тестовой памяти; подменён только callback
|
||||||
|
владельца. При unity множителях строки с `max_volume` `[30, 60, 50, 0]`
|
||||||
|
получили начальные количества с теми же битами, включая нулевую строку, а
|
||||||
|
callback-и пришли в порядке `[0, 1, 2, 3]`. Отдельный прогон с синтетическими
|
||||||
|
множителями `1.5` и `0.5` подтвердил формулу для этих входов, но не порядок
|
||||||
|
операций или загрузку игрового объекта; порядок `max_volume * +0x660 * +0x548`
|
||||||
|
виден в машинных инструкциях getter-а. На начальном пути Unit DAT множители
|
||||||
|
единичные: `ArealMap.dll` (SHA-256
|
||||||
|
`a25f9254ebb339d70e2e07c8121950191e9584ca0858d8e9c2e2b6c671edf6ea`) в RVA
|
||||||
|
`0x15290` передаёт в `CreateObject` три значения `1.0`. Вызов World3D
|
||||||
|
`AddObjectToGame` (`World3D.dll`, SHA-256
|
||||||
|
`17e4a3089b2583a8cf2356c9db0390b1aba138356a09130d79b4e7e4791da61e`, RVA
|
||||||
|
`0x7ea0`) не применяет transform scale; отдельный `AddNewObjectToGame` в RVA
|
||||||
|
`0x8310` имеет ветку установки scale. AniMesh constructor (`AniMesh.dll`,
|
||||||
|
SHA-256 `65659bf67f20e5be77d67a5b2f59968f61b94293143807fa59ca451c560c4f7e`,
|
||||||
|
RVA `0x68a0`) читает три DLL scale globals, которые после LoadLibrary в oracle
|
||||||
|
равны `1.0`. В Rust одна `initial_amount_bits` запись
|
||||||
|
сохраняет это общее начальное количество; полный update, который меняет
|
||||||
|
amount и обработанное предыдущее значение, пока не моделируется.
|
||||||
|
|
||||||
|
Licensed full-load regression `full_load_builds_effective_control_device_table_for_mine_unit_dat`
|
||||||
|
проверяет значения настоящего `min_l_n1.dat`: корневой provider row `0` даёт
|
||||||
|
`1.0`, а row `1` примонтированного `EXTO` (общий ordinal `22`) даёт `6000.0`.
|
||||||
|
Проверка использует исходные CTL/NDP/MSH и не делает выводов о динамическом
|
||||||
|
изменении этих строк.
|
||||||
|
|
||||||
Native-часть этих ABI проверок воспроизводит
|
Native-часть этих ABI проверок воспроизводит
|
||||||
`behavior_distributor_tick_native_oracle.cs` на синтетически выделенной памяти
|
`behavior_distributor_tick_native_oracle.cs` на синтетически выделенной памяти
|
||||||
и оригинальном DLL с указанным SHA. Она подтверждает getters и layout, но не
|
и оригинальном DLL с указанным SHA. Она подтверждает getters и layout, но не
|
||||||
|
|||||||
@@ -882,6 +882,15 @@ initial_mesh_state: Option<MissionControlNodeInitialMeshState>
|
|||||||
начинает с локального узла `1`. Это описывает исходную настройку: код пока не
|
начинает с локального узла `1`. Это описывает исходную настройку: код пока не
|
||||||
переключает стадии в ходе игры и не исполняет полный Control tick.
|
переключает стадии в ходе игры и не исполняет полный Control tick.
|
||||||
|
|
||||||
|
На той же начальной стадии Control вычисляет количество строки по NDP
|
||||||
|
`max_volume`. Для загрузки Unit DAT проверенные множители равны `1.0`, поэтому
|
||||||
|
количество совпадает с исходным значением NDP. Оригинал начинает с одинакового
|
||||||
|
текущего и последнего обработанного количества; Rust сохраняет его один раз как
|
||||||
|
`initial_amount_bits`. Это исходный снимок, а не неизменяемая вместимость:
|
||||||
|
позднее Control меняет оба количества. В лицензированном `min_l_n1.dat`
|
||||||
|
проверены, например, root row `0` со значением `1.0` и строка `EXTO` с local
|
||||||
|
row `1` в общей позиции `22` со значением `6000.0`.
|
||||||
|
|
||||||
После загрузки количество в строках может меняться. Контроллер распределяет
|
После загрузки количество в строках может меняться. Контроллер распределяет
|
||||||
добавку либо пропорционально свободному месту, либо по очереди: при максимумах
|
добавку либо пропорционально свободному месту, либо по очереди: при максимумах
|
||||||
`[30, 60, 50]`, текущих значениях `[10, 20, 0]` и добавке `22` первый способ
|
`[30, 60, 50]`, текущих значениях `[10, 20, 0]` и добавке `22` первый способ
|
||||||
|
|||||||
Reference in new issue
Block a user