mirror of
https://gitea.tendokyu.moe/beerpsi/CHUNITHM-Patch-Finder.git
synced 2024-11-23 23:31:03 +01:00
Initial commit
This commit is contained in:
commit
f0e60910ab
490
.gitignore
vendored
Normal file
490
.gitignore
vendored
Normal file
@ -0,0 +1,490 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/csharp,dotnetcore,rider
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,dotnetcore,rider
|
||||
|
||||
### Csharp ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
### DotnetCore ###
|
||||
# .NET Core build folders
|
||||
bin/
|
||||
obj/
|
||||
|
||||
# Common node modules locations
|
||||
/node_modules
|
||||
/wwwroot/node_modules
|
||||
|
||||
### Rider ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/csharp,dotnetcore,rider
|
13
.idea/.idea.CHUNITHM-Patch-Finder/.idea/.gitignore
vendored
Normal file
13
.idea/.idea.CHUNITHM-Patch-Finder/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/contentModel.xml
|
||||
/.idea.CHUNITHM-Patch-Finder.iml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
8
.idea/.idea.CHUNITHM-Patch-Finder/.idea/indexLayout.xml
Normal file
8
.idea/.idea.CHUNITHM-Patch-Finder/.idea/indexLayout.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
23
CHUNITHM-Patch-Finder.csproj
Normal file
23
CHUNITHM-Patch-Finder.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>CHUNITHM_Patch_Finder</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Reloaded.Memory.Sigscan" Version="3.1.8" />
|
||||
<PackageReference Include="YamlDotNet" Version="15.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ContentWithTargetPath Include="patterns.yaml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<TargetPath>%(Filename)%(Extension)</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
16
CHUNITHM-Patch-Finder.sln
Normal file
16
CHUNITHM-Patch-Finder.sln
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CHUNITHM-Patch-Finder", "CHUNITHM-Patch-Finder.csproj", "{C5CCAA87-16B3-415F-824A-B7C95E645EE1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C5CCAA87-16B3-415F-824A-B7C95E645EE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C5CCAA87-16B3-415F-824A-B7C95E645EE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C5CCAA87-16B3-415F-824A-B7C95E645EE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5CCAA87-16B3-415F-824A-B7C95E645EE1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
14
Pattern.cs
Normal file
14
Pattern.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace CHUNITHM_Patch_Finder;
|
||||
|
||||
public record Pattern
|
||||
{
|
||||
public required string Name;
|
||||
|
||||
public string? Signature = null;
|
||||
|
||||
public required PatternPatch[] Patches;
|
||||
|
||||
public string? Tooltip = null;
|
||||
|
||||
public string? Danger = null;
|
||||
}
|
12
PatternPatch.cs
Normal file
12
PatternPatch.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace CHUNITHM_Patch_Finder;
|
||||
|
||||
public record PatternPatch
|
||||
{
|
||||
public string? Signature = null;
|
||||
|
||||
public required int Offset;
|
||||
|
||||
public required int[] Off;
|
||||
|
||||
public required int[] On;
|
||||
}
|
130
Program.cs
Normal file
130
Program.cs
Normal file
@ -0,0 +1,130 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using CHUNITHM_Patch_Finder;
|
||||
using Reloaded.Memory.Sigscan;
|
||||
using Reloaded.Memory.Sigscan.Definitions.Structs;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
Console.WriteLine($"Usage: {Environment.ProcessPath} <PATH TO EXE>");
|
||||
Environment.Exit(22); // EINVAL
|
||||
}
|
||||
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(LowerCaseNamingConvention.Instance)
|
||||
.Build();
|
||||
var patches =
|
||||
deserializer.Deserialize<Pattern[]>(
|
||||
File.ReadAllText("patterns.yaml"));
|
||||
var binary = File.ReadAllBytes(args[0]);
|
||||
var scanner = new Scanner(binary);
|
||||
var exportedPatches = new JsonArray();
|
||||
|
||||
// Other patches
|
||||
foreach (var patch in patches)
|
||||
{
|
||||
var signatures = patch.Patches.Select(p => p.Signature ?? patch.Signature).ToList();
|
||||
|
||||
if (signatures.Any(s => s == null))
|
||||
{
|
||||
Console.WriteLine($"[ERROR] No signature provided for patch {patch.Name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
var matches = signatures
|
||||
.Zip(scanner.FindPatternsCached(signatures)!)
|
||||
.GroupBy(p => p.First)
|
||||
.ToDictionary(g => g.Key, g => g.First().Second);
|
||||
|
||||
if (matches.Any(p => !p.Value.Found))
|
||||
{
|
||||
Console.WriteLine($"No offset found for patch {patch.Name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
var patchObject = new JsonObject()
|
||||
{
|
||||
{ "name", patch.Name },
|
||||
};
|
||||
|
||||
if (patch.Tooltip != null)
|
||||
patchObject.Add("tooltip", patch.Tooltip);
|
||||
else if (patch.Danger != null)
|
||||
patchObject.Add("danger", patch.Danger);
|
||||
|
||||
var patchArray = new JsonArray();
|
||||
|
||||
foreach (var p in patch.Patches)
|
||||
{
|
||||
var signature = (p.Signature ?? patch.Signature)!;
|
||||
var off = new JsonArray();
|
||||
var on = new JsonArray();
|
||||
|
||||
foreach (var b in p.Off)
|
||||
off.Add(b);
|
||||
|
||||
foreach (var b in p.On)
|
||||
on.Add(b);
|
||||
|
||||
var pObject = new JsonObject()
|
||||
{
|
||||
{ "offset", matches[signature].Offset + p.Offset },
|
||||
{ "off", off },
|
||||
{ "on", on },
|
||||
};
|
||||
|
||||
patchArray.Add(pObject);
|
||||
}
|
||||
|
||||
patchObject.Add("patches", patchArray);
|
||||
exportedPatches.Add(patchObject);
|
||||
}
|
||||
|
||||
// max track count patch
|
||||
if (Path.GetFileName(args[0]) == "chusanApp.exe")
|
||||
{
|
||||
var offset = scanner
|
||||
.FindPatterns([
|
||||
"E8 ?? ?? ?? ?? 8D ?? 78 8B F0", // SDHD 2.00-2.20
|
||||
"E8 ?? ?? ?? ?? 8B 4C 24 24 8B F0", // SDGS 1.30
|
||||
])
|
||||
.FirstOrDefault(o => o.Found, new PatternScanResult(-1));
|
||||
|
||||
if (offset.Found)
|
||||
{
|
||||
var trackCountRelativeAddress = BitConverter.ToInt32(binary, offset.Offset + 1);
|
||||
var trackCountAddress = offset.Offset + 5 + trackCountRelativeAddress;
|
||||
|
||||
Console.WriteLine($"Found track count function at {trackCountAddress:X}");
|
||||
|
||||
var patch = new JsonObject
|
||||
{
|
||||
{ "type", "number" },
|
||||
{ "name", "Maximum tracks" },
|
||||
{ "offset", trackCountAddress + 1 },
|
||||
{ "size", 4 },
|
||||
{ "min", 3 },
|
||||
{ "max", 12 }
|
||||
};
|
||||
|
||||
exportedPatches.Add(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Track count function not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File.WriteAllText(
|
||||
"patches.json",
|
||||
JsonSerializer.Serialize(exportedPatches, new JsonSerializerOptions(JsonSerializerOptions.Default)
|
||||
{
|
||||
WriteIndented = true
|
||||
}));
|
||||
|
||||
Console.WriteLine("Wrote patches to patches.json");
|
14
README.md
Normal file
14
README.md
Normal file
@ -0,0 +1,14 @@
|
||||
A shittily written patch finder hacked together with
|
||||
[Reloaded.Memory.Sigscan](https://github.com/Reloaded-Project/Reloaded.Memory.SigScan).
|
||||
|
||||
Originally written for CHUNITHM, hence the name, but can be used
|
||||
with pretty much anything as long as you have the signatures.
|
||||
|
||||
## Usage
|
||||
```sh
|
||||
./CHUNITHM-Patch-Finder <PATH TO EXE>
|
||||
```
|
||||
|
||||
The program expects a file called `patterns.yaml` (see files in
|
||||
repo for example) and outputs BemaniPatcher-compatible patches
|
||||
to `patches.json`.
|
99
patterns.yaml
Normal file
99
patterns.yaml
Normal file
@ -0,0 +1,99 @@
|
||||
# The patches.yaml format is basically the same thing as the BemaniPatcher format, with 2 major differences:
|
||||
# - There's a global, as well as patch-specific, signature for the patch.
|
||||
# - The `offset` here is the offset from the start of the signature. For example, if you want to modify the 4th byte in
|
||||
# `12 34 56 ??`, the offset should be 0x03.
|
||||
- name: "Disable shop close lockout"
|
||||
tooltip: "Disables ~12-8am lockout. Does not disable maintenance lockout from 6:30-7am JST"
|
||||
signature: "56 8B CB E8 ?? ?? ?? ?? 84 C0 ?? 0E"
|
||||
patches:
|
||||
- offset: 0x0A
|
||||
off: [0x74]
|
||||
on: [0xEB]
|
||||
- name: "Force shared audio mode, system audio sample rate must be 48000Hz"
|
||||
tooltip: "Improves compatibility, but may increase latency"
|
||||
signature: "83 3D ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ?? 6A ?? E8 ?? ?? ?? ??"
|
||||
patches:
|
||||
- offset: 0x0E
|
||||
off: [0x01]
|
||||
on: [0x00]
|
||||
- name: "Force 2 channel audio output"
|
||||
signature: "56 E8 ?? ?? ?? ?? 83 C4 04 85 C0 ?? ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ??"
|
||||
patches:
|
||||
- offset: 0x0B
|
||||
off: [0x75, 0x3F]
|
||||
on: [0x90, 0x90]
|
||||
- name: "Disable song select timer"
|
||||
signature: "E8 ?? ?? ?? ?? 3C 01 74 71 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 8B C8 E8 ?? ?? ?? ?? 8D 48 78 E8 ?? ?? ?? ?? 3C 01 ?? 53"
|
||||
patches:
|
||||
- offset: 0x25
|
||||
off: [0x74]
|
||||
on: [0xEB]
|
||||
- name: "Set all timers to 999"
|
||||
danger: "Breaks online matching functionality"
|
||||
signature: "8B 44 24 04 69 C0 E8 03 00 00"
|
||||
patches:
|
||||
- offset: 0x00
|
||||
off: [0x8B, 0x44, 0x24, 0x04, 0x69, 0xC0, 0xE8, 0x03, 0x00, 0x00]
|
||||
on: [0xB8, 0x58, 0x3E, 0x0F, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90]
|
||||
- name: "Unlimited maximum tracks"
|
||||
tooltip: "Must check to play more than 7 tracks per credit"
|
||||
signature: "B8 07 00 00 00 3B F0 0F 47 ??"
|
||||
patches:
|
||||
- offset: 0x09
|
||||
off: [0xF0]
|
||||
on: [0xC0]
|
||||
- name: "No encryption"
|
||||
tooltip: "Will also disable TLS"
|
||||
signature: "3F 41 56 44 65 66 6C 61 74 65 40 70 72 6F 6A 43 6C 69 65 6E 74 40 40 ?? ?? ?? ?? ?? ?? ?? ??"
|
||||
# 0xDC should be set to whatever the current CHUNITHM integer version is, e.g. 220
|
||||
patches:
|
||||
- offset: 0x1B
|
||||
off: [0xDC]
|
||||
on: [0x00]
|
||||
- offset: 0x1E
|
||||
off: [0xDC]
|
||||
on: [0x00]
|
||||
- name: "No TLS"
|
||||
tooltip: "Title server workaround"
|
||||
signature: "E8 ?? ?? ?? ?? 85 C0 75 07 BE 00 00 ?? 00"
|
||||
patches:
|
||||
- offset: 0x0C
|
||||
off: [0x80]
|
||||
on: [0x00]
|
||||
- name: "Patch for head-to-head play"
|
||||
tooltip: "Fix infinite sync while trying to connect to head to head play"
|
||||
signature: "50 68 ?? ?? ?? ?? FF 76 1C C7 44 24 ?? ?? ?? ?? ?? FF 15 ?? ?? ?? ??"
|
||||
patches:
|
||||
- offset: 0x0D
|
||||
off: [0x01]
|
||||
on: [0x00]
|
||||
- name: "Disable 1080p check"
|
||||
signature: "81 BC 24 B8 02 00 00 80 07 00 00 75 1F 81 BC 24 BC 02 00 00 38 04 00 00 75 12"
|
||||
patches:
|
||||
- offset: 0x00
|
||||
off: [0x81, 0xBC, 0x24, 0xB8, 0x02, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x75, 0x1F, 0x81, 0xBC, 0x24, 0xBC, 0x02, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x75, 0x12]
|
||||
on: [0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90]
|
||||
- name: "Force 120Hz check"
|
||||
tooltip: "Check to make the 120Hz check always pass (do not use with CVT mode)"
|
||||
signature: "50 56 6A 00 FF D7 ?? ?? 74 3F"
|
||||
patches:
|
||||
- offset: 0x06
|
||||
off: [0x85, 0xC0]
|
||||
on: [0xEB, 0x30]
|
||||
- name: "Bypass LED board check"
|
||||
danger: "[DEPRECATED] Forces LED board check to good and auto continues"
|
||||
signature: "E8 ?? ?? ?? ?? 39 44 24 18 7D 0C C6 86 ?? ?? ?? ?? ?? C6 44 24 ?? ??"
|
||||
patches:
|
||||
- offset: 0x11
|
||||
off: [0x01]
|
||||
on: [0x00]
|
||||
- offset: 0x16
|
||||
off: [0x00]
|
||||
on: [0x01]
|
||||
- name: "Ignore some errors from amdaemon"
|
||||
danger: "[DEPRECATED] May relieve some errors like error 6401, but may also cause problems elsewhere."
|
||||
signature: "8B F9 8B CE E8 ?? ?? ?? ?? 8B CE E8 ?? ?? ?? ?? 3C 01 ?? 14"
|
||||
patches:
|
||||
- offset: 0x12
|
||||
off: [0x75]
|
||||
on: [0xEB]
|
18
patterns_amdaemon.yaml
Normal file
18
patterns_amdaemon.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
- name: Allow 127.0.0.1/localhost as the network server
|
||||
patches:
|
||||
- signature: "31 32 37 2F 38 00"
|
||||
offset: 0x00
|
||||
off: [0x31, 0x32, 0x37, 0x2F]
|
||||
on: [0x30, 0x2F, 0x38, 0x00]
|
||||
- signature: "48 83 EC 28 FF 15 ?? ?? ?? ?? 8B C8 3D ?? ?? ?? ?? 77 0A"
|
||||
offset: 0x04
|
||||
# You probably want this for older versions of amdaemon
|
||||
# off: [0xFF, 0x15, 0x3E, 0x79, 0x1A, 0x00, 0x8B]
|
||||
off: [0xFF, 0x15, 0xC6, 0x2F, 0x1B, 0x00, 0x8B]
|
||||
on: [0x33, 0xC0, 0x48, 0x83, 0xC4, 0x28, 0xC3]
|
||||
- name: Infinite credits
|
||||
signature: "74 23 40 28 7C 4A ?? 39 05 ?? ?? ?? ?? 74 05"
|
||||
patches:
|
||||
- offset: 0x03
|
||||
off: [0x28]
|
||||
on: [0x08]
|
Loading…
Reference in New Issue
Block a user