-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 61169a2
Showing
19 changed files
with
1,523 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Build Patcher | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
name: Build on Windows | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build SharkyPatcher | ||
run: | | ||
dotnet restore | ||
dotnet publish -c Release | ||
Compress-Archive -Path .\SharkyPatcher\bin\Release\net462\publish\* -Destination SharkyPatcher.zip | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SharkyPatcher | ||
path: .\SharkyPatcher\bin\Release\net462\publish\ | ||
- name: Tag Release | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: SharkyPatcher.zip | ||
body_path: RELEASE.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.002.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharkyPatcher", "SharkyPatcher\SharkyPatcher.csproj", "{E500130F-BF96-4B7C-91EF-EC5420FF07C5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E500130F-BF96-4B7C-91EF-EC5420FF07C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E500130F-BF96-4B7C-91EF-EC5420FF07C5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E500130F-BF96-4B7C-91EF-EC5420FF07C5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E500130F-BF96-4B7C-91EF-EC5420FF07C5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {8526ABAA-32DE-4974-A0FE-37C37810F443} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<p align="center"> | ||
<img width="200" height="200" src="https://avatars.githubusercontent.com/u/181893880?s=200&v=4"> | ||
</p> | ||
|
||
# FFXIV Sharky Patcher 🦈 鯊鯊補丁 | ||
|
||
[![GitHub Release](https://img.shields.io/github/v/release/sharkycorps/FFXIVSharkyPatcher)](https://github.com/sharkycorps/FFXIVSharkyPatcher/releases) | ||
[![Build Patcher](https://github.com/sharkycorps/FFXIVSharkyPatcher/actions/workflows/build.yml/badge.svg)](https://github.com/sharkycorps/FFXIVSharkyPatcher/actions/workflows/build.yml) | ||
|
||
Patches which remove unreasonable ToS, analytics, plugin bans and integrity check from Dalamud and XIVLauncher CN. | ||
|
||
鯊鯊補丁的目的是移除 Dalamud 和 XIVLauncher CN 中不合理的服務條款、分析、插件禁令和完整性檢查。 | ||
|
||
## Usage 🦈 使用 | ||
|
||
1. Download the latest `SharkyPatcher.zip` from the [Github Releases](https://github.com/sharkycorps/FFXIVSharkyPatcher/releases) | ||
2. Extract it to the same installation directory as `XIVLauncherCN` or `Dalamud.Updater` | ||
3. Double-click `SharkyPatcher.exe` to automatically apply the patch and launch the corresponding main program | ||
|
||
--- | ||
|
||
1. 從 [Github Releases](https://github.com/sharkycorps/FFXIVSharkyPatcher/releases) 中下載最新的 `SharkyPatcher.zip` | ||
2. 將其解壓到 `XIVLauncherCN` 或者 `Dalamud.Updater` 相同安裝目錄下 | ||
3. 雙擊運行 `SharkyPatcher.exe` 即可自動應用補丁,並啟動相應主程序 | ||
|
||
## Community 🦈 社区 | ||
|
||
Discord:https://discord.gg/6XQbvNgn | ||
|
||
## Safety 🦈 安全性 | ||
### Diffs between goatcorp and ottercorp | ||
|
||
goatcorp 和 ottercorp 代碼的區別如下,sharkycorps 只進行了必要的字节码調整和移除,請自行檢查。 | ||
|
||
https://github.com/goatcorp/Dalamud/compare/master...ottercorp:master | ||
https://github.com/goatcorp/FFXIVQuickLauncher/compare/master...ottercorp:FFXIVQuickLauncher:CN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## 使用方法 | ||
|
||
1. 從下方 `Assets` 文件中下載 `SharkyPatcher.zip` | ||
2. 將其解壓到 `XIVLauncherCN` 或者 `Dalamud.Updater` 相同安裝目錄下 | ||
3. 雙擊運行 `SharkyPatcher.exe` 即可自動應用補丁,並啟動相應主程序 | ||
|
||
## 注意 | ||
|
||
1. 啟動器或者衛月版本更新後,可能需要重新運行補丁 | ||
2. 補丁可以重複運行,自身也可作為啟動器的入口 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# build files | ||
bin | ||
obj | ||
|
||
# log files | ||
*.log | ||
|
||
# Fody - auto-generated XML schema | ||
FodyWeavers.xsd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
| ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using SharkyPatcher.Common; | ||
using SharkyPatcher.Patcher; | ||
using static SharkyPatcher.Common.LoggerUtil; | ||
|
||
namespace SharkyPatcher | ||
{ | ||
class App | ||
{ | ||
static readonly string _launcherName = "XIVLauncherCN.exe"; | ||
static readonly string _launcherCommonName = "XIVLauncher.Common.dll"; | ||
static readonly string _updaterName = "Dalamud.Updater.exe"; | ||
static readonly string _dalamudName = "Dalamud.dll"; | ||
static readonly string _launcherDalamudBaseDir = "Roaming"; | ||
static readonly string _updaterDalamudBaseDir = "XIVLauncher"; | ||
static readonly string _currentDir = Directory.GetCurrentDirectory(); | ||
static async Task Main() | ||
{ | ||
string processToStart = ""; | ||
|
||
try | ||
{ | ||
// render sharky ascii art | ||
SharkyArt.Render(); | ||
Log.Information("【鯊鯊補丁】正在啟動……"); | ||
|
||
// patch xiv launcher | ||
if (CheckExists(_launcherName)) | ||
{ | ||
Log.Information("=============================================================="); | ||
|
||
processToStart = _launcherName; | ||
string launcherVersion = await GetLauncherVersionAsync(); | ||
string commonSubPath = Path.Combine(launcherVersion, _launcherCommonName); | ||
if (CheckExists(commonSubPath)) | ||
{ | ||
BackupFile(commonSubPath); | ||
XIVCommonPatcher launcherPatcher = new XIVCommonPatcher( | ||
Path.Combine(_currentDir, launcherVersion), _launcherCommonName); | ||
launcherPatcher.Patch(); | ||
launcherPatcher.Dispose(); | ||
await PatchDalamud(_launcherDalamudBaseDir, _dalamudName); | ||
} | ||
else | ||
{ | ||
Log.Information($"【鯊鯊補丁】<{launcherVersion}> 下未找到 <{_launcherCommonName}>,請確認目錄是否正確"); | ||
Exit(); | ||
} | ||
} | ||
else if (CheckExists(_updaterName)) | ||
{ | ||
Log.Information("=============================================================="); | ||
|
||
processToStart = _updaterName; | ||
BackupFile(_updaterName); | ||
DUpdaterPatcher updaterPatcher = new DUpdaterPatcher(_currentDir, _updaterName); | ||
updaterPatcher.Patch(); | ||
updaterPatcher.Dispose(); | ||
await PatchDalamud(_updaterDalamudBaseDir, _dalamudName); | ||
} | ||
|
||
if (!string.IsNullOrEmpty(processToStart)) | ||
{ | ||
Log.Information("=============================================================="); | ||
Log.Information("【鯊鯊補丁】補丁全部應用成功!"); | ||
Log.Information("=============================================================="); | ||
StartProcess(processToStart); | ||
Log.Information("=============================================================="); | ||
} | ||
else | ||
{ | ||
LogF.Information($"【鯊鯊補丁】當前目錄:{_currentDir}"); | ||
Log.Information("【鯊鯊補丁】當前目錄下未找到啟動器或者更新器,請確認目錄是否正確"); | ||
Exit(); | ||
} | ||
|
||
ExitSuccess(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.Information("=============================================================="); | ||
Log.Error("【鯊鯊補丁】補丁應用過程中出現異常!"); | ||
Exit(ex); | ||
} | ||
finally | ||
{ | ||
Serilog.Log.CloseAndFlush(); | ||
} | ||
} | ||
|
||
static async Task PatchDalamud(string baseDir, string dalamudName) | ||
{ | ||
Log.Information("=============================================================="); | ||
|
||
DalamudVersionInfo dalamudVersion = await GetDalamudVersionAsync(); | ||
string dalamudPath = Path.Combine(baseDir, @"addon\Hooks", dalamudVersion.AssemblyVersion); | ||
bool dalamudExists = CheckExists(Path.Combine(dalamudPath, dalamudName)); | ||
if (dalamudExists) | ||
{ | ||
BackupFile(Path.Combine(dalamudPath, dalamudName)); | ||
DalamudPatcher patcher = new DalamudPatcher(Path.Combine(_currentDir, baseDir), dalamudVersion); | ||
patcher.Patch(); | ||
patcher.Dispose(); | ||
} | ||
else | ||
{ | ||
Log.Information($"【鯊鯊補丁】<{dalamudPath}> 下未找到 <{dalamudName}>,請確認目錄是否正確"); | ||
Exit(); | ||
} | ||
} | ||
|
||
static async Task<DalamudVersionInfo> GetDalamudVersionAsync() | ||
{ | ||
Log.Information("【鯊鯊補丁】獲取框架版本中……"); | ||
|
||
HttpClient client = new HttpClient { Timeout = TimeSpan.FromMinutes(1) }; | ||
client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue { NoCache = true }; | ||
string versionJson = await client.GetStringAsync("https://aonyx.ffxiv.wang/Dalamud/Release/VersionInfo?track=release").ConfigureAwait(false); | ||
DalamudVersionInfo dalamudVersion = JsonConvert.DeserializeObject<DalamudVersionInfo>(versionJson); | ||
LogF.Information($"【鯊鯊補丁】框架版本:{versionJson}"); | ||
Log.Information($"【鯊鯊補丁】當前 Dalamud 版本:<{dalamudVersion.AssemblyVersion}>"); | ||
|
||
return dalamudVersion; | ||
} | ||
|
||
static async Task<string> GetLauncherVersionAsync() | ||
{ | ||
Log.Information("【鯊鯊補丁】獲取啟動器版本中……"); | ||
|
||
HttpClient client = new HttpClient { Timeout = TimeSpan.FromMinutes(1) }; | ||
client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue { NoCache = true }; | ||
string versionJson = await client.GetStringAsync("https://aonyx.ffxiv.wang/Launcher/GetLease").ConfigureAwait(false); | ||
JObject launcherVersion = JObject.Parse(versionJson); | ||
string releasesList = launcherVersion.GetValue("releasesList").Value<string>(); | ||
string latestRelease = releasesList.Split('\n').Last(); | ||
string nupkgVersion = latestRelease.Split().ElementAt(1); | ||
string appVersion = nupkgVersion.Replace("XIVLauncherCN", "app") | ||
.Replace("-full.nupkg", "") | ||
.Replace("-delta.nupkg", ""); | ||
LogF.Information($"【鯊鯊補丁】啟動器版本:{releasesList}"); | ||
Log.Information($"【鯊鯊補丁】當前啟動器版本:<{appVersion}>"); | ||
|
||
return appVersion; | ||
} | ||
|
||
static void StartProcess(string fileName) { | ||
string programPath = Path.Combine(_currentDir, fileName); | ||
ProcessStartInfo startInfo = new ProcessStartInfo | ||
{ | ||
FileName = programPath, | ||
UseShellExecute = true | ||
}; | ||
|
||
Process process = Process.Start(startInfo); | ||
if (process != null) | ||
{ | ||
Log.Information($"【鯊鯊補丁】<{fileName}> 已啟動"); | ||
} | ||
else | ||
{ | ||
Log.Error($"【鯊鯊補丁】<{fileName}> 啟動失敗,請嘗試手動啟動"); | ||
} | ||
} | ||
|
||
static bool CheckExists(string fileName) | ||
{ | ||
string filePath = Path.Combine(_currentDir, fileName); | ||
bool fileExists = File.Exists(filePath); | ||
if (!fileExists) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
static void BackupFile(string fileName) { | ||
string filePath = Path.Combine(_currentDir, fileName); | ||
|
||
try | ||
{ | ||
string bakFilePath = filePath + ".spbak"; | ||
bool bakFileExists = File.Exists(bakFilePath); | ||
if (!bakFileExists) | ||
{ | ||
File.Copy(filePath, bakFilePath, overwrite: true); | ||
Log.Information($"【鯊鯊補丁】<{fileName}> 備份文件已創建"); | ||
} | ||
else | ||
{ | ||
Log.Information($"【鯊鯊補丁】<{fileName}> 備份文件已存在"); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.Error("【鯊鯊補丁】備份文件創建失敗!"); | ||
Exit(ex); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace SharkyPatcher.Common | ||
{ | ||
public class DalamudVersionInfo | ||
{ | ||
public string AssemblyVersion { get; set; } | ||
public string SupportedGameVer { get; set; } | ||
public string RuntimeVersion { get; set; } | ||
public bool RuntimeRequired { get; set; } | ||
public string Key { get; set; } | ||
public string DownloadUrl { get; set; } | ||
public string Hash { get; set;} | ||
} | ||
} |
Oops, something went wrong.