diff options
author | merry <git@mary.rs> | 2023-01-12 07:50:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 07:50:45 +0000 |
commit | e9a173e00ce199117f73626c075f89feedfb31ce (patch) | |
tree | 22c3138869e7916fcb4a4d127b4061bc564f1e53 | |
parent | a11784fcbf7a19b9d36e755cc92a27fe994008c7 (diff) |
Ptc: Check process architecture (#4272)1.1.545
-rw-r--r-- | ARMeilleure/Translation/PTC/Ptc.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs index a59bc588..e5b4623d 100644 --- a/ARMeilleure/Translation/PTC/Ptc.cs +++ b/ARMeilleure/Translation/PTC/Ptc.cs @@ -29,7 +29,7 @@ namespace ARMeilleure.Translation.PTC private const string OuterHeaderMagicString = "PTCohd\0\0"; private const string InnerHeaderMagicString = "PTCihd\0\0"; - private const uint InternalVersion = 4264; //! To be incremented manually for each change to the ARMeilleure project. + private const uint InternalVersion = 4272; //! To be incremented manually for each change to the ARMeilleure project. private const string ActualDir = "0"; private const string BackupDir = "1"; @@ -261,6 +261,13 @@ namespace ARMeilleure.Translation.PTC return false; } + if (outerHeader.Architecture != (uint)RuntimeInformation.ProcessArchitecture) + { + InvalidateCompressedStream(compressedStream); + + return false; + } + IntPtr intPtr = IntPtr.Zero; try @@ -437,6 +444,7 @@ namespace ARMeilleure.Translation.PTC outerHeader.FeatureInfo = GetFeatureInfo(); outerHeader.MemoryManagerMode = GetMemoryManagerMode(); outerHeader.OSPlatform = GetOSPlatform(); + outerHeader.Architecture = (uint)RuntimeInformation.ProcessArchitecture; outerHeader.UncompressedStreamSize = (long)Unsafe.SizeOf<InnerHeader>() + @@ -993,7 +1001,7 @@ namespace ARMeilleure.Translation.PTC return osPlatform; } - [StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 74*/)] + [StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 78*/)] private struct OuterHeader { public ulong Magic; @@ -1004,6 +1012,7 @@ namespace ARMeilleure.Translation.PTC public FeatureInfo FeatureInfo; public byte MemoryManagerMode; public uint OSPlatform; + public uint Architecture; public long UncompressedStreamSize; |