feat: エンジン種別タブ(WOLF/SRPG)追加、Backupsパス統一、Shift_JIS有効化、スキャナ改善

This commit is contained in:
armonica committed 2026-10-06 01:19:07 +09:00
1 parent a1430bbdbc
commit 01ee04b4cc
13 files changed
+1878 -34

No files matched your search

+516 -6
View File
@@ -31,6 +31,11 @@ namespace GameLauncher
private readonly AsarArchiveService _asarService = new();
private readonly UnitySaveManagerService _unitySaveService = new();
private readonly RgssModService _rgssModService = new();
private readonly WolfSaveService _wolfSaveService = new();
private readonly WolfArchiveService _wolfArchiveService = new();
private readonly WolfModService _wolfModService = new();
private readonly SrpgArchiveService _srpgArchiveService = new();
private readonly SrpgModService _srpgModService = new();
private readonly ObservableCollection<GameItemBase> _games = [];
private ListCollectionView _gamesView = null!;
@@ -117,6 +122,8 @@ namespace GameLauncher
case 4: tabVX.IsChecked = true; break;
case 5: tabTyrano.IsChecked = true; break;
case 6: tabUnity.IsChecked = true; break;
case 7: tabWolf.IsChecked = true; break;
case 8: tabSrpg.IsChecked = true; break;
default: tabAll.IsChecked = true; break;
}
@@ -151,6 +158,8 @@ namespace GameLauncher
else if (tabVX.IsChecked == true) tabIndex = 4;
else if (tabTyrano.IsChecked == true) tabIndex = 5;
else if (tabUnity.IsChecked == true) tabIndex = 6;
else if (tabWolf.IsChecked == true) tabIndex = 7;
else if (tabSrpg.IsChecked == true) tabIndex = 8;
_config.SelectedTab = tabIndex;
_config.UnityBackendFilter = rbUnityIL2CPP.IsChecked == true ? "IL2CPP" : (rbUnityMono.IsChecked == true ? "Mono" : "All");
@@ -259,11 +268,13 @@ namespace GameLauncher
if (_games.Count > 0)
{
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano);
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf);
int rgssCount = _games.Count(g => g is TkoolGameItem tg && tg.IsRgss);
int tyranoCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano);
int wolfCount = _games.Count(g => g is TkoolGameItem tg && tg.IsWolf);
int unityCount = _games.Count(g => g is UnityGameItem);
AppendLog($"キャッシュから計 {_games.Count} 件(ツクール: {tkoolCount}, ティラノ: {tyranoCount}, Unity: {unityCount})を即時表示しました。(待たずに即起動可能です)");
AppendLog($"キャッシュから計 {_games.Count} 件(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, Unity: {unityCount})を即時表示しました。(待たずに即起動可能です)");
lblStatusEngine.Text = "裏で更新・実在検証を実行中...";
}
else
@@ -434,6 +445,14 @@ namespace GameLauncher
{
if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Tyrano) return false;
}
else if (tabWolf.IsChecked == true)
{
if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Wolf) return false;
}
else if (tabSrpg.IsChecked == true)
{
if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.SrpgStudio) return false;
}
else if (tabUnity.IsChecked == true)
{
if (game is not UnityGameItem ug) return false;
@@ -445,6 +464,7 @@ namespace GameLauncher
if (chkFilterModdedOnly.IsChecked == true && !game.IsModded) return false;
if (chkFilterAsarOnly.IsChecked == true && (game is not TkoolGameItem tgAsar || !tgAsar.IsAsar)) return false;
if (chkFilterRgssOnly.IsChecked == true && (game is not TkoolGameItem tgRgss || !tgRgss.HasRgssArchive)) return false;
if (chkFilterSrpgOnly.IsChecked == true && (game is not TkoolGameItem tgSrpg || !tgSrpg.HasSrpgArchive)) return false;
if (chkFilterSaveOnly.IsChecked == true && (game is not UnityGameItem ugSave || !ugSave.HasSaveData)) return false;
return true;
@@ -503,13 +523,15 @@ namespace GameLauncher
int total = _games.Count;
int visible = _gamesView?.Count ?? 0;
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss);
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio);
int rgssCount = _games.Count(g => g is TkoolGameItem tg && tg.IsRgss);
int tyranoCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano);
int wolfCount = _games.Count(g => g is TkoolGameItem tg && tg.IsWolf);
int srpgCount = _games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio);
int unityCount = _games.Count(g => g is UnityGameItem);
lblStatusSummary.Text = $"総ゲーム数: {total} 件 | 表示: {visible} 件";
lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, Unity: {unityCount})";
lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, Unity: {unityCount})";
}
#endregion
@@ -609,6 +631,46 @@ namespace GameLauncher
private async Task LaunchTkoolGameAsync(TkoolGameItem tg)
{
// ウディタゲームの場合の起動処理
if (tg.IsWolf)
{
// プロキシDLLの適用または解除の同期
if (tg.WolfProxyDll)
{
var (pSuccess, pMsg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0);
AppendLog($"[ウディタ プロキシDLL] {pMsg.Replace("\n", " ")}");
}
else if (_wolfModService.IsProxyDllInstalled(tg))
{
var (pSuccess, pMsg) = _wolfModService.RemoveProxyDll(tg);
AppendLog($"[ウディタ プロキシDLL] {pMsg}");
}
AppendLog($"[ウディタ起動] {tg.Title} を起動します...");
StartGameProcess(tg);
return;
}
// SRPG Studioゲームの場合の起動処理
if (tg.IsSrpgStudio)
{
// プロキシDLLの適用または解除の同期
if (tg.SrpgProxyDll)
{
bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0);
AppendLog($"[SRPG Studio プロキシDLL] 倍速プロキシDLLを配置しました (倍率: {(tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0):F1}x)");
}
else if (SrpgModService.IsProxyDllEnabled(tg.RootDirectory))
{
_srpgModService.DisableProxyDll(tg.RootDirectory);
AppendLog("[SRPG Studio プロキシDLL] プロキシDLLを解除しました");
}
AppendLog($"[SRPG Studio起動] {tg.Title} を起動します...");
StartGameProcess(tg);
return;
}
// ASAR形式ゲームで未解凍かつ改造適用ONの場合、解凍を促す
if (tg.IsAsar && !tg.IsAsarExtracted && tg.ApplyMod)
{
@@ -689,8 +751,8 @@ namespace GameLauncher
// ツクール/ティラノ等のWebランタイム(NW.js / Chromium)ゲームの場合、
// GameLauncher.exe のあるフォルダ配下の Profiles フォルダに隔離した専用プロファイルディレクトリを指定して起動
// ※RGSS(DirectX/Ruby)やUnity等のネイティブアプリには引数を付与しない
if (game is TkoolGameItem tg && !tg.IsRgss)
// ※RGSS(DirectX/Ruby)やウディタ、Unity等のネイティブアプリには引数を付与しない
if (game is TkoolGameItem tg && !tg.IsRgss && !tg.IsWolf)
{
try
{
@@ -708,6 +770,14 @@ namespace GameLauncher
}
}
// ウディタでデバッグ(テストプレイ)モードがONの場合、公式デバッグ引数を付与
if (game is TkoolGameItem tgWolf && tgWolf.IsWolf && tgWolf.WolfDebugMode)
{
var debugArgs = _wolfModService.GetDebugArguments(tgWolf.WolfDebugWindow);
startInfo.Arguments = debugArgs;
AppendLog($"[ウディタ デバッグ起動] テストプレイモード引数を指定: {debugArgs}");
}
Process.Start(startInfo);
game.LastLaunched = DateTime.Now;
@@ -1242,6 +1312,446 @@ namespace GameLauncher
#endregion
#region WOLF RPGエディター専用アクション
private void btnOpenWolfSaveEditor_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf)
{
var dialog = new WolfSaveEditorDialog(tg, _wolfSaveService)
{
Owner = this
};
dialog.ShowDialog();
}
}
private void chkWolfProxyDll_Checked(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf)
{
var (success, msg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0);
AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}");
_scannerService.SaveCache(_games);
}
}
private void chkWolfProxyDll_Unchecked(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf)
{
var (success, msg) = _wolfModService.RemoveProxyDll(tg);
AppendLog($"[ウディタ プロキシDLL] {msg}");
_scannerService.SaveCache(_games);
}
}
private void btnApplyWolfProxyDll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf)
{
var (success, msg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0);
tg.WolfProxyDll = true;
AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}");
MessageBox.Show(msg, "プロキシDLL適用", MessageBoxButton.OK, MessageBoxImage.Information);
_scannerService.SaveCache(_games);
}
}
private void btnRemoveWolfProxyDll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf)
{
var (success, msg) = _wolfModService.RemoveProxyDll(tg);
tg.WolfProxyDll = false;
AppendLog($"[ウディタ プロキシDLL] {msg}");
MessageBox.Show(msg, "プロキシDLL解除", MessageBoxButton.OK, MessageBoxImage.Information);
_scannerService.SaveCache(_games);
}
}
private async void btnExtractWolf_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return;
var confirm = MessageBox.Show(
$"Data.wolf アーカイブを解凍・抽出しますか?\n\n対象: {tg.Title}\n展開先: {Path.Combine(tg.RootDirectory, "Data")}\n\n解凍すると、ウディタのエディタやファイル直接編集によるデータ改造が可能になります。",
"Data.wolf 解凍の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbWolfProgress.Visibility = Visibility.Visible;
pbWolfProgress.IsIndeterminate = true;
lblWolfProgressStatus.Visibility = Visibility.Visible;
lblWolfProgressStatus.Text = "Data.wolf を解凍しています...";
btnExtractWolf.IsEnabled = false;
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblWolfProgressStatus.Text = status;
AppendLog($"[ウディタ解凍] {status}");
});
});
try
{
var (success, msg) = await _wolfArchiveService.ExtractArchiveAsync(tg, _config.WolfExtractorPath, progress);
if (success)
{
tg.IsWolfExtracted = true;
MessageBox.Show(msg, "解凍完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
finally
{
pbWolfProgress.Visibility = Visibility.Collapsed;
lblWolfProgressStatus.Visibility = Visibility.Collapsed;
btnExtractWolf.IsEnabled = true;
}
}
private void btnRestoreWolfArchive_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return;
var confirm = MessageBox.Show(
"解凍された Data フォルダを Backups フォルダへ退避し、元の Data.wolf アーカイブ優先読み込みに復元しますか?",
"アーカイブ状態復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
var (success, msg) = _wolfArchiveService.RestoreArchiveState(tg);
if (success)
{
tg.IsWolfExtracted = false;
AppendLog($"[ウディタ復元] {tg.Title}: {msg.Replace("\n", " ")}");
MessageBox.Show(msg, "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
_scannerService.SaveCache(_games);
}
else
{
MessageBox.Show(msg, "復元エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
private void btnRestoreWolfAll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return;
var confirm = MessageBox.Show(
$"【完全復元】\n{tg.Title} に対するすべての改造(プロキシDLL、パッチ等)を解除し、元の状態に戻しますか?\n※セーブデータはそのまま維持されます。",
"完全復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
var (success, msg) = _wolfModService.RestoreAllMods(tg);
tg.WolfProxyDll = false;
AppendLog($"[ウディタ完全復元] {tg.Title}:\n{msg}");
MessageBox.Show($"すべての改造を解除しました:\n\n{msg}", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
#endregion
#region SRPG Studio関連イベント
private void chkSrpgProxyDll_Checked(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
tg.SrpgProxyDll = true;
bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0);
if (ok)
{
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを有効化しました (F6で倍速切替)");
}
_scannerService.SaveCache(_games);
}
private void chkSrpgProxyDll_Unchecked(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
tg.SrpgProxyDll = false;
_srpgModService.DisableProxyDll(tg.RootDirectory);
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを解除しました");
_scannerService.SaveCache(_games);
}
private void btnApplySrpgProxyDll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
tg.SrpgProxyDll = true;
bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0);
if (ok)
{
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を配置しました");
MessageBox.Show("プロキシDLL (version.dll) を配置しました。\nゲーム起動後、[F6] キーで倍速切替、[Ctrl] キー押し続けで早送りができます。", "プロキシDLL配置完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
MessageBox.Show("プロキシDLLの配置に失敗しました。\nTools/speedhack-i686/version.dll が存在するか確認してください。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
private void btnRemoveSrpgProxyDll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
tg.SrpgProxyDll = false;
bool ok = _srpgModService.DisableProxyDll(tg.RootDirectory);
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を解除しました");
MessageBox.Show("プロキシDLL (version.dll) を解除しました。", "プロキシDLL解除完了", MessageBoxButton.OK, MessageBoxImage.Information);
_scannerService.SaveCache(_games);
}
private async void btnApplySrpgMod_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
var enabledMods = tg.SrpgModOptions.Where(m => m.IsEnabled).ToList();
if (enabledMods.Count == 0)
{
MessageBox.Show("適用する改造項目にチェックを入れてください。", "改造項目の選択", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
var confirm = MessageBox.Show(
$"選択された {enabledMods.Count} 件の改造項目を適用し、data.dts を再構築しますか?\n(元の data.dts は Backups フォルダに自動保存されます)\n\n対象: {tg.Title}",
"改造プラグイン適用&再構築の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbSrpgProgress.Visibility = Visibility.Visible;
pbSrpgProgress.IsIndeterminate = true;
lblSrpgProgressStatus.Visibility = Visibility.Visible;
lblSrpgProgressStatus.Text = "改造プラグインを適用・再パック中...";
btnApplySrpgMod.IsEnabled = false;
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblSrpgProgressStatus.Text = status;
AppendLog($"[SRPG Studio 改造] {status}");
});
});
try
{
var (success, msg) = await _srpgModService.ApplyModAndRepackAsync(tg, progress);
if (success)
{
AppendLog($"[SRPG Studio 改造成功] {tg.Title}: {msg}");
MessageBox.Show(msg, "改造適用完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
AppendLog($"[SRPG Studio 改造失敗] {tg.Title}: {msg}");
MessageBox.Show(msg, "改造適用エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
finally
{
pbSrpgProgress.Visibility = Visibility.Collapsed;
lblSrpgProgressStatus.Visibility = Visibility.Collapsed;
btnApplySrpgMod.IsEnabled = true;
}
}
private async void btnRemoveSrpgMod_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
var confirm = MessageBox.Show(
$"改造プラグインを解除し、元のアーカイブへ復元しますか?\n\n対象: {tg.Title}",
"改造プラグイン解除の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbSrpgProgress.Visibility = Visibility.Visible;
pbSrpgProgress.IsIndeterminate = true;
lblSrpgProgressStatus.Visibility = Visibility.Visible;
lblSrpgProgressStatus.Text = "改造プラグインを解除中...";
btnRemoveSrpgMod.IsEnabled = false;
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblSrpgProgressStatus.Text = status;
AppendLog($"[SRPG Studio 解除] {status}");
});
});
try
{
var (success, msg) = await _srpgModService.RemoveModAndRepackAsync(tg, progress);
if (success)
{
// チェックをすべてオフにする
foreach (var mod in tg.SrpgModOptions) mod.IsEnabled = false;
AppendLog($"[SRPG Studio 解除成功] {tg.Title}: {msg}");
MessageBox.Show(msg, "改造解除完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
AppendLog($"[SRPG Studio 解除失敗] {tg.Title}: {msg}");
MessageBox.Show(msg, "改造解除エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
finally
{
pbSrpgProgress.Visibility = Visibility.Collapsed;
lblSrpgProgressStatus.Visibility = Visibility.Collapsed;
btnRemoveSrpgMod.IsEnabled = true;
}
}
private async void btnUnpackSrpg_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
var confirm = MessageBox.Show(
$"data.dts アーカイブを解凍・抽出しますか?\n\n対象: {tg.Title}\n展開先: {Path.Combine(tg.RootDirectory, SrpgArchiveService.ExtractedDirName)}\n\n解凍すると、ゲーム内のスクリプト (Script) やプラグイン (Plugin) を自由に編集できるようになります。",
"data.dts 解凍の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbSrpgProgress.Visibility = Visibility.Visible;
pbSrpgProgress.IsIndeterminate = true;
lblSrpgProgressStatus.Visibility = Visibility.Visible;
lblSrpgProgressStatus.Text = "data.dts を解凍しています...";
btnUnpackSrpg.IsEnabled = false;
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblSrpgProgressStatus.Text = status;
AppendLog($"[SRPG Studio 解凍] {status}");
});
});
try
{
var (success, msg) = await _srpgArchiveService.UnpackDataDtsAsync(tg.RootDirectory, progress);
if (success)
{
tg.IsSrpgExtracted = true;
AppendLog($"[SRPG Studio 解凍成功] {tg.Title}: {msg.Replace("\n", " ")}");
MessageBox.Show(msg, "解凍完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
AppendLog($"[SRPG Studio 解凍失敗] {tg.Title}: {msg}");
MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
finally
{
pbSrpgProgress.Visibility = Visibility.Collapsed;
lblSrpgProgressStatus.Visibility = Visibility.Collapsed;
btnUnpackSrpg.IsEnabled = true;
}
}
private async void btnRepackSrpg_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
var confirm = MessageBox.Show(
$"解凍フォルダの内容から data.dts を再構築(再パック)しますか?\n(現在の data.dts は Backups フォルダに自動保存されます)\n\n対象: {tg.Title}",
"data.dts 再構築の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbSrpgProgress.Visibility = Visibility.Visible;
pbSrpgProgress.IsIndeterminate = true;
lblSrpgProgressStatus.Visibility = Visibility.Visible;
lblSrpgProgressStatus.Text = "data.dts を再構築中...";
btnRepackSrpg.IsEnabled = false;
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblSrpgProgressStatus.Text = status;
AppendLog($"[SRPG Studio 再構築] {status}");
});
});
try
{
var (success, msg) = await _srpgArchiveService.RepackDataDtsAsync(tg.RootDirectory, progress);
if (success)
{
AppendLog($"[SRPG Studio 再構築成功] {tg.Title}: {msg.Replace("\n", " ")}");
MessageBox.Show(msg, "再構築完了", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
AppendLog($"[SRPG Studio 再構築失敗] {tg.Title}: {msg}");
MessageBox.Show(msg, "再構築エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
}
_scannerService.SaveCache(_games);
}
finally
{
pbSrpgProgress.Visibility = Visibility.Collapsed;
lblSrpgProgressStatus.Visibility = Visibility.Collapsed;
btnRepackSrpg.IsEnabled = true;
}
}
private async void btnRestoreSrpgAll_Click(object sender, RoutedEventArgs e)
{
if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return;
var confirm = MessageBox.Show(
$"【完全復元】\n{tg.Title} に対するすべての改造(プロキシDLL・Modプラグイン・解凍フォルダ退避等)を解除し、元の安全な状態に戻しますか?\n※セーブデータはそのまま維持されます。\n※解凍データは Backups フォルダに安全退避されます。",
"完全復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (confirm != MessageBoxResult.Yes) return;
pbSrpgProgress.Visibility = Visibility.Visible;
pbSrpgProgress.IsIndeterminate = true;
lblSrpgProgressStatus.Visibility = Visibility.Visible;
lblSrpgProgressStatus.Text = "すべての改造を解除中...";
var progress = new Progress<string>(status =>
{
Dispatcher.Invoke(() =>
{
lblSrpgProgressStatus.Text = status;
AppendLog($"[SRPG Studio 完全復元] {status}");
});
});
try
{
var (success, msg) = await _srpgModService.RestoreAllModsAsync(tg, progress);
foreach (var mod in tg.SrpgModOptions) mod.IsEnabled = false;
AppendLog($"[SRPG Studio 完全復元] {tg.Title}:\n{msg}");
MessageBox.Show($"すべての改造を解除しました:\n\n{msg}", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
_scannerService.SaveCache(_games);
}
finally
{
pbSrpgProgress.Visibility = Visibility.Collapsed;
lblSrpgProgressStatus.Visibility = Visibility.Collapsed;
}
}
#endregion
#region 共通アクション (フォルダを開く・ログ操作)
private void btnOpenFolder_Click(object sender, RoutedEventArgs e)