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