mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 20:57:47 +00:00
Started work on the launcher/patcher editor.
This commit is contained in:
parent
f4e238f4be
commit
8499eeff39
5 changed files with 245 additions and 0 deletions
|
@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FFXIVClassic World Server",
|
|||
{3A3D6626-C820-4C18-8C81-64811424F20E} = {3A3D6626-C820-4C18-8C81-64811424F20E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher Editor", "Launcher Editor\Launcher Editor.csproj", "{0FFA9D2F-41C6-443C-99B7-665702CF548F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -42,6 +44,10 @@ Global
|
|||
{3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
6
Launcher Editor/App.config
Normal file
6
Launcher Editor/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
60
Launcher Editor/Launcher Editor.csproj
Normal file
60
Launcher Editor/Launcher Editor.csproj
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{0FFA9D2F-41C6-443C-99B7-665702CF548F}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Launcher_Editor</RootNamespace>
|
||||
<AssemblyName>Launcher Editor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
137
Launcher Editor/Program.cs
Normal file
137
Launcher Editor/Program.cs
Normal file
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Launcher_Editor
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine(FFXIVLoginStringDecodeBinary("C:\\Program Files (x86)\\SquareEnix\\FINAL FANTASY XIV\\ffxivlogin.exe"));
|
||||
}
|
||||
|
||||
public static string FFXIVLoginStringDecodeBinary(string path)
|
||||
{
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
//int offset = 0x5405a;
|
||||
//int offset = 0x5425d;
|
||||
int offset = 0x53ea0;
|
||||
while (true)
|
||||
{
|
||||
string result = "";
|
||||
uint key = (uint)data[offset + 0] << 8 | data[offset + 1];
|
||||
uint key2 = data[offset + 2];
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
key2 = key2 ^ key;
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
uint finalKey = key;
|
||||
key = data[offset + 3];
|
||||
uint count = (key2 & 0xFF) << 8;
|
||||
key = key ^ finalKey;
|
||||
key &= 0xFF;
|
||||
count |= key;
|
||||
|
||||
int count2 = 0;
|
||||
while (count != 0)
|
||||
{
|
||||
uint encrypted = data[offset + 4 + count2];
|
||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
||||
finalKey -= 0x22AF;
|
||||
finalKey &= 0xFFFF;
|
||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
||||
|
||||
result += (char)encrypted;
|
||||
count--;
|
||||
count2++;
|
||||
}
|
||||
|
||||
offset += 4 + count2;
|
||||
}
|
||||
}
|
||||
|
||||
public static string FFXIVLoginStringDecode(byte[] data)
|
||||
{
|
||||
string result = "";
|
||||
uint key = (uint)data[0] << 8 | data[1];
|
||||
uint key2 = data[2];
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key2 = key2 ^ key;
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
uint finalKey = key;
|
||||
key = data[3];
|
||||
uint count = (key2 & 0xFF) << 8;
|
||||
key = key ^ finalKey;
|
||||
key &= 0xFF;
|
||||
count |= key;
|
||||
|
||||
int count2 = 0;
|
||||
while (count != 0)
|
||||
{
|
||||
uint encrypted = data[4 + count2];
|
||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
||||
finalKey -= 0x22AF;
|
||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
||||
result += (char)encrypted;
|
||||
count--;
|
||||
count2++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte[] FFXIVLoginStringEncode(uint key, string text)
|
||||
{
|
||||
key = key & 0xFFFF;
|
||||
|
||||
uint count = 0;
|
||||
byte[] asciiBytes = Encoding.ASCII.GetBytes(text);
|
||||
byte[] result = new byte[4 + text.Length];
|
||||
for (count = 0; count < text.Length; count++)
|
||||
{
|
||||
result[result.Length - count - 1] = (byte)(asciiBytes[asciiBytes.Length - count - 1] ^ (key & 0xFF));
|
||||
key += 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
}
|
||||
|
||||
count = count ^ key;
|
||||
result[3] = (byte)(count & 0xFF);
|
||||
|
||||
key += 0x22AF & 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
|
||||
result[2] = (byte)(key & 0xFF);
|
||||
|
||||
key += 0x22AF & 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
|
||||
|
||||
result[1] = (byte)(key & 0xFF);
|
||||
result[0] = (byte)((key >> 8) & 0xFF);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint RotateLeft(uint value, int bits)
|
||||
{
|
||||
return (value << bits) | (value >> (16 - bits));
|
||||
}
|
||||
|
||||
public static uint RotateRight(uint value, int bits)
|
||||
{
|
||||
return (value >> bits) | (value << (16 - bits));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
Launcher Editor/Properties/AssemblyInfo.cs
Normal file
36
Launcher Editor/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("Launcher Editor")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Launcher Editor")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[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("0ffa9d2f-41c6-443c-99b7-665702cf548f")]
|
||||
|
||||
// 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")]
|
Loading…
Add table
Reference in a new issue