diff --git a/lib/asl-help b/lib/asl-help index 6901964..5838c1f 100644 Binary files a/lib/asl-help and b/lib/asl-help differ diff --git a/src/Basic/HelperBase.cs b/src/Basic/HelperBase.cs index f0b0270..a868ab8 100644 --- a/src/Basic/HelperBase.cs +++ b/src/Basic/HelperBase.cs @@ -147,8 +147,10 @@ await TaskBuilder.Create(_cts) .Catch() .RetryOnFailure() .Catch() + .WithFailureMessage(ex => ex.Message) .RetryOnFailure() .Catch() + .WithFailureMessage(ex => ex.Message) .RetryOnFailure() .WithTimeout(TryLoadTimeout) .WithFailureMessage("TryLoad not successful.") diff --git a/src/Basic/MemoryUtils/Reflect/ReflectXml.cs b/src/Basic/MemoryUtils/Reflect/ReflectXml.cs index cee6830..2f25af7 100644 --- a/src/Basic/MemoryUtils/Reflect/ReflectXml.cs +++ b/src/Basic/MemoryUtils/Reflect/ReflectXml.cs @@ -34,7 +34,7 @@ public static ReflectXml GetFromResources(string engine, string major, string mi } ReflectXml refXml = CreateFromInherited(root.Element("Inherit")); - refXml.AddStructs(engine is "Unreal", root.Elements("Struct")); + refXml.AddStructs(engine == "Unreal", root.Elements("Struct")); return refXml; } diff --git a/src/Basic/Tasks/ExceptionStage/ExceptionStage.cs b/src/Basic/Tasks/ExceptionStage/ExceptionStage.cs index 6015b52..009a804 100644 --- a/src/Basic/Tasks/ExceptionStage/ExceptionStage.cs +++ b/src/Basic/Tasks/ExceptionStage/ExceptionStage.cs @@ -29,7 +29,7 @@ IExceptionStage IExceptionStage.WithFa return this; } - IExceptionStage IExceptionStage.WithFailureMessage(Func message) + IExceptionStage IExceptionStage.WithFailureMessage(Func message) { if (FailureMessage is not null) { @@ -37,7 +37,7 @@ IExceptionStage IExceptionStage.WithFa throw new InvalidOperationException(msg); } - FailureMessage = new((Func)message); + FailureMessage = new(message); return this; } diff --git a/src/Basic/Tasks/ExceptionStage/IExceptionStage.cs b/src/Basic/Tasks/ExceptionStage/IExceptionStage.cs index 89d22bf..34c0076 100644 --- a/src/Basic/Tasks/ExceptionStage/IExceptionStage.cs +++ b/src/Basic/Tasks/ExceptionStage/IExceptionStage.cs @@ -11,7 +11,7 @@ public interface IExceptionStage where TException : Exception { IExceptionStage WithFailureMessage(string message); - IExceptionStage WithFailureMessage(Func message); + IExceptionStage WithFailureMessage(Func message); ICatchStage RetryOnFailure(); ICatchStage BreakOnFailure(); diff --git a/src/Unity/Mono/Models/MonoImage.cs b/src/Unity/Mono/Models/MonoImage.cs index 419635a..5f579ee 100644 --- a/src/Unity/Mono/Models/MonoImage.cs +++ b/src/Unity/Mono/Models/MonoImage.cs @@ -62,7 +62,7 @@ protected override void OnFound(MonoClass monoClass) monoClass.DebugAllFields(); } - protected override void OnNotFound(string key) + protected override void OnNotFound(string name) { Debug.Info(" => Not found!"); } diff --git a/src/Unreal/Helper/Unreal.Load.cs b/src/Unreal/Helper/Unreal.Load.cs index d7e0ca0..195facd 100644 --- a/src/Unreal/Helper/Unreal.Load.cs +++ b/src/Unreal/Helper/Unreal.Load.cs @@ -22,8 +22,8 @@ protected override UEMemManager MakeManager() (4, < 8) => new UE4_0Manager(UEVersion.Major, UEVersion.Minor), (4, < 11) => new UE4_8Manager(UEVersion.Major, UEVersion.Minor), (4, < 20) => new UE4_11Manager(UEVersion.Major, UEVersion.Minor), - (4, < 22) => new UE4_20Manager(UEVersion.Major, UEVersion.Minor), - (4, < 23) => new UE4_23Manager(UEVersion.Major, UEVersion.Minor), + (4, < 23) => new UE4_20Manager(UEVersion.Major, UEVersion.Minor), + (4, < 25) => new UE4_23Manager(UEVersion.Major, UEVersion.Minor), (4, _) or (5, _) => new UE4_25Manager(UEVersion.Major, UEVersion.Minor), _ => throw new NotSupportedException($"Unreal Engine version {UEVersion.Major}.{UEVersion.Minor} is not supported yet.") }; diff --git a/src/Unreal/Structs/4_23.xml b/src/Unreal/Structs/4_23.xml index 3e2d8ba..6c7e0e6 100644 --- a/src/Unreal/Structs/4_23.xml +++ b/src/Unreal/Structs/4_23.xml @@ -1,30 +1,30 @@ + + + - - - + + + + - - - - - - - + + + diff --git a/src/Unreal/UE/Managers/Base/UEMemManager.Setup.cs b/src/Unreal/UE/Managers/Base/UEMemManager.Setup.cs index aa77c79..03e766c 100644 --- a/src/Unreal/UE/Managers/Base/UEMemManager.Setup.cs +++ b/src/Unreal/UE/Managers/Base/UEMemManager.Setup.cs @@ -28,14 +28,7 @@ private bool Scan(int major, int minor) _fNamePool = _game.Scan(_fNamesTrg); if (_fNamePool == default) { - if (_game.MainModule.Symbols.TryGetValue("FNamePool", out DebugSymbol symbol)) - { - _fNamePool = symbol.Address; - } - else - { - throw new FatalNotFoundException("FNamePool could not be found."); - } + throw new FatalNotFoundException("FNamePool could not be found."); } Debug.Info($"FNamePool: 0x{_fNamePool.ToString("X")}"); @@ -43,51 +36,20 @@ private bool Scan(int major, int minor) _gUObjectArray = _game.Scan(_uObjectsTrg); if (_gUObjectArray == default) { - if (_game.MainModule.Symbols.TryGetValue("GUObjectArray", out DebugSymbol symbol)) - { - _gUObjectArray = symbol.Address; - } - else - { - throw new FatalNotFoundException("GUObjectArray could not be found."); - } + throw new FatalNotFoundException("GUObjectArray could not be found."); } Debug.Info($"GUObjectArray: 0x{_gUObjectArray.ToString("X")}"); GWorld = _game.ScanRel(_gWorldTrg); - if (GWorld == default) - { - if (_game.MainModule.Symbols.TryGetValue("GWorld", out DebugSymbol symbol)) - { - GWorld = symbol.Address; - } - } - Debug.Info($"GWorld: 0x{GWorld.ToString("X")}"); GEngine = _game.ScanRel(_gEngineTrg); - if (GEngine == default) - { - if (_game.MainModule.Symbols.TryGetValue("GEngine", out DebugSymbol symbol)) - { - GEngine = symbol.Address; - } - } - Debug.Info($"GEngine: 0x{GEngine.ToString("X")}"); if ((major, minor) is (4, >= 20) or (5, _)) { GSyncLoadCount = _game.ScanRel(_gSyncLoadCountTrg); - if (GSyncLoadCount == default) - { - if (_game.MainModule.Symbols.TryGetValue("GSyncLoadCount", out DebugSymbol symbol)) - { - GSyncLoadCount = symbol.Address; - } - } - Debug.Info($"GSyncLoadCount: 0x{GSyncLoadCount.ToString("X")}"); } diff --git a/src/Unreal/UE/Managers/UE4_23Manager.cs b/src/Unreal/UE/Managers/UE4_23Manager.cs index 126778d..de07fd9 100644 --- a/src/Unreal/UE/Managers/UE4_23Manager.cs +++ b/src/Unreal/UE/Managers/UE4_23Manager.cs @@ -29,32 +29,27 @@ internal override IEnumerable EnumerateFNames() break; } - yield return new((chunkId << 16) | offset); + yield return new((chunkId << 16) | offset, FNameName(cursor)); - cursor += 2 + length; - - if ((cursor & 1) != 0) - { - cursor += 1; - } + cursor += 2 + length + (cursor & 1); offset = getOffset(cursor); } chunkId++; - chunk = fNamePool + (ptrSize * chunkId); + chunk = ReadPtr(fNamePool + (ptrSize * chunkId)); } int getOffset(nint cursor) { - return (int)(cursor - (long)chunk) >> 1; + return (int)((long)cursor - (long)chunk) >> 1; } } internal override nint FNameNameEntry(int fNameIndex) { nint entry = ReadPtr(FNamePool + (_game.PtrSize * (fNameIndex >> 16))); - return (entry + (fNameIndex & ushort.MaxValue)) << 1; + return entry + ((fNameIndex & ushort.MaxValue) << 1); } internal override int FNameIndex(nint fName) @@ -67,7 +62,7 @@ internal override string FNameName(nint fName) int length = FNameLength(fName, out bool isWide); ReadStringType type = isWide ? ReadStringType.UTF16 : ReadStringType.UTF8; - return _game.ReadString(length, type, fName + _engine["FNameEntry"]["Name"]) ?? ""; + return _game.ReadString(length, type, fName + _engine["FNameEntry"]["Name"]); } internal virtual int FNameLength(nint fName, out bool isWide) diff --git a/src/Unreal/UE/Models/UObjectCache.cs b/src/Unreal/UE/Models/UObjectCache.cs index 971b0f1..52af287 100644 --- a/src/Unreal/UE/Models/UObjectCache.cs +++ b/src/Unreal/UE/Models/UObjectCache.cs @@ -19,7 +19,16 @@ public override IEnumerator GetEnumerator() protected override string GetKey(UObject uObject) { - return uObject.Outer + "." + uObject; + string obj = uObject.ToString(); + + if (uObject.Outer?.ToString() is string outer && outer != "") + { + return outer + "." + obj; + } + else + { + return obj; + } } protected override void OnSearch(string name) @@ -44,4 +53,9 @@ protected override void OnFound(UObject uObject) // uObject.DebugAllFields(); } + + protected override void OnNotFound(string name) + { + Debug.Info(" => Not found!"); + } }