Browse Source

Added basic anti-piracy checks

pull/32/head
Anairkoen Schno 5 years ago
parent
commit
56891e8a2f
4 changed files with 42 additions and 6 deletions
  1. +28
    -0
      IPA.Injector/AntiPiracy.cs
  2. +1
    -1
      IPA.Injector/GameVersionEarly.cs
  3. +6
    -5
      IPA.Injector/IPA.Injector.csproj
  4. +7
    -0
      IPA.Injector/Injector.cs

+ 28
- 0
IPA.Injector/AntiPiracy.cs View File

@ -0,0 +1,28 @@
using System;
using System.IO;
using IPA.Utilities;
#if NET3
using Net3_Proxy;
using Path = Net3_Proxy.Path;
using File = Net3_Proxy.File;
using Directory = Net3_Proxy.Directory;
#endif
namespace IPA.Injector
{
internal class AntiPiracy
{
public static bool IsInvalid(string path)
{
var dataPlugins = Path.Combine(GameVersionEarly.ResolveDataPath(path), "Plugins");
return
File.Exists(Path.Combine(path, "IGG-GAMES.COM.url")) ||
File.Exists(Path.Combine(path, "SmartSteamEmu.ini")) ||
File.Exists(Path.Combine(path, "GAMESTORRENT.CO.url")) ||
File.Exists(Path.Combine(dataPlugins, "BSteam crack.dll")) ||
File.Exists(Path.Combine(dataPlugins, "HUHUVR_steam_api64.dll")) ||
Directory.GetFiles(BeatSaber.PluginsPath, "*.ini", SearchOption.TopDirectoryOnly).Length > 0;
}
}
}

+ 1
- 1
IPA.Injector/GameVersionEarly.cs View File

@ -14,7 +14,7 @@ namespace IPA.Injector
{
internal static class GameVersionEarly
{
private static string ResolveDataPath(string installDir) =>
internal static string ResolveDataPath(string installDir) =>
Path.Combine(Directory.EnumerateDirectories(installDir, "*_Data").First(), "globalgamemanagers");
internal static string GetGameVersion()


+ 6
- 5
IPA.Injector/IPA.Injector.csproj View File

@ -13,10 +13,10 @@
<Deterministic>true</Deterministic>
<PathMap>$(SolutionDir)=C:\</PathMap>
<DebugType>portable</DebugType>
<ShowTargetFrameworks>false</ShowTargetFrameworks>
<ShowTargetFrameworks Condition=" '$(BuildingInsideVisualStudio)' != 'true' Or '$(CI)' == 'True' ">true</ShowTargetFrameworks>
<TargetFrameworks Condition=" '$(ShowTargetFrameworks)' == 'true' ">net461;net35</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
@ -60,6 +60,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AntiPiracy.cs" />
<Compile Include="Backups\BackupManager.cs" />
<Compile Include="Backups\BackupUnit.cs" />
<Compile Include="Bootstrapper.cs" />
@ -75,12 +76,12 @@
<Project>{5ad344f0-01a0-4ca8-92e5-9d095737744d}</Project>
<Name>IPA.Loader</Name>
</ProjectReference>
<ProjectReference Include="..\Net3-Proxy\Net3-Proxy.csproj" Condition=" '$(Platform)' == 'Net3' " >
<ProjectReference Include="..\Net3-Proxy\Net3-Proxy.csproj" Condition=" '$(Platform)' == 'Net3' ">
<Project>{642F52DA-90F9-40E3-8784-6964F36752FB}</Project>
<Name>Net3-Proxy</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'Net4' " >
<ItemGroup Condition=" '$(Platform)' == 'Net4' ">
<Content Include="..\Libs\I18N.Net4.dll">
<Link>Libraries\Mono\I18N.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@ -89,7 +90,7 @@
<Link>Libraries\Mono\I18N.West.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Libs\Microsoft.CSharp.dll" >
<Content Include="..\Libs\Microsoft.CSharp.dll">
<Link>Libraries\Mono\Microsoft.CSharp.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@ -98,7 +99,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'Net3' " >
<ItemGroup Condition=" '$(Platform)' == 'Net3' ">
<Content Include="..\Libs\I18N.Net3.dll">
<Link>Libraries\Mono\I18N.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>


+ 7
- 0
IPA.Injector/Injector.cs View File

@ -76,6 +76,13 @@ namespace IPA.Injector
SelfConfig.ReadCommandLine(Environment.GetCommandLineArgs());
DisabledConfig.Load();
if (AntiPiracy.IsInvalid(Environment.CurrentDirectory))
{
loader.Error("Invalid installation; please buy the game to run BSIPA.");
return;
}
loader.Debug("Prepping bootstrapper");
// updates backup


Loading…
Cancel
Save