From e4c8207cd9c12ff515dcd70790fc44a870851ef1 Mon Sep 17 00:00:00 2001 From: beerpsi Date: Wed, 31 Jul 2024 15:11:47 +0700 Subject: [PATCH] feat: scan for amdaemon version --- Patterns/amdaemon.yaml | 4 ++-- Program.cs | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Patterns/amdaemon.yaml b/Patterns/amdaemon.yaml index bcac8fc..e1635a7 100644 --- a/Patterns/amdaemon.yaml +++ b/Patterns/amdaemon.yaml @@ -21,7 +21,7 @@ # https://eamonwoortman.github.io/openssl-binary-patching/ # https://github.com/openssl/openssl/commit/7123aa81e9fb19afb11fdf3850662c5f7ff1f19c#diff-fd85954e17364d4495e1e077a5768e4e - name: OpenSSL SHA crash bug fix - tooltip: Fixes crashing on 10th and 11th generation Intel CPUs + tooltip: Fixes crashing on 10th generation and newer Intel CPUs signature: "48 8D 46 40 66 0F FE CC 48 0F 45 F0" patches: - offset: 0x00 @@ -29,4 +29,4 @@ on: [0x4C] - offset: 0x08 off: [0x48] - on: [0x49] \ No newline at end of file + on: [0x49] diff --git a/Program.cs b/Program.cs index 74a2327..d7df75a 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,6 @@ // See https://aka.ms/new-console-template for more information +using System.Text; using CHUNITHM_Patch_Finder.Converters; using CHUNITHM_Patch_Finder.Models; using Newtonsoft.Json; @@ -113,8 +114,26 @@ if (exeFileName == "chusanApp.exe") { Console.WriteLine("Track count function not found"); } -} else if (exeFileName == "amdaemon.exe") +} +else if (exeFileName == "amdaemon.exe") { + // "amdaemonExe Ver." + var versionResult = scanner.FindPattern("61 6D 64 61 65 6D 6F 6E 45 78 65 20 56 65 72 2E"); + + if (versionResult.Found) + { + var versionEnd = Array.IndexOf(binary, 0, versionResult.Offset); + var version = Encoding.ASCII + .GetString(binary, versionResult.Offset, versionEnd - versionResult.Offset) + .TrimEnd(); + + Console.WriteLine(version); + } + else + { + Console.WriteLine("[WARN] Could not find amdaemon version."); + } + var results = scanner.FindPatterns([ "E8 ?? ?? ?? ?? 3B C5 7C 32", "E8 ?? ?? ?? ?? A8 10 74 C1", @@ -139,7 +158,7 @@ if (exeFileName == "chusanApp.exe") { Offset = logLevel1Address + 6, Off = [0xC3, 0xCC, 0xCC, 0xCC], - On = [0x83, 0xC0, 0x3F, 0xC3], + On = [0x83, 0xC8, 0x3F, 0xC3], }, new BemaniPatcherStandardPatchEntry { @@ -191,4 +210,4 @@ File.WriteAllText( "patches.json", JsonConvert.SerializeObject(exportedPatches, settings)); -Console.WriteLine("Wrote patches to patches.json"); \ No newline at end of file +Console.WriteLine("Wrote patches to patches.json");