touhou-local-sync

module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: MIT

README

東方Project セーブデータ同期ツール(Windows CLI版)

thlocalsync - 東方Projectのセーブデータを複数のPCで同期するためのCLIツール

⚠️ 重要な注意: このプロジェクトは初期リリース版です。重大な問題が含まれている可能性があります。必ずセーブデータのバックアップを取った上で試用してください。 データ損失について開発者は一切責任を負いません。

概要

複数のWindows PCで東方Project原作STGのセーブデータ(例:score.dat)を ポータブルストレージ(USBメモリ等)上の正本(ハブ) に集約し、手動でPull/Pushするオフライン同期ツールです。

特徴
  • 完全オフライン、ポータブルストレージ常駐、単一実行ファイル
  • タイトル別の保存パスを半自動認識+対話的に登録/編集
  • mtime・ハッシュ・サイズの三点で新旧/正誤判定
  • 履歴バックアップと安全なアトミック書き換え
前提条件

このツールは以下の環境を想定しています:

  • Windows 10/11の一般的なファイル構造
  • ゲーム本体の実行ファイルが単一のフォルダ以下に配置されていること

例:

D:\Games\Touhou\
  東方紅魔郷\
    th06.exe
  東方妖々夢\
    th07.exe
  東方永夜抄\
    th08.exe
  ...

対象環境

  • OS: Windows 10/11 (x64)
  • 実行形態: 単一 exe(ポータブルストレージ直置き)
  • 権限: 標準ユーザ(管理者不要)
  • 開発言語: Go 1.25+

インストール

ビルド方法
# Windowsバイナリのビルド
go build -o thlocalsync.exe ./cmd/thlocalsync
ポータブルストレージ内ディレクトリ構成
/THLocalSync/
  thlocalsync.exe
  /data/
    devices.json
    paths.json
    rules.json
  /vault/
    th06/
      main/score.dat
      _history/2025-11-11T06-20Z-score.dat
    th08/
      main/scoreth08.dat
  /logs/
    2025-11-11.log

使い方

初回セットアップ
  1. ポータブルストレージを接続
  2. セーブデータを半自動認識して登録:
thlocalsync detect

ゲーム本体がまとまっている親フォルダを指定するか、以下のようにオプションで指定できます:

thlocalsync detect --gamedir "D:\Games\Touhou"
基本的な使用フロー
  1. ゲームプレイ後、ローカルからポータブルストレージへ保存(Pull):
thlocalsync pull all
  1. 別PCで、ポータブルストレージからローカルへ配布(Push):
thlocalsync push all
  1. 状態確認:
thlocalsync status all
コマンド一覧
コマンド 機能 例
detect 半自動認識 + 対話登録 thlocalsync detect
status [title|all] ポータブルストレージとローカルの差分一覧 thlocalsync status all
pull [title|all] ローカル → ポータブルストレージ(正本へ吸い上げ) thlocalsync pull th08
push [title|all] ポータブルストレージ → ローカル(配布) thlocalsync push all
backup [title] [--list|--restore <name>] 履歴表示/復元 thlocalsync backup th08 --list

対応タイトル

東方紅魔郷から東方錦上京まで、小数点作品を含めた全22タイトルの原作STGに対応しています。

セーブデータの保存場所
  • th06-th09: ゲームディレクトリまたはVirtualStore
  • th095, th10: ゲームディレクトリまたはVirtualStore(scorethXX.dat形式)
  • th11-th12: ゲームディレクトリ(scorethXX.dat形式)
  • th125以降: %APPDATA%\ShanghaiAlice\thXXX\scorethXXX.dat

開発

プロジェクト構造
.
├── cmd/
│   └── thlocalsync/    # エントリーポイント
├── pkg/
│   ├── config/         # JSON設定ファイルI/O
│   ├── device/         # デバイスID生成
│   ├── pathdetect/     # パス半自動認識+対話登録
│   ├── sync/           # Pull/Push・判定ロジック
│   ├── backup/         # 履歴保存/復元
│   ├── process/        # プロセス/ロック検知
│   ├── logger/         # 構造化ログ
│   └── utils/          # ハッシュ/アトミックコピー
├── internal/
│   └── models/         # 内部データモデル
└── docs/
    └── numbering_memo.txt  # タイトルナンバリング一覧
ビルド
# 開発用(現在のプラットフォーム)
go build ./cmd/thlocalsync

# Windows向けクロスコンパイル(Mac/Linuxから)
GOOS=windows GOARCH=amd64 go build -o thlocalsync.exe ./cmd/thlocalsync
テスト
go test ./...
ライセンス管理

このプロジェクトでは、依存ライブラリのライセンス情報を自動管理しています。

ライセンス情報の自動生成

リリース時、オープンソースライブラリのライセンス情報は自動的に以下の場所に反映されます:

  1. リリースノート: GitHub Releaseのフッターにマークダウンテーブル形式で表示
  2. NOTICEファイル: 完全なライセンステキストを含む詳細版

リリース手順(ライセンステーブルは自動生成):

# タグをプッシュするだけで、GitHub Actionsが以下を自動実行:
# 1. 依存関係のライセンス情報をgo.modから取得
# 2. マークダウンテーブルを生成
# 3. GoReleaserでビルド+リリースノート作成
# 4. GitHub Releaseを公開

git tag v0.3.0
git push origin v0.3.0
ライセンス情報の更新(NOTICEファイル)

依存関係を追加・更新した際は、NOTICEファイルを手動更新してください:

# Windows(WSL2環境)で実行
wsl make license-generate

# または、GitHub Actions上で自動実行(推奨)

注意: リリースノートのライセンステーブルは完全自動化されており、手動更新は不要です。NOTICEファイルのみ手動更新が必要です。

ライセンスチェック

禁止ライセンスの使用を検証:

# ローカルでチェック(WSL2環境)
wsl make license-check

# 完全な監査(チェック + 生成)
wsl make license-audit
自動検証

GitHub Actions により、以下のタイミングで自動的にライセンス検証が実行されます:

  • go.mod または go.sum の変更時
  • Pull Request作成時

許可されているライセンス:

  • MIT
  • Apache-2.0
  • BSD-2-Clause
  • BSD-3-Clause
  • ISC

詳細は NOTICE ファイルを参照してください。

依存関係の自動更新

このプロジェクトは Dependabot による依存関係の自動更新を有効化しています。

  • 通常更新: 毎週月曜に自動PR作成
  • セキュリティ更新: 毎日チェック+即座にPR作成
  • 自動マージ: patch/minor アップデートは自動承認(ライセンス検証通過後)

開発者は NOTICE ファイルの手動更新のみ必要です。詳細は CLAUDE.md を参照してください。

ライセンス

このプロジェクトは MIT ライセンスの下で公開されています。詳細は LICENSE ファイルを参照してください。

注意事項

  • このツールは東方Projectの二次創作物です
  • セーブデータのバックアップは自己責任で行ってください
  • ゲーム実行中はPull/Push操作を行わないでください

Directories

Path Synopsis
cmd
thlocalsync command
Package main is the entry point for thlocalsync CLI application.
Package main is the entry point for thlocalsync CLI application.
internal
models
Package models defines internal data structures used across the application.
Package models defines internal data structures used across the application.
pkg
backup
Package backup handles history management for save files.
Package backup handles history management for save files.
config
Package config handles JSON configuration file I/O.
Package config handles JSON configuration file I/O.
device
Package device handles device identification using hostname and MAC address.
Package device handles device identification using hostname and MAC address.
logger
Package logger provides structured JSON Lines logging functionality.
Package logger provides structured JSON Lines logging functionality.
pathdetect
Package pathdetect handles semi-automatic detection and interactive registration of save file paths.
Package pathdetect handles semi-automatic detection and interactive registration of save file paths.
process
Package process handles game process detection and file lock checking.
Package process handles game process detection and file lock checking.
sync
Package sync handles file synchronization logic and comparison.
Package sync handles file synchronization logic and comparison.
utils
Package utils provides utility functions for hashing, atomic file operations, and time handling.
Package utils provides utility functions for hashing, atomic file operations, and time handling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL