mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 06:52:55 +08:00
Created CodeWalker.Core
This commit is contained in:
parent
947611765e
commit
709bf125ce
@ -41,7 +41,7 @@ namespace CodeWalker
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
RpfMan = new RpfManager();
|
||||
RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, UpdateStatus, false, false);
|
||||
RPFScanComplete();
|
||||
|
@ -64,7 +64,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateStatus("Ready to scan...");
|
||||
}
|
||||
|
78
CodeWalker.Core/CodeWalker.Core.csproj
Normal file
78
CodeWalker.Core/CodeWalker.Core.csproj
Normal file
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DE50D3A6-B49E-47A0-ABE6-101473A00759}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CodeWalker.Core</RootNamespace>
|
||||
<AssemblyName>CodeWalker.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SharpDX, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.4.0.1\lib\net45\SharpDX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.Mathematics, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GameFiles\Utils\Data.cs" />
|
||||
<Compile Include="GameFiles\Utils\GTACrypto.cs" />
|
||||
<Compile Include="GameFiles\Utils\GTAKeys.cs" />
|
||||
<Compile Include="GameFiles\Utils\Jenk.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\Cache.cs" />
|
||||
<Compile Include="Utils\Matrices.cs" />
|
||||
<Compile Include="Utils\Quaternions.cs" />
|
||||
<Compile Include="Utils\Utils.cs" />
|
||||
<Compile Include="Utils\Vectors.cs" />
|
||||
<Compile Include="Utils\Xml.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\magic.dat" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -27,7 +27,7 @@
|
||||
|
||||
//shamelessly stolen
|
||||
|
||||
using CodeWalker.Properties;
|
||||
using CodeWalker.Core.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -160,15 +160,12 @@ namespace CodeWalker.GameFiles
|
||||
updateStatus?.Invoke("Searching for AES key...");
|
||||
PC_AES_KEY = HashSearch.SearchHash(exeStr, GTA5KeyHashes.PC_AES_KEY_HASH, 0x20);
|
||||
|
||||
Settings.Default.Key = Convert.ToBase64String(PC_AES_KEY);
|
||||
Settings.Default.Save();
|
||||
|
||||
updateStatus?.Invoke("Complete.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void LoadFromPath(string path = ".\\Keys")
|
||||
public static void LoadFromPath(string path = ".\\Keys", string key = null)
|
||||
{
|
||||
//PC_AES_KEY = File.ReadAllBytes(path + "\\gtav_aes_key.dat");
|
||||
//PC_NG_KEYS = CryptoIO.ReadNgKeys(path + "\\gtav_ng_key.dat");
|
||||
@ -178,7 +175,7 @@ namespace CodeWalker.GameFiles
|
||||
//PC_LUT = File.ReadAllBytes(path + "\\gtav_hash_lut.dat");
|
||||
|
||||
//GenerateMagicData(path);
|
||||
UseMagicData(path);
|
||||
UseMagicData(path, key);
|
||||
}
|
||||
|
||||
public static void SaveToPath(string path = ".\\Keys")
|
||||
@ -248,17 +245,17 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
}
|
||||
|
||||
private static void UseMagicData(string path)
|
||||
private static void UseMagicData(string path, string key)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(Settings.Default.Key))
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
byte[] exedata = File.ReadAllBytes(path + "\\gta5.exe");
|
||||
GenerateV2(exedata, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
PC_AES_KEY = Convert.FromBase64String(Settings.Default.Key);
|
||||
PC_AES_KEY = Convert.FromBase64String(key);
|
||||
}
|
||||
//GenerateMagicData();
|
||||
|
36
CodeWalker.Core/Properties/AssemblyInfo.cs
Normal file
36
CodeWalker.Core/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CodeWalker.Core")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CodeWalker.Core")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("de50d3a6-b49e-47a0-abe6-101473a00759")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
73
CodeWalker.Core/Properties/Resources.Designer.cs
generated
Normal file
73
CodeWalker.Core/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CodeWalker.Core.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeWalker.Core.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] magic {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("magic", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
CodeWalker.Core/Properties/Resources.resx
Normal file
124
CodeWalker.Core/Properties/Resources.resx
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="magic" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\magic.dat;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
197
CodeWalker.Core/Utils/Utils.cs
Normal file
197
CodeWalker.Core/Utils/Utils.cs
Normal file
@ -0,0 +1,197 @@
|
||||
using SharpDX;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CodeWalker
|
||||
{
|
||||
|
||||
|
||||
public static class TextUtil
|
||||
{
|
||||
|
||||
public static string GetBytesReadable(long i)
|
||||
{
|
||||
//shamelessly stolen from stackoverflow, and a bit mangled
|
||||
|
||||
// Returns the human-readable file size for an arbitrary, 64-bit file size
|
||||
// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
|
||||
// Get absolute value
|
||||
long absolute_i = (i < 0 ? -i : i);
|
||||
// Determine the suffix and readable value
|
||||
string suffix;
|
||||
double readable;
|
||||
if (absolute_i >= 0x1000000000000000) // Exabyte
|
||||
{
|
||||
suffix = "EB";
|
||||
readable = (i >> 50);
|
||||
}
|
||||
else if (absolute_i >= 0x4000000000000) // Petabyte
|
||||
{
|
||||
suffix = "PB";
|
||||
readable = (i >> 40);
|
||||
}
|
||||
else if (absolute_i >= 0x10000000000) // Terabyte
|
||||
{
|
||||
suffix = "TB";
|
||||
readable = (i >> 30);
|
||||
}
|
||||
else if (absolute_i >= 0x40000000) // Gigabyte
|
||||
{
|
||||
suffix = "GB";
|
||||
readable = (i >> 20);
|
||||
}
|
||||
else if (absolute_i >= 0x100000) // Megabyte
|
||||
{
|
||||
suffix = "MB";
|
||||
readable = (i >> 10);
|
||||
}
|
||||
else if (absolute_i >= 0x400) // Kilobyte
|
||||
{
|
||||
suffix = "KB";
|
||||
readable = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
return i.ToString("0 bytes"); // Byte
|
||||
}
|
||||
// Divide by 1024 to get fractional value
|
||||
readable = (readable / 1024);
|
||||
|
||||
string fmt = "0.### ";
|
||||
if (readable > 1000)
|
||||
{
|
||||
fmt = "0";
|
||||
}
|
||||
else if (readable > 100)
|
||||
{
|
||||
fmt = "0.#";
|
||||
}
|
||||
else if (readable > 10)
|
||||
{
|
||||
fmt = "0.##";
|
||||
}
|
||||
|
||||
// Return formatted number with suffix
|
||||
return readable.ToString(fmt) + suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class FloatUtil
|
||||
{
|
||||
public static bool TryParse(string s, out float f)
|
||||
{
|
||||
f = 0.0f;
|
||||
if (float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out f))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static float Parse(string s)
|
||||
{
|
||||
float f;
|
||||
TryParse(s, out f);
|
||||
return f;
|
||||
}
|
||||
public static string ToString(float f)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return f.ToString(c);
|
||||
}
|
||||
|
||||
|
||||
public static string GetVector2String(Vector2 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c);
|
||||
}
|
||||
public static string GetVector3String(Vector3 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c) + ", " + v.Z.ToString(c);
|
||||
}
|
||||
public static string GetVector3String(Vector3 v, string format)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(format, c) + ", " + v.Y.ToString(format, c) + ", " + v.Z.ToString(format, c);
|
||||
}
|
||||
public static string GetVector3XmlString(Vector3 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\"", v.X.ToString(c), v.Y.ToString(c), v.Z.ToString(c));
|
||||
}
|
||||
public static string GetVector4XmlString(Vector4 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\" w=\"{3}\"", v.X.ToString(c), v.Y.ToString(c), v.Z.ToString(c), v.W.ToString(c));
|
||||
}
|
||||
public static string GetQuaternionXmlString(Quaternion q)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\" w=\"{3}\"", q.X.ToString(c), q.Y.ToString(c), q.Z.ToString(c), q.W.ToString(c));
|
||||
}
|
||||
|
||||
public static Vector3 ParseVector3String(string s)
|
||||
{
|
||||
Vector3 p = new Vector3(0.0f);
|
||||
string[] ss = s.Split(',');
|
||||
if (ss.Length > 0)
|
||||
{
|
||||
FloatUtil.TryParse(ss[0].Trim(), out p.X);
|
||||
}
|
||||
if (ss.Length > 1)
|
||||
{
|
||||
FloatUtil.TryParse(ss[1].Trim(), out p.Y);
|
||||
}
|
||||
if (ss.Length > 2)
|
||||
{
|
||||
FloatUtil.TryParse(ss[2].Trim(), out p.Z);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string GetVector4String(Vector4 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c) + ", " + v.Z.ToString(c) + ", " + v.W.ToString(c);
|
||||
}
|
||||
public static Vector4 ParseVector4String(string s)
|
||||
{
|
||||
Vector4 p = new Vector4(0.0f);
|
||||
string[] ss = s.Split(',');
|
||||
if (ss.Length > 0)
|
||||
{
|
||||
FloatUtil.TryParse(ss[0].Trim(), out p.X);
|
||||
}
|
||||
if (ss.Length > 1)
|
||||
{
|
||||
FloatUtil.TryParse(ss[1].Trim(), out p.Y);
|
||||
}
|
||||
if (ss.Length > 2)
|
||||
{
|
||||
FloatUtil.TryParse(ss[2].Trim(), out p.Z);
|
||||
}
|
||||
if (ss.Length > 3)
|
||||
{
|
||||
FloatUtil.TryParse(ss[3].Trim(), out p.W);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
5
CodeWalker.Core/packages.config
Normal file
5
CodeWalker.Core/packages.config
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SharpDX" version="4.0.1" targetFramework="net461" />
|
||||
<package id="SharpDX.Mathematics" version="4.0.1" targetFramework="net461" />
|
||||
</packages>
|
@ -97,6 +97,7 @@
|
||||
<Compile Include="TreeViewFix.Designer.cs">
|
||||
<DependentUpon>TreeViewFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FormUtils.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -1,13 +1,6 @@
|
||||
using SharpDX;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Point = System.Drawing.Point;
|
||||
|
||||
@ -15,9 +8,6 @@ namespace CodeWalker
|
||||
{
|
||||
////public static class Utils
|
||||
////{
|
||||
|
||||
|
||||
|
||||
//// //unused
|
||||
//// //public static Bitmap ResizeImage(Image image, int width, int height)
|
||||
//// //{
|
||||
@ -39,12 +29,9 @@ namespace CodeWalker
|
||||
//// // }
|
||||
//// // return destImage;
|
||||
//// //}
|
||||
|
||||
|
||||
////}
|
||||
|
||||
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
@ -239,193 +226,6 @@ namespace CodeWalker
|
||||
|
||||
|
||||
|
||||
public static class TextUtil
|
||||
{
|
||||
|
||||
public static string GetBytesReadable(long i)
|
||||
{
|
||||
//shamelessly stolen from stackoverflow, and a bit mangled
|
||||
|
||||
// Returns the human-readable file size for an arbitrary, 64-bit file size
|
||||
// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
|
||||
// Get absolute value
|
||||
long absolute_i = (i < 0 ? -i : i);
|
||||
// Determine the suffix and readable value
|
||||
string suffix;
|
||||
double readable;
|
||||
if (absolute_i >= 0x1000000000000000) // Exabyte
|
||||
{
|
||||
suffix = "EB";
|
||||
readable = (i >> 50);
|
||||
}
|
||||
else if (absolute_i >= 0x4000000000000) // Petabyte
|
||||
{
|
||||
suffix = "PB";
|
||||
readable = (i >> 40);
|
||||
}
|
||||
else if (absolute_i >= 0x10000000000) // Terabyte
|
||||
{
|
||||
suffix = "TB";
|
||||
readable = (i >> 30);
|
||||
}
|
||||
else if (absolute_i >= 0x40000000) // Gigabyte
|
||||
{
|
||||
suffix = "GB";
|
||||
readable = (i >> 20);
|
||||
}
|
||||
else if (absolute_i >= 0x100000) // Megabyte
|
||||
{
|
||||
suffix = "MB";
|
||||
readable = (i >> 10);
|
||||
}
|
||||
else if (absolute_i >= 0x400) // Kilobyte
|
||||
{
|
||||
suffix = "KB";
|
||||
readable = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
return i.ToString("0 bytes"); // Byte
|
||||
}
|
||||
// Divide by 1024 to get fractional value
|
||||
readable = (readable / 1024);
|
||||
|
||||
string fmt = "0.### ";
|
||||
if (readable > 1000)
|
||||
{
|
||||
fmt = "0";
|
||||
}
|
||||
else if (readable > 100)
|
||||
{
|
||||
fmt = "0.#";
|
||||
}
|
||||
else if (readable > 10)
|
||||
{
|
||||
fmt = "0.##";
|
||||
}
|
||||
|
||||
// Return formatted number with suffix
|
||||
return readable.ToString(fmt) + suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class FloatUtil
|
||||
{
|
||||
public static bool TryParse(string s, out float f)
|
||||
{
|
||||
f = 0.0f;
|
||||
if (float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out f))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static float Parse(string s)
|
||||
{
|
||||
float f;
|
||||
TryParse(s, out f);
|
||||
return f;
|
||||
}
|
||||
public static string ToString(float f)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return f.ToString(c);
|
||||
}
|
||||
|
||||
|
||||
public static string GetVector2String(Vector2 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c);
|
||||
}
|
||||
public static string GetVector3String(Vector3 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c) + ", " + v.Z.ToString(c);
|
||||
}
|
||||
public static string GetVector3String(Vector3 v, string format)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(format, c) + ", " + v.Y.ToString(format, c) + ", " + v.Z.ToString(format, c);
|
||||
}
|
||||
public static string GetVector3XmlString(Vector3 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\"", v.X.ToString(c), v.Y.ToString(c), v.Z.ToString(c));
|
||||
}
|
||||
public static string GetVector4XmlString(Vector4 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\" w=\"{3}\"", v.X.ToString(c), v.Y.ToString(c), v.Z.ToString(c), v.W.ToString(c));
|
||||
}
|
||||
public static string GetQuaternionXmlString(Quaternion q)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return string.Format("x=\"{0}\" y=\"{1}\" z=\"{2}\" w=\"{3}\"", q.X.ToString(c), q.Y.ToString(c), q.Z.ToString(c), q.W.ToString(c));
|
||||
}
|
||||
|
||||
public static Vector3 ParseVector3String(string s)
|
||||
{
|
||||
Vector3 p = new Vector3(0.0f);
|
||||
string[] ss = s.Split(',');
|
||||
if (ss.Length > 0)
|
||||
{
|
||||
FloatUtil.TryParse(ss[0].Trim(), out p.X);
|
||||
}
|
||||
if (ss.Length > 1)
|
||||
{
|
||||
FloatUtil.TryParse(ss[1].Trim(), out p.Y);
|
||||
}
|
||||
if (ss.Length > 2)
|
||||
{
|
||||
FloatUtil.TryParse(ss[2].Trim(), out p.Z);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string GetVector4String(Vector4 v)
|
||||
{
|
||||
var c = CultureInfo.InvariantCulture;
|
||||
return v.X.ToString(c) + ", " + v.Y.ToString(c) + ", " + v.Z.ToString(c) + ", " + v.W.ToString(c);
|
||||
}
|
||||
public static Vector4 ParseVector4String(string s)
|
||||
{
|
||||
Vector4 p = new Vector4(0.0f);
|
||||
string[] ss = s.Split(',');
|
||||
if (ss.Length > 0)
|
||||
{
|
||||
FloatUtil.TryParse(ss[0].Trim(), out p.X);
|
||||
}
|
||||
if (ss.Length > 1)
|
||||
{
|
||||
FloatUtil.TryParse(ss[1].Trim(), out p.Y);
|
||||
}
|
||||
if (ss.Length > 2)
|
||||
{
|
||||
FloatUtil.TryParse(ss[2].Trim(), out p.Z);
|
||||
}
|
||||
if (ss.Length > 3)
|
||||
{
|
||||
FloatUtil.TryParse(ss[3].Trim(), out p.W);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Prompt
|
||||
{
|
||||
@ -461,9 +261,6 @@ namespace CodeWalker
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//unused
|
||||
//public class AccurateTimer
|
||||
//{
|
@ -280,7 +280,6 @@
|
||||
<Compile Include="GameFiles\FileTypes\CacheDatFile.cs" />
|
||||
<Compile Include="GameFiles\Resources\Bounds.cs" />
|
||||
<Compile Include="GameFiles\Resources\Clip.cs" />
|
||||
<Compile Include="GameFiles\Resources\Data.cs" />
|
||||
<Compile Include="GameFiles\Resources\Drawable.cs" />
|
||||
<Compile Include="GameFiles\Resources\Frag.cs" />
|
||||
<Compile Include="GameFiles\FileTypes\FxcFile.cs" />
|
||||
@ -293,9 +292,6 @@
|
||||
<Compile Include="GameFiles\Resources\Texture.cs" />
|
||||
<Compile Include="GameFiles\Resources\VehicleRecord.cs" />
|
||||
<Compile Include="GameFiles\Resources\WaypointRecord.cs" />
|
||||
<Compile Include="GameFiles\Utils\GTAKeys.cs" />
|
||||
<Compile Include="GameFiles\Utils\GTACrypto.cs" />
|
||||
<Compile Include="GameFiles\Utils\Jenk.cs" />
|
||||
<Compile Include="GameFiles\MetaTypes\Meta.cs" />
|
||||
<Compile Include="GameFiles\MetaTypes\MetaTypes.cs" />
|
||||
<Compile Include="GameFiles\MetaTypes\MetaNames.cs" />
|
||||
@ -393,15 +389,10 @@
|
||||
<Compile Include="TextInputForm.Designer.cs">
|
||||
<DependentUpon>TextInputForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\Cache.cs" />
|
||||
<Compile Include="Utils\DDSIO.cs" />
|
||||
<Compile Include="Utils\InputUtils.cs" />
|
||||
<Compile Include="Utils\MapUtils.cs" />
|
||||
<Compile Include="Utils\Matrices.cs" />
|
||||
<Compile Include="Utils\Quaternions.cs" />
|
||||
<Compile Include="Utils\TextureLoader.cs" />
|
||||
<Compile Include="Utils\Vectors.cs" />
|
||||
<Compile Include="Utils\Xml.cs" />
|
||||
<Compile Include="ProjectForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -431,7 +422,6 @@
|
||||
<Compile Include="BinarySearchForm.Designer.cs">
|
||||
<DependentUpon>BinarySearchForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\Utils.cs" />
|
||||
<Compile Include="WorldForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -570,7 +560,6 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<None Include="Resources\magic.dat" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@ -599,6 +588,10 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="CodeWalker.Core\CodeWalker.Core.csproj">
|
||||
<Project>{de50d3a6-b49e-47a0-abe6-101473a00759}</Project>
|
||||
<Name>CodeWalker.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="CodeWalker.WinForms\CodeWalker.WinForms.csproj">
|
||||
<Project>{9702c58d-f52f-45cf-9456-9ce5af40f5c3}</Project>
|
||||
<Name>CodeWalker.WinForms</Name>
|
||||
|
@ -1,17 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.13
|
||||
VisualStudioVersion = 15.0.27130.2020
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeWalker", "CodeWalker.csproj", "{3BB16320-99BF-4E30-9065-CA0877A36BF4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0D14B076-0ABF-434E-AB9F-36E7800D8887} = {0D14B076-0ABF-434E-AB9F-36E7800D8887}
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759} = {DE50D3A6-B49E-47A0-ABE6-101473A00759}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeWalkerShaders", "Shaders\CodeWalkerShaders.vcxproj", "{0D14B076-0ABF-434E-AB9F-36E7800D8887}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeWalker.WinForms", "CodeWalker.WinForms\CodeWalker.WinForms.csproj", "{9702C58D-F52F-45CF-9456-9CE5AF40F5C3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeWalker.Core", "CodeWalker.Core\CodeWalker.Core.csproj", "{DE50D3A6-B49E-47A0-ABE6-101473A00759}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -58,8 +61,23 @@ Global
|
||||
{9702C58D-F52F-45CF-9456-9CE5AF40F5C3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9702C58D-F52F-45CF-9456-9CE5AF40F5C3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9702C58D-F52F-45CF-9456-9CE5AF40F5C3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DE50D3A6-B49E-47A0-ABE6-101473A00759}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5D6153C2-98D1-4C3D-9232-4C2BEEAEC8E0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -70,7 +70,7 @@ namespace CodeWalker
|
||||
{
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateStatus("Keys loaded. Nothing to do here!");
|
||||
}
|
||||
@ -127,6 +127,8 @@ namespace CodeWalker
|
||||
|
||||
UpdateStatus("Saving found keys...");
|
||||
|
||||
Settings.Default.Key = Convert.ToBase64String(GTA5Keys.PC_AES_KEY);
|
||||
Settings.Default.Save();
|
||||
//GTA5Keys.SaveToPath();
|
||||
|
||||
UpdateStatus("Keys extracted successfully.");
|
||||
|
@ -31,7 +31,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateExtractStatus("Ready to extract.");
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateDumpStatus("Ready.");
|
||||
UpdateExtractStatus("Ready to extract.");
|
||||
|
@ -31,7 +31,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateExtractStatus("Ready to extract.");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
KeysLoaded = true;
|
||||
UpdateExtractStatus("Ready to extract.");
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace CodeWalker
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
GameFileCache gfc = new GameFileCache();
|
||||
gfc.DoFullStringIndex = true;
|
||||
gfc.Init(UpdateStatus, UpdateStatus);
|
||||
|
12
Properties/Resources.Designer.cs
generated
12
Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace CodeWalker.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
@ -69,15 +69,5 @@ namespace CodeWalker.Properties {
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] magic {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("magic", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,4 @@
|
||||
<data name="CW" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CW.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="magic" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\magic.dat;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
@ -297,57 +297,23 @@ namespace CodeWalker.World
|
||||
Planes[5] = Plane.Normalize(new Plane((vp.M14 - vp.M13), (vp.M24 - vp.M23), (vp.M34 - vp.M33), (vp.M44 - vp.M43)));
|
||||
}
|
||||
|
||||
public bool ContainsSphere(ref Vector3 c, float cls, float r)
|
||||
{
|
||||
//cls = c length squared, for optimization
|
||||
if (cls < (r * r))
|
||||
{
|
||||
return true; //frustrum center is in the sphere
|
||||
}
|
||||
float nr = -r;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (Plane.DotCoordinate(Planes[i], c) < nr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool ContainsSphereNoClip(ref Vector3 c, float cls, float r)
|
||||
{
|
||||
//cls = c length squared, for optimization
|
||||
if (cls < (r * r))
|
||||
{
|
||||
return true; //frustrum center is in the sphere
|
||||
}
|
||||
float nr = -r;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (Plane.DotCoordinate(Planes[i], c) < nr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool ContainsSphereNoFrontClip(ref Vector3 c, float cls, float r)
|
||||
{
|
||||
//cls = c length squared, for optimization
|
||||
if (cls < (r * r))
|
||||
{
|
||||
return true; //frustrum center is in the sphere
|
||||
}
|
||||
float nr = -r;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if ((i != 4) && (Plane.DotCoordinate(Planes[i], c) < nr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//public bool ContainsSphere(ref Vector3 c, float cls, float r)
|
||||
//{
|
||||
// //cls = c length squared, for optimization
|
||||
// if (cls < (r * r))
|
||||
// {
|
||||
// return true; //frustrum center is in the sphere
|
||||
// }
|
||||
// float nr = -r;
|
||||
// for (int i = 0; i < 6; i++)
|
||||
// {
|
||||
// if (Plane.DotCoordinate(Planes[i], c) < nr)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
public bool ContainsSphereNoClipNoOpt(ref Vector3 c, float r)
|
||||
{
|
||||
float nr = -r;
|
||||
|
@ -3889,7 +3889,14 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); //now loads from magic
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
|
||||
//save the key for later if it's not saved already. not really ideal to have this in this thread
|
||||
if (string.IsNullOrEmpty(Settings.Default.Key) && (GTA5Keys.PC_AES_KEY != null))
|
||||
{
|
||||
Settings.Default.Key = Convert.ToBase64String(GTA5Keys.PC_AES_KEY);
|
||||
Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user