diff --git a/.github/workflows/reloaded.yml b/.github/workflows/reloaded.yml index a0b5c6b..914f4fe 100644 --- a/.github/workflows/reloaded.yml +++ b/.github/workflows/reloaded.yml @@ -80,7 +80,7 @@ jobs: } - name: Build - run: ./External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 -ChangelogPath "$env:PUBLISH_CHANGELOG_PATH" + run: ./External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 -ChangelogPath "$env:PUBLISH_CHANGELOG_PATH" -ReadmePath "./External/Reloaded.Memory.SigScan.ReloadedII/README-RII.md" - name: Upload GitHub Release Artifact uses: actions/upload-artifact@v2.2.4 diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/BuildLinked.ps1 b/External/Reloaded.Memory.SigScan.ReloadedII/BuildLinked.ps1 index ae81edd..2d5db71 100644 --- a/External/Reloaded.Memory.SigScan.ReloadedII/BuildLinked.ps1 +++ b/External/Reloaded.Memory.SigScan.ReloadedII/BuildLinked.ps1 @@ -3,7 +3,7 @@ Split-Path $MyInvocation.MyCommand.Path | Push-Location [Environment]::CurrentDirectory = $PWD Remove-Item "$env:RELOADEDIIMODS/Reloaded.Memory.SigScan.ReloadedII/*" -Force -Recurse -dotnet publish "./Reloaded.Memory.SigScan.ReloadedII.csproj" -c Release -o "$env:RELOADEDIIMODS/Reloaded.Memory.SigScan.ReloadedII" /p:OutputPath="./bin/Release" /p:RobustILLink="true" +dotnet publish "./Reloaded.Memory.SigScan.ReloadedII.csproj" -c Release -o "$env:RELOADEDIIMODS/Reloaded.Memory.SigScan.ReloadedII" /p:OutputPath="./bin/Release" /p:ReloadedILLink="true" # Restore Working Directory Pop-Location \ No newline at end of file diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json b/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json index f5ee157..582d661 100644 --- a/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json +++ b/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json @@ -2,7 +2,7 @@ "ModId": "Reloaded.Memory.SigScan.ReloadedII", "ModName": "Library: Reloaded.Memory.Sigscan for Reloaded II", "ModAuthor": "Sewer56", - "ModVersion": "1.2.3", + "ModVersion": "1.2.4", "ModDescription": "Shared implementation of Reloaded.Memory.Sigscan", "ModDll": "Reloaded.Memory.SigScan.ReloadedII.dll", "ModIcon": "Preview.png", @@ -29,5 +29,6 @@ "IsUniversalMod": false, "ModDependencies": [], "OptionalDependencies": [], - "SupportedAppId": [] + "SupportedAppId": [], + "ProjectUrl": "https://github.com/Reloaded-Project/Reloaded.Memory.SigScan" } \ No newline at end of file diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/Preview.png b/External/Reloaded.Memory.SigScan.ReloadedII/Preview.png new file mode 100644 index 0000000..c423ad7 Binary files /dev/null and b/External/Reloaded.Memory.SigScan.ReloadedII/Preview.png differ diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 b/External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 index fa2ba96..0f5fc15 100644 --- a/External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 +++ b/External/Reloaded.Memory.SigScan.ReloadedII/Publish.ps1 @@ -32,6 +32,10 @@ Full or relative path to a file containing the changelog for the mod. The changelog should be written in Markdown format. +.PARAMETER ReadmePath + Full or relative path to a file containing the changelog for the mod. + The changelog should be written in Markdown format. + .PARAMETER IsPrerelease Default: $False @@ -131,6 +135,11 @@ Removes executables from build output. Useful when performing R2R Optimisation. +.PARAMETER UseScriptDirectory + Default: $True + + Uses script directory for performing build. Otherwise uses current directory. + .EXAMPLE .\Publish.ps1 -ProjectPath "Reloaded.Hooks.ReloadedII/Reloaded.Hooks.ReloadedII.csproj" -PackageName "Reloaded.Hooks.ReloadedII" -PublishOutputDir "Publish/ToUpload" @@ -146,10 +155,12 @@ param ( $IsPrerelease=$False, $MakeDelta=$False, $ChangelogPath="", + $ReadmePath="", $Build=$True, - $BuildR2R=$True, - $RemoveExe = $True, - + $BuildR2R=$False, + $RemoveExe=$True, + $UseScriptDirectory=$True, + ## => User Config <= ## $ProjectPath = "Reloaded.Memory.SigScan.ReloadedII.csproj", $PackageName = "Reloaded.Memory.SigScan.ReloadedII", @@ -193,12 +204,18 @@ $reloadedToolsPath = "./Publish/Tools/Reloaded-Tools" # Used to check if tool $updateToolsPath = "./Publish/Tools/Update-Tools" # Used to check if update tools are installed. $reloadedToolPath = "$reloadedToolsPath/Reloaded.Publisher.exe" # Path to Reloaded publishing tool. $updateToolPath = "$updateToolsPath/Sewer56.Update.Tool.dll" # Path to Update tool. -$changelogFullPath = $([System.IO.Path]::GetFullPath($ChangelogPath)) +$changelogFullPath = $null +$readmeFullPath = $null +if ($ChangelogPath) { $changelogFullPath = [System.IO.Path]::GetFullPath($ChangelogPath) } +if ($ReadmePath) { $readmeFullPath = [System.IO.Path]::GetFullPath($ReadmePath) } ## => Script <= ## # Set Working Directory -Split-Path $MyInvocation.MyCommand.Path | Push-Location -[Environment]::CurrentDirectory = $PWD +$UseScriptDirectory = [bool]::Parse($UseScriptDirectory) +if ($UseScriptDirectory) { + Split-Path $MyInvocation.MyCommand.Path | Push-Location + [Environment]::CurrentDirectory = $PWD +} # Convert Booleans $IsPrerelease = [bool]::Parse($IsPrerelease) @@ -302,6 +319,10 @@ function Get-Common-Publish-Args { if ($ChangelogPath) { $arguments += " --changelogpath `"$changelogFullPath`"" } + + if ($ReadmePath) { + $arguments += " --readmepath `"$readmeFullPath`"" + } if ($AllowDeltas -and $MakeDelta) { $arguments += " --olderversionfolders `"$deltaDirectory`"" @@ -382,4 +403,6 @@ Remove-Item $TempDirectory -Recurse -ErrorAction SilentlyContinue # Restore Working Directory Write-Host "Done." Write-Host "Upload the files in folder `"$PublishOutputDir`" to respective location or website." -Pop-Location \ No newline at end of file +if ($UseScriptDirectory) { + Pop-Location +} \ No newline at end of file diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/README-RII.md b/External/Reloaded.Memory.SigScan.ReloadedII/README-RII.md new file mode 100644 index 0000000..4e3c4e8 --- /dev/null +++ b/External/Reloaded.Memory.SigScan.ReloadedII/README-RII.md @@ -0,0 +1,37 @@ +## Reloaded-II Shared Library + +[For information on consuming Shared Libraries, see [Dependency Injection in Reloaded II](https://reloaded-project.github.io/Reloaded-II/DependencyInjection_Consumer/).] + +[![NuGet](https://img.shields.io/nuget/v/Reloaded.Memory.SigScan.ReloadedII.Interfaces)](https://www.nuget.org/packages/Reloaded.Memory.SigScan.ReloadedII.Interfaces) + +`Reloaded.Memory.SigScan.ReloadedII.Interfaces` [(NuGet)](https://www.nuget.org/packages/Reloaded.Memory.SigScan.ReloadedII.Interfaces) exposes the following APIs: +- `IStartupScanner`: Queues signature scans for batch parallel scanning. +- `IScannerFactory`: Creates `Scanner` instances. + +It is highly recommended that you use `IStartupScanner` in your mods. +Running signature scans in parallel provides very significant gains to startup time. + +Scans submitted to this class are performed in the order they are submitted. +There is no need to worry about conflicts/race conditions. + +Example: +```csharp +void Start() +{ + // ... code omitted + _modLoader.GetController().TryGetTarget(out var startupScanner); + startupScanner.AddMainModuleScan("C3", OnMainModuleScan); +} + +private void OnMainModuleScan(PatternScanResult result) +{ + _logger.WriteLine($"Found `ret` at: {result.Offset}"); +} +``` + +If you need additional APIs in `IStartupScanner`, such as scanning custom/different ranges, please let me know. For now the API only handles the common use case. + +## Acknowledgements + +Vectorised implementations of `Reloaded.Memory.Sigscan` are based off of a modified version of `LazySIMD` by [uberhalit](https://github.com/uberhalit). +[Binary by ismail abdurrasyid from Noun Project](https://thenounproject.com/browse/icons/term/binary/). diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Memory.SigScan.ReloadedII.csproj b/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Memory.SigScan.ReloadedII.csproj index cba114e..a212620 100644 --- a/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Memory.SigScan.ReloadedII.csproj +++ b/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Memory.SigScan.ReloadedII.csproj @@ -4,25 +4,25 @@ net5.0-windows false true - preview + 10.0 enable True $(RELOADEDIIMODS)/Reloaded.Memory.SigScan.ReloadedII - - - true + true - + - - + + - + @@ -39,7 +39,7 @@ - + diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/Robust.Trimming.targets b/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Trimming.targets similarity index 57% rename from External/Reloaded.Memory.SigScan.ReloadedII/Robust.Trimming.targets rename to External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Trimming.targets index 932d73c..38f3fc2 100644 --- a/External/Reloaded.Memory.SigScan.ReloadedII/Robust.Trimming.targets +++ b/External/Reloaded.Memory.SigScan.ReloadedII/Reloaded.Trimming.targets @@ -1,84 +1,104 @@ - + - + false - - + + false - + - - - + + + - - - + + + <__PDBToLink Include="@(ResolvedFileToPublish)" Exclude="@(ManagedAssemblyToLink->'%(RelativeDir)%(Filename).pdb')" /> + <_PDBToLink Include="@(ResolvedFileToPublish)" Exclude="@(__PDBToLink)" /> + - - - + + <_LinkedResolvedFileToPublishCandidate Include="@(ManagedAssemblyToLink->'$(IntermediateLinkDir)%(Filename)%(Extension)')" /> + <_LinkedResolvedFileToPublishCandidate Include="@(_PDBToLink->'$(IntermediateLinkDir)%(Filename)%(Extension)')" /> + + + + + + + true + + link + copy - <_ExtraTrimmerArgs>--skip-unresolved true $(_ExtraTrimmerArgs) $(TreatWarningsAsErrors) + <_ExtraTrimmerArgs>--skip-unresolved true $(_ExtraTrimmerArgs) true + + + + - - Copy - - - Link - + + + + - - <__PDBToLink Include="@(ResolvedFileToPublish)" Exclude="@(RobustAssemblyToLink->'%(RelativeDir)%(Filename).pdb')" /> - <_PDBToLink Include="@(ResolvedFileToPublish)" Exclude="@(__PDBToLink)" /> + + - <_LinkedResolvedFileToPublishCandidate Include="@(RobustAssemblyToLink->'$(IntermediateLinkDir)%(Filename)%(Extension)')" /> - <_LinkedResolvedFileToPublishCandidate Include="@(_PDBToLink->'$(IntermediateLinkDir)%(Filename)%(Extension)')" /> + - + + + Input Assembly: %(filename) [Mode: %(ManagedAssemblyToLink.TrimMode)] + + + + - + <_LinkedResolvedFileToPublish Include="@(_LinkedResolvedFileToPublishCandidate)" Condition="Exists('%(Identity)')" /> - + - + \ No newline at end of file diff --git a/README.md b/README.md index 5ced6b5..64983b3 100644 --- a/README.md +++ b/README.md @@ -149,38 +149,7 @@ To run the benchmarks yourself, simply run `Reloaded.Memory.Sigscan.Benchmark` a ## Reloaded-II Shared Library -[For information on consuming Shared Libraries, see [Dependency Injection in Reloaded II](https://reloaded-project.github.io/Reloaded-II/DependencyInjection_Consumer/).] - - - Nuget - - -`Reloaded.Memory.SigScan.ReloadedII.Interfaces` [(NuGet)](https://www.nuget.org/packages/Reloaded.Memory.SigScan.ReloadedII.Interfaces) exposes the following APIs: -- `IStartupScanner`: Queues signature scans for batch parallel scanning. -- `IScannerFactory`: Creates `Scanner` instances. - -It is highly recommended that you use `IStartupScanner` in your mods. -Running signature scans in parallel provides very significant gains to startup time. - -Scans submitted to this class are performed in the order they are submitted. -There is no need to worry about conflicts/race conditions. - -Example: -```csharp -void Start() -{ - // ... code omitted - _modLoader.GetController().TryGetTarget(out var startupScanner); - startupScanner.AddMainModuleScan("C3", OnMainModuleScan); -} - -private void OnMainModuleScan(PatternScanResult result) -{ - _logger.WriteLine($"Found `ret` at: {result.Offset}"); -} -``` - -If you need additional APIs in `IStartupScanner`, such as scanning custom/different ranges, please let me know. For now the API only handles the common use case. +See [Reloaded-II SigScan Shared Library](./External/Reloaded.Memory.SigScan.ReloadedII/README-RII.md). ## Acknowledgements