Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90584379b7 | ||
|
|
5433371a77 | ||
|
|
3550e20891 |
No files matched your search
@@ -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>
|
/// <summary>
|
||||||
/// Parses the PE section table and checks for the EVB packer's section names.
|
/// Parses the PE section table and checks for the EVB packer's section names.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -18,9 +18,16 @@ namespace GameLauncher.Engines.Evb
|
|||||||
public static class EvbDetector
|
public static class EvbDetector
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true when the game directory holds an EVB packed executable.
|
/// 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
|
/// (or a completed extraction of one).
|
||||||
/// decisive signal, in addition to the PE-signature check.
|
///
|
||||||
|
/// 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>
|
/// </summary>
|
||||||
public static bool IsEvbGame(string gameDirectory)
|
public static bool IsEvbGame(string gameDirectory)
|
||||||
{
|
{
|
||||||
@@ -39,7 +46,13 @@ namespace GameLauncher.Engines.Evb
|
|||||||
}
|
}
|
||||||
catch
|
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;
|
return EvbDetectionHelper.FindEvbPackedExecutable(gameDirectory) != null;
|
||||||
|
|||||||
@@ -134,14 +134,14 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
public bool IsEvbPacked
|
public bool IsEvbPacked
|
||||||
{
|
{
|
||||||
get => _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>
|
/// <summary>EVB 解凍済み(_evb_extracted に出力済み)かどうか</summary>
|
||||||
public bool IsEvbExtracted
|
public bool IsEvbExtracted
|
||||||
{
|
{
|
||||||
get => _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>
|
/// <summary>EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted)</summary>
|
||||||
@@ -177,6 +177,12 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
/// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary>
|
/// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary>
|
||||||
public Visibility EvbNeedsUnpackVisibility => (IsEvbPacked && !IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
|
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>
|
/// <summary>
|
||||||
/// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。
|
/// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。
|
||||||
/// 選択時のガイドで「README.md を参照してください」と案内するために使用します。
|
/// 選択時のガイドで「README.md を参照してください」と案内するために使用します。
|
||||||
@@ -215,12 +221,20 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
return ExecutablePath;
|
return ExecutablePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。
|
||||||
var outputDir = !string.IsNullOrEmpty(EvbExtractedDirPath)
|
var outputDir = !string.IsNullOrEmpty(EvbExtractedDirPath)
|
||||||
? EvbExtractedDirPath!
|
? EvbExtractedDirPath!
|
||||||
: GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(RootDirectory);
|
: GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(RootDirectory);
|
||||||
|
|
||||||
|
// ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで
|
||||||
|
// 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。
|
||||||
var exe = GameLauncher.Engines.Evb.EvbUnpackService.FindLaunchExecutable(outputDir);
|
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>
|
/// <summary>FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか</summary>
|
||||||
|
|||||||
@@ -688,6 +688,13 @@
|
|||||||
<TextBlock Text="要解凍" FontSize="10" FontWeight="Bold" Foreground="#3A2A00"/>
|
<TextBlock Text="要解凍" FontSize="10" FontWeight="Bold" Foreground="#3A2A00"/>
|
||||||
</Border>
|
</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 Background="{StaticResource BadgeModdedBg}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
|
|||||||
+9
-3
@@ -617,10 +617,16 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private async Task LaunchGameAsync(GameItemBase game)
|
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);
|
MessageBox.Show($"実行ファイルが見つかりません:\n{effectiveExe}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
AppendLog($"[起動失敗] 実行ファイルが見つかりません: {game.ExecutablePath}");
|
AppendLog($"[起動失敗] 実行ファイルが見つかりません: {effectiveExe}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -474,7 +474,15 @@ namespace GameLauncher.Services
|
|||||||
SrpgProxyDll = tg.SrpgProxyDll,
|
SrpgProxyDll = tg.SrpgProxyDll,
|
||||||
SrpgSpeedMultiplier = tg.SrpgSpeedMultiplier,
|
SrpgSpeedMultiplier = tg.SrpgSpeedMultiplier,
|
||||||
IsFossilSingleExe = tg.IsFossilSingleExe,
|
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);
|
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
|
return new TkoolGameItem
|
||||||
{
|
{
|
||||||
Title = folderName,
|
Title = folderName,
|
||||||
FolderName = folderName,
|
FolderName = folderName,
|
||||||
RootDirectory = dirPath,
|
RootDirectory = dirPath,
|
||||||
ExecutablePath = packedExe ?? string.Empty,
|
ExecutablePath = launchExe ?? string.Empty,
|
||||||
EngineType = TkoolEngineType.Unknown,
|
PluginsJsPath = pluginsJsPath,
|
||||||
ApplyMod = false,
|
PluginsDirPath = pluginsDirPath,
|
||||||
|
EngineType = engineType,
|
||||||
|
ApplyMod = canApplyMod,
|
||||||
IconImage = icon,
|
IconImage = icon,
|
||||||
FolderLastModified = folderModified,
|
FolderLastModified = folderModified,
|
||||||
IsEvbPacked = true,
|
IsEvbPacked = true,
|
||||||
IsEvbExtracted = isExtracted,
|
IsEvbExtracted = isExtracted,
|
||||||
EvbExtractedDirPath = evbOutDir,
|
EvbExtractedDirPath = evbOutDir,
|
||||||
EvbBackupPath = packedExe != null
|
EvbBackupPath = backupPath,
|
||||||
? packedExe + EvbUnpackService.ExeBackupSuffix
|
|
||||||
: null,
|
|
||||||
EvbUnderlyingEngine = underlying == EngineDetectionHelper.EngineUnknown
|
EvbUnderlyingEngine = underlying == EngineDetectionHelper.EngineUnknown
|
||||||
? string.Empty
|
? string.Empty
|
||||||
: underlying,
|
: 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)
|
public TkoolGameItem? DetectTkoolGameInDirectory(string dirPath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in new issue
Block a user