diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-08-09 23:27:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-09 18:27:45 -0300 |
commit | 5e9678c8fad4625026268e457f4c3e23bdc22697 (patch) | |
tree | f63ea9b82af78209909a49a84a8cab02c1e8275a /src/ARMeilleure/Translation/PTC/PtcFormatter.cs | |
parent | 773e239db7ceb2c55aa15f9787add4430edcdfcf (diff) |
Allow access to code memory for exefs mods (#5518)1.1.978
* Allow access to code memory for exefs mods
* Add ASLR workaround for Skyline
* Hardcode allowCodeMemoryForJit to true
Diffstat (limited to 'src/ARMeilleure/Translation/PTC/PtcFormatter.cs')
-rw-r--r-- | src/ARMeilleure/Translation/PTC/PtcFormatter.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ARMeilleure/Translation/PTC/PtcFormatter.cs b/src/ARMeilleure/Translation/PTC/PtcFormatter.cs index ddac3133..60953dcd 100644 --- a/src/ARMeilleure/Translation/PTC/PtcFormatter.cs +++ b/src/ARMeilleure/Translation/PTC/PtcFormatter.cs @@ -28,6 +28,26 @@ namespace ARMeilleure.Translation.PTC } [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Dictionary<TKey, TValue> DeserializeAndUpdateDictionary<TKey, TValue>(Stream stream, Func<Stream, TValue> valueFunc, Func<TKey, TValue, (TKey, TValue)> updateFunc) where TKey : struct + { + Dictionary<TKey, TValue> dictionary = new(); + + int count = DeserializeStructure<int>(stream); + + for (int i = 0; i < count; i++) + { + TKey key = DeserializeStructure<TKey>(stream); + TValue value = valueFunc(stream); + + (key, value) = updateFunc(key, value); + + dictionary.Add(key, value); + } + + return dictionary; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static List<T> DeserializeList<T>(Stream stream) where T : struct { List<T> list = new(); |