Compare commits

..
3 Commits
Author SHA1 Message Date
armonica 90584379b7 feat(ui): EVB解凍済みバッジの表示および実効exeによる起動処理に対応
- TkoolGameItem に EVB解凍済みバッジ用の可視性プロパティ(EvbExtractedVisibility)を追加
- ResolveLaunchExecutable にて解凍先ディレクトリからの実効exe解決フォールバックを強化
- MainWindow.xaml に緑色の「解凍済み」バッジを追加し、UI上で状態を一目で確認可能に改善
- MainWindow.xaml.cs の LaunchGameAsync で TkoolGameItem の実効起動exeパスを解決して起動するように修正
2026-10-08 14:12:48 +09:00
armonica 5433371a77 feat(scanner): 解凍済みEVBゲームの起動パス・Mod対象解決と状態永続化に対応
- 解凍済みEVBゲームに対して、解凍先ディレクトリ内の実効exeを起動対象として解決
- 退避バックアップファイル(.glbak)の検索・解決処理を追加
- 解凍先フォルダ(_evb_extracted)配下の plugins.js をMod適用対象として検出し、MV/MZエンジン種別を判定
- EVBメタデータ(IsEvbPacked, IsEvbExtracted, EvbExtractedDirPathなど)をスキャンキャッシュに永続化
2026-10-08 14:12:17 +09:00
armonica 3550e20891 feat(evb): 解凍完了マーカーに基づくEVBゲーム検出の維持機能を追加
- 元exeが .glbak に退避された解凍後でもEVBゲームとして継続認識できるよう IsExtracted 判定を追加
- 解凍完了マーカー(_evb_extracted)の存在を検証し、後続の起動・アイコン解決の破損を防止
2026-10-08 14:12:07 +09:00
6 changed files with 156 additions and 18 deletions

No files matched your search

+29
View File
@@ -92,6 +92,35 @@ namespace GameLauncher.Engines.Evb
}
}
/// <summary>
/// Returns true when the game directory already holds a completed EVB extraction.
///
/// Once a game is unpacked, the original packed exe is renamed to "*.glbak" and the
/// unpacked files (including the real exe) live inside the game-local "_evb_extracted"
/// folder. At that point <see cref="FindEvbPackedExecutable"/> can no longer find a
/// top-level "*.exe", so this extra signal is required to keep recognizing the folder
/// as an EVB game (otherwise launch and icon resolution break after unpacking).
///
/// Only a completed extraction (completion marker present) is accepted, so a normal
/// unpacked game without any EVB artifacts is never misclassified.
/// </summary>
public static bool IsExtracted(string gameDirectory)
{
if (string.IsNullOrWhiteSpace(gameDirectory) || !Directory.Exists(gameDirectory))
{
return false;
}
try
{
return EvbUnpackService.IsExtractionComplete(gameDirectory, out _);
}
catch
{
return false;
}
}
/// <summary>
/// Parses the PE section table and checks for the EVB packer's section names.
/// </summary>
+17 -4
View File
@@ -18,9 +18,16 @@ namespace GameLauncher.Engines.Evb
public static class EvbDetector
{
/// <summary>
/// Returns true when the game directory holds an EVB packed executable.
/// A packed project file (<c>*.evb</c>) in the folder is also accepted as a
/// decisive signal, in addition to the PE-signature check.
/// Returns true when the game directory holds an EVB packed executable
/// (or a completed extraction of one).
///
/// Accepts any of the following decisive signals:
/// 1. A packed project file (<c>*.evb</c>) in the folder.
/// 2. A top-level executable carrying a decisive EVB PE signature.
/// 3. An already-unpacked game (game-local "_evb_extracted" with a completion
/// marker). This is required because unpacking renames the original packed exe
/// to "*.glbak", after which the signature check alone would no longer detect
/// the game and its launch / icon resolution would break.
/// </summary>
public static bool IsEvbGame(string gameDirectory)
{
@@ -39,7 +46,13 @@ namespace GameLauncher.Engines.Evb
}
catch
{
// Fall through to the executable signature check.
// Fall through to the remaining checks.
}
// A completed extraction keeps the game recognized even without the packed exe.
if (EvbDetectionHelper.IsExtracted(gameDirectory))
{
return true;
}
return EvbDetectionHelper.FindEvbPackedExecutable(gameDirectory) != null;
+17 -3
View File
@@ -134,14 +134,14 @@ namespace GameLauncher.Engines.Tkool
public bool IsEvbPacked
{
get => _isEvbPacked;
set { if (_isEvbPacked != value) { _isEvbPacked = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbBadgeVisibility)); OnPropertyChanged(nameof(IsEvb)); } }
set { if (_isEvbPacked != value) { _isEvbPacked = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbBadgeVisibility)); OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); OnPropertyChanged(nameof(EvbExtractedVisibility)); OnPropertyChanged(nameof(IsEvb)); } }
}
/// <summary>EVB 解凍済み(_evb_extracted に出力済み)かどうか</summary>
public bool IsEvbExtracted
{
get => _isEvbExtracted;
set { if (_isEvbExtracted != value) { _isEvbExtracted = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbDetailStatusText)); } }
set { if (_isEvbExtracted != value) { _isEvbExtracted = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbDetailStatusText)); OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); OnPropertyChanged(nameof(EvbExtractedVisibility)); } }
}
/// <summary>EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted)</summary>
@@ -177,6 +177,12 @@ namespace GameLauncher.Engines.Tkool
/// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary>
public Visibility EvbNeedsUnpackVisibility => (IsEvbPacked && !IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary>EVB 解凍済みのときだけ「解凍済み」ラベルを表示するための可視性(一目で分かる導線)</summary>
public Visibility EvbExtractedVisibility => (IsEvbPacked && IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary>EVB「解凍済み」ラベルのテキスト</summary>
public string EvbExtractedBadgeText => "解凍済み";
/// <summary>
/// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。
/// 選択時のガイドで「README.md を参照してください」と案内するために使用します。
@@ -215,12 +221,20 @@ namespace GameLauncher.Engines.Tkool
return ExecutablePath;
}
// 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。
var outputDir = !string.IsNullOrEmpty(EvbExtractedDirPath)
? EvbExtractedDirPath!
: GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(RootDirectory);
// ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで
// 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。
var exe = GameLauncher.Engines.Evb.EvbUnpackService.FindLaunchExecutable(outputDir);
return string.IsNullOrEmpty(exe) ? ExecutablePath : exe!;
if (!string.IsNullOrEmpty(exe))
{
return exe!;
}
return ExecutablePath;
}
/// <summary>FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか</summary>
+7
View File
@@ -688,6 +688,13 @@
<TextBlock Text="要解凍" FontSize="10" FontWeight="Bold" Foreground="#3A2A00"/>
</Border>
<!-- EVB 解凍済みのときだけ「解凍済み」を表示(一目で分かる導線) -->
<Border Background="#00B894" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
ToolTip="EVB は解凍済みです。解凍後の exe で起動し、改造も解凍先フォルダへ適用されます。"
Visibility="{Binding EvbExtractedVisibility}">
<TextBlock Text="{Binding EvbExtractedBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
</Border>
<!-- 改造適用中インジケータ(ツクール専用) -->
<Border Background="{StaticResource BadgeModdedBg}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
<Border.Style>
+9 -3
View File
@@ -617,10 +617,16 @@ namespace GameLauncher
private async Task LaunchGameAsync(GameItemBase game)
{
if (string.IsNullOrEmpty(game.ExecutablePath) || !File.Exists(game.ExecutablePath))
// EVB 解凍済みゲームは、保存済みパスが空でも解凍後の exe を解決して起動対象にする。
// 実効パス(解決後)で存在判定を行い、非 EVB ゲームの挙動は変えない。
var effectiveExe = game is TkoolGameItem tkoolItem
? tkoolItem.ResolveLaunchExecutable()
: game.ExecutablePath;
if (string.IsNullOrEmpty(effectiveExe) || !File.Exists(effectiveExe))
{
MessageBox.Show($"実行ファイルが見つかりません:\n{game.ExecutablePath}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
AppendLog($"[起動失敗] 実行ファイルが見つかりません: {game.ExecutablePath}");
MessageBox.Show($"実行ファイルが見つかりません:\n{effectiveExe}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
AppendLog($"[起動失敗] 実行ファイルが見つかりません: {effectiveExe}");
return;
}
+77 -8
View File
@@ -474,7 +474,15 @@ namespace GameLauncher.Services
SrpgProxyDll = tg.SrpgProxyDll,
SrpgSpeedMultiplier = tg.SrpgSpeedMultiplier,
IsFossilSingleExe = tg.IsFossilSingleExe,
IsBoxedExe = tg.IsBoxedExe
IsBoxedExe = tg.IsBoxedExe,
// EVB (Enigma Virtual Box) パック済みゲームの状態を保存する。
// これを保存しないと再スキャン/再起動時に IsEvbExtracted が失われ、
// 解凍後の exe を起動対象として解決できなくなる。
IsEvbPacked = tg.IsEvbPacked,
IsEvbExtracted = tg.IsEvbExtracted,
EvbExtractedDirPath = tg.EvbExtractedDirPath,
EvbBackupPath = tg.EvbBackupPath,
EvbUnderlyingEngine = tg.EvbUnderlyingEngine
});
}
}
@@ -879,24 +887,66 @@ namespace GameLauncher.Services
evbOutDir, EngineDetectionHelper.EngineUnknown);
}
var icon = LoadIcon(packedExe, dirPath);
// 解凍済みなら、元 exe は .glbak に退避されているため、
// 起動対象は解凍後の exe に切り替える。これを行わないと ExecutablePath が
// 空になり「実行ファイルが見つかりません」で起動できなくなる。
string? launchExe = packedExe;
if (packedExe == null && isExtracted && evbOutDir != null)
{
launchExe = EvbUnpackService.FindLaunchExecutable(evbOutDir);
}
var icon = LoadIcon(launchExe ?? packedExe, dirPath);
// 解凍済みで元 exe が .glbak に退避されている場合は、その退避ファイルを
// バックアップパスとして扱う(packedExe は null になるため)。
var backupPath = packedExe != null
? packedExe + EvbUnpackService.ExeBackupSuffix
: FindEvbBackupPath(dirPath);
// 解凍済みの場合、改造(mod)の適用対象は「実際に起動するフォルダ」である
// _evb_extracted 内の plugins.js でなければならない。外側フォルダを対象にすると
// 改造後の plugins.js が読み込まれず、改造が一切効かない。
var engineType = TkoolEngineType.Unknown;
var pluginsJsPath = string.Empty;
var pluginsDirPath = string.Empty;
var canApplyMod = false;
if (isExtracted && evbOutDir != null)
{
var pluginsJs = FindPluginsJs(evbOutDir, maxDepth: 2);
if (!string.IsNullOrEmpty(pluginsJs) && File.Exists(pluginsJs))
{
pluginsJsPath = pluginsJs;
pluginsDirPath = Path.Combine(Path.GetDirectoryName(pluginsJs)!, "plugins");
canApplyMod = true;
// www\js\plugins.js 配下なら MV、js\plugins.js 配下なら MZ として扱う。
// RepairMisdetection は "Tkool" までしか判定できないため、ここで MV/MZ を確定する。
var jsDir = Path.GetDirectoryName(pluginsJs)!;
var rootOfJs = Path.GetDirectoryName(jsDir)!;
var rootFolderName = Path.GetFileName(rootOfJs.TrimEnd('\\', '/'));
engineType = string.Equals(rootFolderName, "www", StringComparison.OrdinalIgnoreCase)
? TkoolEngineType.MV
: TkoolEngineType.MZ;
}
}
return new TkoolGameItem
{
Title = folderName,
FolderName = folderName,
RootDirectory = dirPath,
ExecutablePath = packedExe ?? string.Empty,
EngineType = TkoolEngineType.Unknown,
ApplyMod = false,
ExecutablePath = launchExe ?? string.Empty,
PluginsJsPath = pluginsJsPath,
PluginsDirPath = pluginsDirPath,
EngineType = engineType,
ApplyMod = canApplyMod,
IconImage = icon,
FolderLastModified = folderModified,
IsEvbPacked = true,
IsEvbExtracted = isExtracted,
EvbExtractedDirPath = evbOutDir,
EvbBackupPath = packedExe != null
? packedExe + EvbUnpackService.ExeBackupSuffix
: null,
EvbBackupPath = backupPath,
EvbUnderlyingEngine = underlying == EngineDetectionHelper.EngineUnknown
? string.Empty
: underlying,
@@ -908,6 +958,25 @@ namespace GameLauncher.Services
}
}
/// <summary>
/// EVB の退避ファイル(*.glbak)をゲームフォルダ直下から探します。
/// 解凍後は元 exe がリネームされているため、packedExe からは導出できません。
/// 見つからない場合は null を返します。
/// </summary>
private static string? FindEvbBackupPath(string gameDirectory)
{
try
{
return Directory.GetFiles(gameDirectory, "*" + EvbUnpackService.ExeBackupSuffix,
SearchOption.TopDirectoryOnly)
.FirstOrDefault();
}
catch
{
return null;
}
}
public TkoolGameItem? DetectTkoolGameInDirectory(string dirPath)
{
try