huge refactor
This commit is contained in:
parent
e5ebe05571
commit
a8341e8232
29 changed files with 3184 additions and 340 deletions
36
src/Roboto.Memory/States/AreaLoadingState.cs
Normal file
36
src/Roboto.Memory/States/AreaLoadingState.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using Roboto.GameOffsets.States;
|
||||
|
||||
namespace Roboto.Memory.States;
|
||||
|
||||
/// <summary>
|
||||
/// Reads AreaLoading state (slot 0). Individual field reads — the full struct is 3672B, wasteful to bulk-read.
|
||||
/// </summary>
|
||||
public sealed class AreaLoadingState : RemoteObject
|
||||
{
|
||||
// AreaLoading struct field offsets
|
||||
private const int IsLoadingOffset = 0x660;
|
||||
private const int TotalLoadingScreenTimeMsOffset = 0xDB8;
|
||||
|
||||
public bool IsLoading { get; private set; }
|
||||
public long TotalLoadingScreenTimeMs { get; private set; }
|
||||
|
||||
public AreaLoadingState(MemoryContext ctx) : base(ctx) { }
|
||||
|
||||
protected override bool ReadData()
|
||||
{
|
||||
var mem = Ctx.Memory;
|
||||
|
||||
var loadingFlag = mem.Read<int>(Address + IsLoadingOffset);
|
||||
IsLoading = loadingFlag != 0;
|
||||
|
||||
TotalLoadingScreenTimeMs = mem.Read<long>(Address + TotalLoadingScreenTimeMsOffset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Clear()
|
||||
{
|
||||
IsLoading = false;
|
||||
TotalLoadingScreenTimeMs = 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue