2026-10-30 21:09:45 +07:00
# 🚀 G-Launcher
<div align="center">

**A lightweight, modern, and high-performance game launcher for Anime & Hoyoverse games.**
Built with **Go** , **Wails v3** , **React 19** , and **Tailwind CSS v4** .
[](https://go.dev/)
[](https://v3.wails.io/)
[](https://react.dev/)
[](https://www.typescriptlang.org/)
[](https://tailwindcss.com/)
[](https://opensource.org/licenses/MIT)
[English ](#-english ) | [ภาษาไทย ](#-ภาษาไทย )
</div>
---
## 🇹🇭 ภาษาไทย
### ✨ ฟีเจอร์เด่น (Key Features)
* **🎮 Game Process & Environment Management:**
* ตรวจสอบและเปิดเกมพร้อมพารามิเตอร์ที่ถูกต้องผ่านระบบจัดการ Console ของ Windows (`CREATE_NEW_CONSOLE | CREATE_BREAKAWAY_FROM_JOB` )
* ตรวจจับสถานะการทำงานของตัวเกมและเซิร์ฟเวอร์แบบ Real-time พร้อมแจ้งเตือนเมื่อเกมปิดตัวลง
* **🌐 ระบบหลายภาษา (Multi-Language UI & Game Patcher):**
* หน้า UI รองรับ **ภาษาไทย (TH)** , **English (EN)** , **日本語 (JA)** , **한국어 (KO)** , **Tiếng Việt (VI)** , และ **中文 (ZH)**
* เครื่องมือสลับภาษาภายในเกมผ่าน Binary `ExcelData` Patcher (EN, JP, CN, KR) และรองรับ Thai Mod Pack สำหรับตัวเกม Beta
* **📦 ระบบอัปเดตไฟล์เกมแบบลดขนาด (Incremental Diff Patching):**
* รองรับไฟล์อัปเดตแบบ **HDiffPatch** โดยตรงจาก Chunk Protobuf Manifest ของเกม (`proto/firefly.proto` )
* รองรับการลงแพตช์ไฟล์นามสกุล `.ziff` ด้วย **Zift Tool** (`zift.exe` )
* ตรวจสอบความถูกต้องของไฟล์ผ่าน Checksum (MD5 / SHA-256)
* **🔄 ระบบอัปเดต Launcher อัตโนมัติ (Smart Self-Update):**
* อัปเดตผ่าน Manifest `latest.json` พร้อมตรวจสอบความสมบูรณ์ด้วย SHA-256
* มีระบบ Fallback ไปยัง Gitea/GitHub Releases API
* ป้องกันการทับไฟล์ในโหมด Development อัตโนมัติ
* **🛡️ ความปลอดภัยของข้อมูล (Safe Data & Atomic Operations):**
* จดจำโฟลเดอร์เกมใน AppData (`%APPDATA%/g-launcher/game-selection.json` ) ด้วย Windows API `MoveFileEx` แบบ Atomic ป้องกันไฟล์เสียหาย
* สำรองไฟล์ตัวจริงเป็น `.backup` ก่อนลงแพตช์ และมีระบบ Rollback คืนสภาพไฟล์อัตโนมัติหากการลงแพตช์ล้มเหลว
* **🧰 พร้อมใช้งานแบบไม่ต้องติดตั้งเครื่องมือเสริม (Zero-Dependency):**
* **Portable MinGit:** ดาวน์โหลด Git แบบพกพามาติดตั้งในตัวอัตโนมัติหากตรวจไม่พบ Git ในเครื่องผู้ใช้
* บรรจุ Binary Tools สำคัญ (`7za.exe` , `hpatchz.exe` , `zift.exe` ) ไว้ในตัวโปรแกรมและแตกไฟล์ใช้งานอัตโนมัติ
* **🎨 ปรับแต่งหน้าตาได้ตามใจ (Customization & Themes):**
* หน้าต่างไร้ขอบ (Frameless Glassmorphism) พร้อมถาดระบบ (System Tray Menu)
* ระบบเปลี่ยนภาพพื้นหลัง (Background Selector) รองรับทั้งคลังภาพในตัว, อัปโหลดจากเครื่อง หรือใส่ Image URL
---
### 🏗️ สถาปัตยกรรมระบบ (Architecture)
```mermaid
2026-10-30 22:58:24 +07:00
graph TD
subgraph Frontend [Frontend Layer: React 19 and TypeScript]
UI[UI Pages and Modals]
Router[TanStack Router]
Store[Zustand Stores]
I18n[i18next Locales]
Bindings[TypeScript Bindings]
2026-10-30 21:12:01 +07:00
UI --> Router
Router --> Store
Store --> Bindings
2026-10-30 21:09:45 +07:00
UI --> I18n
end
2026-10-30 22:58:24 +07:00
subgraph IPCBridgeLayer [Wails v3 IPC Gateway]
IPCBridge[Bidirectional Events and RPC Bindings]
2026-10-30 21:09:45 +07:00
end
2026-10-30 22:58:24 +07:00
subgraph BackendServices [Backend Services: Go 1.24]
AppSvc[AppService - Window Controls]
FSSvc[FSService - Process and Storage]
GitSvc[GitService - Update and MinGit]
DiffSvc[DiffService - HDiff and Zift]
LangSvc[LanguageService - Excel and Mod]
2026-10-30 21:09:45 +07:00
end
2026-10-30 22:58:24 +07:00
subgraph WindowsHost [Windows Host and Game Storage]
GameExe[Game Process: StarRail.exe]
GameFiles[Game Assets and Backup Files]
ConfigDir[User Config in APPDATA]
ToolsDir[Tools: MinGit, 7za, Zift]
2026-10-30 21:09:45 +07:00
end
2026-10-30 21:12:01 +07:00
Bindings <--> IPCBridge
IPCBridge <--> AppSvc
IPCBridge <--> FSSvc
IPCBridge <--> GitSvc
IPCBridge <--> DiffSvc
IPCBridge <--> LangSvc
FSSvc --> GameExe
2026-10-30 22:58:24 +07:00
FSSvc --> ConfigDir
GitSvc --> ToolsDir
2026-10-30 21:12:01 +07:00
DiffSvc --> GameFiles
LangSvc --> GameFiles
2026-10-30 21:09:45 +07:00
```
---
### 💻 ข้อกำหนดของระบบและเครื่องมือพัฒนา (Prerequisites)
* [Go 1.24+ ](https://go.dev/dl/ )
* [Node.js 22+ ](https://nodejs.org/ )
* [Wails v3 CLI ](https://v3.wails.io/ ):
```bash
go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-alpha.74
` ``
---
### 🛠️ วิธีการรันและบิลด์ (Development & Build)
2026-10-30 21:24:42 +07:00
#### ⚡ บิลด์และอัปเดตอัตโนมัติในคลิกเดียว (Zero-Dependency One-Click Auto-Update)
หากคุณหรือผู้ใช้งานไม่มี Go, Node.js, Git หรือ Wails ติดตั้งในเครื่อง สามารถดับเบิลคลิกไฟล์นี้ได้ทันที:
` ``cmd
update-and-build.bat
` ``
> ระบบจะดาวน์โหลด Portable MinGit, Go 1.24, Node.js v22 และ Wails v3 CLI ไว้ในโฟลเดอร์ ` tools/` อัตโนมัติ จากนั้นจะ ` git pull` โค้ดล่าสุดจากสาขา ` Dev` แล้วทำการคอมไพล์ออกมาเป็น ` bin/G-Launcher.exe` พร้อมเปิดใช้งานทันที
#### 1. ติดตั้ง Dependencies (สำหรับผู้ที่มี Toolchain ในเครื่องแล้ว)
2026-10-30 21:09:45 +07:00
` ``bash
# ติดตั้งแพ็กเกจ Frontend
cd frontend
npm install
cd ..
# ติดตั้งโมดูล Go
go mod tidy
` ``
#### 2. รันในโหมดพัฒนา (Development Mode)
` ``bash
# รัน Wails dev (มี Hot Reload ทั้ง Frontend และ Backend)
wails3 dev
# หรือรันสคริปต์
.\run.bat
` ``
#### 3. บิลด์สำหรับใช้งานจริง (Production Build)
` ``bash
# บิลด์แบบปกติผ่าน Wails Task
wails3 task build PRODUCTION=true
# หรือใช้สคริปต์ Build พร้อมบีบอัดขนาดไฟล์ด้วย UPX
.\build.bat
` ``
#### 4. สร้างตัวติดตั้ง (Installer Packaging)
` ``bash
wails3 task package
` ``
---
## 🇬🇧 English
### ✨ Features
* **Game Process Orchestration:** Launch games with decoupled console execution flags (` CREATE_NEW_CONSOLE | CREATE_BREAKAWAY_FROM_JOB`) with active process lifecycle hooks.
* **Full Multi-Language Support:** Fully localized in English, Thai, Japanese, Korean, Vietnamese, and Chinese with live switching in the header. Includes game asset translation utilities.
* **Smart Incremental Patching:** Parse Hoyoverse manifest protobuf chunks, apply ` .hdiff` delta patches with ` hpatchz`, and apply ` .ziff` archives via ` zift`.
* **Reliable CI/CD Self-Updating:** Integrated release workflows via ` .github/workflows/build-launcher.yml` and ` scripts/launcher-release.mjs` verifying SHA-256 hashes against ` latest.json`.
* **Zero-Dependency Tooling:** Auto-configures MinGit portable and extracts required binaries (` 7za.exe`, ` hpatchz.exe`, ` zift.exe`) automatically.
* **Data Safety First:** Atomic config updates with Windows ` MoveFileEx` and automatic rollback on patch failure.
---
### 📁 Project Structure
` ``
G-Launcher/
├── .github/workflows/ # GitHub Actions release & build workflows
├── assets/ # Embedded binary tools (7za, hpatchz, zift, appicon)
2026-10-30 21:36:24 +07:00
├── Doc/ # Technical documentation, architecture & AI memory
2026-10-30 21:09:45 +07:00
├── build/ # Wails build configurations & OS templates
│ ├── config.yml # App metadata (CompanyName, ProductName, AppID)
│ └── windows/ # Windows manifests, icons, info.json
├── frontend/ # React 19 Frontend application
│ ├── bindings/ # Auto-generated Wails TypeScript bindings
│ ├── public/ # Static assets, backgrounds, locales (en, th, ja, ko, vi, zh)
│ └── src/ # React components, pages, stores, hooks
├── internal/ # Go Backend Services
│ ├── app-service/ # Window lifecycle & version management
│ ├── diff-service/ # HDiffz, Ziff, and LDiff chunk patching
│ ├── fs-service/ # File dialogs, process runner, persistent storage
│ ├── git-service/ # Self-update, server/proxy downloader, portable MinGit
│ └── language-service/ # ExcelData binary patcher & Thai mod engine
├── pkg/ # Shared Go packages & constants
│ ├── constant/ # Centralized URLs & configuration
│ ├── firefly/ # Protobuf parser & chunk loader
│ ├── hpatchz/ # HPatchz wrapper
│ └── sevenzip/ # 7-Zip archive utilities
├── proto/ # Protobuf definitions
├── scripts/ # Release & version calculation scripts (launcher-release.mjs)
├── AGENTS.md # Engineering guidelines & development rules
2026-10-30 21:24:42 +07:00
├── update-and-build.bat # Zero-dependency auto-updater & local builder
2026-10-30 21:09:45 +07:00
├── build.bat # Windows build & UPX compression script
├── main.go # Application entry point & service registration
└── Taskfile.yml # Wails build tasks definition
` ``
---
### 📜 Engineering Guidelines
1. **System-First Rule:** Always implement and verify changes in the **Go Backend** (` internal/`, ` pkg/`) first. Run ` go vet ./...` and generate bindings before touching Frontend UI.
2. **Strict No-Hardcoding:** Do not hardcode URLs, IP addresses, ports, or absolute drive paths. Centralize constants in [` pkg/constant/constant.go`](pkg/constant/constant.go).
3. **Branch Workflow:** All active development takes place on branch **` Dev`**.
---
### 🤝 Credits & Acknowledgments
* **[Firefly Shelter ](https://git.kain.io.vn/Firefly-Shelter/Firefly_Launcher )** — The original upstream foundation, proxy architecture, and UI design.
* **[Horoyoi-san ](https://github.com/horoyoi-san/game-Launcher )** — Architectural enhancements (portable MinGit, safe rollback, Zig integration patterns, and update workflows).
* **[Wails ](https://v3.wails.io/ )** — Next-generation desktop application framework for Go.
* Developed with ❤️ by **GaCy** .