Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 100c93e8da | |||
| 1e17f76340 | |||
| 1f9c95d6ac |
Binary file not shown.
@@ -25,11 +25,10 @@ export function CutData(gamePath) {
|
||||
/**
|
||||
* @param {string} gamePath
|
||||
* @param {string} patchPath
|
||||
* @param {boolean} isSkipVerify
|
||||
* @returns {$CancellablePromise<[boolean, string]>}
|
||||
*/
|
||||
export function DataExtract(gamePath, patchPath, isSkipVerify) {
|
||||
return $Call.ByID(2161622254, gamePath, patchPath, isSkipVerify);
|
||||
export function DataExtract(gamePath, patchPath) {
|
||||
return $Call.ByID(2161622254, gamePath, patchPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,9 +58,8 @@ export function LDiffPatchData(gamePath) {
|
||||
/**
|
||||
* @param {string} gamePath
|
||||
* @param {string} patchPath
|
||||
* @param {boolean} isNeedHDiff
|
||||
* @returns {$CancellablePromise<[boolean, string]>}
|
||||
*/
|
||||
export function VersionValidate(gamePath, patchPath, isNeedHDiff) {
|
||||
return $Call.ByID(2105077257, gamePath, patchPath, isNeedHDiff);
|
||||
export function VersionValidate(gamePath, patchPath) {
|
||||
return $Call.ByID(2105077257, gamePath, patchPath);
|
||||
}
|
||||
|
||||
@@ -4,20 +4,15 @@ import { RouterProvider, createRouter } from '@tanstack/react-router'
|
||||
import './styles/index.css'
|
||||
import "../runtime.js"
|
||||
import "@wailsio/runtime";
|
||||
// Import the generated route tree
|
||||
import { routeTree } from './routeTree.gen.js'
|
||||
|
||||
// Create a new router instance
|
||||
const router = createRouter({ routeTree })
|
||||
|
||||
// Register the router instance for type safety
|
||||
declare module '@tanstack/react-router' {
|
||||
interface Register {
|
||||
router: typeof router
|
||||
}
|
||||
}
|
||||
|
||||
// Render the app
|
||||
const rootElement = document.getElementById('root')!
|
||||
if (!rootElement.innerHTML) {
|
||||
const root = ReactDOM.createRoot(rootElement)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Link } from "@tanstack/react-router";
|
||||
export default function AboutPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-base-200 flex items-center justify-center p-6">
|
||||
<div className="max-w-3xl w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-6">
|
||||
<div className="w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-6">
|
||||
<h1 className="text-4xl font-bold text-primary text-center">About</h1>
|
||||
|
||||
<div className="space-y-4">
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Link } from '@tanstack/react-router';
|
||||
export default function AnalysisPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-base-200 flex items-center justify-center p-6">
|
||||
<div className="max-w-4xl w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<div className="w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<h1 className="text-4xl font-bold text-primary text-center">
|
||||
Firefly Analysis & Veritas Plugin
|
||||
</h1>
|
||||
@@ -144,7 +144,7 @@ export default function AnalysisPage() {
|
||||
<div className="space-y-2 text-purple-700">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="font-medium min-w-[20px] text-purple-600">1.</span>
|
||||
<p>Launch the <span className="font-semibold">game</span> and your <span className="font-semibold">Firefly Private Server (PS)</span>.</p>
|
||||
<p>Launch the <span className="font-semibold">game</span> and your <span className="font-semibold">Firefly GO Server (PS)</span>.</p>
|
||||
</div>
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="font-medium min-w-[20px] text-purple-600">2.</span>
|
||||
|
||||
@@ -131,15 +131,13 @@ export default function DiffPage() {
|
||||
setStageType('Version Validate')
|
||||
setProgressUpdate(0)
|
||||
setMaxProgressUpdate(1)
|
||||
const isNeedHDiff = validType !== 'hdiffmap.json'
|
||||
const [validVersion, errorVersion] = await DiffService.VersionValidate(gameDir, diffDir, isNeedHDiff)
|
||||
const [validVersion, errorVersion] = await DiffService.VersionValidate(gameDir, diffDir)
|
||||
if (!handleResult(validVersion, errorVersion)) return
|
||||
setProgressUpdate(1)
|
||||
}
|
||||
|
||||
const isSkipVerify = ['manifest', 'hdifffiles.txt', 'hdifffiles.json'].includes(validType)
|
||||
setStageType('Data Extract')
|
||||
const [validData, errorData] = await DiffService.DataExtract(gameDir, diffDir, isSkipVerify)
|
||||
const [validData, errorData] = await DiffService.DataExtract(gameDir, diffDir)
|
||||
if (!handleResult(validData, errorData)) return
|
||||
|
||||
setStageType('Cut Data')
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { Link } from "@tanstack/react-router";
|
||||
|
||||
export default function SrToolsPage() {
|
||||
export default function FireflyToolsPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-base-200 flex items-center justify-center p-6">
|
||||
<div className="max-w-4xl w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<h1 className="text-4xl font-bold text-primary text-center">SR Tools</h1>
|
||||
<div className="w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<h1 className="text-4xl font-bold text-primary text-center">Firefly Tools</h1>
|
||||
|
||||
{/* Section 1: About SR Tools */}
|
||||
<div className="bg-blue-50 border-l-4 border-blue-400 p-6 rounded-r-lg">
|
||||
<h2 className="text-2xl font-bold text-blue-800 flex items-center gap-2 mb-4">
|
||||
<span>ℹ️</span>
|
||||
<span>About SR Tools</span>
|
||||
<span>About Firefly Tools</span>
|
||||
</h2>
|
||||
<div className="space-y-3 text-blue-700">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-blue-600 text-lg">🏠</div>
|
||||
<p>
|
||||
This site is a another version of {" "}
|
||||
<span className="font-semibold text-success">SR Tools {" "}</span>
|
||||
<span className="font-semibold text-success">Firefly Tools {" "}</span>
|
||||
developed by {" "}
|
||||
<span className="font-semibold text-warning">Me {"(Kain)"}</span>
|
||||
</p>
|
||||
@@ -95,9 +95,24 @@ export default function SrToolsPage() {
|
||||
</div>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-green-600 text-lg">🔌</div>
|
||||
<p>Instantly apply setups to <span className="font-semibold text-warning">Firefly Private Server</span> using <span className="font-semibold">Connect PS</span> — no manual file uploads required.</p>
|
||||
<p>Instantly apply setups to <span className="font-semibold text-warning">Firefly GO Server</span> using <span className="font-semibold">Connect PS</span> — no manual file uploads required.</p>
|
||||
</div>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-green-600 text-2xl">✨</div>
|
||||
<div>
|
||||
<h4 className="font-semibold text-green-800 text-lg">Extra Settings</h4>
|
||||
<p className="text-green-700 mt-1">
|
||||
Enhance your <span className="font-semibold text-warning">Firefly GO Server</span> experience with extra features:
|
||||
</p>
|
||||
<ul className="list-disc list-inside mt-2 space-y-1 text-green-700">
|
||||
<li>🎭 <span className="font-medium">Hidden Game UI</span> — remove the entire game interface.</li>
|
||||
<li>🚫 <span className="font-medium">Disable Censorship</span> — get rid of Lens Flare censor 💀.</li>
|
||||
<li>🧪 <span className="font-medium">Theorycraft Mode</span> — configure HP, cycles, and more via the web.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-green-600 text-lg">📂</div>
|
||||
<p>Export and import full builds using <code className="bg-gray-200 px-2 py-1 rounded text-sm">freesr-data.json</code>.</p>
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@ import { Link } from '@tanstack/react-router';
|
||||
export default function HowToPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-base-200 flex items-center justify-center p-6">
|
||||
<div className="max-w-4xl w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<div className=" w-full bg-base-100 shadow-xl rounded-2xl p-8 space-y-8">
|
||||
<h1 className="text-4xl font-bold text-primary text-center">How to Use</h1>
|
||||
|
||||
{/* Section 1: Launcher Features */}
|
||||
@@ -28,13 +28,23 @@ export default function HowToPage() {
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-green-600 text-lg">📦</div>
|
||||
<p>Patch and update game files using{" "}
|
||||
<a href="/hdiff" className="link link-info font-mono">Hdiffz Tool</a>
|
||||
{" "}(HDiffPatch) — fast & lightweight incremental updates.
|
||||
<div className="text-green-600 text-2xl">📦</div>
|
||||
<div>
|
||||
<p className="text-green-800 font-semibold">
|
||||
Patch & Update Game Files
|
||||
</p>
|
||||
<p className="text-green-700">
|
||||
Use the{" "}
|
||||
<a href="/diff" className="link link-info font-mono">Diff Tool</a>{" "}
|
||||
(<span className="font-medium">DiffPatch</span>) for fast & lightweight incremental updates.
|
||||
</p>
|
||||
<p className="text-green-700 mt-1">
|
||||
Supports <span className="font-semibold">Hdiff</span>, <span className="font-semibold">Ldiff</span>, and custom diff formats.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Section 2: FireflyGo Commands */}
|
||||
@@ -65,8 +75,60 @@ export default function HowToPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-blue-600 text-lg">✨</div>
|
||||
<div className="flex-1">
|
||||
<h4 className="font-semibold text-blue-800 mb-1">Extra Settings</h4>
|
||||
|
||||
<div className="space-y-4 text-blue-700 text-sm">
|
||||
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||||
<h5 className="font-semibold text-blue-800 flex items-center gap-2">
|
||||
🎭 Hidden UI
|
||||
</h5>
|
||||
<p className="mt-1">
|
||||
Instantly hides the entire game UI — often used in DIM showcase videos.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||||
<h5 className="font-semibold text-blue-800 flex items-center gap-2">
|
||||
🚫 Disable Censorship
|
||||
</h5>
|
||||
<p className="mt-1">
|
||||
Remove the Lens Flare censor effect 💀 for a cleaner experience.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||||
<h5 className="font-semibold text-blue-800 flex items-center gap-2">
|
||||
🧪 Theorycraft Mode
|
||||
</h5>
|
||||
<p className="mt-1">
|
||||
No need to type chat commands anymore — configure everything through the
|
||||
web: adjust monster HP, set cycles, view logs, and more.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="mt-4 aspect-w-16 aspect-h-9">
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/uiKdFrvn9NQ"
|
||||
title="Extra Settings Tutorial"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
className="rounded-lg w-full h-[300px]"
|
||||
></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Commands List */}
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4 mt-4">
|
||||
<h3 className="text-lg font-semibold text-blue-800">Available Commands:</h3>
|
||||
|
||||
{/* Theorycraft Toggle */}
|
||||
@@ -103,16 +165,28 @@ export default function HowToPage() {
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="text-blue-600 text-lg">❤️</div>
|
||||
<div className="flex-1">
|
||||
<h4 className="font-semibold text-blue-800 mb-1">HP Override <span className="text-red-600 text-sm">(Theorycraft only)</span></h4>
|
||||
<div className="space-y-1 text-blue-700">
|
||||
<p><code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp WAVE HP</code> — Set monster HP for a specific wave</p>
|
||||
<p className="text-sm">Example: <code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp 1 2000000</code> sets Wave 1 monster HP to 2,000,000</p>
|
||||
<p className="text-sm"><code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp 0</code> disables HP override</p>
|
||||
<h4 className="font-semibold text-blue-800 mb-1">
|
||||
HP Override <span className="text-red-600 text-sm">(Theorycraft only)</span>
|
||||
</h4>
|
||||
<div className="space-y-2 text-blue-700 text-sm">
|
||||
<p>
|
||||
<code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp N</code> — Set monster HP (only available in Theorycraft mode)
|
||||
</p>
|
||||
<p>
|
||||
<code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp 0</code> — Disable the set HP feature
|
||||
</p>
|
||||
<p>
|
||||
<code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp Wave V1 V2 ...</code> — Set HP for each monster in a specific wave
|
||||
</p>
|
||||
<p className="ml-4">
|
||||
Example: <code className="bg-blue-100 px-1 py-0.5 rounded text-sm">/hp 1 2000000 3000000</code> sets wave 1 monster1 HP=2,000,000 and monster2 HP=3,000,000
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{/* Log Command */}
|
||||
<div className="bg-white border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-start gap-3">
|
||||
|
||||
@@ -71,7 +71,7 @@ function RootLayout() {
|
||||
</Link>
|
||||
</div>
|
||||
<div className="navbar-center hidden md:flex">
|
||||
<ul className="menu menu-horizontal px-1">
|
||||
<ul className="menu menu-horizontal px-1 gap-4">
|
||||
<li><Link to="/">Home</Link></li>
|
||||
<li>
|
||||
<details>
|
||||
@@ -87,7 +87,7 @@ function RootLayout() {
|
||||
<summary>Plugins</summary>
|
||||
<ul className="p-2">
|
||||
<li><Link to="/analysis">Analysis (Veritas)</Link></li>
|
||||
<li><Link to="/srtools">SrTools</Link></li>
|
||||
<li><Link to="/srtools">Firefly Tools</Link></li>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SrToolsPage from '@/pages/srtools'
|
||||
import FireflyToolsPage from '@/pages/fireflytools'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/srtools')({
|
||||
component: SrToolsPage,
|
||||
component: FireflyToolsPage,
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -35,13 +35,11 @@ func (h *DiffService) CheckTypeHDiff(patchPath string) (bool, string, string) {
|
||||
return false, "", "not found hdifffiles.txt or hdiffmap.json"
|
||||
}
|
||||
|
||||
func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bool) (bool, string) {
|
||||
func (h *DiffService) VersionValidate(gamePath, patchPath string) (bool, string) {
|
||||
oldBinPath := filepath.Join(gamePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
||||
oldVersionData, err := models.ParseBinaryVersion(oldBinPath)
|
||||
if err != nil {
|
||||
if _, err := os.Stat(oldBinPath); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
if _, err := os.Stat(patchPath); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
@@ -52,38 +50,33 @@ func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bo
|
||||
}
|
||||
}
|
||||
|
||||
if !isNeedHDiff {
|
||||
okFull, errFull := sevenzip.IsFileIn7z(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
||||
okDiff, errDiff := sevenzip.IsFileIn7z(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes.hdiff")
|
||||
|
||||
if (errFull != nil && errDiff != nil) || (!okFull && !okDiff) {
|
||||
return false, "BinaryVersion file not found in patch"
|
||||
}
|
||||
|
||||
var tempBinFile string
|
||||
|
||||
if okFull {
|
||||
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes", constant.TempUrl); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
binPath := filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||
newVersionData, err := models.ParseBinaryVersion(binPath)
|
||||
if err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
defer os.Remove(binPath)
|
||||
|
||||
v := newVersionData.Subtract(oldVersionData)
|
||||
if v != 0 && v != 1 {
|
||||
return false, fmt.Sprintf("the diff version %s not valid with game version %s", newVersionData, oldVersionData)
|
||||
}
|
||||
|
||||
return true, "validated"
|
||||
}
|
||||
|
||||
tempBinFile = filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||
} else {
|
||||
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes.hdiff", constant.TempUrl); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
patchBinFile := filepath.Join(constant.TempUrl, "BinaryVersion.bytes.hdiff")
|
||||
sourceBinFile := filepath.Join(gamePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
||||
tempBinFile := filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||
sourceBinFile := oldBinPath
|
||||
tempBinFile = filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||
if err := hpatchz.ApplyPatch(sourceBinFile, patchBinFile, tempBinFile); err != nil {
|
||||
os.Remove(patchBinFile)
|
||||
return false, err.Error()
|
||||
}
|
||||
os.Remove(patchBinFile)
|
||||
}
|
||||
|
||||
okFullPkg, err1 := sevenzip.IsFileIn7z(patchPath, "pkg_version")
|
||||
okDiffPkg, err2 := sevenzip.IsFileIn7z(patchPath, "pkg_version.hdiff")
|
||||
@@ -96,7 +89,6 @@ func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bo
|
||||
}
|
||||
}
|
||||
if okDiffPkg {
|
||||
|
||||
if err := sevenzip.ExtractAFileFromZip(patchPath, "pkg_version.hdiff", constant.TempUrl); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
@@ -119,8 +111,11 @@ func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bo
|
||||
}
|
||||
os.Remove(tempPkgFile)
|
||||
|
||||
// MD5 check BinaryVersion
|
||||
flags := false
|
||||
for _, pkgData := range pkgDataList {
|
||||
if filepath.ToSlash(pkgData.RemoteFile) == "StarRail_Data/StreamingAssets/BinaryVersion.bytes" {
|
||||
flags = true
|
||||
md5, err := verifier.FileMD5(tempBinFile)
|
||||
if err != nil {
|
||||
os.Remove(tempBinFile)
|
||||
@@ -134,15 +129,18 @@ func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bo
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !flags {
|
||||
os.Remove(tempBinFile)
|
||||
return false, "BinaryVersion file not found in patch"
|
||||
}
|
||||
_, err = models.ParseBinaryVersion(tempBinFile)
|
||||
if err != nil {
|
||||
os.Remove(tempBinFile)
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
os.Remove(tempBinFile)
|
||||
return true, "validated"
|
||||
|
||||
}
|
||||
|
||||
func (h *DiffService) HDiffPatchData(gamePath string) (bool, string) {
|
||||
|
||||
@@ -2,15 +2,15 @@ package diffService
|
||||
|
||||
import (
|
||||
"firefly-launcher/pkg/constant"
|
||||
"firefly-launcher/pkg/verifier"
|
||||
"firefly-launcher/pkg/sevenzip"
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"io"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
func (h *DiffService) DataExtract(gamePath, patchPath string, isSkipVerify bool) (bool, string) {
|
||||
func (h *DiffService) DataExtract(gamePath, patchPath string) (bool, string) {
|
||||
os.RemoveAll(constant.TempUrl)
|
||||
if _, err := os.Stat(gamePath); err != nil {
|
||||
return false, err.Error()
|
||||
@@ -30,20 +30,7 @@ func (h *DiffService) DataExtract(gamePath, patchPath string, isSkipVerify bool)
|
||||
os.RemoveAll(constant.TempUrl)
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
if !isSkipVerify {
|
||||
validator, err := verifier.NewVerifier(gamePath, constant.TempUrl)
|
||||
if err != nil {
|
||||
os.RemoveAll(constant.TempUrl)
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
if err := validator.VerifyAll(); err != nil {
|
||||
os.RemoveAll(constant.TempUrl)
|
||||
return false, err.Error()
|
||||
}
|
||||
}
|
||||
return true, "validated"
|
||||
return true, "extract completed"
|
||||
}
|
||||
|
||||
func (h *DiffService) CutData(gamePath string) (bool, string) {
|
||||
|
||||
@@ -13,16 +13,34 @@ import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
)
|
||||
|
||||
func HumanFormat(bytes float64) string {
|
||||
for _, unit := range []string{"", "Ki", "Mi", "Gi"} {
|
||||
if math.Abs(bytes) < 1024.0 {
|
||||
return fmt.Sprintf("%3.1f%sB", bytes, unit)
|
||||
if math.IsNaN(bytes) || math.IsInf(bytes, 0) {
|
||||
return fmt.Sprintf("%v", bytes)
|
||||
}
|
||||
bytes /= 1024.0
|
||||
if bytes == 0 {
|
||||
return "0B"
|
||||
}
|
||||
return fmt.Sprintf("%.1fTiB", bytes)
|
||||
|
||||
neg := bytes < 0
|
||||
if neg {
|
||||
bytes = -bytes
|
||||
}
|
||||
|
||||
units := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"}
|
||||
i := 0
|
||||
for bytes >= 1024 && i < len(units)-1 {
|
||||
bytes /= 1024
|
||||
i++
|
||||
}
|
||||
|
||||
res := fmt.Sprintf("%.1f%s", bytes, units[i])
|
||||
if neg {
|
||||
res = "-" + res
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
type WriteCounter struct {
|
||||
@@ -53,14 +71,13 @@ func (wc *WriteCounter) PrintProgress() {
|
||||
if elapsed < 0.001 {
|
||||
elapsed = 0.001
|
||||
}
|
||||
speed := float64(wc.Total) / 1024 / 1024 / elapsed
|
||||
speed := float64(wc.Total) / elapsed
|
||||
percent := float64(wc.Total) / float64(wc.TotalSize) * 100
|
||||
if wc.OnEmit != nil {
|
||||
wc.OnEmit(percent, fmt.Sprintf("%s/s", HumanFormat(speed)))
|
||||
}
|
||||
}
|
||||
|
||||
// --- DownloadFileParallel ---
|
||||
func (g *GitService) downloadFileParallel(filePath, url string, numParts int, onEmit func(percent float64, speed string)) (tmpPath string, err error) {
|
||||
resp, err := http.Head(url)
|
||||
if err != nil {
|
||||
|
||||
1
main.go
1
main.go
@@ -98,7 +98,6 @@ func main() {
|
||||
DevToolsEnabled: true,
|
||||
})
|
||||
|
||||
|
||||
err = app.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
@@ -10,7 +10,7 @@ const ProxyZipFile = "64bit.zip"
|
||||
const LauncherFile = "firefly-launcher.exe"
|
||||
const TempUrl = "./temp"
|
||||
|
||||
const CurrentLauncherVersion = "1.7.0"
|
||||
const CurrentLauncherVersion = "1.9.0"
|
||||
|
||||
type ToolFile string
|
||||
|
||||
@@ -19,15 +19,13 @@ const (
|
||||
Tool7zaDLL ToolFile = "bin/7za.dll"
|
||||
Tool7zxaDLL ToolFile = "bin/7zxa.dll"
|
||||
ToolHPatchzExe ToolFile = "bin/hpatchz.exe"
|
||||
ToolHDiffzExe ToolFile = "bin/hdiffz.exe"
|
||||
)
|
||||
|
||||
var RequiredFiles = map[ToolFile]string{
|
||||
Tool7zaExe: "assets/7zip/7za.exe",
|
||||
Tool7zaDLL: "assets/7zip/7za.dll",
|
||||
Tool7zxaDLL: "assets/7zip/7zxa.dll",
|
||||
ToolHPatchzExe: "assets/HDiffPatch/hpatchz.exe",
|
||||
ToolHDiffzExe: "assets/HDiffPatch/hdiffz.exe",
|
||||
Tool7zaExe: "assets/7za.exe",
|
||||
Tool7zaDLL: "assets/7za.dll",
|
||||
Tool7zxaDLL: "assets/7zxa.dll",
|
||||
ToolHPatchzExe: "assets/hpatchz.exe",
|
||||
}
|
||||
|
||||
func (t ToolFile) GetEmbedPath() string {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type BinaryVersion struct {
|
||||
@@ -24,45 +23,25 @@ func ParseBinaryVersion(path string) (*BinaryVersion, error) {
|
||||
}
|
||||
|
||||
content := string(data)
|
||||
fmt.Println(content)
|
||||
|
||||
lastDash := strings.LastIndex(content, "-")
|
||||
if lastDash == -1 {
|
||||
return nil, errors.New("no dash found in version string")
|
||||
}
|
||||
|
||||
secondLastDash := strings.LastIndex(content[:lastDash], "-")
|
||||
if secondLastDash == -1 {
|
||||
return nil, errors.New("only one dash found in version string")
|
||||
}
|
||||
|
||||
versionSlice := content[secondLastDash+1 : lastDash]
|
||||
re := regexp.MustCompile(`^([A-Za-z]+)([\d\.]+)$`)
|
||||
matches := re.FindStringSubmatch(versionSlice)
|
||||
if len(matches) < 3 {
|
||||
re := regexp.MustCompile(`([A-Za-z]+)(\d+)(?:\.(\d+))?(?:\.(\d+))?`)
|
||||
matches := re.FindStringSubmatch(content)
|
||||
if len(matches) < 2 {
|
||||
return nil, errors.New("invalid version format")
|
||||
}
|
||||
|
||||
binaryVersion := BinaryVersion{
|
||||
Name: matches[1],
|
||||
}
|
||||
numbers := strings.Split(matches[2], ".")
|
||||
|
||||
if len(numbers) > 0 {
|
||||
binaryVersion.Major, err = strconv.Atoi(numbers[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if matches[2] != "" {
|
||||
binaryVersion.Major, _ = strconv.Atoi(matches[2])
|
||||
}
|
||||
if len(matches) > 3 && matches[3] != "" {
|
||||
binaryVersion.Minor, _ = strconv.Atoi(matches[3])
|
||||
}
|
||||
if len(numbers) > 1 {
|
||||
binaryVersion.Minor, err = strconv.Atoi(numbers[1])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if len(numbers) > 2 {
|
||||
binaryVersion.Patch, err = strconv.Atoi(numbers[2])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(matches) > 4 && matches[4] != "" {
|
||||
binaryVersion.Patch, _ = strconv.Atoi(matches[4])
|
||||
}
|
||||
|
||||
binaryVersion.Data = data
|
||||
|
||||
Reference in New Issue
Block a user