mirror of
https://gitea.tendokyu.moe/beerpsi/CHUNITHM-Patch-Finder.git
synced 2024-11-23 23:31:03 +01:00
Organize patterns and shit
This commit is contained in:
parent
65ad4bb7b5
commit
8438ed9bf6
@ -15,9 +15,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ContentWithTargetPath Include="patterns.yaml">
|
||||
<ContentWithTargetPath Include="Patterns/**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<TargetPath>%(Filename)%(Extension)</TargetPath>
|
||||
<TargetPath>Patterns/%(RecursiveDir)/%(Filename)%(Extension)</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
|
20
Program.cs
20
Program.cs
@ -11,17 +11,29 @@ using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
Console.WriteLine($"Usage: {Environment.ProcessPath} <PATH TO EXE>");
|
||||
Console.WriteLine($"Usage: {Environment.ProcessPath} <PATH TO EXE> [PATH TO PATTERNS]");
|
||||
Environment.Exit(22); // EINVAL
|
||||
}
|
||||
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(LowerCaseNamingConvention.Instance)
|
||||
.Build();
|
||||
var exeFile = args[0];
|
||||
var exeFileName = Path.GetFileName(exeFile);
|
||||
var patternsFile = args.Length >= 2
|
||||
? args[1]
|
||||
: Path.Join("Patterns", Path.GetFileNameWithoutExtension(exeFile) + ".yaml");
|
||||
|
||||
if (!Path.Exists(patternsFile))
|
||||
{
|
||||
Console.WriteLine($"[ERROR] Could not find patterns file {patternsFile}. Nothing to search for.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
var patches =
|
||||
deserializer.Deserialize<Pattern[]>(
|
||||
File.ReadAllText("patterns.yaml"));
|
||||
var binary = File.ReadAllBytes(args[0]);
|
||||
File.ReadAllText(patternsFile));
|
||||
var binary = File.ReadAllBytes(exeFile);
|
||||
var scanner = new Scanner(binary);
|
||||
var exportedPatches = new List<BemaniPatcherPatch>();
|
||||
|
||||
@ -70,7 +82,7 @@ foreach (var patch in patches)
|
||||
}
|
||||
|
||||
// max track count patch
|
||||
if (Path.GetFileName(args[0]) == "chusanApp.exe")
|
||||
if (exeFileName == "chusanApp.exe")
|
||||
{
|
||||
var offset = scanner
|
||||
.FindPatterns([
|
||||
|
10
README.md
10
README.md
@ -8,11 +8,13 @@ Does not do any patch validation for now.
|
||||
|
||||
## Usage
|
||||
```sh
|
||||
./CHUNITHM-Patch-Finder <PATH TO EXE>
|
||||
./CHUNITHM-Patch-Finder <PATH TO EXE> [PATH TO PATTERNS]
|
||||
```
|
||||
|
||||
The program expects a file called `patterns.yaml` (see files in
|
||||
repo for example) and outputs BemaniPatcher-compatible patches
|
||||
to `patches.json`.
|
||||
If a patterns file is not specified, the program defaults to
|
||||
finding a file named `[file].yaml` under its `Patterns`
|
||||
directory.
|
||||
|
||||
The output is in a format compatible with [BemaniPatcher](https://github.com/mon/BemaniPatcher).
|
||||
|
||||
[How to find signatures](https://reloaded-project.github.io/Reloaded-II/CheatSheet/SignatureScanning/)
|
Loading…
Reference in New Issue
Block a user