test
This commit is contained in:
parent
0df70abad7
commit
0c14d78d8a
25 changed files with 1487 additions and 179 deletions
|
|
@ -1,17 +1,19 @@
|
|||
using System.Numerics;
|
||||
using Roboto.GameOffsets.States;
|
||||
using Roboto.Memory;
|
||||
using WdStruct = Roboto.GameOffsets.States.WorldData;
|
||||
|
||||
namespace Roboto.Memory.States;
|
||||
namespace Roboto.Memory.Objects;
|
||||
|
||||
/// <summary>
|
||||
/// Reads WorldData struct (168B, 1 RPM) and resolves the camera matrix.
|
||||
/// Primary camera source: WorldData.CameraPtr. Fallback: InGameState.CameraPtr (set via FallbackCameraPtr).
|
||||
/// Owns AreaTemplate child for area metadata.
|
||||
/// </summary>
|
||||
public sealed class WorldDataState : RemoteObject
|
||||
public sealed class WorldData : RemoteObject
|
||||
{
|
||||
private WorldData _data;
|
||||
private WdStruct _data;
|
||||
|
||||
/// <summary>Camera pointer from InGameState, set by InGameStateReader before Update() is called.</summary>
|
||||
/// <summary>Camera pointer from InGameState, set by InGameState before Update() is called.</summary>
|
||||
public nint FallbackCameraPtr { get; set; }
|
||||
|
||||
public Matrix4x4? CameraMatrix { get; private set; }
|
||||
|
|
@ -19,7 +21,12 @@ public sealed class WorldDataState : RemoteObject
|
|||
/// <summary>Resolved address of the camera matrix for hot-path caching.</summary>
|
||||
public nint CameraMatrixAddress { get; private set; }
|
||||
|
||||
public WorldDataState(MemoryContext ctx) : base(ctx) { }
|
||||
public AreaTemplate AreaTemplate { get; }
|
||||
|
||||
public WorldData(MemoryContext ctx, MsvcStringReader strings) : base(ctx)
|
||||
{
|
||||
AreaTemplate = new AreaTemplate(ctx, strings);
|
||||
}
|
||||
|
||||
protected override bool ReadData()
|
||||
{
|
||||
|
|
@ -27,7 +34,13 @@ public sealed class WorldDataState : RemoteObject
|
|||
var offsets = Ctx.Offsets;
|
||||
|
||||
// Read the full WorldData struct (0xA8 = 168 bytes, 1 RPM)
|
||||
_data = mem.Read<WorldData>(Address);
|
||||
_data = mem.Read<WdStruct>(Address);
|
||||
|
||||
// Cascade to AreaTemplate
|
||||
if (_data.WorldAreaDetailsPtr != 0)
|
||||
AreaTemplate.Update(_data.WorldAreaDetailsPtr);
|
||||
else
|
||||
AreaTemplate.Reset();
|
||||
|
||||
// Resolve camera: primary from WorldData, fallback from InGameState
|
||||
if (offsets.CameraMatrixOffset <= 0)
|
||||
|
|
@ -56,5 +69,6 @@ public sealed class WorldDataState : RemoteObject
|
|||
FallbackCameraPtr = 0;
|
||||
CameraMatrix = null;
|
||||
CameraMatrixAddress = 0;
|
||||
AreaTemplate.Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue