chore: bundle evbunpack tool and add EVB control/launch fixes

- Add Enigma Virtual Box (EVB) engine support: detection, badge, unpack/restore UI
- Bundle evbunpack.exe under Engines/Evb/Tools/evbunpack (Apache-2.0, with LICENSE/README)
- Copy Engines\\**\\Tools\\** to build output via csproj (publish already covered by publish.ps1)
- Throttle evbunpack progress reporting and shorten timeout to stop UI freeze
- Rename original packed exe to .glbak and write a completion marker; make Restore reverse it
- Launch the unpacked exe from _evb_extracted so script mods apply
- Replace EVB MessageBox dialogs with readable log summaries
- Remove obsolete boxed/7zip extraction code (NwjsPackageUnpacker, TkoolPackagedExtractionService)
This commit is contained in:
armonica committed 2026-10-07 09:30:09 +09:00
1 parent 8cea2a147d
commit 05e7bdb3c0
23 files changed
+1542 -1288

No files matched your search

+91 -45
View File
@@ -22,6 +22,8 @@ using GameLauncher.Engines.Tyrano;
using GameLauncher.Engines.Wolf;
using GameLauncher.Engines.Unity;
using GameLauncher.Engines.Nwjs;
using GameLauncher.Engines.Common;
using GameLauncher.Engines.Evb;
namespace GameLauncher.Services
{
@@ -64,14 +66,16 @@ namespace GameLauncher.Services
public bool SrpgProxyDll { get; set; }
public double SrpgSpeedMultiplier { get; set; } = 3.0;
// 単体exe梱包(FOSSIL / boxed)専用
// 単体exe梱包(FOSSIL / boxed)専用(起動のみ対応。埋め込み展開は廃止)
public bool IsFossilSingleExe { get; set; }
public bool IsBoxedExe { get; set; }
public bool IsStandaloneExeExtracted { get; set; }
public string? StandaloneExtractedDirPath { get; set; }
public string? StandaloneBackupPath { get; set; }
public string? BoxedPayloadEntryPath { get; set; }
public bool CanExtractViaExternalTool { get; set; }
// Enigma Virtual Box (EVB) 梱包専用
public bool IsEvbPacked { get; set; }
public bool IsEvbExtracted { get; set; }
public string? EvbExtractedDirPath { get; set; }
public string? EvbBackupPath { get; set; }
public string EvbUnderlyingEngine { get; set; } = string.Empty;
// Unity専用
public string DataDirectoryPath { get; set; } = string.Empty;
@@ -184,10 +188,11 @@ namespace GameLauncher.Services
SrpgSpeedMultiplier = entry.SrpgSpeedMultiplier > 0 ? entry.SrpgSpeedMultiplier : 3.0,
IsFossilSingleExe = entry.IsFossilSingleExe,
IsBoxedExe = entry.IsBoxedExe,
IsStandaloneExeExtracted = entry.IsStandaloneExeExtracted,
StandaloneExtractedDirPath = entry.StandaloneExtractedDirPath,
StandaloneBackupPath = entry.StandaloneBackupPath,
BoxedPayloadEntryPath = entry.BoxedPayloadEntryPath
IsEvbPacked = entry.IsEvbPacked,
IsEvbExtracted = entry.IsEvbExtracted,
EvbExtractedDirPath = entry.EvbExtractedDirPath,
EvbBackupPath = entry.EvbBackupPath,
EvbUnderlyingEngine = entry.EvbUnderlyingEngine
};
if (entry.PluginSettings != null)
{
@@ -287,11 +292,6 @@ namespace GameLauncher.Services
bool isFossilSingleExe = element.TryGetProperty("IsFossilSingleExe", out var ifs) && ifs.GetBoolean();
bool isBoxedExe = element.TryGetProperty("IsBoxedExe", out var ibx) && ibx.GetBoolean();
bool isStandaloneExeExtracted = element.TryGetProperty("IsStandaloneExeExtracted", out var isx) && isx.GetBoolean();
string? standaloneExtDir = element.TryGetProperty("StandaloneExtractedDirPath", out var sed) ? sed.GetString() : null;
string? standaloneBackup = element.TryGetProperty("StandaloneBackupPath", out var sbp) ? sbp.GetString() : null;
string? boxedEntry = element.TryGetProperty("BoxedPayloadEntryPath", out var bep) ? bep.GetString() : null;
bool canExtractViaExternalTool = element.TryGetProperty("CanExtractViaExternalTool", out var cet) && cet.GetBoolean();
var item = new TkoolGameItem
{
@@ -312,12 +312,7 @@ namespace GameLauncher.Services
AsarExtractedDirPath = asarExtP,
RelativePluginsJsInAsar = relJs,
IsFossilSingleExe = isFossilSingleExe,
IsBoxedExe = isBoxedExe,
IsStandaloneExeExtracted = isStandaloneExeExtracted,
StandaloneExtractedDirPath = standaloneExtDir,
StandaloneBackupPath = standaloneBackup,
BoxedPayloadEntryPath = boxedEntry,
CanExtractViaExternalTool = canExtractViaExternalTool
IsBoxedExe = isBoxedExe
};
// 既存キャッシュの自動修復: ウディタの誤判定を修正
@@ -479,12 +474,7 @@ namespace GameLauncher.Services
SrpgProxyDll = tg.SrpgProxyDll,
SrpgSpeedMultiplier = tg.SrpgSpeedMultiplier,
IsFossilSingleExe = tg.IsFossilSingleExe,
IsBoxedExe = tg.IsBoxedExe,
IsStandaloneExeExtracted = tg.IsStandaloneExeExtracted,
StandaloneExtractedDirPath = tg.StandaloneExtractedDirPath,
StandaloneBackupPath = tg.StandaloneBackupPath,
BoxedPayloadEntryPath = tg.BoxedPayloadEntryPath,
CanExtractViaExternalTool = tg.CanExtractViaExternalTool
IsBoxedExe = tg.IsBoxedExe
});
}
}
@@ -858,6 +848,66 @@ namespace GameLauncher.Services
#region ツクール / ティラノ 検出ロジック
/// <summary>
/// Enigma Virtual Box (EVB) でパックされたゲームを判定し、TkoolGameItem を生成します。
///
/// EVB は汎用パッカーで、内部にどのエンジンのゲームでも包めるため、
/// 他エンジン判定より前に評価します。確実な EVB シグネチャが検出できた場合のみ
/// 検出し、通常の(非パック)ゲームを誤検出しません。
///
/// 解凍(evbunpack 実行)はこの時点では行わず、UI からの明示操作に委ねます。
/// 検出時は IsEvbPacked を立て、通常の plugins.js 等が無い場合はゲームフォルダの
/// exe を起動対象として登録します。特定ゲーム専用の決め打ちは一切行いません。
/// </summary>
public TkoolGameItem? DetectEvbGameInDirectory(string dirPath, string folderName, DateTime? folderModified)
{
try
{
if (!EvbDetector.IsEvbGame(dirPath))
{
return null;
}
var packedExe = EvbDetector.FindPackedExecutable(dirPath);
// 既に解凍済みなら出力フォルダから本来エンジンを再判定する。
var underlying = EngineDetectionHelper.EngineUnknown;
var isExtracted = EvbUnpackService.IsExtractionComplete(dirPath, out var evbOutDir);
if (isExtracted && evbOutDir != null)
{
underlying = EngineDetectionHelper.RepairMisdetection(
evbOutDir, EngineDetectionHelper.EngineUnknown);
}
var icon = LoadIcon(packedExe, dirPath);
return new TkoolGameItem
{
Title = folderName,
FolderName = folderName,
RootDirectory = dirPath,
ExecutablePath = packedExe ?? string.Empty,
EngineType = TkoolEngineType.Unknown,
ApplyMod = false,
IconImage = icon,
FolderLastModified = folderModified,
IsEvbPacked = true,
IsEvbExtracted = isExtracted,
EvbExtractedDirPath = evbOutDir,
EvbBackupPath = packedExe != null
? packedExe + EvbUnpackService.ExeBackupSuffix
: null,
EvbUnderlyingEngine = underlying == EngineDetectionHelper.EngineUnknown
? string.Empty
: underlying,
};
}
catch
{
return null;
}
}
public TkoolGameItem? DetectTkoolGameInDirectory(string dirPath)
{
try
@@ -866,6 +916,15 @@ namespace GameLauncher.Services
DateTime? folderModified = null;
try { folderModified = Directory.GetLastWriteTime(dirPath); } catch { }
// 0. Enigma Virtual Box (EVB) パック済みゲームの検出(最優先・前段)。
// EVB は汎用パッカーで、内部にどのエンジンのゲームでも包めるため、
// 他エンジン判定より前に評価し、Evb 用の情報(本来エンジン等)を付与する。
var evbGame = DetectEvbGameInDirectory(dirPath, folderName, folderModified);
if (evbGame != null)
{
return evbGame;
}
// 1. 通常の plugins.js 探索
var pluginsJs = FindPluginsJs(dirPath, maxDepth: 2);
if (pluginsJs != null)
@@ -1058,13 +1117,12 @@ namespace GameLauncher.Services
var icon = LoadIcon(exePath, dirPath);
string? title = null;
string? pluginsJsInContainer = null;
string? embeddedPluginsPath = null;
// 3. boxed 命名exeは内包コンテナ(package.nw)からplugins.js位置を推定
if (isBoxedExe)
{
TryProbeBoxedEmbeddedPayload(exePath, out pluginsJsInContainer, out embeddedPluginsPath);
TryProbeBoxedEmbeddedPayload(exePath, out _, out embeddedPluginsPath);
}
// 4. タイトル解決: data/System.json の gameTitle を優先、無ければフォルダ名
@@ -1102,8 +1160,7 @@ namespace GameLauncher.Services
IsAsar = false,
// 形態フラグ(他ゲームへ影響しないための識別子)
IsFossilSingleExe = hasFossilHtml || !isBoxed,
IsBoxedExe = isBoxed,
BoxedPayloadEntryPath = pluginsJsInContainer
IsBoxedExe = isBoxed
};
}
catch { }
@@ -1233,17 +1290,9 @@ namespace GameLauncher.Services
return null;
}
// (c) 埋め込みpackage.nwマーカーの有無(限定部分読み)
// (c) 埋め込みpackage.nwマーカーの有無(限定部分読み。表示判定の補助情報として使用)
bool hasEmbeddedPkg = ContainsPackageNwMarker(boxedExe);
// (d) boxed命名exeが存在すれば、マーカー未確定でも外部アンパッカーでの展開を試行できるため一覧に表示する。
// (マーカーは中盤の限られた窓でしか確認しないため、非標準コンテナでは拾えない場合がある)
// 展開可否は実行時(ExtractPackageNw)に確定し、不可なら「起動のみ」にフォールバックする。
bool canTryExternalTool = true;
if (!hasEmbeddedPkg && onDiskPlugins == null && !canTryExternalTool)
{
return null;
}
_ = hasEmbeddedPkg;
var dataDir = Path.Combine(dirPath, "data");
var engine = DetectEngineTypeByDataJson(dirPath);
@@ -1266,10 +1315,7 @@ namespace GameLauncher.Services
FolderLastModified = folderModified,
IsAsar = false,
IsFossilSingleExe = false,
IsBoxedExe = true,
BoxedPayloadEntryPath = hasEmbeddedPkg ? "js/plugins.js" : null,
// boxed命名exeが存在するため、外部アンパッカーでの展開を試行できる可能性がある
CanExtractViaExternalTool = canTryExternalTool
IsBoxedExe = true
};
}
catch { }