Compare commits
25
Commits
90584379b7
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f50976a6c0 | ||
|
|
b0fdea2411 | ||
|
|
dd00c96e20 | ||
|
|
4c94cf814f | ||
|
|
2c02e10dd1 | ||
|
|
b65122537d | ||
|
|
ee9eeb3118 | ||
|
|
dc03f5284a | ||
|
|
6447fc2635 | ||
|
|
ec4d718311 | ||
|
|
c03cc97af1 | ||
|
|
ae86b53147 | ||
|
|
2fa40c950f | ||
|
|
7ead7386f6 | ||
|
|
ee7b37323c | ||
|
|
922f669191 | ||
|
|
751e382adc | ||
|
|
cfdba6806a | ||
|
|
45bff52198 | ||
|
|
4398f80aa4 | ||
|
|
908dc443eb | ||
|
|
8f67ab1864 | ||
|
|
6f98860892 | ||
|
|
c0989362a9 | ||
|
|
59519208f3 |
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8-bom
|
||||||
|
end_of_line = crlf
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# this. の明示
|
||||||
|
dotnet_style_qualification_for_field = true:suggestion
|
||||||
|
dotnet_style_qualification_for_property = true:suggestion
|
||||||
|
dotnet_style_qualification_for_method = true:suggestion
|
||||||
|
dotnet_style_qualification_for_event = true:suggestion
|
||||||
|
|
||||||
|
# 改行・波括弧スタイル
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
|
||||||
|
# 空白スタイル
|
||||||
|
csharp_space_after_cast = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Visual Studio 2026 / .NET .gitignore
|
## Visual Studio 2026 / .NET .gitignore
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# AGENTS.md — GameLauncher エージェント規則
|
# AGENTS.md — GameLauncher エージェント規則
|
||||||
|
|
||||||
このファイルは **GameLauncher プロジェクトの AI エージェント向け規則** である。
|
このファイルは **GameLauncher プロジェクトの AI エージェント向け規則** である。
|
||||||
本プロジェクトでのすべての変更(コード追加・修正・削除・発行)は、必ず以下の規則に従って実施すること。
|
本プロジェクトでのすべての変更(コード追加・修正・削除・発行)は、必ず以下の規則に従って実施すること。
|
||||||
@@ -50,6 +50,10 @@
|
|||||||
- コードコメントは既存コードに合わせて日本語/英語を適切に使い分ける。
|
- コードコメントは既存コードに合わせて日本語/英語を適切に使い分ける。
|
||||||
- 新規ファイルには冒頭に説明コメントを付ける。
|
- 新規ファイルには冒頭に説明コメントを付ける。
|
||||||
- ファイル名・シンボル参照はバッククォートで囲む。
|
- ファイル名・シンボル参照はバッククォートで囲む。
|
||||||
|
- UI 文字列を追加・変更する場合は、既存の日本語表記に合わせる。
|
||||||
|
|
||||||
|
> 注: ユーザーから見える出力の言語(日本語)については、グローバルのユーザー記憶
|
||||||
|
> (`/memories/preferences.md`)で規定する。重複を避けるため本ファイルでは規定しない。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -60,3 +64,4 @@
|
|||||||
3. ゲーム個別処理は `Engines/<Engine>/Games/<GameName>/` に分離し、他ゲームへ影響しないか。
|
3. ゲーム個別処理は `Engines/<Engine>/Games/<GameName>/` に分離し、他ゲームへ影響しないか。
|
||||||
4. 外部ツールは `Engines/<Engine>/Tools/` にあり、`AppPathHelper` 経由で参照しているか。
|
4. 外部ツールは `Engines/<Engine>/Tools/` にあり、`AppPathHelper` 経由で参照しているか。
|
||||||
5. ビルドが成功し、`publish.ps1` で発行できるか。
|
5. ビルドが成功し、`publish.ps1` で発行できるか。
|
||||||
|
6. ユーザーから見える出力が日本語になっているか(判定基準は `/memories/preferences.md`)。
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="GameLauncher.AddKeyDialog"
|
<Window x:Class="GameLauncher.AddKeyDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
|||||||
+12
-12
@@ -1,4 +1,4 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using GameLauncher.Models;
|
using GameLauncher.Models;
|
||||||
using GameLauncher.Engines.Unity;
|
using GameLauncher.Engines.Unity;
|
||||||
@@ -16,37 +16,37 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public AddKeyDialog()
|
public AddKeyDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.InitializeComponent();
|
||||||
txtKeyName.Focus();
|
this.txtKeyName.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOk_Click(object sender, RoutedEventArgs e)
|
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var keyName = txtKeyName.Text.Trim();
|
var keyName = this.txtKeyName.Text.Trim();
|
||||||
if (string.IsNullOrWhiteSpace(keyName))
|
if (string.IsNullOrWhiteSpace(keyName))
|
||||||
{
|
{
|
||||||
MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyName = keyName;
|
this.KeyName = keyName;
|
||||||
var selectedTag = (cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString();
|
var selectedTag = (this.cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString();
|
||||||
KeyType = selectedTag switch
|
this.KeyType = selectedTag switch
|
||||||
{
|
{
|
||||||
"Float" => PlayerPrefsType.Float,
|
"Float" => PlayerPrefsType.Float,
|
||||||
"String" => PlayerPrefsType.String,
|
"String" => PlayerPrefsType.String,
|
||||||
_ => PlayerPrefsType.Int
|
_ => PlayerPrefsType.Int
|
||||||
};
|
};
|
||||||
KeyValue = txtKeyValue.Text;
|
this.KeyValue = this.txtKeyValue.Text;
|
||||||
|
|
||||||
DialogResult = true;
|
this.DialogResult = true;
|
||||||
Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult = false;
|
this.DialogResult = false;
|
||||||
Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Application x:Class="GameLauncher.App"
|
<Application x:Class="GameLauncher.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:GameLauncher"
|
xmlns:local="clr-namespace:GameLauncher"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using GameLauncher.Helpers;
|
using GameLauncher.Helpers;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
//ティラノビルダーによる自動ビルド
|
//ティラノビルダーによる自動ビルド
|
||||||
;debugMenu.visible=false
|
;debugMenu.visible=false
|
||||||
;configSave=file
|
;configSave=file
|
||||||
;global.config_version=5.00
|
;global.config_version=5.00
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="GameLauncher.ConfigDialog"
|
<Window x:Class="GameLauncher.ConfigDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="アプリケーション設定"
|
Title="アプリケーション設定"
|
||||||
|
|||||||
+23
-23
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -19,14 +19,14 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public ConfigDialog(LauncherConfig config)
|
public ConfigDialog(LauncherConfig config)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.InitializeComponent();
|
||||||
_config = config;
|
this._config = config;
|
||||||
|
|
||||||
txtRgssExtractorPath.Text = _config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe";
|
this.txtRgssExtractorPath.Text = this._config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe";
|
||||||
txtWolfExtractorPath.Text = _config.WolfExtractorPath ?? string.Empty;
|
this.txtWolfExtractorPath.Text = this._config.WolfExtractorPath ?? string.Empty;
|
||||||
txtWindowResizeToolPath.Text = _config.WindowResizeToolPath ?? string.Empty;
|
this.txtWindowResizeToolPath.Text = this._config.WindowResizeToolPath ?? string.Empty;
|
||||||
txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory();
|
this.txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory();
|
||||||
chkDefaultApplyMod.IsChecked = _config.DefaultApplyMod;
|
this.chkDefaultApplyMod.IsChecked = this._config.DefaultApplyMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnBrowseExtractor_Click(object sender, RoutedEventArgs e)
|
private void btnBrowseExtractor_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -38,7 +38,7 @@ namespace GameLauncher
|
|||||||
FileName = "RGSS Extractor.exe"
|
FileName = "RGSS Extractor.exe"
|
||||||
};
|
};
|
||||||
|
|
||||||
var currentDir = Path.GetDirectoryName(txtRgssExtractorPath.Text);
|
var currentDir = Path.GetDirectoryName(this.txtRgssExtractorPath.Text);
|
||||||
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
||||||
{
|
{
|
||||||
ofd.InitialDirectory = currentDir;
|
ofd.InitialDirectory = currentDir;
|
||||||
@@ -46,7 +46,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
if (ofd.ShowDialog() == true)
|
if (ofd.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
txtRgssExtractorPath.Text = ofd.FileName;
|
this.txtRgssExtractorPath.Text = ofd.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ namespace GameLauncher
|
|||||||
FileName = "UberWolfCli.exe"
|
FileName = "UberWolfCli.exe"
|
||||||
};
|
};
|
||||||
|
|
||||||
var currentDir = Path.GetDirectoryName(txtWolfExtractorPath.Text);
|
var currentDir = Path.GetDirectoryName(this.txtWolfExtractorPath.Text);
|
||||||
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
||||||
{
|
{
|
||||||
ofd.InitialDirectory = currentDir;
|
ofd.InitialDirectory = currentDir;
|
||||||
@@ -67,7 +67,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
if (ofd.ShowDialog() == true)
|
if (ofd.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
txtWolfExtractorPath.Text = ofd.FileName;
|
this.txtWolfExtractorPath.Text = ofd.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ namespace GameLauncher
|
|||||||
FileName = "Sizer.exe"
|
FileName = "Sizer.exe"
|
||||||
};
|
};
|
||||||
|
|
||||||
var currentDir = Path.GetDirectoryName(txtWindowResizeToolPath.Text);
|
var currentDir = Path.GetDirectoryName(this.txtWindowResizeToolPath.Text);
|
||||||
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
|
||||||
{
|
{
|
||||||
ofd.InitialDirectory = currentDir;
|
ofd.InitialDirectory = currentDir;
|
||||||
@@ -88,7 +88,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
if (ofd.ShowDialog() == true)
|
if (ofd.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
txtWindowResizeToolPath.Text = ofd.FileName;
|
this.txtWindowResizeToolPath.Text = ofd.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,19 +111,19 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnSave_Click(object sender, RoutedEventArgs e)
|
private void btnSave_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_config.RgssExtractorPath = txtRgssExtractorPath.Text.Trim();
|
this._config.RgssExtractorPath = this.txtRgssExtractorPath.Text.Trim();
|
||||||
_config.WolfExtractorPath = txtWolfExtractorPath.Text.Trim();
|
this._config.WolfExtractorPath = this.txtWolfExtractorPath.Text.Trim();
|
||||||
_config.WindowResizeToolPath = txtWindowResizeToolPath.Text.Trim();
|
this._config.WindowResizeToolPath = this.txtWindowResizeToolPath.Text.Trim();
|
||||||
_config.DefaultApplyMod = chkDefaultApplyMod.IsChecked == true;
|
this._config.DefaultApplyMod = this.chkDefaultApplyMod.IsChecked == true;
|
||||||
IsSaved = true;
|
this.IsSaved = true;
|
||||||
DialogResult = true;
|
this.DialogResult = true;
|
||||||
Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult = false;
|
this.DialogResult = false;
|
||||||
Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace GameLauncher.Engines.Common
|
namespace GameLauncher.Engines.Common
|
||||||
@@ -136,8 +136,7 @@ namespace GameLauncher.Engines.Common
|
|||||||
return EngineTkool;
|
return EngineTkool;
|
||||||
}
|
}
|
||||||
|
|
||||||
var packageJson = Path.Combine(gameDirectory, "package.json");
|
if (Engines.Nwjs.NwjsDetector.IsNwjsGame(gameDirectory))
|
||||||
if (File.Exists(packageJson) && Directory.Exists(Path.Combine(gameDirectory, "nwjs")))
|
|
||||||
{
|
{
|
||||||
return EngineNwjs;
|
return EngineNwjs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using GameLauncher.Models;
|
using GameLauncher.Models;
|
||||||
|
|
||||||
namespace GameLauncher.Engines.Common
|
namespace GameLauncher.Engines.Common
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,43 +1,40 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace GameLauncher.Engines.Evb
|
namespace GameLauncher.Engines.Evb
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detects Enigma Virtual Box (EVB) packed executables using reliable PE signatures
|
/// Detects Enigma Virtual Box (EVB) packed executables that are actually compressed
|
||||||
/// only. Heuristic checks such as file name or extension are intentionally avoided so
|
/// with EVB and unpackable by <c>evbunpack</c>.
|
||||||
/// that ordinary (unpacked) games are never misclassified.
|
|
||||||
///
|
///
|
||||||
/// Detection strategy:
|
/// Detection strategy:
|
||||||
/// 1. Parse the PE header and inspect the section table for the packer's sections
|
/// 1. Parse the PE header and inspect the section table for the packer's
|
||||||
/// (".enigma1" / ".enigma2"). A present section is a decisive match.
|
/// <c>.enigma1</c> section (required by <c>evbunpack</c> to restore the PE).
|
||||||
/// 2. When sections are inconclusive, scan bounded windows of the file for the
|
/// 2. Verify the presence of the EVB virtual filesystem pack header signature
|
||||||
/// "Enigma Virtual Box" marker string embedded by the packer.
|
/// (<c>"EVB\0"</c> / <c>0x45, 0x56, 0x42, 0x00</c>) inside the Enigma section
|
||||||
|
/// data or PE overlay (required by <c>evbunpack</c> to extract the VFS, and
|
||||||
|
/// distinguishes Enigma Virtual Box from commercial Enigma Protector DRM which
|
||||||
|
/// cannot be unpacked).
|
||||||
///
|
///
|
||||||
/// This class is engine-local and has no side effects.
|
/// This class is engine-local and has no side effects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class EvbDetectionHelper
|
public static class EvbDetectionHelper
|
||||||
{
|
{
|
||||||
/// <summary>Marker string embedded by the Enigma Virtual Box packer.</summary>
|
/// <summary>Primary section name required by evbunpack.</summary>
|
||||||
private const string EnigmaMarker = "Enigma Virtual Box";
|
private const string EnigmaPrimarySection = ".enigma1";
|
||||||
|
|
||||||
/// <summary>Section names produced by the packer.</summary>
|
/// <summary>Secondary section name produced by the packer.</summary>
|
||||||
private static readonly string[] EnigmaSections = { ".enigma1", ".enigma2" };
|
private const string EnigmaSecondarySection = ".enigma2";
|
||||||
|
|
||||||
/// <summary>Additional loader identifiers checked during the content scan.</summary>
|
/// <summary>EVB virtual filesystem header magic ("EVB\0").</summary>
|
||||||
private static readonly string[] EvbContentMarkers =
|
private static readonly byte[] EvbMagic = [0x45, 0x56, 0x42, 0x00];
|
||||||
{
|
|
||||||
EnigmaMarker,
|
|
||||||
"evb.dll",
|
|
||||||
"EnigmaVB",
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>Returns true when the given executable is packed with EVB.</summary>
|
/// <summary>Returns true when the given executable is packed with EVB and can be unpacked.</summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Step 1 reads the PE section table for the packer's section names.
|
/// Reads the PE section table for <c>.enigma1</c> and verifies the <c>EVB\0</c>
|
||||||
/// Step 2 falls back to a bounded content scan for the packer marker.
|
/// virtual filesystem header. Any IO/format error yields false.
|
||||||
/// Any IO/format error yields false (treated as "not confidently EVB").
|
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static bool IsEvbPacked(string exePath)
|
public static bool IsEvbPacked(string exePath)
|
||||||
{
|
{
|
||||||
@@ -48,24 +45,11 @@ namespace GameLauncher.Engines.Evb
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Step 1: decisive PE section check.
|
return HasExtractableEnigmaPackage(exePath);
|
||||||
if (HasEnigmaSection(exePath))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Fall through to the content scan on any parse failure.
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Step 2: content marker scan over bounded windows.
|
|
||||||
return ContainsEvbContentMarker(exePath);
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
// Unparseable executable -> never claim EVB.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,8 +67,11 @@ namespace GameLauncher.Engines.Evb
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Directory.GetFiles(gameDirectory, "*.exe", SearchOption.TopDirectoryOnly)
|
var exes = Directory.GetFiles(gameDirectory, "*.exe", SearchOption.TopDirectoryOnly)
|
||||||
.FirstOrDefault(IsEvbPacked);
|
.Where(f => !IsExcludedUtilityExe(Path.GetFileName(f)))
|
||||||
|
.OrderBy(f => string.Equals(Path.GetFileName(f), "Game.exe", StringComparison.OrdinalIgnoreCase) ? 0 : 1);
|
||||||
|
|
||||||
|
return exes.FirstOrDefault(IsEvbPacked);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -92,6 +79,15 @@ namespace GameLauncher.Engines.Evb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsExcludedUtilityExe(string fileName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fileName)) return true;
|
||||||
|
return fileName.StartsWith("unins", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
fileName.StartsWith("UnityCrashHandler", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
fileName.Equals("notification_helper.exe", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
fileName.Equals("crashpad_handler.exe", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true when the game directory already holds a completed EVB extraction.
|
/// Returns true when the game directory already holds a completed EVB extraction.
|
||||||
///
|
///
|
||||||
@@ -122,9 +118,10 @@ namespace GameLauncher.Engines.Evb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the PE section table and checks for the EVB packer's section names.
|
/// Parses the PE section table, verifies the <c>.enigma1</c> section, and checks
|
||||||
|
/// for the <c>EVB\0</c> virtual filesystem header required by <c>evbunpack</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool HasEnigmaSection(string exePath)
|
private static bool HasExtractableEnigmaPackage(string exePath)
|
||||||
{
|
{
|
||||||
using var fs = new FileStream(exePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
using var fs = new FileStream(exePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
using var reader = new BinaryReader(fs);
|
using var reader = new BinaryReader(fs);
|
||||||
@@ -153,22 +150,30 @@ namespace GameLauncher.Engines.Evb
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// COFF header: skip machine + number of sections is at offset 2 from here.
|
// COFF header: number of sections is at offset 6 from PE signature (peOffset + 6).
|
||||||
fs.Seek(peOffset + 4, SeekOrigin.Begin);
|
fs.Seek(peOffset + 6, SeekOrigin.Begin);
|
||||||
ushort sectionCount = reader.ReadUInt16();
|
ushort sectionCount = reader.ReadUInt16();
|
||||||
|
if (sectionCount == 0 || sectionCount > 96)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Optional header size (end of the optional header) is at offset 20 in the COFF header.
|
// Optional header size is at offset 20 in the COFF header.
|
||||||
fs.Seek(peOffset + 20, SeekOrigin.Begin);
|
fs.Seek(peOffset + 20, SeekOrigin.Begin);
|
||||||
ushort optionalHeaderSize = reader.ReadUInt16();
|
ushort optionalHeaderSize = reader.ReadUInt16();
|
||||||
|
|
||||||
// Section table starts right after the optional header.
|
// Section table starts right after the optional header.
|
||||||
long sectionTable = peOffset + 24 + optionalHeaderSize;
|
long sectionTable = peOffset + 24 + optionalHeaderSize;
|
||||||
|
|
||||||
// Each section header is 40 bytes; the section name is the first 8 bytes.
|
bool hasEnigma1 = false;
|
||||||
|
var enigmaRanges = new List<(long Offset, long Size)>();
|
||||||
|
long maxSectionEnd = 0;
|
||||||
|
|
||||||
|
// Each section header is 40 bytes.
|
||||||
for (int i = 0; i < sectionCount; i++)
|
for (int i = 0; i < sectionCount; i++)
|
||||||
{
|
{
|
||||||
long offset = sectionTable + (long)i * 40;
|
long offset = sectionTable + (long)i * 40;
|
||||||
if (offset + 8 > fs.Length)
|
if (offset + 40 > fs.Length)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -177,54 +182,100 @@ namespace GameLauncher.Engines.Evb
|
|||||||
var nameBytes = reader.ReadBytes(8);
|
var nameBytes = reader.ReadBytes(8);
|
||||||
var name = System.Text.Encoding.ASCII.GetString(nameBytes).TrimEnd('\0').Trim();
|
var name = System.Text.Encoding.ASCII.GetString(nameBytes).TrimEnd('\0').Trim();
|
||||||
|
|
||||||
foreach (var section in EnigmaSections)
|
fs.Seek(offset + 16, SeekOrigin.Begin);
|
||||||
|
uint rawSize = reader.ReadUInt32();
|
||||||
|
uint rawPtr = reader.ReadUInt32();
|
||||||
|
|
||||||
|
if (rawPtr > 0 && rawSize > 0)
|
||||||
{
|
{
|
||||||
if (string.Equals(name, section, StringComparison.OrdinalIgnoreCase))
|
long end = (long)rawPtr + rawSize;
|
||||||
|
if (end > maxSectionEnd && end <= fs.Length)
|
||||||
|
{
|
||||||
|
maxSectionEnd = end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(name, EnigmaPrimarySection, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
hasEnigma1 = true;
|
||||||
|
if (rawPtr > 0 && rawSize > 0 && rawPtr < fs.Length)
|
||||||
|
{
|
||||||
|
enigmaRanges.Insert(0, (rawPtr, Math.Min((long)rawSize, fs.Length - rawPtr)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (string.Equals(name, EnigmaSecondarySection, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (rawPtr > 0 && rawSize > 0 && rawPtr < fs.Length)
|
||||||
|
{
|
||||||
|
enigmaRanges.Add((rawPtr, Math.Min((long)rawSize, fs.Length - rawPtr)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// evbunpack requires the .enigma1 section to unpack and rebuild the executable.
|
||||||
|
if (!hasEnigma1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also include PE overlay if any bytes exist after the last section.
|
||||||
|
if (maxSectionEnd > 0 && maxSectionEnd + 64 <= fs.Length)
|
||||||
|
{
|
||||||
|
enigmaRanges.Add((maxSectionEnd, fs.Length - maxSectionEnd));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the EVB virtual filesystem signature ("EVB\0") exists in the
|
||||||
|
// Enigma sections or overlay so that Enigma Protector DRM executables (which
|
||||||
|
// have .enigma1/.enigma2 but no unpackable EVB VFS) are not misclassified.
|
||||||
|
foreach (var (rangeOffset, rangeSize) in enigmaRanges)
|
||||||
|
{
|
||||||
|
if (ContainsEvbMagicInRange(fs, rangeOffset, rangeSize))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scans bounded windows of the executable for EVB loader markers.
|
/// Searches for the "EVB\0" pack header signature within the given file range
|
||||||
/// EVB metadata typically sits near the end of the PE (overlay).
|
/// (scanning up to the first 16 MB of the range in 64 KB chunks).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool ContainsEvbContentMarker(string exePath)
|
private static bool ContainsEvbMagicInRange(FileStream fs, long startOffset, long length)
|
||||||
{
|
{
|
||||||
const int windowSize = 2 * 1024 * 1024;
|
const int chunkSize = 64 * 1024;
|
||||||
using var fs = new FileStream(exePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
long maxScan = Math.Min(length, 16L * 1024 * 1024);
|
||||||
long size = fs.Length;
|
if (maxScan < EvbMagic.Length)
|
||||||
if (size < 1024)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double[] fractions = { 0.5, 0.8, 0.9, 0.97 };
|
var buffer = new byte[chunkSize + EvbMagic.Length];
|
||||||
foreach (var frac in fractions)
|
long scanned = 0;
|
||||||
|
|
||||||
|
while (scanned < maxScan)
|
||||||
{
|
{
|
||||||
long start = (long)(size * frac);
|
long readPos = startOffset + scanned;
|
||||||
int readLen = (int)Math.Min(windowSize, size - start);
|
int toRead = (int)Math.Min(buffer.Length, (startOffset + maxScan) - readPos);
|
||||||
if (readLen <= 0)
|
if (toRead < EvbMagic.Length)
|
||||||
{
|
{
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf = new byte[readLen];
|
fs.Seek(readPos, SeekOrigin.Begin);
|
||||||
fs.Seek(start, SeekOrigin.Begin);
|
int read = fs.Read(buffer, 0, toRead);
|
||||||
int read = fs.Read(buf, 0, buf.Length);
|
if (read < EvbMagic.Length)
|
||||||
var text = System.Text.Encoding.ASCII.GetString(buf, 0, read);
|
|
||||||
|
|
||||||
foreach (var marker in EvbContentMarkers)
|
|
||||||
{
|
{
|
||||||
if (text.IndexOf(marker, StringComparison.OrdinalIgnoreCase) >= 0)
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer.AsSpan(0, read).IndexOf(EvbMagic) >= 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
scanned += chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using GameLauncher.Engines.Common;
|
using GameLauncher.Engines.Common;
|
||||||
|
|
||||||
@@ -19,12 +19,12 @@ namespace GameLauncher.Engines.Evb
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true when the game directory holds an EVB packed executable
|
/// Returns true when the game directory holds an EVB packed executable
|
||||||
/// (or a completed extraction of one).
|
/// that can actually be unpacked (or a completed extraction of one).
|
||||||
///
|
///
|
||||||
/// Accepts any of the following decisive signals:
|
/// Accepts only the following decisive signals:
|
||||||
/// 1. A packed project file (<c>*.evb</c>) in the folder.
|
/// 1. A top-level executable carrying both a decisive EVB PE section (.enigma1)
|
||||||
/// 2. A top-level executable carrying a decisive EVB PE signature.
|
/// and the EVB virtual filesystem signature ("EVB\0"), so it is unpackable.
|
||||||
/// 3. An already-unpacked game (game-local "_evb_extracted" with a completion
|
/// 2. An already-unpacked game (game-local "_evb_extracted" with a completion
|
||||||
/// marker). This is required because unpacking renames the original packed exe
|
/// marker). This is required because unpacking renames the original packed exe
|
||||||
/// to "*.glbak", after which the signature check alone would no longer detect
|
/// to "*.glbak", after which the signature check alone would no longer detect
|
||||||
/// the game and its launch / icon resolution would break.
|
/// the game and its launch / icon resolution would break.
|
||||||
@@ -36,19 +36,6 @@ namespace GameLauncher.Engines.Evb
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// A packed project file in the folder is the strongest single signal.
|
|
||||||
if (Directory.GetFiles(gameDirectory, "*.evb", SearchOption.TopDirectoryOnly).Length > 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Fall through to the remaining checks.
|
|
||||||
}
|
|
||||||
|
|
||||||
// A completed extraction keeps the game recognized even without the packed exe.
|
// A completed extraction keeps the game recognized even without the packed exe.
|
||||||
if (EvbDetectionHelper.IsExtracted(gameDirectory))
|
if (EvbDetectionHelper.IsExtracted(gameDirectory))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using GameLauncher.Engines.Common;
|
using GameLauncher.Engines.Common;
|
||||||
using GameLauncher.Models;
|
using GameLauncher.Models;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace GameLauncher.Engines.Evb
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string ResolveToolPath(string toolFileName)
|
public string ResolveToolPath(string toolFileName)
|
||||||
=> AppPathHelperBridge.Resolve(EngineName, toolFileName);
|
=> AppPathHelperBridge.Resolve(this.EngineName, toolFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -79,7 +79,7 @@ namespace GameLauncher.Engines.Evb
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Preferred names commonly used by NW.js / RPG Maker / Tyrano bundles.
|
// Preferred names commonly used by NW.js / RPG Maker / Tyrano bundles.
|
||||||
string[] preferred = { "Game.exe", "game.exe", "nw.exe", "Game_boxed.exe" };
|
string[] preferred = ["Game.exe", "game.exe", "nw.exe", "Game_boxed.exe"];
|
||||||
foreach (var name in preferred)
|
foreach (var name in preferred)
|
||||||
{
|
{
|
||||||
var direct = Path.Combine(outputDirectory, name);
|
var direct = Path.Combine(outputDirectory, name);
|
||||||
@@ -302,7 +302,7 @@ namespace GameLauncher.Engines.Evb
|
|||||||
{
|
{
|
||||||
foreach (var backup in Directory.GetFiles(gameRootDir, "*" + ExeBackupSuffix))
|
foreach (var backup in Directory.GetFiles(gameRootDir, "*" + ExeBackupSuffix))
|
||||||
{
|
{
|
||||||
var original = backup.Substring(0, backup.Length - ExeBackupSuffix.Length);
|
var original = backup[..^ExeBackupSuffix.Length];
|
||||||
if (!File.Exists(original))
|
if (!File.Exists(original))
|
||||||
{
|
{
|
||||||
File.Move(backup, original);
|
File.Move(backup, original);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# evbunpack (bundled tool)
|
# evbunpack (bundled tool)
|
||||||
|
|
||||||
`evbunpack.exe` is a bundled, third-party unpacker used by the **Evb** engine module to
|
`evbunpack.exe` is a bundled, third-party unpacker used by the **Evb** engine module to
|
||||||
unpack applications protected with **Enigma Virtual Box**.
|
unpack applications protected with **Enigma Virtual Box**.
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
long packageJsonOffset = -1;
|
long packageJsonOffset = -1;
|
||||||
long packageJsonSize = -1;
|
long packageJsonSize = -1;
|
||||||
|
|
||||||
TraverseFiles(filesRoot, "", dataOffset, fs.Length, result, includeFileList,
|
this.TraverseFiles(filesRoot, "", dataOffset, fs.Length, result, includeFileList,
|
||||||
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
||||||
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
|
|
||||||
if (val.TryGetProperty("files", out var subFiles))
|
if (val.TryGetProperty("files", out var subFiles))
|
||||||
{
|
{
|
||||||
TraverseFiles(subFiles, path, dataOffset, fileLength, result, includeFileList,
|
this.TraverseFiles(subFiles, path, dataOffset, fileLength, result, includeFileList,
|
||||||
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
||||||
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
// UNC パス (例: \\server\share\...) の場合
|
// UNC パス (例: \\server\share\...) の場合
|
||||||
if (normalized.StartsWith(@"\\", StringComparison.Ordinal))
|
if (normalized.StartsWith(@"\\", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
return @"\\?\UNC\" + normalized.Substring(2);
|
return @"\\?\UNC\" + normalized[2..];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 相対パスの場合は安全に絶対パスを取得してからプレフィックスを付与
|
// 相対パスの場合は安全に絶対パスを取得してからプレフィックスを付与
|
||||||
@@ -408,7 +408,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
}
|
}
|
||||||
if (full.StartsWith(@"\\", StringComparison.Ordinal))
|
if (full.StartsWith(@"\\", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
return @"\\?\UNC\" + full.Substring(2);
|
return @"\\?\UNC\" + full[2..];
|
||||||
}
|
}
|
||||||
return @"\\?\" + full;
|
return @"\\?\" + full;
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ヘッダ詳細解析
|
// ヘッダ詳細解析
|
||||||
var inspect = InspectAsar(targetAsar, includeFileList: true);
|
var inspect = this.InspectAsar(targetAsar, includeFileList: true);
|
||||||
if (!inspect.IsValid || inspect.FileEntries.Count == 0)
|
if (!inspect.IsValid || inspect.FileEntries.Count == 0)
|
||||||
{
|
{
|
||||||
return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。");
|
return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。");
|
||||||
@@ -503,8 +503,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin);
|
fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin);
|
||||||
long remaining = entry.Size;
|
long remaining = entry.Size;
|
||||||
|
|
||||||
using (var outFs = new FileStream(destFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
|
using var outFs = new FileStream(destFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
{
|
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
int toRead = (int)Math.Min(remaining, buffer.Length);
|
int toRead = (int)Math.Min(remaining, buffer.Length);
|
||||||
@@ -518,7 +517,6 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
progress?.Report((extractedBytes, totalBytes, i + 1, totalFiles, Path.GetFileName(entry.RelativePath)));
|
progress?.Report((extractedBytes, totalBytes, i + 1, totalFiles, Path.GetFileName(entry.RelativePath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception fileEx)
|
catch (Exception fileEx)
|
||||||
{
|
{
|
||||||
// 予約文字や排他ロック等の例外が発生した場合、解凍全体を止めずに警告として記録
|
// 予約文字や排他ロック等の例外が発生した場合、解凍全体を止めずに警告として記録
|
||||||
@@ -573,7 +571,7 @@ namespace GameLauncher.Engines.Nwjs
|
|||||||
: asarPath + AsarBackupSuffix;
|
: asarPath + AsarBackupSuffix;
|
||||||
|
|
||||||
var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase)
|
var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase)
|
||||||
? asarPath.Substring(0, asarPath.Length - AsarBackupSuffix.Length)
|
? asarPath[..^AsarBackupSuffix.Length]
|
||||||
: asarPath;
|
: asarPath;
|
||||||
|
|
||||||
string extExtractedDir = ToExtendedPath(extractedDir);
|
string extExtractedDir = ToExtendedPath(extractedDir);
|
||||||
|
|||||||
@@ -0,0 +1,332 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using GameLauncher.Engines.Common;
|
||||||
|
using GameLauncher.Engines.Tkool;
|
||||||
|
using GameLauncher.Engines.Unity;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Engines.Nwjs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 汎用 NW.js (Node-Webkit) アプリケーション/ゲームの検出およびアイテム生成を行うヘルパークラス
|
||||||
|
/// </summary>
|
||||||
|
public static class NwjsDetector
|
||||||
|
{
|
||||||
|
private static readonly HashSet<string> ExcludedExeNames = new(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
"notification_helper.exe",
|
||||||
|
"crashpad_handler.exe",
|
||||||
|
"elevate.exe"
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたディレクトリが汎用 NW.js ゲームであるかを判定します。
|
||||||
|
/// ツクール(MV/MZ/RGSS)、ティラノスクリプト、ウディタ、SRPG Studio など既存エンジン形式は除外します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dirPath">対象ディレクトリパス</param>
|
||||||
|
/// <returns>NW.js ゲームであれば true</returns>
|
||||||
|
public static bool IsNwjsGame(string dirPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(dirPath) || !Directory.Exists(dirPath))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var packageJsonPath = Path.Combine(dirPath, "package.json");
|
||||||
|
if (!File.Exists(packageJsonPath))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 既存の他エンジン判定(ツクール・ティラノ・ウディタ・SRPG)を最優先で除外
|
||||||
|
if (Directory.Exists(Path.Combine(dirPath, "www")) ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "data", "System.json")) ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "Game.ini")) ||
|
||||||
|
Directory.Exists(Path.Combine(dirPath, "tyrano")) ||
|
||||||
|
Directory.GetFiles(dirPath, "*.tjs", SearchOption.TopDirectoryOnly).Length > 0 ||
|
||||||
|
Directory.GetFiles(dirPath, "*.wolf", SearchOption.TopDirectoryOnly).Length > 0 ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "data.dts")))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NW.js の痕跡を確認
|
||||||
|
if (File.Exists(Path.Combine(dirPath, "nw.dll")) ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "nw.exe")) ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "resources.pak")) ||
|
||||||
|
File.Exists(Path.Combine(dirPath, "node.dll")) ||
|
||||||
|
Directory.Exists(Path.Combine(dirPath, "nwjs")))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// package.json に main や window 記述があるか確認
|
||||||
|
if (TryReadPackageJson(dirPath, out _, out _, out var main, out _))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(main) && File.Exists(Path.Combine(dirPath, main)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定ディレクトリ内の NW.js ゲームを検出し、TkoolGameItem を生成します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dirPath">ゲームフォルダの絶対パス</param>
|
||||||
|
/// <param name="folderName">フォルダ名</param>
|
||||||
|
/// <param name="folderModified">フォルダ更新日時</param>
|
||||||
|
/// <param name="iconLoader">アイコン読み込み関数</param>
|
||||||
|
/// <returns>検出されたゲームアイテム。該当しない場合は null</returns>
|
||||||
|
public static TkoolGameItem? DetectNwjsGame(
|
||||||
|
string dirPath,
|
||||||
|
string folderName,
|
||||||
|
DateTime? folderModified,
|
||||||
|
Func<string?, string?, ImageSource?> iconLoader)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!IsNwjsGame(dirPath))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
TryReadPackageJson(dirPath, out var windowTitle, out var packageName, out var mainFile, out var iconRelPath);
|
||||||
|
|
||||||
|
// タイトルの決定: window.title > index.html の <title> > package.json の name > フォルダ名
|
||||||
|
string title = string.Empty;
|
||||||
|
if (!string.IsNullOrWhiteSpace(windowTitle))
|
||||||
|
{
|
||||||
|
title = windowTitle.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(title))
|
||||||
|
{
|
||||||
|
var htmlPath = !string.IsNullOrWhiteSpace(mainFile)
|
||||||
|
? Path.Combine(dirPath, mainFile)
|
||||||
|
: Path.Combine(dirPath, "index.html");
|
||||||
|
|
||||||
|
title = ExtractHtmlTitle(htmlPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(title) && !string.IsNullOrWhiteSpace(packageName))
|
||||||
|
{
|
||||||
|
title = packageName.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(title))
|
||||||
|
{
|
||||||
|
title = folderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 実行ファイルの探索
|
||||||
|
var exePath = FindNwjsExecutable(dirPath, title, packageName);
|
||||||
|
|
||||||
|
// アイコンの取得
|
||||||
|
ImageSource? icon = null;
|
||||||
|
if (iconLoader != null)
|
||||||
|
{
|
||||||
|
icon = iconLoader(exePath, dirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TkoolGameItem
|
||||||
|
{
|
||||||
|
Title = title,
|
||||||
|
FolderName = folderName,
|
||||||
|
RootDirectory = dirPath,
|
||||||
|
ExecutablePath = exePath ?? string.Empty,
|
||||||
|
PluginsJsPath = string.Empty,
|
||||||
|
PluginsDirPath = string.Empty,
|
||||||
|
EngineType = TkoolEngineType.Nwjs,
|
||||||
|
IsModded = false,
|
||||||
|
ApplyMod = false,
|
||||||
|
IconImage = icon,
|
||||||
|
FolderLastModified = folderModified
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NW.js ゲーム用の実行可能ファイル(.exe)を探索します。
|
||||||
|
/// notification_helper.exe などの Chromium 内部ユーティリティを除外し、ゲーム本体の exe を特定します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dirPath">ディレクトリパス</param>
|
||||||
|
/// <param name="title">ゲームタイトル</param>
|
||||||
|
/// <param name="packageName">package.json の name</param>
|
||||||
|
/// <returns>実行ファイルのパス。見つからない場合は null</returns>
|
||||||
|
public static string? FindNwjsExecutable(string dirPath, string? title, string? packageName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var exes = Directory.GetFiles(dirPath, "*.exe", SearchOption.TopDirectoryOnly)
|
||||||
|
.Where(f =>
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(f);
|
||||||
|
if (fileName.StartsWith("unins", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ExcludedExeNames.Contains(fileName))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (exes.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exes.Count == 1)
|
||||||
|
{
|
||||||
|
return exes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 優先度1: タイトル名またはパッケージ名が含まれる実行ファイル
|
||||||
|
if (!string.IsNullOrWhiteSpace(title))
|
||||||
|
{
|
||||||
|
var match = exes.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f).Contains(title, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (match != null)
|
||||||
|
{
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(packageName))
|
||||||
|
{
|
||||||
|
var match = exes.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f).Contains(packageName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (match != null)
|
||||||
|
{
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 優先度2: Game.exe または nw.exe
|
||||||
|
var gameExe = exes.FirstOrDefault(f => string.Equals(Path.GetFileName(f), "Game.exe", StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (gameExe != null)
|
||||||
|
{
|
||||||
|
return gameExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nwExe = exes.FirstOrDefault(f => string.Equals(Path.GetFileName(f), "nw.exe", StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (nwExe != null)
|
||||||
|
{
|
||||||
|
return nwExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 優先度3: 候補の先頭
|
||||||
|
return exes[0];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// package.json を読み込み、主要な設定値を抽出します。
|
||||||
|
/// </summary>
|
||||||
|
private static bool TryReadPackageJson(
|
||||||
|
string dirPath,
|
||||||
|
out string? windowTitle,
|
||||||
|
out string? name,
|
||||||
|
out string? main,
|
||||||
|
out string? iconRelPath)
|
||||||
|
{
|
||||||
|
windowTitle = null;
|
||||||
|
name = null;
|
||||||
|
main = null;
|
||||||
|
iconRelPath = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var packageJsonPath = Path.Combine(dirPath, "package.json");
|
||||||
|
if (!File.Exists(packageJsonPath))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var json = File.ReadAllText(packageJsonPath);
|
||||||
|
using var doc = JsonDocument.Parse(json);
|
||||||
|
var root = doc.RootElement;
|
||||||
|
|
||||||
|
if (root.TryGetProperty("name", out var nameProp) && nameProp.ValueKind == JsonValueKind.String)
|
||||||
|
{
|
||||||
|
name = nameProp.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.TryGetProperty("main", out var mainProp) && mainProp.ValueKind == JsonValueKind.String)
|
||||||
|
{
|
||||||
|
main = mainProp.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.TryGetProperty("window", out var winProp) && winProp.ValueKind == JsonValueKind.Object)
|
||||||
|
{
|
||||||
|
if (winProp.TryGetProperty("title", out var titleProp) && titleProp.ValueKind == JsonValueKind.String)
|
||||||
|
{
|
||||||
|
windowTitle = titleProp.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (winProp.TryGetProperty("icon", out var iconProp) && iconProp.ValueKind == JsonValueKind.String)
|
||||||
|
{
|
||||||
|
iconRelPath = iconProp.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// HTML ファイルから title タグのテキストを抽出します。
|
||||||
|
/// </summary>
|
||||||
|
private static string ExtractHtmlTitle(string htmlPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(htmlPath))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = File.ReadAllText(htmlPath);
|
||||||
|
var match = Regex.Match(html, @"<title[^>]*>(.*?)</title>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
var title = match.Groups[1].Value.Trim();
|
||||||
|
return System.Net.WebUtility.HtmlDecode(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using GameLauncher.Engines.Tkool;
|
using GameLauncher.Engines.Tkool;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
|
|||||||
var trim = line.Trim();
|
var trim = line.Trim();
|
||||||
if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
|
if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var val = trim.Substring(6).Trim();
|
var val = trim[6..].Trim();
|
||||||
if (!string.IsNullOrWhiteSpace(val) && !val.Contains('\uFFFD'))
|
if (!string.IsNullOrWhiteSpace(val) && !val.Contains('\uFFFD'))
|
||||||
{
|
{
|
||||||
tg.Title = val;
|
tg.Title = val;
|
||||||
@@ -73,23 +73,23 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!File.Exists(filePath)) return Array.Empty<string>();
|
if (!File.Exists(filePath)) return [];
|
||||||
|
|
||||||
byte[] bytes = File.ReadAllBytes(filePath);
|
byte[] bytes = File.ReadAllBytes(filePath);
|
||||||
if (bytes.Length == 0) return Array.Empty<string>();
|
if (bytes.Length == 0) return [];
|
||||||
|
|
||||||
// 1. UTF-8 BOM (EF BB BF)
|
// 1. UTF-8 BOM (EF BB BF)
|
||||||
if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF)
|
if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF)
|
||||||
{
|
{
|
||||||
var text = System.Text.Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3);
|
var text = System.Text.Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3);
|
||||||
return text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
return text.Split(["\r\n", "\r", "\n"], StringSplitOptions.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. UTF-16 LE BOM (FF FE)
|
// 2. UTF-16 LE BOM (FF FE)
|
||||||
if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE)
|
if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE)
|
||||||
{
|
{
|
||||||
var text = System.Text.Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2);
|
var text = System.Text.Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2);
|
||||||
return text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
return text.Split(["\r\n", "\r", "\n"], StringSplitOptions.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Shift_JIS (CP932)
|
// 3. Shift_JIS (CP932)
|
||||||
@@ -104,11 +104,11 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
|
|||||||
}
|
}
|
||||||
|
|
||||||
var decoded = encoding.GetString(bytes);
|
var decoded = encoding.GetString(bytes);
|
||||||
return decoded.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
return decoded.Split(["\r\n", "\r", "\n"], StringSplitOptions.None);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return Array.Empty<string>();
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,11 +415,11 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
{
|
{
|
||||||
if (game.ApplyMod)
|
if (game.ApplyMod)
|
||||||
{
|
{
|
||||||
return await ApplyModAsync(game, pluginSettings, rgssExtractorPath);
|
return await this.ApplyModAsync(game, pluginSettings, rgssExtractorPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RestoreOriginal(game);
|
return this.RestoreOriginal(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
// 1. スクリプトファイルが存在しない場合(RGSS暗号化アーカイブ内の場合)、自動抽出
|
// 1. スクリプトファイルが存在しない場合(RGSS暗号化アーカイブ内の場合)、自動抽出
|
||||||
if (string.IsNullOrEmpty(scriptsPath) || !File.Exists(scriptsPath))
|
if (string.IsNullOrEmpty(scriptsPath) || !File.Exists(scriptsPath))
|
||||||
{
|
{
|
||||||
var (extractSuccess, extractMsg) = await ExtractScriptsAsync(game, rgssExtractorPath);
|
var (extractSuccess, extractMsg) = await this.ExtractScriptsAsync(game, rgssExtractorPath);
|
||||||
if (!extractSuccess)
|
if (!extractSuccess)
|
||||||
{
|
{
|
||||||
return (false, $"スクリプトの抽出に失敗したため改造を適用できませんでした: {extractMsg}");
|
return (false, $"スクリプトの抽出に失敗したため改造を適用できませんでした: {extractMsg}");
|
||||||
@@ -819,14 +819,13 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
if (parserType != null)
|
if (parserType != null)
|
||||||
{
|
{
|
||||||
var parser = Activator.CreateInstance(parserType);
|
var parser = Activator.CreateInstance(parserType);
|
||||||
var parseFileMethod = parserType.GetMethod("parse_file", new[] { typeof(string) });
|
var parseFileMethod = parserType.GetMethod("parse_file", [typeof(string)]);
|
||||||
var getFileDataMethod = parserType.GetMethod("get_filedata");
|
var getFileDataMethod = parserType.GetMethod("get_filedata");
|
||||||
var closeFileMethod = parserType.GetMethod("close_file");
|
var closeFileMethod = parserType.GetMethod("close_file");
|
||||||
|
|
||||||
if (parseFileMethod != null && getFileDataMethod != null && parser != null)
|
if (parseFileMethod != null && getFileDataMethod != null && parser != null)
|
||||||
{
|
{
|
||||||
var entries = parseFileMethod.Invoke(parser, new object[] { archivePath }) as System.Collections.IEnumerable;
|
if (parseFileMethod.Invoke(parser, [archivePath]) is System.Collections.IEnumerable entries)
|
||||||
if (entries != null)
|
|
||||||
{
|
{
|
||||||
foreach (var entry in entries)
|
foreach (var entry in entries)
|
||||||
{
|
{
|
||||||
@@ -839,8 +838,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
(entryName.EndsWith(targetFileName, StringComparison.OrdinalIgnoreCase) ||
|
(entryName.EndsWith(targetFileName, StringComparison.OrdinalIgnoreCase) ||
|
||||||
Path.GetFileName(entryName).Equals(targetFileName, StringComparison.OrdinalIgnoreCase)))
|
Path.GetFileName(entryName).Equals(targetFileName, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
var fileBytes = getFileDataMethod.Invoke(parser, new object[] { entry }) as byte[];
|
if (getFileDataMethod.Invoke(parser, [entry]) is byte[] fileBytes && fileBytes.Length > 0)
|
||||||
if (fileBytes != null && fileBytes.Length > 0)
|
|
||||||
{
|
{
|
||||||
closeFileMethod?.Invoke(parser, null);
|
closeFileMethod?.Invoke(parser, null);
|
||||||
|
|
||||||
@@ -873,10 +871,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
};
|
};
|
||||||
|
|
||||||
using var proc = Process.Start(psi);
|
using var proc = Process.Start(psi);
|
||||||
if (proc != null)
|
proc?.WaitForExit(30000); // 最大30秒待機
|
||||||
{
|
|
||||||
proc.WaitForExit(30000); // 最大30秒待機
|
|
||||||
}
|
|
||||||
|
|
||||||
// RGSS Extractor はツール自身のフォルダ配下に Data\Scripts.rvdata2 等を出力
|
// RGSS Extractor はツール自身のフォルダ配下に Data\Scripts.rvdata2 等を出力
|
||||||
var possibleOutput = Path.Combine(toolDir, "Data", targetFileName);
|
var possibleOutput = Path.Combine(toolDir, "Data", targetFileName);
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
int endIdx = content.IndexOf(ModEndTag, StringComparison.Ordinal);
|
int endIdx = content.IndexOf(ModEndTag, StringComparison.Ordinal);
|
||||||
if (endIdx > startIdx)
|
if (endIdx > startIdx)
|
||||||
{
|
{
|
||||||
content = content.Substring(0, startIdx).TrimEnd() + "\n\n" + modCode + "\n";
|
content = content[..startIdx].TrimEnd() + "\n\n" + modCode + "\n";
|
||||||
File.WriteAllText(scriptPath, content, Encoding.UTF8);
|
File.WriteAllText(scriptPath, content, Encoding.UTF8);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
if (!SrpgArchiveService.IsExtracted(gameDir))
|
if (!SrpgArchiveService.IsExtracted(gameDir))
|
||||||
{
|
{
|
||||||
progress?.Report("アーカイブ(data.dts)を初回展開中...");
|
progress?.Report("アーカイブ(data.dts)を初回展開中...");
|
||||||
var unpackRes = await _archiveService.UnpackDataDtsAsync(gameDir, progress);
|
var unpackRes = await this._archiveService.UnpackDataDtsAsync(gameDir, progress);
|
||||||
if (!unpackRes.Success)
|
if (!unpackRes.Success)
|
||||||
{
|
{
|
||||||
return unpackRes;
|
return unpackRes;
|
||||||
@@ -571,7 +571,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
|
|
||||||
var extractedDir = SrpgArchiveService.GetExtractedDirectory(gameDir);
|
var extractedDir = SrpgArchiveService.GetExtractedDirectory(gameDir);
|
||||||
progress?.Report("Modスクリプトを生成中...");
|
progress?.Report("Modスクリプトを生成中...");
|
||||||
var modBody = GenerateModScript(item);
|
var modBody = this.GenerateModScript(item);
|
||||||
var jsContent = $"{ModStartTag}\n{modBody}\n{ModEndTag}";
|
var jsContent = $"{ModStartTag}\n{modBody}\n{ModEndTag}";
|
||||||
|
|
||||||
// 2. 既存のスクリプトへ注入
|
// 2. 既存のスクリプトへ注入
|
||||||
@@ -604,7 +604,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
|
|
||||||
// 3. data.dts を再パック
|
// 3. data.dts を再パック
|
||||||
progress?.Report("Modを適用した data.dts を再構築中...");
|
progress?.Report("Modを適用した data.dts を再構築中...");
|
||||||
var repackRes = await _archiveService.RepackDataDtsAsync(gameDir, progress);
|
var repackRes = await this._archiveService.RepackDataDtsAsync(gameDir, progress);
|
||||||
if (repackRes.Success)
|
if (repackRes.Success)
|
||||||
{
|
{
|
||||||
item.IsModded = true;
|
item.IsModded = true;
|
||||||
@@ -658,8 +658,8 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
|
|
||||||
// 2. バックアップが存在すればバックアップ復元を試行
|
// 2. バックアップが存在すればバックアップ復元を試行
|
||||||
progress?.Report("オリジナルバックアップから data.dts を復元中...");
|
progress?.Report("オリジナルバックアップから data.dts を復元中...");
|
||||||
var revertRes = await _archiveService.RevertBackupAsync(gameDir);
|
var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir);
|
||||||
if (revertRes.Success)
|
if (Success)
|
||||||
{
|
{
|
||||||
item.IsModded = false;
|
item.IsModded = false;
|
||||||
return (true, "改造プラグインを解除し、元のアーカイブへ復元しました。");
|
return (true, "改造プラグインを解除し、元のアーカイブへ復元しました。");
|
||||||
@@ -667,7 +667,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
|
|
||||||
// バックアップが無い場合は Mod解除状態で再パック
|
// バックアップが無い場合は Mod解除状態で再パック
|
||||||
progress?.Report("Mod解除状態でアーカイブを再構築中...");
|
progress?.Report("Mod解除状態でアーカイブを再構築中...");
|
||||||
var repackRes = await _archiveService.RepackDataDtsAsync(gameDir, progress);
|
var repackRes = await this._archiveService.RepackDataDtsAsync(gameDir, progress);
|
||||||
if (repackRes.Success)
|
if (repackRes.Success)
|
||||||
{
|
{
|
||||||
item.IsModded = false;
|
item.IsModded = false;
|
||||||
@@ -689,7 +689,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
// 1. プロキシDLL解除
|
// 1. プロキシDLL解除
|
||||||
if (IsProxyDllEnabled(gameDir))
|
if (IsProxyDllEnabled(gameDir))
|
||||||
{
|
{
|
||||||
DisableProxyDll(gameDir);
|
this.DisableProxyDll(gameDir);
|
||||||
logs.Add("・プロキシDLL (version.dll) を解除しました");
|
logs.Add("・プロキシDLL (version.dll) を解除しました");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,10 +726,10 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
|
|
||||||
// 3. バックアップからの data.dts 復元
|
// 3. バックアップからの data.dts 復元
|
||||||
progress?.Report("バックアップから元の data.dts を復元中...");
|
progress?.Report("バックアップから元の data.dts を復元中...");
|
||||||
var revertRes = await _archiveService.RevertBackupAsync(gameDir);
|
var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir);
|
||||||
if (revertRes.Success)
|
if (Success)
|
||||||
{
|
{
|
||||||
logs.Add($"・{revertRes.Message}");
|
logs.Add($"・{Message}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -737,7 +737,7 @@ namespace GameLauncher.Engines.Rgss
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. 解凍フォルダの退避
|
// 4. 解凍フォルダの退避
|
||||||
var restoreExtractedRes = _archiveService.RestoreExtractedState(gameDir);
|
var restoreExtractedRes = this._archiveService.RestoreExtractedState(gameDir);
|
||||||
if (restoreExtractedRes.Success && !restoreExtractedRes.Message.Contains("存在しません"))
|
if (restoreExtractedRes.Success && !restoreExtractedRes.Message.Contains("存在しません"))
|
||||||
{
|
{
|
||||||
logs.Add($"・{restoreExtractedRes.Message}");
|
logs.Add($"・{restoreExtractedRes.Message}");
|
||||||
|
|||||||
+476
-234
File diff suppressed because it is too large.
Load diff
@@ -159,9 +159,9 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
|
|
||||||
var entry = $"{BeginMarker}{{\"name\":\"{ModPluginId}\",\"status\":true,\"description\":\"GameLauncher mod\",\"parameters\":{{}}}}{EndMarker}";
|
var entry = $"{BeginMarker}{{\"name\":\"{ModPluginId}\",\"status\":true,\"description\":\"GameLauncher mod\",\"parameters\":{{}}}}{EndMarker}";
|
||||||
|
|
||||||
var prefix = content.Substring(0, arrayStart + 1);
|
var prefix = content[..(arrayStart + 1)];
|
||||||
var inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
|
var inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
|
||||||
var suffix = content.Substring(arrayEnd);
|
var suffix = content[arrayEnd..];
|
||||||
|
|
||||||
var trimmedInner = inner.Trim();
|
var trimmedInner = inner.Trim();
|
||||||
var newInner = string.IsNullOrEmpty(trimmedInner)
|
var newInner = string.IsNullOrEmpty(trimmedInner)
|
||||||
@@ -198,7 +198,7 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
while (scan >= 0 && char.IsWhiteSpace(content[scan])) scan--;
|
while (scan >= 0 && char.IsWhiteSpace(content[scan])) scan--;
|
||||||
if (scan >= 0 && content[scan] == ',') cutStart = scan;
|
if (scan >= 0 && content[scan] == ',') cutStart = scan;
|
||||||
|
|
||||||
content = content.Substring(0, cutStart) + content.Substring(end);
|
content = content[..cutStart] + content[end..];
|
||||||
}
|
}
|
||||||
while (content != prev);
|
while (content != prev);
|
||||||
|
|
||||||
|
|||||||
@@ -31,17 +31,21 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
"BattleTurnRecover",
|
"BattleTurnRecover",
|
||||||
"MaxGainGold",
|
"MaxGainGold",
|
||||||
"MaxGainExp",
|
"MaxGainExp",
|
||||||
"InstantMessage"
|
"InstantMessage",
|
||||||
|
"GameLauncher_Mod",
|
||||||
|
"GameLauncherMod",
|
||||||
|
"GameLauncher_StandaloneMod",
|
||||||
|
"GameLauncherStandaloneMod"
|
||||||
];
|
];
|
||||||
|
|
||||||
private List<ModPluginDefinition> _availablePlugins = [];
|
private List<ModPluginDefinition> _availablePlugins = [];
|
||||||
|
|
||||||
/// <summary>現在認識されている利用可能なプラグイン一覧</summary>
|
/// <summary>現在認識されている利用可能なプラグイン一覧</summary>
|
||||||
public IReadOnlyList<ModPluginDefinition> AvailablePlugins => _availablePlugins;
|
public IReadOnlyList<ModPluginDefinition> AvailablePlugins => this._availablePlugins;
|
||||||
|
|
||||||
public TkoolModService()
|
public TkoolModService()
|
||||||
{
|
{
|
||||||
LoadAvailablePlugins();
|
this.LoadAvailablePlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -86,13 +90,22 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
list.Add(ModPluginDefinition.FromFile(file));
|
var def = ModPluginDefinition.FromFile(file);
|
||||||
|
if (string.Equals(def.Id, "GameLauncher_Mod", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(def.Id, "GameLauncher_StandaloneMod", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(def.Id, "GameLauncherMod", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(def.Id, "GameLauncherStandaloneMod", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(def);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_availablePlugins = list;
|
this._availablePlugins = list;
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,11 +159,11 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
{
|
{
|
||||||
if (game.ApplyMod)
|
if (game.ApplyMod)
|
||||||
{
|
{
|
||||||
return ApplyMod(game, defaultSettings);
|
return this.ApplyMod(game, defaultSettings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RestoreOriginal(game);
|
return this.RestoreOriginal(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -203,18 +216,27 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
string baseContent = File.ReadAllText(backupPath, Encoding.UTF8);
|
string baseContent = File.ReadAllText(backupPath, Encoding.UTF8);
|
||||||
|
|
||||||
// 最新の動的プラグイン一覧を取得
|
// 最新の動的プラグイン一覧を取得
|
||||||
if (_availablePlugins.Count == 0)
|
if (this._availablePlugins.Count == 0)
|
||||||
{
|
{
|
||||||
LoadAvailablePlugins();
|
this.LoadAvailablePlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有効化対象のプラグインを取得
|
// 有効化対象のプラグインを取得
|
||||||
var pluginsToEnable = _availablePlugins
|
// ※ResourceLoaderFix はリソース読み込み不具合の必須救済プラグインのため、常に有効化・先頭配置
|
||||||
.Where(p => game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true))
|
var fixPlugin = this._availablePlugins.FirstOrDefault(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase));
|
||||||
|
var pluginsToEnable = this._availablePlugins
|
||||||
|
.Where(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase) || game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
// ResourceLoaderFix を最優先(先頭)に配置して、他プラグイン実行前のリソース要求も確実に救済
|
||||||
|
if (fixPlugin != null && pluginsToEnable.Contains(fixPlugin))
|
||||||
|
{
|
||||||
|
pluginsToEnable.Remove(fixPlugin);
|
||||||
|
pluginsToEnable.Insert(0, fixPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
// 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除
|
// 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除
|
||||||
var allManaged = GetAllManagedPluginNames(_availablePlugins);
|
var allManaged = GetAllManagedPluginNames(this._availablePlugins);
|
||||||
var enabledIds = new HashSet<string>(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase);
|
var enabledIds = new HashSet<string>(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
foreach (var pluginId in allManaged)
|
foreach (var pluginId in allManaged)
|
||||||
@@ -233,7 +255,7 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
// 4. 有効対象のプラグインファイルをゲーム側へ配置
|
// 4. 有効対象のプラグインファイルをゲーム側へ配置
|
||||||
foreach (var plugin in pluginsToEnable)
|
foreach (var plugin in pluginsToEnable)
|
||||||
{
|
{
|
||||||
CopyPluginToGame(plugin, pluginsDir);
|
this.CopyPluginToGame(plugin, pluginsDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. plugins.js をパース・再構築して有効プラグインを追加
|
// 5. plugins.js をパース・再構築して有効プラグインを追加
|
||||||
@@ -285,7 +307,7 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
// 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない)
|
// 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない)
|
||||||
if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir))
|
if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir))
|
||||||
{
|
{
|
||||||
var allManaged = GetAllManagedPluginNames(_availablePlugins);
|
var allManaged = GetAllManagedPluginNames(this._availablePlugins);
|
||||||
foreach (var pluginName in allManaged)
|
foreach (var pluginName in allManaged)
|
||||||
{
|
{
|
||||||
var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js");
|
var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js");
|
||||||
@@ -332,9 +354,9 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
string prefix = content.Substring(0, arrayStart + 1);
|
string prefix = content[..(arrayStart + 1)];
|
||||||
string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
|
string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
|
||||||
string suffix = content.Substring(arrayEnd);
|
string suffix = content[arrayEnd..];
|
||||||
|
|
||||||
// 新旧すべてのプラグイン名を除去対象とする
|
// 新旧すべてのプラグイン名を除去対象とする
|
||||||
var managedSet = GetAllManagedPluginNames();
|
var managedSet = GetAllManagedPluginNames();
|
||||||
@@ -388,7 +410,7 @@ namespace GameLauncher.Engines.Tkool
|
|||||||
|
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
{
|
{
|
||||||
string objText = inner.Substring(objStart, i - objStart).Trim();
|
string objText = inner[objStart..i].Trim();
|
||||||
// このオブジェクトが新旧管理対象プラグインかどうか判定
|
// このオブジェクトが新旧管理対象プラグインかどうか判定
|
||||||
var match = Regex.Match(objText, @"""name""\s*:\s*""([^""]+)""");
|
var match = Regex.Match(objText, @"""name""\s*:\s*""([^""]+)""");
|
||||||
if (match.Success && managedSet.Contains(match.Groups[1].Value))
|
if (match.Success && managedSet.Contains(match.Groups[1].Value))
|
||||||
|
|||||||
@@ -0,0 +1,618 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using GameLauncher.Helpers;
|
||||||
|
|
||||||
|
namespace GameLauncher.Engines.Tkool
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ツクールMV/MZ等のゲームリソース(画像・音声・スクリプト等)における
|
||||||
|
/// URLエンコード名、文字化け、機種依存文字(丸数字等)の不整合を、
|
||||||
|
/// 「実際のゲームコード・データで使われているファイル名」と照合して並列かつ超高速に自動修復するサービス。
|
||||||
|
///
|
||||||
|
/// 設計方針:
|
||||||
|
/// - コード主導のピンポイント照合:
|
||||||
|
/// 1. data/*.json や plugins.js 等のゲームコード・定義データから要求リソース名を並列抽出。
|
||||||
|
/// 2. コード側が要求しているのにディスク上に存在しないファイル名(例: エロステ_ページ②.png)を特定。
|
||||||
|
/// 3. ディスク上の類似ファイル(エロステ_ページ2.png や URLデコード名)から要求通りのファイルを作成。
|
||||||
|
/// - マルチスレッド並列処理:
|
||||||
|
/// ・Parallel.ForEach による CPU コア全開の超高速走査・チェック・リンク生成。
|
||||||
|
/// - 独立ログファイル出力:
|
||||||
|
/// ・Logs フォルダ内に詳細ログファイル(ResourceRepair_*.log)を出力し、
|
||||||
|
/// ランチャー画面上のテキストボックス肥大化によるUIフリーズを完全防止。
|
||||||
|
/// </summary>
|
||||||
|
public class TkoolResourceRepairService
|
||||||
|
{
|
||||||
|
[DllImport("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
private static extern bool CreateHardLink(string lpFileName, string lpExistingFileName, IntPtr lpSecurityAttributes);
|
||||||
|
|
||||||
|
/// <summary>修復完了キャッシュマーカーファイル名</summary>
|
||||||
|
public const string RepairMarkerFileName = ".gl_resource_repaired";
|
||||||
|
|
||||||
|
private static bool _encodingProviderRegistered;
|
||||||
|
|
||||||
|
// 丸数字マッピング (①: U+2460 〜 ⑳: U+2473)
|
||||||
|
private static readonly string[] CircleNumbers =
|
||||||
|
[
|
||||||
|
"①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩",
|
||||||
|
"⑪", "⑫", "⑬", "⑭", "⑮", "⑯", "⑰", "⑱", "⑲", "⑳"
|
||||||
|
];
|
||||||
|
|
||||||
|
// 全角数字マッピング (0: U+FF10 〜 9: U+FF19)
|
||||||
|
private static readonly string[] FullWidthNumbers =
|
||||||
|
[
|
||||||
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
||||||
|
];
|
||||||
|
|
||||||
|
public TkoolResourceRepairService()
|
||||||
|
{
|
||||||
|
EnsureEncodingProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void EnsureEncodingProvider()
|
||||||
|
{
|
||||||
|
if (!_encodingProviderRegistered)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
_encodingProviderRegistered = true;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修復処理のリアルタイム進捗情報
|
||||||
|
/// </summary>
|
||||||
|
public record RepairProgress(int Current, int Total, int RepairedCount, string CurrentStatus);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修復処理の結果情報
|
||||||
|
/// </summary>
|
||||||
|
public record RepairResult(bool Success, int RepairedCount, int CleanedCount, long ElapsedMilliseconds, string Message, string LogFilePath);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ログファイルの保存先ディレクトリを取得します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetLogsDirectory()
|
||||||
|
{
|
||||||
|
var exeDir = AppPathHelper.GetExeDirectory();
|
||||||
|
var logsDir = Path.Combine(exeDir, "Logs");
|
||||||
|
if (!Directory.Exists(logsDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(logsDir);
|
||||||
|
}
|
||||||
|
return logsDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定したツクールゲームのリソースファイルを非同期・並列で修復します(UIをブロックしません)。
|
||||||
|
/// </summary>
|
||||||
|
public Task<RepairResult> RepairGameResourcesAsync(
|
||||||
|
TkoolGameItem game,
|
||||||
|
bool forceRescan = false,
|
||||||
|
IProgress<RepairProgress>? progress = null,
|
||||||
|
Action<string>? uiLogCallback = null)
|
||||||
|
{
|
||||||
|
return Task.Run(() => this.RepairGameResources(game, forceRescan, progress, uiLogCallback));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定したツクールゲームのリソースファイルを並列走査・コード照合修復します。
|
||||||
|
/// </summary>
|
||||||
|
public RepairResult RepairGameResources(
|
||||||
|
TkoolGameItem game,
|
||||||
|
bool forceRescan = false,
|
||||||
|
IProgress<RepairProgress>? progress = null,
|
||||||
|
Action<string>? uiLogCallback = null)
|
||||||
|
{
|
||||||
|
if (game == null)
|
||||||
|
{
|
||||||
|
return new RepairResult(false, 0, 0, 0, "対象ゲームが指定されていません。", string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
// ログファイルの初期化
|
||||||
|
var logsDir = GetLogsDirectory();
|
||||||
|
var safeGameName = Regex.Replace(game.FolderName ?? game.Title ?? "Game", @"[\\/:*?""<>|]", "_");
|
||||||
|
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
|
var logFilePath = Path.Combine(logsDir, $"ResourceRepair_{safeGameName}_{timestamp}.log");
|
||||||
|
|
||||||
|
var logLines = new ConcurrentBag<string>();
|
||||||
|
void FileLog(string message)
|
||||||
|
{
|
||||||
|
logLines.Add($"[{DateTime.Now:HH:mm:ss.fff}] {message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
FileLog($"=== ゲームリソース高速並列修復開始 ===");
|
||||||
|
FileLog($"ゲーム名: {game.Title}");
|
||||||
|
FileLog($"ルートフォルダ: {game.RootDirectory}");
|
||||||
|
FileLog($"並列CPUコア数: {Environment.ProcessorCount}");
|
||||||
|
|
||||||
|
uiLogCallback?.Invoke($"[リソース修復] {game.Title}: ゲームコードとの並列照合を開始します...");
|
||||||
|
progress?.Report(new RepairProgress(0, 100, 0, "ゲームコード・データを収集中..."));
|
||||||
|
|
||||||
|
var targetDirs = this.CollectResourceDirectories(game);
|
||||||
|
if (targetDirs.Count == 0)
|
||||||
|
{
|
||||||
|
sw.Stop();
|
||||||
|
var msg = "修復対象のリソースディレクトリが見つかりませんでした。";
|
||||||
|
FileLog(msg);
|
||||||
|
this.WriteLogFile(logFilePath, logLines);
|
||||||
|
uiLogCallback?.Invoke($"[リソース修復] {msg}");
|
||||||
|
return new RepairResult(true, 0, 0, sw.ElapsedMilliseconds, msg, logFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// ステップ 1: ゲームデータ (data/*.json, js/*.js) から要求リソース名を並列抽出
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
FileLog("ステップ 1: data フォルダ内の JSON およびスクリプトから、コード上で実際に使用されているリソース名を並列抽出中...");
|
||||||
|
var requestedNames = this.ExtractRequestedResourceNamesFromCode(game, FileLog);
|
||||||
|
FileLog($"ステップ 1 完了: コード上で使われているリソース識別子を {requestedNames.Count} 件抽出しました。");
|
||||||
|
progress?.Report(new RepairProgress(20, 100, 0, $"コードリソース抽出完了 ({requestedNames.Count}件)"));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// ステップ 2: 素材フォルダ (img, audio 等) の実ファイルを並列収集
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
FileLog("ステップ 2: 素材フォルダ (img, audio 等) の全ファイルを並列収集・分類中...");
|
||||||
|
var resourceFiles = new ConcurrentBag<string>();
|
||||||
|
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||||
|
|
||||||
|
Parallel.ForEach(targetDirs, parallelOptions, dir =>
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(dir)) return;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var f in Directory.EnumerateFiles(dir, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
var name = Path.GetFileName(f);
|
||||||
|
if (!string.Equals(name, RepairMarkerFileName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
resourceFiles.Add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FileLog($"[警告] 一覧取得例外: {dir} ({ex.Message})");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var allFilesList = resourceFiles.ToList();
|
||||||
|
FileLog($"ステップ 2 完了: 素材ファイルを合計 {allFilesList.Count} 件検出しました。");
|
||||||
|
progress?.Report(new RepairProgress(40, 100, 0, $"素材ファイル収集完了 ({allFilesList.Count}件)"));
|
||||||
|
|
||||||
|
int repairedCount = 0;
|
||||||
|
int cleanedCount = 0;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// ステップ 3: 過去の破損ファイル (%と丸数字の混在) の並列クリーンアップ
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
Parallel.ForEach(allFilesList, parallelOptions, filePath =>
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
if (fileName.Contains('%') && this.ContainsCircleNumber(fileName))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
File.Delete(filePath);
|
||||||
|
System.Threading.Interlocked.Increment(ref cleanedCount);
|
||||||
|
FileLog($"[不正ファイル削除] {fileName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// ステップ 4: パーセントエンコードされたファイル名の安全完全デコード (並列)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
FileLog("ステップ 4: URLエンコードされたファイル名の完全デコードと日本語リンク作成中 (並列)...");
|
||||||
|
var newlyDecodedFiles = new ConcurrentBag<string>();
|
||||||
|
Parallel.ForEach(allFilesList, parallelOptions, filePath =>
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
if (fileName.Contains('%'))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var unescaped = this.FullyUnescapeString(fileName);
|
||||||
|
if (!string.Equals(unescaped, fileName, StringComparison.Ordinal) && !unescaped.Contains('%'))
|
||||||
|
{
|
||||||
|
var dirPath = Path.GetDirectoryName(filePath);
|
||||||
|
if (!string.IsNullOrEmpty(dirPath))
|
||||||
|
{
|
||||||
|
var unescapedPath = Path.Combine(dirPath, unescaped);
|
||||||
|
if (!File.Exists(unescapedPath))
|
||||||
|
{
|
||||||
|
if (this.CreateLinkOrCopy(filePath, unescapedPath))
|
||||||
|
{
|
||||||
|
System.Threading.Interlocked.Increment(ref repairedCount);
|
||||||
|
newlyDecodedFiles.Add(unescapedPath);
|
||||||
|
FileLog($"[URLデコード作成] {fileName} -> {unescaped}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// ステップ4で新しく作成されたファイルも素材リストに合流
|
||||||
|
if (!newlyDecodedFiles.IsEmpty)
|
||||||
|
{
|
||||||
|
allFilesList.AddRange(newlyDecodedFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
progress?.Report(new RepairProgress(70, 100, repairedCount, "コード上のファイル名と実素材の照合中..."));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// ステップ 5: コード上で要求されているファイル名と実素材の照合・表記揺れ解決 (並列)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
FileLog("ステップ 5: コード上で要求されているファイル名(丸数字など)と実素材の表記揺れ照合中 (並列)...");
|
||||||
|
|
||||||
|
// ディレクトリごとに実ファイル名辞書を作成(高速ルックアップ用)
|
||||||
|
var dirFilesMap = allFilesList
|
||||||
|
.GroupBy(f => Path.GetDirectoryName(f) ?? string.Empty)
|
||||||
|
.ToDictionary(g => g.Key, g => g.Select(p => Path.GetFileName(p)).ToHashSet(StringComparer.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
// ディレクトリごとに実ファイルの正規化キー辞書を作成(重複キーによるArgumentException例外を安全に回避)
|
||||||
|
var dirNormalizedMap = allFilesList
|
||||||
|
.GroupBy(f => Path.GetDirectoryName(f) ?? string.Empty)
|
||||||
|
.ToDictionary(g => g.Key, g =>
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
foreach (var p in g)
|
||||||
|
{
|
||||||
|
var key = this.NormalizeFuzzyKey(Path.GetFileNameWithoutExtension(p));
|
||||||
|
if (!dict.ContainsKey(key))
|
||||||
|
{
|
||||||
|
dict[key] = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
});
|
||||||
|
|
||||||
|
// コードで要求されている各リソース名について照合
|
||||||
|
Parallel.ForEach(requestedNames, parallelOptions, reqName =>
|
||||||
|
{
|
||||||
|
var reqExt = Path.GetExtension(reqName);
|
||||||
|
var reqNameNoExt = string.IsNullOrEmpty(reqExt) ? reqName : Path.GetFileNameWithoutExtension(reqName);
|
||||||
|
var normalizedReq = this.NormalizeFuzzyKey(reqNameNoExt);
|
||||||
|
|
||||||
|
foreach (var (dirPath, fileSet) in dirFilesMap)
|
||||||
|
{
|
||||||
|
// 拡張子がある場合とない場合(.png を補完)を検討
|
||||||
|
var extensionsToCheck = string.IsNullOrEmpty(reqExt)
|
||||||
|
? new[] { ".png", ".ogg", ".m4a" }
|
||||||
|
: [reqExt];
|
||||||
|
|
||||||
|
foreach (var ext in extensionsToCheck)
|
||||||
|
{
|
||||||
|
var expectedFileName = reqNameNoExt + ext;
|
||||||
|
|
||||||
|
// すでにその名前が存在していれば修復不要
|
||||||
|
if (fileSet.Contains(expectedFileName)) continue;
|
||||||
|
|
||||||
|
// ディレクトリ内に正規化キーが一致する実ファイルがあるか探す
|
||||||
|
if (dirNormalizedMap.TryGetValue(dirPath, out var normDict) &&
|
||||||
|
normDict.TryGetValue(normalizedReq, out var existingFilePath))
|
||||||
|
{
|
||||||
|
var existingExt = Path.GetExtension(existingFilePath);
|
||||||
|
if (string.Equals(existingExt, ext, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var targetPath = Path.Combine(dirPath, expectedFileName);
|
||||||
|
if (!File.Exists(targetPath))
|
||||||
|
{
|
||||||
|
if (this.CreateLinkOrCopy(existingFilePath, targetPath))
|
||||||
|
{
|
||||||
|
System.Threading.Interlocked.Increment(ref repairedCount);
|
||||||
|
FileLog($"[コード要求リソース修復] コード要求名: {expectedFileName} <- 実ファイル: {Path.GetFileName(existingFilePath)}");
|
||||||
|
lock (fileSet) { fileSet.Add(expectedFileName); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
sw.Stop();
|
||||||
|
|
||||||
|
// ログファイルへの一括書き込み
|
||||||
|
FileLog($"=== 修復完了: 作成 {repairedCount} 件、クリーンアップ {cleanedCount} 件 (所要時間: {sw.ElapsedMilliseconds}ms) ===");
|
||||||
|
this.WriteLogFile(logFilePath, logLines);
|
||||||
|
|
||||||
|
var summaryMsg = $"リソース修復完了: コード要求照合により {repairedCount} 件作成、{cleanedCount} 件クリーンアップ (所要時間: {sw.ElapsedMilliseconds}ms)";
|
||||||
|
uiLogCallback?.Invoke($"[リソース修復] {summaryMsg}");
|
||||||
|
uiLogCallback?.Invoke($"[リソース修復] 詳細ログを出力しました: {logFilePath}");
|
||||||
|
|
||||||
|
progress?.Report(new RepairProgress(100, 100, repairedCount, "完了"));
|
||||||
|
|
||||||
|
return new RepairResult(true, repairedCount, cleanedCount, sw.ElapsedMilliseconds, summaryMsg, logFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲームの data/*.json および js/*.js からコード上で要求されているリソース名を並列抽出します。
|
||||||
|
/// </summary>
|
||||||
|
private HashSet<string> ExtractRequestedResourceNamesFromCode(TkoolGameItem game, Action<string> log)
|
||||||
|
{
|
||||||
|
var requested = new ConcurrentBag<string>();
|
||||||
|
var dataDirs = new List<string>();
|
||||||
|
|
||||||
|
// data フォルダおよび js フォルダの探索
|
||||||
|
var roots = new List<string>();
|
||||||
|
if (game.IsEvbExtracted && !string.IsNullOrEmpty(game.EvbExtractedDirPath) && Directory.Exists(game.EvbExtractedDirPath))
|
||||||
|
{
|
||||||
|
roots.Add(game.EvbExtractedDirPath);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(game.RootDirectory) && Directory.Exists(game.RootDirectory))
|
||||||
|
{
|
||||||
|
roots.Add(game.RootDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var r in roots)
|
||||||
|
{
|
||||||
|
var candidates = new[] { r, Path.Combine(r, "www") };
|
||||||
|
foreach (var c in candidates)
|
||||||
|
{
|
||||||
|
var dataPath = Path.Combine(c, "data");
|
||||||
|
if (Directory.Exists(dataPath) && !dataDirs.Contains(dataPath)) dataDirs.Add(dataPath);
|
||||||
|
|
||||||
|
var jsPath = Path.Combine(c, "js");
|
||||||
|
if (Directory.Exists(jsPath) && !dataDirs.Contains(jsPath)) dataDirs.Add(jsPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var textFiles = new List<string>();
|
||||||
|
foreach (var d in dataDirs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
textFiles.AddRange(Directory.GetFiles(d, "*.json", SearchOption.AllDirectories));
|
||||||
|
textFiles.AddRange(Directory.GetFiles(d, "*.js", SearchOption.AllDirectories));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
log($"コード検査対象ファイル数: {textFiles.Count} 件 (並列抽出)");
|
||||||
|
|
||||||
|
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||||
|
Parallel.ForEach(textFiles, parallelOptions, file =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var text = File.ReadAllText(file, Encoding.UTF8);
|
||||||
|
|
||||||
|
// JSON/JS文字列 "..." または '...' を抽出
|
||||||
|
var matches = Regex.Matches(text, @"""([^""\r\n]{1,80})""|'([^'\r\n]{1,80})'");
|
||||||
|
foreach (Match m in matches)
|
||||||
|
{
|
||||||
|
var val = (m.Groups[1].Success ? m.Groups[1].Value : m.Groups[2].Value).Trim();
|
||||||
|
// 素材名として意味のある文字列(日本語、丸数字、記号、拡張子付き等)を収集
|
||||||
|
if (this.IsPotentialResourceName(val))
|
||||||
|
{
|
||||||
|
requested.Add(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
});
|
||||||
|
|
||||||
|
return new HashSet<string>(requested, StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文字列が画像・音声等のリソース名候補として適切か判定します。
|
||||||
|
/// </summary>
|
||||||
|
private bool IsPotentialResourceName(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(text) || text.Length > 80) return false;
|
||||||
|
|
||||||
|
// システム予約語やJSON構文は除外
|
||||||
|
if (text == "true" || text == "false" || text == "null" || text == "undefined") return false;
|
||||||
|
if (text.StartsWith("{") || text.StartsWith("[")) return false;
|
||||||
|
|
||||||
|
// 拡張子を持つ、または日本語/丸数字を含む、または _ や - を含む識別子
|
||||||
|
if (text.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
text.EndsWith(".ogg", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
text.EndsWith(".m4a", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 日本語・全角文字または丸数字を含む文字列(例: "エロステ_ページ②")
|
||||||
|
if (this.ContainsNonAscii(text) || this.ContainsCircleNumber(text))
|
||||||
|
{
|
||||||
|
// 空白のみや極端な記号列は除外
|
||||||
|
return !text.Contains("<") && !text.Contains(">");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 丸数字(①〜⑳)⇔ 通常数字(1〜20)および 全角数字 を正規化したファジーマッチ用キーを生成します。
|
||||||
|
/// </summary>
|
||||||
|
private string NormalizeFuzzyKey(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(text)) return string.Empty;
|
||||||
|
var res = text.Normalize(NormalizationForm.FormC).ToLowerInvariant();
|
||||||
|
|
||||||
|
// 丸数字 -> 通常数字
|
||||||
|
for (int i = 0; i < CircleNumbers.Length; i++)
|
||||||
|
{
|
||||||
|
res = res.Replace(CircleNumbers[i], (i + 1).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全角数字 -> 半角数字
|
||||||
|
for (int i = 0; i < FullWidthNumbers.Length; i++)
|
||||||
|
{
|
||||||
|
res = res.Replace(FullWidthNumbers[i], i.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 波ダッシュ・チルダ
|
||||||
|
res = res.Replace('\u301C', '\uFF5E');
|
||||||
|
|
||||||
|
// 全角カッコ -> 半角カッコ
|
||||||
|
res = res.Replace('(', '(').Replace(')', ')');
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 蓄積されたログ行をログファイルへ一括書き込みします。
|
||||||
|
/// </summary>
|
||||||
|
private void WriteLogFile(string path, IEnumerable<string> lines)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllLines(path, lines, new UTF8Encoding(true));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パーセントエンコードされた文字列を100%完全にデコードします。
|
||||||
|
/// </summary>
|
||||||
|
private string FullyUnescapeString(string input)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input) || !input.Contains('%')) return input;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var unescaped = Uri.UnescapeDataString(input);
|
||||||
|
if (!unescaped.Contains('%')) return unescaped;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Regex.Replace(input, @"((?:%[0-9A-Fa-f]{2})+)", match =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var hexPart = match.Value;
|
||||||
|
var bytes = new List<byte>();
|
||||||
|
for (int i = 0; i < hexPart.Length; i += 3)
|
||||||
|
{
|
||||||
|
if (hexPart[i] == '%' && i + 2 < hexPart.Length)
|
||||||
|
{
|
||||||
|
bytes.Add(Convert.ToByte(hexPart.Substring(i + 1, 2), 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Encoding.UTF8.GetString([.. bytes]);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return match.Value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 丸数字が含まれているか判定します。
|
||||||
|
/// </summary>
|
||||||
|
private bool ContainsCircleNumber(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(text)) return false;
|
||||||
|
foreach (var circle in CircleNumbers)
|
||||||
|
{
|
||||||
|
if (text.Contains(circle)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 非ASCII文字(全角文字・日本語等)が含まれているか判定します。
|
||||||
|
/// </summary>
|
||||||
|
private bool ContainsNonAscii(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(text)) return false;
|
||||||
|
foreach (char c in text)
|
||||||
|
{
|
||||||
|
if (c > 127) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ハードリンクを最優先で作成し、失敗した場合はファイルコピーを行います。
|
||||||
|
/// </summary>
|
||||||
|
private bool CreateLinkOrCopy(string sourceFile, string targetFile)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(targetFile)) return true;
|
||||||
|
|
||||||
|
if (CreateHardLink(targetFile, sourceFile, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Copy(sourceFile, targetFile, overwrite: false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修復対象となるリソースフォルダ一覧(img, audio, js, data等)を収集します。
|
||||||
|
/// </summary>
|
||||||
|
private List<string> CollectResourceDirectories(TkoolGameItem game)
|
||||||
|
{
|
||||||
|
var result = new List<string>();
|
||||||
|
var roots = new List<string>();
|
||||||
|
|
||||||
|
if (game.IsEvbExtracted && !string.IsNullOrEmpty(game.EvbExtractedDirPath) && Directory.Exists(game.EvbExtractedDirPath))
|
||||||
|
{
|
||||||
|
roots.Add(game.EvbExtractedDirPath);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(game.RootDirectory) && Directory.Exists(game.RootDirectory))
|
||||||
|
{
|
||||||
|
roots.Add(game.RootDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var root in roots)
|
||||||
|
{
|
||||||
|
var candidates = new[] { root, Path.Combine(root, "www"), Path.Combine(root, "package.nw") };
|
||||||
|
foreach (var baseDir in candidates)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(baseDir)) continue;
|
||||||
|
|
||||||
|
var subDirs = new[] { "img", "audio", "js", "data" };
|
||||||
|
foreach (var sub in subDirs)
|
||||||
|
{
|
||||||
|
var target = Path.Combine(baseDir, sub);
|
||||||
|
if (Directory.Exists(target) && !result.Contains(target))
|
||||||
|
{
|
||||||
|
result.Add(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,9 @@
|
|||||||
Unity,
|
Unity,
|
||||||
Wolf,
|
Wolf,
|
||||||
SrpgStudio,
|
SrpgStudio,
|
||||||
Evb
|
Evb,
|
||||||
|
Nwjs,
|
||||||
|
Other
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -25,6 +27,8 @@
|
|||||||
VXAce,
|
VXAce,
|
||||||
Wolf,
|
Wolf,
|
||||||
SrpgStudio,
|
SrpgStudio,
|
||||||
|
Nwjs,
|
||||||
|
Other,
|
||||||
Unknown
|
Unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +53,8 @@
|
|||||||
FolderLastModifiedAsc = 3, // フォルダ更新日時 (古い順)
|
FolderLastModifiedAsc = 3, // フォルダ更新日時 (古い順)
|
||||||
TitleAsc = 4, // タイトル (昇順)
|
TitleAsc = 4, // タイトル (昇順)
|
||||||
TitleDesc = 5, // タイトル (降順)
|
TitleDesc = 5, // タイトル (降順)
|
||||||
FolderNameAsc = 6 // フォルダ名 (昇順)
|
FolderNameAsc = 6, // フォルダ名 (昇順)
|
||||||
|
BookmarkedFirst = 7 // ★ ブックマーク優先
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -21,22 +21,22 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>[Game]_Data ディレクトリ絶対パス</summary>
|
/// <summary>[Game]_Data ディレクトリ絶対パス</summary>
|
||||||
public string DataDirectoryPath
|
public string DataDirectoryPath
|
||||||
{
|
{
|
||||||
get => _dataDirectoryPath;
|
get => this._dataDirectoryPath;
|
||||||
set { if (_dataDirectoryPath != value) { _dataDirectoryPath = value; OnPropertyChanged(); } }
|
set { if (this._dataDirectoryPath != value) { this._dataDirectoryPath = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>app.info 由来の会社名/開発者名</summary>
|
/// <summary>app.info 由来の会社名/開発者名</summary>
|
||||||
public string CompanyName
|
public string CompanyName
|
||||||
{
|
{
|
||||||
get => _companyName;
|
get => this._companyName;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_companyName != value)
|
if (this._companyName != value)
|
||||||
{
|
{
|
||||||
_companyName = value;
|
this._companyName = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(RegistryPath));
|
this.OnPropertyChanged(nameof(this.RegistryPath));
|
||||||
OnPropertyChanged(nameof(LocalLowPath));
|
this.OnPropertyChanged(nameof(this.LocalLowPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,35 +44,35 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>app.info 由来の製品名</summary>
|
/// <summary>app.info 由来の製品名</summary>
|
||||||
public string ProductName
|
public string ProductName
|
||||||
{
|
{
|
||||||
get => _productName;
|
get => this._productName;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_productName != value)
|
if (this._productName != value)
|
||||||
{
|
{
|
||||||
_productName = value;
|
this._productName = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(RegistryPath));
|
this.OnPropertyChanged(nameof(this.RegistryPath));
|
||||||
OnPropertyChanged(nameof(LocalLowPath));
|
this.OnPropertyChanged(nameof(this.LocalLowPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsIL2CPP => BackendType == UnityBackendType.IL2CPP;
|
public override bool IsIL2CPP => this.BackendType == UnityBackendType.IL2CPP;
|
||||||
public override bool IsMono => BackendType == UnityBackendType.Mono;
|
public override bool IsMono => this.BackendType == UnityBackendType.Mono;
|
||||||
|
|
||||||
/// <summary>バックエンド形式 (IL2CPP / Mono)</summary>
|
/// <summary>バックエンド形式 (IL2CPP / Mono)</summary>
|
||||||
public UnityBackendType BackendType
|
public UnityBackendType BackendType
|
||||||
{
|
{
|
||||||
get => _backendType;
|
get => this._backendType;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_backendType != value)
|
if (this._backendType != value)
|
||||||
{
|
{
|
||||||
_backendType = value;
|
this._backendType = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(BackendBadgeText));
|
this.OnPropertyChanged(nameof(this.BackendBadgeText));
|
||||||
OnPropertyChanged(nameof(IsIL2CPP));
|
this.OnPropertyChanged(nameof(this.IsIL2CPP));
|
||||||
OnPropertyChanged(nameof(IsMono));
|
this.OnPropertyChanged(nameof(this.IsMono));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,15 +80,15 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>Unityバージョン文字列</summary>
|
/// <summary>Unityバージョン文字列</summary>
|
||||||
public override string UnityVersion
|
public override string UnityVersion
|
||||||
{
|
{
|
||||||
get => _unityVersion;
|
get => this._unityVersion;
|
||||||
set { if (_unityVersion != value) { _unityVersion = value; OnPropertyChanged(); } }
|
set { if (this._unityVersion != value) { this._unityVersion = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>セーブデータ(レジストリまたはファイル)が検出されたかどうか</summary>
|
/// <summary>セーブデータ(レジストリまたはファイル)が検出されたかどうか</summary>
|
||||||
public override bool HasSaveData
|
public override bool HasSaveData
|
||||||
{
|
{
|
||||||
get => _hasSaveData;
|
get => this._hasSaveData;
|
||||||
set { if (_hasSaveData != value) { _hasSaveData = value; OnPropertyChanged(); } }
|
set { if (this._hasSaveData != value) { this._hasSaveData = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -99,9 +99,9 @@ namespace GameLauncher.Engines.Unity
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName))
|
if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName))
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return $@"Software\{CompanyName}\{ProductName}";
|
return $@"Software\{this.CompanyName}\{this.ProductName}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,22 +113,28 @@ namespace GameLauncher.Engines.Unity
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName))
|
if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName))
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
var appData = Path.GetDirectoryName(localAppData);
|
var appData = Path.GetDirectoryName(localAppData);
|
||||||
if (string.IsNullOrEmpty(appData)) return string.Empty;
|
if (string.IsNullOrEmpty(appData)) return string.Empty;
|
||||||
|
|
||||||
return Path.Combine(appData, "LocalLow", CompanyName, ProductName);
|
return Path.Combine(appData, "LocalLow", this.CompanyName, this.ProductName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string BackendBadgeText => BackendType switch
|
public override string BackendBadgeText => this.BackendType switch
|
||||||
{
|
{
|
||||||
UnityBackendType.IL2CPP => "IL2CPP",
|
UnityBackendType.IL2CPP => "IL2CPP",
|
||||||
UnityBackendType.Mono => "Mono",
|
UnityBackendType.Mono => "Mono",
|
||||||
_ => "Unity"
|
_ => "Unity"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// エンジン種別ラベル。Unityは専用バッジ(IL2CPP/Mono等)で表現するため空文字を返し、
|
||||||
|
/// エンジン種別ラベル自体は表示しません。
|
||||||
|
/// </summary>
|
||||||
|
public override string EngineLabelText => string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,35 +28,35 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary>
|
/// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary>
|
||||||
public string RawKey
|
public string RawKey
|
||||||
{
|
{
|
||||||
get => _rawKey;
|
get => this._rawKey;
|
||||||
set { if (_rawKey != value) { _rawKey = value; OnPropertyChanged(); } }
|
set { if (this._rawKey != value) { this._rawKey = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary>
|
/// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary>
|
||||||
public string CleanKey
|
public string CleanKey
|
||||||
{
|
{
|
||||||
get => _cleanKey;
|
get => this._cleanKey;
|
||||||
set { if (_cleanKey != value) { _cleanKey = value; OnPropertyChanged(); } }
|
set { if (this._cleanKey != value) { this._cleanKey = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>値のデータ型</summary>
|
/// <summary>値のデータ型</summary>
|
||||||
public PlayerPrefsType Type
|
public PlayerPrefsType Type
|
||||||
{
|
{
|
||||||
get => _type;
|
get => this._type;
|
||||||
set { if (_type != value) { _type = value; OnPropertyChanged(); OnPropertyChanged(nameof(TypeDisplay)); } }
|
set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.TypeDisplay)); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>実際の値(int, float, string, byte[])</summary>
|
/// <summary>実際の値(int, float, string, byte[])</summary>
|
||||||
public object? Value
|
public object? Value
|
||||||
{
|
{
|
||||||
get => _value;
|
get => this._value;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!Equals(_value, value))
|
if (!Equals(this._value, value))
|
||||||
{
|
{
|
||||||
_value = value;
|
this._value = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
UpdateEditValue();
|
this.UpdateEditValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,15 +64,15 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>UI表示・編集用の文字列値</summary>
|
/// <summary>UI表示・編集用の文字列値</summary>
|
||||||
public string EditValue
|
public string EditValue
|
||||||
{
|
{
|
||||||
get => _editValue;
|
get => this._editValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_editValue != value)
|
if (this._editValue != value)
|
||||||
{
|
{
|
||||||
_editValue = value;
|
this._editValue = value;
|
||||||
_isModified = true;
|
this._isModified = true;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(IsModified));
|
this.OnPropertyChanged(nameof(this.IsModified));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,11 +80,11 @@ namespace GameLauncher.Engines.Unity
|
|||||||
/// <summary>値が変更されたかどうか</summary>
|
/// <summary>値が変更されたかどうか</summary>
|
||||||
public bool IsModified
|
public bool IsModified
|
||||||
{
|
{
|
||||||
get => _isModified;
|
get => this._isModified;
|
||||||
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
|
set { if (this._isModified != value) { this._isModified = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TypeDisplay => Type switch
|
public string TypeDisplay => this.Type switch
|
||||||
{
|
{
|
||||||
PlayerPrefsType.Int => "Int (数値)",
|
PlayerPrefsType.Int => "Int (数値)",
|
||||||
PlayerPrefsType.Float => "Float (小数)",
|
PlayerPrefsType.Float => "Float (小数)",
|
||||||
@@ -95,19 +95,19 @@ namespace GameLauncher.Engines.Unity
|
|||||||
|
|
||||||
private void UpdateEditValue()
|
private void UpdateEditValue()
|
||||||
{
|
{
|
||||||
if (_value == null)
|
if (this._value == null)
|
||||||
{
|
{
|
||||||
_editValue = string.Empty;
|
this._editValue = string.Empty;
|
||||||
}
|
}
|
||||||
else if (_value is byte[] bytes)
|
else if (this._value is byte[] bytes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0');
|
var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0');
|
||||||
if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t'))
|
if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t'))
|
||||||
{
|
{
|
||||||
_editValue = text;
|
this._editValue = text;
|
||||||
_type = PlayerPrefsType.String;
|
this._type = PlayerPrefsType.String;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,21 +118,21 @@ namespace GameLauncher.Engines.Unity
|
|||||||
float f = BitConverter.ToSingle(bytes, 0);
|
float f = BitConverter.ToSingle(bytes, 0);
|
||||||
if (!float.IsNaN(f) && !float.IsInfinity(f))
|
if (!float.IsNaN(f) && !float.IsInfinity(f))
|
||||||
{
|
{
|
||||||
_editValue = f.ToString("G");
|
this._editValue = f.ToString("G");
|
||||||
_type = PlayerPrefsType.Float;
|
this._type = PlayerPrefsType.Float;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_editValue = BitConverter.ToString(bytes).Replace("-", " ");
|
this._editValue = BitConverter.ToString(bytes).Replace("-", " ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_editValue = _value.ToString() ?? string.Empty;
|
this._editValue = this._value.ToString() ?? string.Empty;
|
||||||
}
|
}
|
||||||
_isModified = false;
|
this._isModified = false;
|
||||||
OnPropertyChanged(nameof(EditValue));
|
this.OnPropertyChanged(nameof(this.EditValue));
|
||||||
OnPropertyChanged(nameof(IsModified));
|
this.OnPropertyChanged(nameof(this.IsModified));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,13 +152,13 @@ namespace GameLauncher.Engines.Unity
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (FileSize < 1024) return $"{FileSize} B";
|
if (this.FileSize < 1024) return $"{this.FileSize} B";
|
||||||
if (FileSize < 1024 * 1024) return $"{FileSize / 1024.0:F1} KB";
|
if (this.FileSize < 1024 * 1024) return $"{this.FileSize / 1024.0:F1} KB";
|
||||||
return $"{FileSize / (1024.0 * 1024.0):F2} MB";
|
return $"{this.FileSize / (1024.0 * 1024.0):F2} MB";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LastModifiedDisplay => LastModified.ToString("yyyy/MM/dd HH:mm:ss");
|
public string LastModifiedDisplay => this.LastModified.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -172,6 +172,6 @@ namespace GameLauncher.Engines.Unity
|
|||||||
public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル"
|
public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル"
|
||||||
public string Note { get; set; } = string.Empty;
|
public string Note { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string TimestampDisplay => Timestamp.ToString("yyyy/MM/dd HH:mm:ss");
|
public string TimestampDisplay => this.Timestamp.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
// キー名昇順でソート
|
// キー名昇順でソート
|
||||||
return list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase).ToList();
|
return [.. list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -319,7 +319,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
proc?.WaitForExit(3000);
|
proc?.WaitForExit(3000);
|
||||||
|
|
||||||
// JSONバックアップも併せて出力
|
// JSONバックアップも併せて出力
|
||||||
var entries = GetPlayerPrefs(registryPath);
|
var entries = this.GetPlayerPrefs(registryPath);
|
||||||
var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json");
|
var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json");
|
||||||
var serializableList = entries.Select(e => new
|
var serializableList = entries.Select(e => new
|
||||||
{
|
{
|
||||||
@@ -416,7 +416,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
FileSize = fi.Length,
|
FileSize = fi.Length,
|
||||||
LastModified = fi.LastWriteTime,
|
LastModified = fi.LastWriteTime,
|
||||||
LocationType = "LocalLow",
|
LocationType = "LocalLow",
|
||||||
IsTextOrJson = CheckIsTextOrJson(f)
|
IsTextOrJson = this.CheckIsTextOrJson(f)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// ルート直下
|
// ルート直下
|
||||||
CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list);
|
this.CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list);
|
||||||
|
|
||||||
// Save / SaveData / saves / savedata サブフォルダ
|
// Save / SaveData / saves / savedata サブフォルダ
|
||||||
var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" };
|
var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" };
|
||||||
@@ -438,21 +438,21 @@ namespace GameLauncher.Engines.Unity
|
|||||||
var subPath = Path.Combine(game.RootDirectory, sub);
|
var subPath = Path.Combine(game.RootDirectory, sub);
|
||||||
if (Directory.Exists(subPath))
|
if (Directory.Exists(subPath))
|
||||||
{
|
{
|
||||||
CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false);
|
this.CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dataフォルダ直下のセーブファイル候補
|
// Dataフォルダ直下のセーブファイル候補
|
||||||
if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath))
|
if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath))
|
||||||
{
|
{
|
||||||
CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list);
|
this.CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新日時降順でソート
|
// 更新日時降順でソート
|
||||||
return list.OrderByDescending(f => f.LastModified).ToList();
|
return [.. list.OrderByDescending(f => f.LastModified)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CollectCandidateFiles(string dir, string locationLabel, List<SaveFileEntry> list, bool isStrict = true)
|
private void CollectCandidateFiles(string dir, string locationLabel, List<SaveFileEntry> list, bool isStrict = true)
|
||||||
@@ -494,7 +494,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
FileSize = fi.Length,
|
FileSize = fi.Length,
|
||||||
LastModified = fi.LastWriteTime,
|
LastModified = fi.LastWriteTime,
|
||||||
LocationType = locationLabel,
|
LocationType = locationLabel,
|
||||||
IsTextOrJson = CheckIsTextOrJson(f)
|
IsTextOrJson = this.CheckIsTextOrJson(f)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,7 +649,7 @@ namespace GameLauncher.Engines.Unity
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
return list.OrderByDescending(b => b.Timestamp).ToList();
|
return [.. list.OrderByDescending(b => b.Timestamp)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
return (false, "ゲームのルートディレクトリが見つかりません。");
|
return (false, "ゲームのルートディレクトリが見つかりません。");
|
||||||
}
|
}
|
||||||
|
|
||||||
var extractorPath = ResolveExtractorPath(customExtractorPath);
|
var extractorPath = this.ResolveExtractorPath(customExtractorPath);
|
||||||
if (string.IsNullOrEmpty(extractorPath) || !File.Exists(extractorPath))
|
if (string.IsNullOrEmpty(extractorPath) || !File.Exists(extractorPath))
|
||||||
{
|
{
|
||||||
return (false, "Wolf RPG アーカイブ解凍ツール(UberWolfCli.exe / WolfDec.exe)が見つかりません。設定ダイアログからツールのパスを指定してください。");
|
return (false, "Wolf RPG アーカイブ解凍ツール(UberWolfCli.exe / WolfDec.exe)が見つかりません。設定ダイアログからツールのパスを指定してください。");
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 1. プロキシDLL本体の探索 (Tools\speedhack-i686\version.dll)
|
// 1. プロキシDLL本体の探索 (Tools\speedhack-i686\version.dll)
|
||||||
var sourceDllPath = ResolveProxyDllPath();
|
var sourceDllPath = this.ResolveProxyDllPath();
|
||||||
if (string.IsNullOrEmpty(sourceDllPath) || !File.Exists(sourceDllPath))
|
if (string.IsNullOrEmpty(sourceDllPath) || !File.Exists(sourceDllPath))
|
||||||
{
|
{
|
||||||
return (false, "プロキシDLL(Engines\\Wolf\\Tools\\speedhack-i686\\version.dll)が見つかりません。");
|
return (false, "プロキシDLL(Engines\\Wolf\\Tools\\speedhack-i686\\version.dll)が見つかりません。");
|
||||||
@@ -73,7 +73,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
File.Copy(sourceDllPath, targetDllPath, overwrite: true);
|
File.Copy(sourceDllPath, targetDllPath, overwrite: true);
|
||||||
|
|
||||||
// 4. speedhack_config.json の生成・書き込み
|
// 4. speedhack_config.json の生成・書き込み
|
||||||
var configContent = GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed);
|
var configContent = this.GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed);
|
||||||
File.WriteAllText(targetConfigPath, configContent, new UTF8Encoding(false));
|
File.WriteAllText(targetConfigPath, configContent, new UTF8Encoding(false));
|
||||||
|
|
||||||
game.WolfProxyDll = true;
|
game.WolfProxyDll = true;
|
||||||
@@ -138,7 +138,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
// 1. プロキシDLLの解除
|
// 1. プロキシDLLの解除
|
||||||
var (dllSuccess, dllMsg) = RemoveProxyDll(game);
|
var (dllSuccess, dllMsg) = this.RemoveProxyDll(game);
|
||||||
sb.AppendLine(dllMsg);
|
sb.AppendLine(dllMsg);
|
||||||
|
|
||||||
// 2. Game.exe バックアップからの復元(存在する場合)
|
// 2. Game.exe バックアップからの復元(存在する場合)
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
return [.. result.Distinct(StringComparer.OrdinalIgnoreCase)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -186,7 +186,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
throw new FileNotFoundException($"セーブデータファイルが見つかりません: {filePath}");
|
throw new FileNotFoundException($"セーブデータファイルが見つかりません: {filePath}");
|
||||||
|
|
||||||
byte[] rawBytes = File.ReadAllBytes(filePath);
|
byte[] rawBytes = File.ReadAllBytes(filePath);
|
||||||
byte[] decrypted = Decrypt(rawBytes);
|
byte[] decrypted = this.Decrypt(rawBytes);
|
||||||
|
|
||||||
var result = new WolfSaveData
|
var result = new WolfSaveData
|
||||||
{
|
{
|
||||||
@@ -217,10 +217,10 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// セーブデータ内の全文字列スキャン
|
// セーブデータ内の全文字列スキャン
|
||||||
ScanStrings(result, decrypted, enc);
|
this.ScanStrings(result, decrypted, enc);
|
||||||
|
|
||||||
// セーブデータ内の通常変数スキャン
|
// セーブデータ内の通常変数スキャン
|
||||||
ScanVariables(result, decrypted);
|
this.ScanVariables(result, decrypted);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
throw new InvalidOperationException("保存対象のデータが空です。");
|
throw new InvalidOperationException("保存対象のデータが空です。");
|
||||||
|
|
||||||
// 1. バックアップ作成 (Backups フォルダへ)
|
// 1. バックアップ作成 (Backups フォルダへ)
|
||||||
string? backupPath = BackupSaveFile(model.FilePath, folderName, rootDirectory);
|
string? backupPath = this.BackupSaveFile(model.FilePath, folderName, rootDirectory);
|
||||||
|
|
||||||
// 2. 変数・項目の変更を RawDecryptedBytes に書き戻し
|
// 2. 変数・項目の変更を RawDecryptedBytes に書き戻し
|
||||||
foreach (var item in model.Variables)
|
foreach (var item in model.Variables)
|
||||||
@@ -306,7 +306,7 @@ namespace GameLauncher.Engines.Wolf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. 暗号化 & チェックサム再計算
|
// 3. 暗号化 & チェックサム再計算
|
||||||
byte[] encrypted = Encrypt(model.RawDecryptedBytes);
|
byte[] encrypted = this.Encrypt(model.RawDecryptedBytes);
|
||||||
|
|
||||||
// 4. アトミック書き込み
|
// 4. アトミック書き込み
|
||||||
string tempFile = model.FilePath + ".tmp_" + Guid.NewGuid().ToString("N");
|
string tempFile = model.FilePath + ".tmp_" + Guid.NewGuid().ToString("N");
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<PublishSingleFile>true</PublishSingleFile>
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -24,7 +25,6 @@
|
|||||||
<None Remove="Engines\Nwjs\Tools\speedhack-i686\hid.dll" />
|
<None Remove="Engines\Nwjs\Tools\speedhack-i686\hid.dll" />
|
||||||
<None Remove="Engines\Nwjs\Tools\speedhack-i686\version.dll" />
|
<None Remove="Engines\Nwjs\Tools\speedhack-i686\version.dll" />
|
||||||
<None Remove="plugins\AlwaysMaxHpMp.js" />
|
<None Remove="plugins\AlwaysMaxHpMp.js" />
|
||||||
<None Remove="plugins\GameLauncher_StandaloneMod.js" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
<Project Path="GameLauncher.csproj" />
|
<Project Path="GameLauncher.csproj" />
|
||||||
</Solution>
|
</Solution>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace GameLauncher.Helpers
|
namespace GameLauncher.Helpers
|
||||||
@@ -157,6 +157,24 @@ namespace GameLauncher.Helpers
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// サムネイル画像キャッシュの格納ルートディレクトリを取得します。
|
||||||
|
/// GameLauncher.exe のあるフォルダ直下の「Thumbnails」フォルダを使用・作成します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetThumbnailsDirectory()
|
||||||
|
{
|
||||||
|
var thumbDir = Path.Combine(GetExeDirectory(), "Thumbnails");
|
||||||
|
if (!Directory.Exists(thumbDir))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(thumbDir);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
return thumbDir;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unityセーブデータバックアップ全体の格納ルートディレクトリを取得します。
|
/// Unityセーブデータバックアップ全体の格納ルートディレクトリを取得します。
|
||||||
/// GameLauncher.exe のあるフォルダ直下の「Backups」フォルダを使用・作成します。
|
/// GameLauncher.exe のあるフォルダ直下の「Backups」フォルダを使用・作成します。
|
||||||
|
|||||||
+41
-1
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
@@ -108,4 +108,44 @@ namespace GameLauncher.Helpers
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文字列が null または空文字(空白のみ含む)の場合に Collapsed、文字が存在する場合に Visible を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class StringNotEmptyToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly StringNotEmptyToVisibilityConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is string s && !string.IsNullOrWhiteSpace(s))
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// bool値が true の場合に Visible、false または null の場合に Collapsed を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class BooleanToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly BooleanToVisibilityConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value is true ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value is Visibility v && v == Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+262
-307
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="GameLauncher.MainWindow"
|
<Window x:Class="GameLauncher.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
<SolidColorBrush x:Key="AccentWolf" Color="#4834D4"/>
|
<SolidColorBrush x:Key="AccentWolf" Color="#4834D4"/>
|
||||||
<SolidColorBrush x:Key="AccentWolfHover" Color="#686DE0"/>
|
<SolidColorBrush x:Key="AccentWolfHover" Color="#686DE0"/>
|
||||||
<SolidColorBrush x:Key="BadgeSrpgBg" Color="#0984E3"/>
|
<SolidColorBrush x:Key="BadgeSrpgBg" Color="#0984E3"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeNwjsBg" Color="#00838F"/>
|
||||||
<SolidColorBrush x:Key="AccentSrpg" Color="#0984E3"/>
|
<SolidColorBrush x:Key="AccentSrpg" Color="#0984E3"/>
|
||||||
<SolidColorBrush x:Key="AccentSrpgHover" Color="#74B9FF"/>
|
<SolidColorBrush x:Key="AccentSrpgHover" Color="#74B9FF"/>
|
||||||
|
|
||||||
@@ -338,6 +339,7 @@
|
|||||||
<TextBlock Text="並び順:" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
<TextBlock Text="並び順:" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||||
<ComboBox x:Name="cmbSortOrder" Width="205" Height="34" Style="{StaticResource DarkModernComboBox}"
|
<ComboBox x:Name="cmbSortOrder" Width="205" Height="34" Style="{StaticResource DarkModernComboBox}"
|
||||||
SelectionChanged="cmbSortOrder_SelectionChanged">
|
SelectionChanged="cmbSortOrder_SelectionChanged">
|
||||||
|
<ComboBoxItem Content="★ ブックマーク優先" Tag="BookmarkedFirst"/>
|
||||||
<ComboBoxItem Content="最終実行日時 (新しい順)" Tag="LastLaunchedDesc" IsSelected="True"/>
|
<ComboBoxItem Content="最終実行日時 (新しい順)" Tag="LastLaunchedDesc" IsSelected="True"/>
|
||||||
<ComboBoxItem Content="最終実行日時 (古い順)" Tag="LastLaunchedAsc"/>
|
<ComboBoxItem Content="最終実行日時 (古い順)" Tag="LastLaunchedAsc"/>
|
||||||
<ComboBoxItem Content="フォルダ更新日時 (新しい順)" Tag="FolderLastModifiedDesc"/>
|
<ComboBoxItem Content="フォルダ更新日時 (新しい順)" Tag="FolderLastModifiedDesc"/>
|
||||||
@@ -358,16 +360,16 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ================= ナビゲーションタブ & フィルターバー ================= -->
|
<!-- ================= ナビゲーションタブ & フィルターバー ================= -->
|
||||||
<Border Grid.Row="1" Background="#181824" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,0,0,1" Padding="14,8">
|
<Border Grid.Row="1" Background="#181824" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,0,0,1" Padding="14,6">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<RowDefinition Height="Auto"/> <!-- 1行目: ゲームの種類セレクター -->
|
||||||
<ColumnDefinition Width="*"/>
|
<RowDefinition Height="Auto"/> <!-- 2行目: チェックボックス条件部分 -->
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- エンジンの種類セレクター(全エンジン常時表示ピル型タブ) -->
|
<!-- 1行目: エンジンの種類セレクター(全エンジン常時表示ピル型タブ) -->
|
||||||
<Border Grid.Column="0" Background="#12121A" CornerRadius="8" Padding="3" Margin="0,0,14,0" BorderBrush="#303040" BorderThickness="1">
|
<Border Grid.Row="0" Background="#12121A" CornerRadius="8" Padding="3" Margin="0,0,0,6" BorderBrush="#303040" BorderThickness="1" HorizontalAlignment="Left">
|
||||||
<StackPanel Orientation="Horizontal">
|
<WrapPanel Orientation="Horizontal">
|
||||||
<RadioButton x:Name="tabAll" Style="{StaticResource NavTabRadioButton}" Content="すべて" ToolTip="すべて" IsChecked="True" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabAll" Style="{StaticResource NavTabRadioButton}" Content="すべて" ToolTip="すべて" IsChecked="True" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
<RadioButton x:Name="tabMV" Style="{StaticResource NavTabRadioButton}" Content="MV" ToolTip="ツクールMV" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabMV" Style="{StaticResource NavTabRadioButton}" Content="MV" ToolTip="ツクールMV" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
<RadioButton x:Name="tabMZ" Style="{StaticResource NavTabRadioButton}" Content="MZ" ToolTip="ツクールMZ" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabMZ" Style="{StaticResource NavTabRadioButton}" Content="MZ" ToolTip="ツクールMZ" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
@@ -377,11 +379,16 @@
|
|||||||
<RadioButton x:Name="tabWolf" Style="{StaticResource NavTabRadioButton}" Content="ウディタ" ToolTip="WOLF RPGエディター" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabWolf" Style="{StaticResource NavTabRadioButton}" Content="ウディタ" ToolTip="WOLF RPGエディター" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
<RadioButton x:Name="tabSrpg" Style="{StaticResource NavTabRadioButton}" Content="SRPG" ToolTip="SRPG Studio" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabSrpg" Style="{StaticResource NavTabRadioButton}" Content="SRPG" ToolTip="SRPG Studio" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
<RadioButton x:Name="tabUnity" Style="{StaticResource NavTabRadioButton}" Content="Unity" ToolTip="Unity" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
<RadioButton x:Name="tabUnity" Style="{StaticResource NavTabRadioButton}" Content="Unity" ToolTip="Unity" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
</StackPanel>
|
<RadioButton x:Name="tabNwjs" Style="{StaticResource NavTabRadioButton}" Content="NW.js" ToolTip="NW.js" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
|
<RadioButton x:Name="tabOther" Style="{StaticResource NavTabRadioButton}" Content="その他" ToolTip="その他(エンジン不問)" GroupName="MainEngineTabs" Checked="EngineTab_Checked" Padding="9,5"/>
|
||||||
|
</WrapPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- サブフィルター群(状態・形式の追加絞り込み) -->
|
<!-- 2行目: サブフィルター群(状態・形式の追加絞り込みチェックボックス) -->
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<!-- ブックマークのみ絞り込み -->
|
||||||
|
<CheckBox x:Name="chkFilterBookmarkedOnly" Content="★ ブックマークのみ" Margin="0,0,14,0" Foreground="#FFEAA7" FontWeight="Bold" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
|
|
||||||
<!-- Unityバックエンド切り替え(Unityタブ選択時のみ表示) -->
|
<!-- Unityバックエンド切り替え(Unityタブ選択時のみ表示) -->
|
||||||
<StackPanel x:Name="pnlUnityBackendFilter" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,12,0" Visibility="Collapsed">
|
<StackPanel x:Name="pnlUnityBackendFilter" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,12,0" Visibility="Collapsed">
|
||||||
<TextBlock Text="形式:" FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
<TextBlock Text="形式:" FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
@@ -391,12 +398,12 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- 全体共通詳細チェックボックス -->
|
<!-- 全体共通詳細チェックボックス -->
|
||||||
<CheckBox x:Name="chkFilterModdedOnly" Content="改造中のみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
<CheckBox x:Name="chkFilterModdedOnly" Content="改造中のみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
<CheckBox x:Name="chkFilterAsarOnly" Content="ASAR形式のみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
<CheckBox x:Name="chkFilterAsarOnly" Content="ASAR形式のみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
<CheckBox x:Name="chkFilterRgssOnly" Content="RGSSアーカイブのみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
<CheckBox x:Name="chkFilterRgssOnly" Content="RGSSアーカイブのみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
<CheckBox x:Name="chkFilterSrpgOnly" Content="data.dtsのみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
<CheckBox x:Name="chkFilterSrpgOnly" Content="data.dtsのみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
<CheckBox x:Name="chkFilterSaveOnly" Content="セーブありのみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
<CheckBox x:Name="chkFilterSaveOnly" Content="セーブありのみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
</StackPanel>
|
</WrapPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
@@ -413,6 +420,11 @@
|
|||||||
<ListBox x:Name="lstGames" Background="Transparent" BorderThickness="0"
|
<ListBox x:Name="lstGames" Background="Transparent" BorderThickness="0"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
|
VirtualizingPanel.ScrollUnit="Pixel"
|
||||||
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
SelectionChanged="lstGames_SelectionChanged"
|
SelectionChanged="lstGames_SelectionChanged"
|
||||||
MouseDoubleClick="lstGames_MouseDoubleClick"
|
MouseDoubleClick="lstGames_MouseDoubleClick"
|
||||||
Padding="12">
|
Padding="12">
|
||||||
@@ -420,10 +432,12 @@
|
|||||||
<ListBox.ContextMenu>
|
<ListBox.ContextMenu>
|
||||||
<ContextMenu x:Name="listContextMenu" ContextMenuOpening="listContextMenu_ContextMenuOpening">
|
<ContextMenu x:Name="listContextMenu" ContextMenuOpening="listContextMenu_ContextMenuOpening">
|
||||||
<MenuItem Header="🚀 このゲームを起動" Click="MenuLaunch_Click"/>
|
<MenuItem Header="🚀 このゲームを起動" Click="MenuLaunch_Click"/>
|
||||||
|
<MenuItem x:Name="menuToggleBookmark" Header="★ ブックマーク登録/解除" Click="MenuToggleBookmark_Click"/>
|
||||||
<Separator Background="{StaticResource BorderBrushColor}"/>
|
<Separator Background="{StaticResource BorderBrushColor}"/>
|
||||||
|
|
||||||
<!-- ツクール専用メニュー項目 -->
|
<!-- ツクール専用メニュー項目 -->
|
||||||
<MenuItem x:Name="menuTkoolOpenFolder" Header="📁 ゲームフォルダを開く" Click="MenuOpenFolder_Click"/>
|
<MenuItem x:Name="menuTkoolOpenFolder" Header="📁 ゲームフォルダを開く" Click="MenuOpenFolder_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolRepairResources" Header="🔧 リソース文字化け・エンコード修復" Click="MenuRepairResources_Click"/>
|
||||||
<MenuItem x:Name="menuTkoolOpenProfile" Header="📂 プロファイルフォルダを開く" Click="MenuOpenProfileFolder_Click"/>
|
<MenuItem x:Name="menuTkoolOpenProfile" Header="📂 プロファイルフォルダを開く" Click="MenuOpenProfileFolder_Click"/>
|
||||||
<MenuItem x:Name="menuTkoolOpenPluginsJs" Header="📄 plugins.js を開く" Click="MenuOpenPluginsJs_Click"/>
|
<MenuItem x:Name="menuTkoolOpenPluginsJs" Header="📄 plugins.js を開く" Click="MenuOpenPluginsJs_Click"/>
|
||||||
<MenuItem x:Name="menuTkoolRestoreOriginal" Header="↩ 改造を解除してオリジナルに復元" Click="MenuRestoreOriginal_Click"/>
|
<MenuItem x:Name="menuTkoolRestoreOriginal" Header="↩ 改造を解除してオリジナルに復元" Click="MenuRestoreOriginal_Click"/>
|
||||||
@@ -474,162 +488,67 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type models:GameItemBase}">
|
<DataTemplate DataType="{x:Type models:GameItemBase}">
|
||||||
<Grid>
|
<Grid Margin="4,2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="52"/>
|
<ColumnDefinition Width="Auto"/> <!-- アイコン -->
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/> <!-- タイトル・フォルダ・バッジ・日付・ブックマーク -->
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- ゲームアイコン -->
|
<!-- ゲームアイコン -->
|
||||||
<Border Grid.Column="0" Width="44" Height="44" CornerRadius="6" Background="#16161E"
|
<Border Grid.Column="0" Width="44" Height="44" CornerRadius="6" Background="#16161E"
|
||||||
BorderBrush="#303040" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Center">
|
BorderBrush="#303040" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,10,0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock Text="🎮" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
<TextBlock Text="🎮" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
||||||
Visibility="{Binding IconImage, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
Visibility="{Binding IconImage, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
||||||
<Image Source="{Binding IconImage}" Width="36" Height="36" Stretch="Uniform" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<Image Source="{Binding IconImage}" Width="36" Height="36" Stretch="Uniform" RenderOptions.BitmapScalingMode="LowQuality"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- タイトル・フォルダ名・日付 -->
|
<!-- メイン情報(右側2行構成) -->
|
||||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="10,0,10,0">
|
<Grid Grid.Column="1" VerticalAlignment="Center">
|
||||||
<TextBlock Text="{Binding Title}" FontSize="14" FontWeight="SemiBold"
|
<Grid.RowDefinitions>
|
||||||
Foreground="{StaticResource TextPrimary}" TextTrimming="CharacterEllipsis"/>
|
<RowDefinition Height="Auto"/> <!-- 1行目: タイトル + [ラベル群] + [ブックマーク] -->
|
||||||
<Grid Margin="0,3,0,0">
|
<RowDefinition Height="Auto"/> <!-- 2行目: フォルダ名 + [更新日時] + [最終起動日時] -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 1行目: タイトル(左詰め) & ラベル群+ブックマーク(右寄せ) -->
|
||||||
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="0" Text="{Binding FolderName}" FontSize="11" Foreground="{StaticResource TextSecondary}"
|
|
||||||
TextTrimming="CharacterEllipsis"/>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding FolderLastModifiedCardDisplay}" FontSize="11" Foreground="#FAB1A0"
|
|
||||||
Margin="8,0,0,0"/>
|
|
||||||
<TextBlock Grid.Column="2" Text="{Binding LastLaunchedCardDisplay}" FontSize="11" Foreground="#81ECEC"
|
|
||||||
Margin="8,0,0,0"/>
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- バッジ群(ツクール / Unity 双方の種別バッジ) -->
|
<!-- タイトル -->
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
<TextBlock Grid.Column="0" Text="{Binding Title}" FontSize="14" FontWeight="SemiBold"
|
||||||
<!-- MVバッジ -->
|
Foreground="{StaticResource TextPrimary}" TextTrimming="CharacterEllipsis"
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
<!-- ラベル群(ブックマークの左側に配置) & ブックマークボタン(右端) -->
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeMvBg}"/>
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
<!-- エンジン種別バッジ (エンジン文字列が空なら非表示) -->
|
||||||
<Style.Triggers>
|
<Border Background="{Binding EngineLabelBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
<DataTrigger Binding="{Binding IsMV}" Value="True">
|
Visibility="{Binding EngineLabelText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
<TextBlock Text="{Binding EngineLabelText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="MV" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- MZバッジ -->
|
<!-- SRPG アーカイブバッジ (文字が空なら非表示) -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeMzBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsMZ}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="MZ" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- VX Aceバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeVxAceBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsVXAce}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="VX Ace" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- VXバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeVxBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsVX}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="VX" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- ティラノバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeTyranoBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsTyrano}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="ティラノ" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- ウディタバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeWolfBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsWolf}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="ウディタ" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- SRPG Studioバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Background" Value="{StaticResource BadgeSrpgBg}"/>
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsSrpgStudio}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="SRPG" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- SRPG アーカイブバッジ -->
|
|
||||||
<Border Background="{Binding SrpgBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding SrpgBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding SrpgBadgeVisibility}">
|
Visibility="{Binding SrpgBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SrpgBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SrpgBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<!-- NW.jsバッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="{StaticResource BadgeNwjsBg}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding NwjsBadgeVisibility, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="NW.js" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- その他バッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="#57606F" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding OtherBadgeVisibility, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="その他" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- IL2CPPバッジ -->
|
<!-- IL2CPPバッジ -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
@@ -662,40 +581,46 @@
|
|||||||
<TextBlock Text="Mono" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="Mono" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ASARバッジ(ツクール専用) -->
|
<!-- ウディタアーカイブバッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="{Binding WolfArchiveBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding WolfArchiveBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="{Binding WolfArchiveBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ASARバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="{Binding AsarBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding AsarBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding AsarBadgeVisibility}">
|
Visibility="{Binding AsarBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding AsarBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding AsarBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- RGSSアーカイブバッジ(ツクールVX専用) -->
|
<!-- RGSSアーカイブバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="{Binding RgssBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding RgssBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding RgssBadgeVisibility}">
|
Visibility="{Binding RgssBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding RgssBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding RgssBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Enigma Virtual Box (EVB) バッジ -->
|
<!-- EVB バッジ (文字が空なら非表示) -->
|
||||||
<Border Background="#6C5CE7" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="#6C5CE7" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
ToolTip="Enigma Virtual Box でパックされています。選択して「📦 EVBを解凍」を押してください。"
|
ToolTip="Enigma Virtual Box でパックされています。選択して「📦 EVBを解凍」を押してください。"
|
||||||
Visibility="{Binding EvbBadgeVisibility}">
|
Visibility="{Binding EvbBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding EvbBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding EvbBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- EVB 未解凍のときだけ「要解凍」を強調表示(一目で分かる導線) -->
|
<!-- EVB 要解凍バッジ (文字が空なら非表示) -->
|
||||||
<Border Background="#FDCB6E" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="#FDCB6E" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
ToolTip="選択して「📦 EVBを解凍」を押すと、同梱の evbunpack で解凍できます。"
|
ToolTip="選択して「📦 EVBを解凍」を押すと、同梱の evbunpack で解凍できます。"
|
||||||
Visibility="{Binding EvbNeedsUnpackVisibility}">
|
Visibility="{Binding EvbNeedsUnpackBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="要解凍" FontSize="10" FontWeight="Bold" Foreground="#3A2A00"/>
|
<TextBlock Text="{Binding EvbNeedsUnpackBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#3A2A00"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- EVB 解凍済みのときだけ「解凍済み」を表示(一目で分かる導線) -->
|
<!-- EVB 解凍済みバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="#00B894" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="#00B894" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
ToolTip="EVB は解凍済みです。解凍後の exe で起動し、改造も解凍先フォルダへ適用されます。"
|
ToolTip="EVB は解凍済みです。解凍後の exe で起動し、改造も解凍先フォルダへ適用されます。"
|
||||||
Visibility="{Binding EvbExtractedVisibility}">
|
Visibility="{Binding EvbExtractedBadgeText, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding EvbExtractedBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding EvbExtractedBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</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>
|
||||||
<Style TargetType="Border">
|
<Style TargetType="Border">
|
||||||
@@ -710,8 +635,8 @@
|
|||||||
<TextBlock Text="改造適用中" FontSize="10" FontWeight="SemiBold" Foreground="#FFDEAA"/>
|
<TextBlock Text="改造適用中" FontSize="10" FontWeight="SemiBold" Foreground="#FFDEAA"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- セーブデータありインジケータ(Unity専用) -->
|
<!-- セーブデータありインジケータ -->
|
||||||
<Border Background="{StaticResource BadgeSaveBg}" CornerRadius="4" Padding="6,2">
|
<Border Background="{StaticResource BadgeSaveBg}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
<Style TargetType="Border">
|
<Style TargetType="Border">
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
@@ -724,8 +649,35 @@
|
|||||||
</Border.Style>
|
</Border.Style>
|
||||||
<TextBlock Text="💾 セーブあり" FontSize="10" FontWeight="SemiBold" Foreground="#81ECEC"/>
|
<TextBlock Text="💾 セーブあり" FontSize="10" FontWeight="SemiBold" Foreground="#81ECEC"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<!-- ブックマークボタン(右端) -->
|
||||||
|
<Button Style="{StaticResource ModernButton}"
|
||||||
|
Padding="6,1" Margin="2,0,0,0" VerticalAlignment="Center"
|
||||||
|
Content="{Binding BookmarkIcon}" Foreground="{Binding BookmarkBrush}"
|
||||||
|
ToolTip="{Binding BookmarkTooltip}" FontSize="13" FontWeight="Bold"
|
||||||
|
Click="btnCardBookmark_Click" Focusable="False"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 2行目: フォルダ名(左詰め) & 日付表示部分(右寄せ: 1行目のブックマークと右端がピッタリ揃う) -->
|
||||||
|
<Grid Grid.Row="1" Margin="0,4,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- フォルダ名 -->
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding FolderName}" FontSize="11" Foreground="{StaticResource TextSecondary}"
|
||||||
|
TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||||
|
|
||||||
|
<!-- 日付表示部分(右寄せ) -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||||
|
<TextBlock Text="{Binding FolderLastModifiedCardDisplay}" FontSize="11" Foreground="#FAB1A0" Margin="0,0,8,0"/>
|
||||||
|
<TextBlock Text="{Binding LastLaunchedCardDisplay}" FontSize="11" Foreground="#81ECEC"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
@@ -754,14 +706,7 @@
|
|||||||
|
|
||||||
<!-- 右側:詳細 & 操作パネル -->
|
<!-- 右側:詳細 & 操作パネル -->
|
||||||
<Border Grid.Column="2" Background="{StaticResource SidePanelBg}" Padding="12,10">
|
<Border Grid.Column="2" Background="{StaticResource SidePanelBg}" Padding="12,10">
|
||||||
<DockPanel>
|
<Grid x:Name="pnlGameDetails">
|
||||||
<!-- 詳細パネルの開閉トグル(コンパクト化のため既定は展開、必要時に折りたたみ) -->
|
|
||||||
<Button x:Name="btnToggleDetails" DockPanel.Dock="Top"
|
|
||||||
Style="{StaticResource ModernButton}" Padding="8,4" FontSize="11"
|
|
||||||
HorizontalAlignment="Right" Margin="0,0,0,6"
|
|
||||||
Content="▾ 詳細を折りたたむ" Click="btnToggleDetails_Click"/>
|
|
||||||
<ScrollViewer x:Name="scvDetails" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
|
||||||
<Grid x:Name="pnlGameDetails" Margin="0,0,4,0">
|
|
||||||
<!-- 未選択時メッセージ -->
|
<!-- 未選択時メッセージ -->
|
||||||
<StackPanel x:Name="pnlNoSelection" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,80,0,0" Opacity="0.6">
|
<StackPanel x:Name="pnlNoSelection" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,80,0,0" Opacity="0.6">
|
||||||
<TextBlock Text="👈" FontSize="44" HorizontalAlignment="Center" Margin="0,0,0,10"/>
|
<TextBlock Text="👈" FontSize="44" HorizontalAlignment="Center" Margin="0,0,0,10"/>
|
||||||
@@ -769,10 +714,16 @@
|
|||||||
<TextBlock Text="ダブルクリックで即時起動することもできます" FontSize="12" HorizontalAlignment="Center" Margin="0,6,0,0"/>
|
<TextBlock Text="ダブルクリックで即時起動することもできます" FontSize="12" HorizontalAlignment="Center" Margin="0,6,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- 選択時コンテンツ -->
|
<!-- 選択時コンテンツ(上部固定ヘッダー + 下部スクロールエリア) -->
|
||||||
<StackPanel x:Name="pnlSelectedContent" Margin="0,0,0,16" Visibility="Collapsed">
|
<Grid x:Name="pnlSelectedContent" Visibility="Collapsed">
|
||||||
<!-- 1. ゲームアイコン・タイトル・バッジ(共通) -->
|
<Grid.RowDefinitions>
|
||||||
<Grid Margin="0,0,0,16">
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 1. ゲームアイコン・タイトル・ブックマーク・起動ボタン(上部固定エリア) -->
|
||||||
|
<StackPanel Grid.Row="0" Margin="0,0,0,8">
|
||||||
|
<Grid Margin="0,0,0,12">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="64"/>
|
<ColumnDefinition Width="64"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
@@ -783,134 +734,95 @@
|
|||||||
<TextBlock Text="🎮" FontSize="26" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
<TextBlock Text="🎮" FontSize="26" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
||||||
Visibility="{Binding SelectedItem.IconImage, ElementName=lstGames, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
Visibility="{Binding SelectedItem.IconImage, ElementName=lstGames, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
||||||
<Image Source="{Binding SelectedItem.IconImage, ElementName=lstGames}" Stretch="Uniform" Width="48" Height="48"
|
<Image Source="{Binding SelectedItem.IconImage, ElementName=lstGames}" Stretch="Uniform" Width="48" Height="48"
|
||||||
RenderOptions.BitmapScalingMode="HighQuality"/>
|
RenderOptions.BitmapScalingMode="LowQuality"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<!-- 詳細ヘッダー用ブックマーク切り替えボタン -->
|
||||||
|
<Button x:Name="btnDetailBookmark" DockPanel.Dock="Right" Style="{StaticResource ModernButton}"
|
||||||
|
Padding="8,3" Margin="6,0,0,0" VerticalAlignment="Center"
|
||||||
|
Content="{Binding SelectedItem.BookmarkButtonText, ElementName=lstGames}"
|
||||||
|
Foreground="{Binding SelectedItem.BookmarkBrush, ElementName=lstGames}"
|
||||||
|
ToolTip="{Binding SelectedItem.BookmarkTooltip, ElementName=lstGames}"
|
||||||
|
FontSize="12" FontWeight="Bold" Click="btnDetailBookmark_Click"/>
|
||||||
<TextBlock x:Name="lblSelectedTitle" Text="{Binding SelectedItem.Title, ElementName=lstGames}"
|
<TextBlock x:Name="lblSelectedTitle" Text="{Binding SelectedItem.Title, ElementName=lstGames}"
|
||||||
FontSize="17" FontWeight="Bold" Foreground="{StaticResource TextPrimary}" TextWrapping="Wrap"/>
|
FontSize="17" FontWeight="Bold" Foreground="{StaticResource TextPrimary}" TextWrapping="Wrap"/>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
<!-- 種別バッジライン -->
|
<!-- 種別バッジライン -->
|
||||||
<WrapPanel Orientation="Horizontal" Margin="0,4,0,0">
|
<WrapPanel Orientation="Horizontal" Margin="0,4,0,0">
|
||||||
<!-- ツクールMVバッジ -->
|
<!-- エンジン種別バッジ (エンジン文字列が空なら非表示) -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeMvBg}">
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{Binding SelectedItem.EngineLabelBackground, ElementName=lstGames}"
|
||||||
<Border.Style>
|
Visibility="{Binding SelectedItem.EngineLabelText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<Style TargetType="Border">
|
<TextBlock Text="{Binding SelectedItem.EngineLabelText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsMV, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="RPGツクールMV" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ツクールMZバッジ -->
|
<!-- NW.jsバッジ (文字が空なら非表示) -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeMzBg}">
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeNwjsBg}"
|
||||||
<Border.Style>
|
Visibility="{Binding SelectedItem.NwjsBadgeVisibility, ElementName=lstGames, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<Style TargetType="Border">
|
<TextBlock Text="NW.js" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsMZ, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="RPGツクールMZ" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ツクールVXバッジ -->
|
<!-- その他バッジ (文字が空なら非表示) -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeVxBg}">
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="#57606F"
|
||||||
<Border.Style>
|
Visibility="{Binding SelectedItem.OtherBadgeVisibility, ElementName=lstGames, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<Style TargetType="Border">
|
<TextBlock Text="その他" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsVX, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="RPGツクールVX" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ツクールVX Aceバッジ -->
|
<!-- Unityバックエンドバッジ (文字が空なら非表示) -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeVxAceBg}">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsVXAce, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="RPGツクールVX Ace" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- ティラノバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeTyranoBg}">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsTyrano, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="ティラノスクリプト" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- ウディタバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeWolfBg}">
|
|
||||||
<Border.Style>
|
|
||||||
<Style TargetType="Border">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsWolf, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<TextBlock Text="WOLF RPGエディター" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Unityバックエンドバッジ -->
|
|
||||||
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeIl2cppBg}"
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeIl2cppBg}"
|
||||||
Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsUnityToVisibilityConverter.Instance}}">
|
Visibility="{Binding SelectedItem.BackendBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.BackendBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.BackendBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Unityバージョン -->
|
<!-- Unityバージョン -->
|
||||||
<TextBlock Text="{Binding SelectedItem.UnityVersion, ElementName=lstGames, StringFormat='Unity {0}'}"
|
<TextBlock Text="{Binding SelectedItem.UnityVersion, ElementName=lstGames, StringFormat='Unity {0}'}"
|
||||||
FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,8,0"
|
FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,8,0"
|
||||||
Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsUnityToVisibilityConverter.Instance}}"/>
|
Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsUnityToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}"/>
|
||||||
|
|
||||||
<!-- ASARバッジ -->
|
<!-- ASARバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="{Binding SelectedItem.AsarBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding SelectedItem.AsarBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding SelectedItem.AsarBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- RGSSバッジ -->
|
<!-- RGSSバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="{Binding SelectedItem.RgssBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding SelectedItem.RgssBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding SelectedItem.RgssBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ウディタアーカイブバッジ -->
|
<!-- ウディタアーカイブバッジ (文字が空なら非表示) -->
|
||||||
<Border Background="{Binding SelectedItem.WolfArchiveBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
<Border Background="{Binding SelectedItem.WolfArchiveBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
Visibility="{Binding SelectedItem.WolfArchiveBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<!-- SRPGアーカイブバッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="{Binding SelectedItem.SrpgBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding SelectedItem.SrpgBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.SrpgBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- EVB バッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="#6C5CE7" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding SelectedItem.EvbBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.EvbBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- EVB 要解凍バッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="#FDCB6E" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding SelectedItem.EvbNeedsUnpackBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.EvbNeedsUnpackBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#3A2A00"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- EVB 解凍済みバッジ (文字が空なら非表示) -->
|
||||||
|
<Border Background="#00B894" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding SelectedItem.EvbExtractedBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.EvbExtractedBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- 改造中バッジ -->
|
<!-- 改造中バッジ -->
|
||||||
<Border CornerRadius="4" Padding="6,2" Background="{StaticResource BadgeModdedBg}" Margin="0,0,6,0">
|
<Border CornerRadius="4" Padding="6,2" Background="{StaticResource BadgeModdedBg}" Margin="0,0,6,0">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
@@ -930,13 +842,23 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 2. 起動ボタン(大・共通) -->
|
<!-- 2. 起動ボタン(大・共通) -->
|
||||||
<Button x:Name="btnLaunchGame" Style="{StaticResource LaunchBigButton}" Height="48" Margin="0,0,0,12" Click="btnLaunchGame_Click">
|
<Button x:Name="btnLaunchGame" Style="{StaticResource LaunchBigButton}" Height="48" Margin="0,0,0,8" Click="btnLaunchGame_Click">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<TextBlock Text="🚀" FontSize="20" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
<TextBlock Text="🚀" FontSize="20" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="ゲームを起動" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"/>
|
<TextBlock Text="ゲームを起動" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<!-- 詳細設定の開閉トグルボタン -->
|
||||||
|
<Button x:Name="btnToggleDetails"
|
||||||
|
Style="{StaticResource ModernButton}" Padding="8,4" FontSize="11"
|
||||||
|
HorizontalAlignment="Right" Margin="0,0,0,4"
|
||||||
|
Content="▾ 詳細設定を折りたたむ" Click="btnToggleDetails_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- ================= 2. 下部可変・スクロールエリア ================= -->
|
||||||
|
<ScrollViewer x:Name="scvDetails" Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<StackPanel Margin="0,0,4,16">
|
||||||
<!-- ================= A. ツクール / ティラノ 選択時の個別UI ================= -->
|
<!-- ================= A. ツクール / ティラノ 選択時の個別UI ================= -->
|
||||||
<StackPanel x:Name="pnlTkoolDetails" Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsTkoolToVisibilityConverter.Instance}}">
|
<StackPanel x:Name="pnlTkoolDetails" Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsTkoolToVisibilityConverter.Instance}}">
|
||||||
<!-- クイックボタン -->
|
<!-- クイックボタン -->
|
||||||
@@ -947,17 +869,8 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Grid.Column="0" Style="{StaticResource ModernButton}" Content="📁 フォルダを開く" Click="btnOpenFolder_Click"/>
|
<Button Grid.Column="0" Style="{StaticResource ModernButton}" Content="📁 フォルダを開く" Click="btnOpenFolder_Click"/>
|
||||||
<Button Grid.Column="2" Content="↩ 改造を解除(復元)" Click="btnRestoreOriginal_Click">
|
<Button Grid.Column="2" Content="↩ 改造を解除(復元)" Click="btnRestoreOriginal_Click" Style="{StaticResource ModernButton}"
|
||||||
<Button.Style>
|
Visibility="{Binding SelectedItem.CanApplyScriptMod, ElementName=lstGames, Converter={x:Static helpers:BooleanToVisibilityConverter.Instance}}"/>
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsWolf, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Button.Style>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- パス・日時情報 -->
|
<!-- パス・日時情報 -->
|
||||||
@@ -987,11 +900,12 @@
|
|||||||
|
|
||||||
<!-- ASARパッケージ管理セクション(IsAsar時のみ表示) -->
|
<!-- ASARパッケージ管理セクション(IsAsar時のみ表示) -->
|
||||||
<Border Background="#1E1E2E" BorderBrush="#6C5CE7" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
<Border Background="#1E1E2E" BorderBrush="#6C5CE7" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
||||||
Visibility="{Binding SelectedItem.AsarBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.AsarBadgeVisibility, ElementName=lstGames, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
||||||
<TextBlock Text="📦 app.asar パッケージ管理" FontSize="13" FontWeight="Bold" Foreground="#A29BFE"/>
|
<TextBlock Text="📦 app.asar パッケージ管理" FontSize="13" FontWeight="Bold" Foreground="#A29BFE"/>
|
||||||
<Border Background="{Binding SelectedItem.AsarBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0">
|
<Border Background="{Binding SelectedItem.AsarBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
||||||
|
Visibility="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -1019,7 +933,7 @@
|
|||||||
|
|
||||||
<!-- Enigma Virtual Box (EVB) 梱包管理セクション(IsEvbPacked時のみ表示) -->
|
<!-- Enigma Virtual Box (EVB) 梱包管理セクション(IsEvbPacked時のみ表示) -->
|
||||||
<Border Background="#1E1E2E" BorderBrush="#A29BFE" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
<Border Background="#1E1E2E" BorderBrush="#A29BFE" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
||||||
Visibility="{Binding SelectedItem.EvbBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.EvbBadgeVisibility, ElementName=lstGames, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
||||||
<TextBlock Text="🧩 Enigma Virtual Box (EVB) 管理" FontSize="13" FontWeight="Bold" Foreground="#A29BFE"/>
|
<TextBlock Text="🧩 Enigma Virtual Box (EVB) 管理" FontSize="13" FontWeight="Bold" Foreground="#A29BFE"/>
|
||||||
@@ -1051,11 +965,12 @@
|
|||||||
|
|
||||||
<!-- RGSSアーカイブ管理セクション(HasRgssArchive時のみ表示) -->
|
<!-- RGSSアーカイブ管理セクション(HasRgssArchive時のみ表示) -->
|
||||||
<Border Background="#1E1E2E" BorderBrush="#00CEC9" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
<Border Background="#1E1E2E" BorderBrush="#00CEC9" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
||||||
Visibility="{Binding SelectedItem.RgssBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.RgssBadgeVisibility, ElementName=lstGames, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
||||||
<TextBlock Text="📦 RGSS アーカイブ管理" FontSize="13" FontWeight="Bold" Foreground="#81ECEC"/>
|
<TextBlock Text="📦 RGSS アーカイブ管理" FontSize="13" FontWeight="Bold" Foreground="#81ECEC"/>
|
||||||
<Border Background="{Binding SelectedItem.RgssBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0">
|
<Border Background="{Binding SelectedItem.RgssBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
||||||
|
Visibility="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.RgssBadgeText, ElementName=lstGames}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -1081,17 +996,9 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- スクリプト改造セクション -->
|
<!-- スクリプト改造セクション(該当ゲームで改造不可能な場合は非表示) -->
|
||||||
<Border Background="#252535" BorderBrush="{StaticResource AccentPrimary}" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14">
|
<Border Background="#252535" BorderBrush="{StaticResource AccentPrimary}" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
||||||
<Border.Style>
|
Visibility="{Binding SelectedItem.CanApplyScriptMod, ElementName=lstGames, Converter={x:Static helpers:BooleanToVisibilityConverter.Instance}}">
|
||||||
<Style TargetType="Border">
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding SelectedItem.IsWolf, ElementName=lstGames}" Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<CheckBox x:Name="chkApplyMod" IsChecked="{Binding SelectedItem.ApplyMod, ElementName=lstGames, Mode=TwoWay}"
|
<CheckBox x:Name="chkApplyMod" IsChecked="{Binding SelectedItem.ApplyMod, ElementName=lstGames, Mode=TwoWay}"
|
||||||
FontSize="15" FontWeight="Bold" Foreground="#A29BFE">
|
FontSize="15" FontWeight="Bold" Foreground="#A29BFE">
|
||||||
@@ -1101,8 +1008,11 @@
|
|||||||
FontSize="11" Foreground="{StaticResource TextSecondary}" TextWrapping="Wrap" Margin="24,4,0,10"/>
|
FontSize="11" Foreground="{StaticResource TextSecondary}" TextWrapping="Wrap" Margin="24,4,0,10"/>
|
||||||
|
|
||||||
<!-- 個別プラグインアコーディオン -->
|
<!-- 個別プラグインアコーディオン -->
|
||||||
<Expander Header="プラグイン個別設定(詳細)" IsExpanded="True" Foreground="{StaticResource TextSecondary}" FontSize="12">
|
<Expander Header="プラグイン個別設定(詳細)" IsExpanded="False" Foreground="{StaticResource TextSecondary}" FontSize="12">
|
||||||
<ItemsControl ItemsSource="{Binding SelectedItem.PluginOptions, ElementName=lstGames}" Margin="4,8,0,0">
|
<StackPanel Margin="4,8,0,0">
|
||||||
|
<!-- 共通機能プラグイン グループ -->
|
||||||
|
<TextBlock Text="【共通プラグイン】" FontSize="11" FontWeight="Bold" Foreground="#A29BFE" Margin="2,2,0,6"/>
|
||||||
|
<ItemsControl ItemsSource="{Binding SelectedItem.CommonPluginOptions, ElementName=lstGames}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type models:ModPluginOptionItem}">
|
<DataTemplate DataType="{x:Type models:ModPluginOptionItem}">
|
||||||
<Border Margin="0,0,0,6" Background="#1B1B26" CornerRadius="5" Padding="10,7" BorderBrush="#35354A" BorderThickness="1">
|
<Border Margin="0,0,0,6" Background="#1B1B26" CornerRadius="5" Padding="10,7" BorderBrush="#35354A" BorderThickness="1">
|
||||||
@@ -1120,6 +1030,42 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
|
<!-- 固有ゲーム専用プラグイン グループ(プリンセスシナジー等でのみ表示) -->
|
||||||
|
<Border Margin="0,8,0,0" Background="#231A2D" BorderBrush="#E84393" BorderThickness="1.2" CornerRadius="6" Padding="8,8,8,2">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem.HasSpecificPlugins, ElementName=lstGames}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="【💖 固有ゲーム専用プラグイン】" FontSize="11" FontWeight="Bold" Foreground="#FD79A8" Margin="2,0,0,6"/>
|
||||||
|
<ItemsControl ItemsSource="{Binding SelectedItem.SpecificPluginOptions, ElementName=lstGames}">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type models:ModPluginOptionItem}">
|
||||||
|
<Border Margin="0,0,0,6" Background="#1E1626" CornerRadius="5" Padding="10,7" BorderBrush="#633959" BorderThickness="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<CheckBox Grid.Row="0" IsChecked="{Binding IsEnabled, Mode=TwoWay}"
|
||||||
|
Content="{Binding Name}" FontWeight="SemiBold" FontSize="12" Foreground="#FFEAA7"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding Description}" FontSize="11" Foreground="{StaticResource TextSecondary}"
|
||||||
|
TextWrapping="Wrap" Margin="22,2,0,0" Opacity="0.85"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
</Expander>
|
</Expander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -1203,7 +1149,7 @@
|
|||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
||||||
<TextBlock Text="📦 Data.wolf アーカイブ管理" FontSize="12" FontWeight="Bold" Foreground="#A29BFE"/>
|
<TextBlock Text="📦 Data.wolf アーカイブ管理" FontSize="12" FontWeight="Bold" Foreground="#A29BFE"/>
|
||||||
<Border Background="{Binding SelectedItem.WolfArchiveBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
<Border Background="{Binding SelectedItem.WolfArchiveBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
||||||
Visibility="{Binding SelectedItem.WolfArchiveBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames}" FontSize="9" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.WolfArchiveBadgeText, ElementName=lstGames}" FontSize="9" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -1318,7 +1264,7 @@
|
|||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
||||||
<TextBlock Text="📦 data.dts アーカイブ管理" FontSize="12" FontWeight="Bold" Foreground="#A29BFE"/>
|
<TextBlock Text="📦 data.dts アーカイブ管理" FontSize="12" FontWeight="Bold" Foreground="#A29BFE"/>
|
||||||
<Border Background="{Binding SelectedItem.SrpgBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
<Border Background="{Binding SelectedItem.SrpgBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="10,0,0,0"
|
||||||
Visibility="{Binding SelectedItem.SrpgBadgeVisibility, ElementName=lstGames}">
|
Visibility="{Binding SelectedItem.SrpgBadgeText, ElementName=lstGames, Converter={x:Static helpers:StringNotEmptyToVisibilityConverter.Instance}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
|
||||||
<TextBlock Text="{Binding SelectedItem.SrpgBadgeText, ElementName=lstGames}" FontSize="9" FontWeight="Bold" Foreground="#FFFFFF"/>
|
<TextBlock Text="{Binding SelectedItem.SrpgBadgeText, ElementName=lstGames}" FontSize="9" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -1405,9 +1351,9 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</DockPanel>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -1444,6 +1390,7 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
@@ -1451,8 +1398,16 @@
|
|||||||
<TextBlock x:Name="lblStatusBreakdown" Text=" (ツクール: 0, ティラノ: 0, Unity: 0)" FontSize="11" Foreground="#7D6DF8" Margin="8,0,0,0"/>
|
<TextBlock x:Name="lblStatusBreakdown" Text=" (ツクール: 0, ティラノ: 0, Unity: 0)" FontSize="11" Foreground="#7D6DF8" Margin="8,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock x:Name="lblStatusEngine" Grid.Column="1" Text="待機中" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center"/>
|
<!-- 処理中プログレス表示エリア -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0,16,0">
|
||||||
|
<ProgressBar x:Name="pbGlobalProgress" Width="180" Height="10" Minimum="0" Maximum="100" Visibility="Collapsed"
|
||||||
|
Background="#222233" Foreground="{StaticResource AccentPrimary}" BorderThickness="0" Margin="0,0,8,0"/>
|
||||||
|
<TextBlock x:Name="lblGlobalProgressText" Text="" FontSize="11" Foreground="{StaticResource AccentGreen}" VerticalAlignment="Center" Visibility="Collapsed"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock x:Name="lblStatusEngine" Grid.Column="2" Text="待機中" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
||||||
+850
-555
File diff suppressed because it is too large.
Load diff
+193
-39
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -22,6 +22,7 @@ namespace GameLauncher.Models
|
|||||||
private ImageSource? _iconImage;
|
private ImageSource? _iconImage;
|
||||||
private DateTime? _lastLaunched;
|
private DateTime? _lastLaunched;
|
||||||
private DateTime? _folderLastModified;
|
private DateTime? _folderLastModified;
|
||||||
|
private bool _isBookmarked;
|
||||||
|
|
||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
@@ -33,51 +34,51 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>ゲームの表示タイトル</summary>
|
/// <summary>ゲームの表示タイトル</summary>
|
||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
get => _title;
|
get => this._title;
|
||||||
set { if (_title != value) { _title = value; OnPropertyChanged(); } }
|
set { if (this._title != value) { this._title = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>フォルダ名</summary>
|
/// <summary>フォルダ名</summary>
|
||||||
public string FolderName
|
public string FolderName
|
||||||
{
|
{
|
||||||
get => _folderName;
|
get => this._folderName;
|
||||||
set { if (_folderName != value) { _folderName = value; OnPropertyChanged(); } }
|
set { if (this._folderName != value) { this._folderName = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>ゲームのルートディレクトリ絶対パス</summary>
|
/// <summary>ゲームのルートディレクトリ絶対パス</summary>
|
||||||
public string RootDirectory
|
public string RootDirectory
|
||||||
{
|
{
|
||||||
get => _rootDirectory;
|
get => this._rootDirectory;
|
||||||
set { if (_rootDirectory != value) { _rootDirectory = value; OnPropertyChanged(); } }
|
set { if (this._rootDirectory != value) { this._rootDirectory = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>ゲームの実行ファイル(.exe等)絶対パス</summary>
|
/// <summary>ゲームの実行ファイル(.exe等)絶対パス</summary>
|
||||||
public string ExecutablePath
|
public string ExecutablePath
|
||||||
{
|
{
|
||||||
get => _executablePath;
|
get => this._executablePath;
|
||||||
set { if (_executablePath != value) { _executablePath = value; OnPropertyChanged(); } }
|
set { if (this._executablePath != value) { this._executablePath = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>アプリアイコン画像</summary>
|
/// <summary>アプリアイコン画像</summary>
|
||||||
public ImageSource? IconImage
|
public ImageSource? IconImage
|
||||||
{
|
{
|
||||||
get => _iconImage;
|
get => this._iconImage;
|
||||||
set { if (_iconImage != value) { _iconImage = value; OnPropertyChanged(); } }
|
set { if (this._iconImage != value) { this._iconImage = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>ランチャーからの最終起動日時</summary>
|
/// <summary>ランチャーからの最終起動日時</summary>
|
||||||
public DateTime? LastLaunched
|
public DateTime? LastLaunched
|
||||||
{
|
{
|
||||||
get => _lastLaunched;
|
get => this._lastLaunched;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_lastLaunched != value)
|
if (this._lastLaunched != value)
|
||||||
{
|
{
|
||||||
_lastLaunched = value;
|
this._lastLaunched = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(LastLaunchedDisplay));
|
this.OnPropertyChanged(nameof(this.LastLaunchedDisplay));
|
||||||
OnPropertyChanged(nameof(LastLaunchedCardDisplay));
|
this.OnPropertyChanged(nameof(this.LastLaunchedCardDisplay));
|
||||||
OnPropertyChanged(nameof(LastLaunchedDetailDisplay));
|
this.OnPropertyChanged(nameof(this.LastLaunchedDetailDisplay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,51 +86,111 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>フォルダ更新日時</summary>
|
/// <summary>フォルダ更新日時</summary>
|
||||||
public DateTime? FolderLastModified
|
public DateTime? FolderLastModified
|
||||||
{
|
{
|
||||||
get => _folderLastModified;
|
get => this._folderLastModified;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_folderLastModified != value)
|
if (this._folderLastModified != value)
|
||||||
{
|
{
|
||||||
_folderLastModified = value;
|
this._folderLastModified = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(FolderLastModifiedDisplay));
|
this.OnPropertyChanged(nameof(this.FolderLastModifiedDisplay));
|
||||||
OnPropertyChanged(nameof(FolderLastModifiedCardDisplay));
|
this.OnPropertyChanged(nameof(this.FolderLastModifiedCardDisplay));
|
||||||
OnPropertyChanged(nameof(FolderLastModifiedDetailDisplay));
|
this.OnPropertyChanged(nameof(this.FolderLastModifiedDetailDisplay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>ユーザーによるブックマーク登録状態</summary>
|
||||||
|
public bool IsBookmarked
|
||||||
|
{
|
||||||
|
get => this._isBookmarked;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (this._isBookmarked != value)
|
||||||
|
{
|
||||||
|
this._isBookmarked = value;
|
||||||
|
this.OnPropertyChanged();
|
||||||
|
this.OnPropertyChanged(nameof(this.BookmarkIcon));
|
||||||
|
this.OnPropertyChanged(nameof(this.BookmarkTooltip));
|
||||||
|
this.OnPropertyChanged(nameof(this.BookmarkButtonText));
|
||||||
|
this.OnPropertyChanged(nameof(this.BookmarkBrush));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string BookmarkIcon => this._isBookmarked ? "★" : "☆";
|
||||||
|
public string BookmarkTooltip => this._isBookmarked ? "ブックマーク解除" : "ブックマークに追加";
|
||||||
|
public string BookmarkButtonText => this._isBookmarked ? "★ ブックマーク中" : "☆ ブックマーク";
|
||||||
|
public Brush BookmarkBrush => this._isBookmarked
|
||||||
|
? new SolidColorBrush(Color.FromRgb(0xFD, 0xCB, 0x6E))
|
||||||
|
: new SolidColorBrush(Color.FromArgb(0x88, 0xAA, 0xAA, 0xBB));
|
||||||
|
|
||||||
/// <summary>ゲームエンジンの種別</summary>
|
/// <summary>ゲームエンジンの種別</summary>
|
||||||
public abstract GameEngineKind EngineKind { get; }
|
public abstract GameEngineKind EngineKind { get; }
|
||||||
|
|
||||||
public bool IsTkoolOrTyrano => EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano;
|
public bool IsTkoolOrTyrano => this.EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano;
|
||||||
public bool IsUnity => EngineKind == GameEngineKind.Unity;
|
public bool IsUnity => this.EngineKind == GameEngineKind.Unity;
|
||||||
|
|
||||||
/// <summary>Enigma Virtual Box でパックされたゲームか</summary>
|
/// <summary>Enigma Virtual Box でパックされたゲームか</summary>
|
||||||
public virtual bool IsEvb => false;
|
public virtual bool IsEvb => false;
|
||||||
|
|
||||||
public string LastLaunchedDisplay => LastLaunched.HasValue
|
/// <summary>Enigma Virtual Box でパックされた exe を持つゲームかどうか</summary>
|
||||||
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm")
|
public virtual bool IsEvbPacked
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>EVB 解凍済みかどうか</summary>
|
||||||
|
public virtual bool IsEvbExtracted
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>EVB バッジの可視性(該当しなければ Collapsed)</summary>
|
||||||
|
public virtual Visibility EvbBadgeVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>EVB バッジのテキスト(該当しなければ空文字)</summary>
|
||||||
|
public virtual string EvbBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>EVB 要解凍バッジの可視性(該当しなければ Collapsed)</summary>
|
||||||
|
public virtual Visibility EvbNeedsUnpackVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>EVB 要解凍バッジのテキスト(該当しなければ空文字)</summary>
|
||||||
|
public virtual string EvbNeedsUnpackBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>EVB 解凍済みバッジの可視性(該当しなければ Collapsed)</summary>
|
||||||
|
public virtual Visibility EvbExtractedVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>EVB 解凍済みバッジのテキスト(該当しなければ空文字)</summary>
|
||||||
|
public virtual string EvbExtractedBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>EVB 詳細状態テキスト</summary>
|
||||||
|
public virtual string EvbDetailStatusText => string.Empty;
|
||||||
|
|
||||||
|
public string LastLaunchedDisplay => this.LastLaunched.HasValue
|
||||||
|
? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm")
|
||||||
: "未起動";
|
: "未起動";
|
||||||
|
|
||||||
public string LastLaunchedCardDisplay => LastLaunched.HasValue
|
public string LastLaunchedCardDisplay => this.LastLaunched.HasValue
|
||||||
? $"▶ {LastLaunched.Value:yy/MM/dd HH:mm}"
|
? $"▶ {this.LastLaunched.Value:yy/MM/dd HH:mm}"
|
||||||
: "▶ 未起動";
|
: "▶ 未起動";
|
||||||
|
|
||||||
public string LastLaunchedDetailDisplay => LastLaunched.HasValue
|
public string LastLaunchedDetailDisplay => this.LastLaunched.HasValue
|
||||||
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
: "まだ起動されていません";
|
: "まだ起動されていません";
|
||||||
|
|
||||||
public string FolderLastModifiedDisplay => FolderLastModified.HasValue
|
public string FolderLastModifiedDisplay => this.FolderLastModified.HasValue
|
||||||
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm")
|
? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm")
|
||||||
: "-";
|
: "-";
|
||||||
|
|
||||||
public string FolderLastModifiedCardDisplay => FolderLastModified.HasValue
|
public string FolderLastModifiedCardDisplay => this.FolderLastModified.HasValue
|
||||||
? $"📁 {FolderLastModified.Value:yy/MM/dd HH:mm}"
|
? $"📁 {this.FolderLastModified.Value:yy/MM/dd HH:mm}"
|
||||||
: "📁 -";
|
: "📁 -";
|
||||||
|
|
||||||
public string FolderLastModifiedDetailDisplay => FolderLastModified.HasValue
|
public string FolderLastModifiedDetailDisplay => this.FolderLastModified.HasValue
|
||||||
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
: "不明";
|
: "不明";
|
||||||
|
|
||||||
// ================= バッジ・UIバインディング共通仮想プロパティ =================
|
// ================= バッジ・UIバインディング共通仮想プロパティ =================
|
||||||
@@ -157,6 +218,24 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>SRPG Studioか</summary>
|
/// <summary>SRPG Studioか</summary>
|
||||||
public virtual bool IsSrpgStudio => false;
|
public virtual bool IsSrpgStudio => false;
|
||||||
|
|
||||||
|
/// <summary>NW.js汎用ゲームか</summary>
|
||||||
|
public virtual bool IsNwjs => false;
|
||||||
|
|
||||||
|
/// <summary>その他のゲームエンジンか</summary>
|
||||||
|
public virtual bool IsOther => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// エンジン種別ラベルの表示文字列。空文字の場合はラベル自体を表示しません。
|
||||||
|
/// (Unity等は該当しないため空、ツクール系は MV/MZ 等を返す)
|
||||||
|
/// </summary>
|
||||||
|
public virtual string EngineLabelText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>エンジン種別ラベルの背景色</summary>
|
||||||
|
public virtual Brush EngineLabelBackground => Brushes.Transparent;
|
||||||
|
|
||||||
|
/// <summary>その他バッジの可視性(該当しなければ Collapsed)</summary>
|
||||||
|
public virtual Visibility OtherBadgeVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
/// <summary>プリンセスシナジー(専用改造対象のMZゲーム)か</summary>
|
/// <summary>プリンセスシナジー(専用改造対象のMZゲーム)か</summary>
|
||||||
public virtual bool IsPrincessSynergy => false;
|
public virtual bool IsPrincessSynergy => false;
|
||||||
|
|
||||||
@@ -188,6 +267,18 @@ namespace GameLauncher.Models
|
|||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>ウディタアーカイブバッジのテキスト(該当しなければ空文字)</summary>
|
||||||
|
public virtual string WolfArchiveBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>ウディタアーカイブバッジの背景色</summary>
|
||||||
|
public virtual Brush WolfArchiveBadgeBackground => Brushes.Transparent;
|
||||||
|
|
||||||
|
/// <summary>ウディタアーカイブバッジの可視性(該当しなければ Collapsed)</summary>
|
||||||
|
public virtual Visibility WolfArchiveBadgeVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>ウディタアーカイブ詳細状態テキスト</summary>
|
||||||
|
public virtual string WolfArchiveDetailStatusText => string.Empty;
|
||||||
|
|
||||||
/// <summary>SRPG Studioアーカイブ(data.dts)を持つか</summary>
|
/// <summary>SRPG Studioアーカイブ(data.dts)を持つか</summary>
|
||||||
public virtual bool HasSrpgArchive
|
public virtual bool HasSrpgArchive
|
||||||
{
|
{
|
||||||
@@ -226,6 +317,18 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>SRPG Studio詳細状態テキスト</summary>
|
/// <summary>SRPG Studio詳細状態テキスト</summary>
|
||||||
public virtual string SrpgDetailStatusText => string.Empty;
|
public virtual string SrpgDetailStatusText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>NW.jsバッジのテキスト</summary>
|
||||||
|
public virtual string NwjsBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>NW.jsバッジの背景色</summary>
|
||||||
|
public virtual Brush NwjsBadgeBackground => Brushes.Transparent;
|
||||||
|
|
||||||
|
/// <summary>NW.jsバッジの可視性</summary>
|
||||||
|
public virtual Visibility NwjsBadgeVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>NW.js詳細状態テキスト</summary>
|
||||||
|
public virtual string NwjsDetailStatusText => string.Empty;
|
||||||
|
|
||||||
/// <summary>Unity IL2CPPか</summary>
|
/// <summary>Unity IL2CPPか</summary>
|
||||||
public virtual bool IsIL2CPP => false;
|
public virtual bool IsIL2CPP => false;
|
||||||
|
|
||||||
@@ -301,5 +404,56 @@ namespace GameLauncher.Models
|
|||||||
get => _emptyPluginOptions;
|
get => _emptyPluginOptions;
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>共通プラグイン設定コレクション</summary>
|
||||||
|
public virtual ObservableCollection<ModPluginOptionItem> CommonPluginOptions
|
||||||
|
{
|
||||||
|
get => _emptyPluginOptions;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>固有ゲーム専用プラグイン設定コレクション</summary>
|
||||||
|
public virtual ObservableCollection<ModPluginOptionItem> SpecificPluginOptions
|
||||||
|
{
|
||||||
|
get => _emptyPluginOptions;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>固有ゲーム専用プラグインが存在するかどうか</summary>
|
||||||
|
public virtual bool HasSpecificPlugins => false;
|
||||||
|
|
||||||
|
/// <summary>プリンセスシナジー専用: HP常時MAX</summary>
|
||||||
|
public virtual bool PrincessAlwaysMaxHp
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>プリンセスシナジー専用: MP常時MAX</summary>
|
||||||
|
public virtual bool PrincessAlwaysMaxMp
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ウディタ プロキシDLL適用フラグ</summary>
|
||||||
|
public virtual bool WolfProxyDll
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>SRPG Studio プロキシDLL適用フラグ</summary>
|
||||||
|
public virtual bool SrpgProxyDll
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// スクリプト改造(プラグイン注入など)が適用可能な状態かどうか。
|
||||||
|
/// 該当ゲームが改造非対応(ウディタ・SRPG・NW.js・その他・未解凍状態など)の場合は false を返し、
|
||||||
|
/// 右側パネルのスクリプト改造項目を非表示にします。
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool CanApplyScriptMod => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GameLauncher.Engines.Tkool;
|
using GameLauncher.Engines.Tkool;
|
||||||
@@ -40,6 +40,7 @@ namespace GameLauncher.Models
|
|||||||
public bool TkoolFilterAsarOnly { get; set; }
|
public bool TkoolFilterAsarOnly { get; set; }
|
||||||
public bool TkoolFilterRgssOnly { get; set; }
|
public bool TkoolFilterRgssOnly { get; set; }
|
||||||
public bool TkoolFilterAllRgss { get; set; }
|
public bool TkoolFilterAllRgss { get; set; }
|
||||||
|
public bool FilterBookmarkedOnly { get; set; }
|
||||||
public string UnityBackendFilter { get; set; } = "All";
|
public string UnityBackendFilter { get; set; } = "All";
|
||||||
public bool UnityFilterSaveOnly { get; set; }
|
public bool UnityFilterSaveOnly { get; set; }
|
||||||
}
|
}
|
||||||
@@ -56,8 +57,9 @@ namespace GameLauncher.Models
|
|||||||
if (x is not GameItemBase a || y is not GameItemBase b)
|
if (x is not GameItemBase a || y is not GameItemBase b)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return SortOrder switch
|
return this.SortOrder switch
|
||||||
{
|
{
|
||||||
|
GameSortOrder.BookmarkedFirst => CompareBookmarkedFirst(a, b),
|
||||||
GameSortOrder.LastLaunchedDesc => CompareNullableDateTimeDesc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
GameSortOrder.LastLaunchedDesc => CompareNullableDateTimeDesc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
||||||
GameSortOrder.LastLaunchedAsc => CompareNullableDateTimeAsc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
GameSortOrder.LastLaunchedAsc => CompareNullableDateTimeAsc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
||||||
GameSortOrder.FolderLastModifiedDesc => CompareNullableDateTimeDesc(a.FolderLastModified, b.FolderLastModified, a.Title, b.Title),
|
GameSortOrder.FolderLastModifiedDesc => CompareNullableDateTimeDesc(a.FolderLastModified, b.FolderLastModified, a.Title, b.Title),
|
||||||
@@ -69,6 +71,15 @@ namespace GameLauncher.Models
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int CompareBookmarkedFirst(GameItemBase a, GameItemBase b)
|
||||||
|
{
|
||||||
|
if (a.IsBookmarked != b.IsBookmarked)
|
||||||
|
{
|
||||||
|
return a.IsBookmarked ? -1 : 1;
|
||||||
|
}
|
||||||
|
return CompareNullableDateTimeDesc(a.LastLaunched, b.LastLaunched, a.Title, b.Title);
|
||||||
|
}
|
||||||
|
|
||||||
private static int CompareNullableDateTimeDesc(DateTime? d1, DateTime? d2, string title1, string title2)
|
private static int CompareNullableDateTimeDesc(DateTime? d1, DateTime? d2, string title1, string title2)
|
||||||
{
|
{
|
||||||
if (d1.HasValue && d2.HasValue)
|
if (d1.HasValue && d2.HasValue)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -17,6 +17,18 @@ namespace GameLauncher.Models
|
|||||||
public string FileName { get; set; } = string.Empty; // ファイル名 (例: "BattleSpeedUp.js")
|
public string FileName { get; set; } = string.Empty; // ファイル名 (例: "BattleSpeedUp.js")
|
||||||
public string FilePath { get; set; } = string.Empty; // フルパス
|
public string FilePath { get; set; } = string.Empty; // フルパス
|
||||||
|
|
||||||
|
/// <summary>特定ゲーム専用プラグインかどうか</summary>
|
||||||
|
public bool IsGameSpecific { get; set; }
|
||||||
|
|
||||||
|
/// <summary>対象ゲーム識別子 (例: "PrincessSynergy")</summary>
|
||||||
|
public string TargetGameKey { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>表示用グループ名</summary>
|
||||||
|
public string GroupName { get; set; } = "共通機能";
|
||||||
|
|
||||||
|
/// <summary>初期チェックの既定値 (未設定時の初期値)</summary>
|
||||||
|
public bool DefaultEnabled { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// .js ファイルから定義情報を解析・生成します。
|
/// .js ファイルから定義情報を解析・生成します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,6 +50,16 @@ namespace GameLauncher.Models
|
|||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
string displayName = GetFriendlyName(id, desc);
|
string displayName = GetFriendlyName(id, desc);
|
||||||
|
bool isSpecific = id is "AlwaysMaxHp" or "AlwaysMaxMp";
|
||||||
|
string targetKey = isSpecific ? "PrincessSynergy" : string.Empty;
|
||||||
|
string groupName = isSpecific ? "固有ゲーム専用プラグイン" : "共通プラグイン";
|
||||||
|
bool defEnabled = id switch
|
||||||
|
{
|
||||||
|
"ShopMaxBuy" => false,
|
||||||
|
"AlwaysMaxHp" => false,
|
||||||
|
"AlwaysMaxMp" => false,
|
||||||
|
_ => true
|
||||||
|
};
|
||||||
|
|
||||||
return new ModPluginDefinition
|
return new ModPluginDefinition
|
||||||
{
|
{
|
||||||
@@ -45,7 +67,11 @@ namespace GameLauncher.Models
|
|||||||
Name = displayName,
|
Name = displayName,
|
||||||
Description = desc,
|
Description = desc,
|
||||||
FileName = fileName,
|
FileName = fileName,
|
||||||
FilePath = filePath
|
FilePath = filePath,
|
||||||
|
IsGameSpecific = isSpecific,
|
||||||
|
TargetGameKey = targetKey,
|
||||||
|
GroupName = groupName,
|
||||||
|
DefaultEnabled = defEnabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +91,8 @@ namespace GameLauncher.Models
|
|||||||
"GoldGainMax" => "所持金増減時MAX (9999999G)",
|
"GoldGainMax" => "所持金増減時MAX (9999999G)",
|
||||||
"ExpGainMax" => "経験値獲得時MAX (一気にLv99)",
|
"ExpGainMax" => "経験値獲得時MAX (一気にLv99)",
|
||||||
"MessageInstant" => "メッセージ瞬間表示 (ウェイトスキップ)",
|
"MessageInstant" => "メッセージ瞬間表示 (ウェイトスキップ)",
|
||||||
|
"AlwaysMaxHp" => "HP常時MAX (プリンセスシナジー専用)",
|
||||||
|
"AlwaysMaxMp" => "MP常時MAX (プリンセスシナジー専用)",
|
||||||
_ => !string.IsNullOrEmpty(desc) ? $"{id} ({desc})" : id
|
_ => !string.IsNullOrEmpty(desc) ? $"{id} ({desc})" : id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -78,19 +106,21 @@ namespace GameLauncher.Models
|
|||||||
private bool _isEnabled = true;
|
private bool _isEnabled = true;
|
||||||
|
|
||||||
public ModPluginDefinition Definition { get; set; } = null!;
|
public ModPluginDefinition Definition { get; set; } = null!;
|
||||||
public string Id => Definition.Id;
|
public string Id => this.Definition.Id;
|
||||||
public string Name => Definition.Name;
|
public string Name => this.Definition.Name;
|
||||||
public string Description => Definition.Description;
|
public string Description => this.Definition.Description;
|
||||||
|
public string GroupName => this.Definition.GroupName;
|
||||||
|
public bool IsGameSpecific => this.Definition.IsGameSpecific;
|
||||||
|
|
||||||
public bool IsEnabled
|
public bool IsEnabled
|
||||||
{
|
{
|
||||||
get => _isEnabled;
|
get => this._isEnabled;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_isEnabled != value)
|
if (this._isEnabled != value)
|
||||||
{
|
{
|
||||||
_isEnabled = value;
|
this._isEnabled = value;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
@@ -26,36 +26,36 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>項目名(キー名、変数名)</summary>
|
/// <summary>項目名(キー名、変数名)</summary>
|
||||||
public string Key
|
public string Key
|
||||||
{
|
{
|
||||||
get => _key;
|
get => this._key;
|
||||||
set { if (_key != value) { _key = value; OnPropertyChanged(); } }
|
set { if (this._key != value) { this._key = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary>
|
/// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary>
|
||||||
public string Category
|
public string Category
|
||||||
{
|
{
|
||||||
get => _category;
|
get => this._category;
|
||||||
set { if (_category != value) { _category = value; OnPropertyChanged(); } }
|
set { if (this._category != value) { this._category = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>データ型(Int, Float, Bool, String など)</summary>
|
/// <summary>データ型(Int, Float, Bool, String など)</summary>
|
||||||
public string Type
|
public string Type
|
||||||
{
|
{
|
||||||
get => _type;
|
get => this._type;
|
||||||
set { if (_type != value) { _type = value; OnPropertyChanged(); } }
|
set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>GUI編集用の値文字列</summary>
|
/// <summary>GUI編集用の値文字列</summary>
|
||||||
public string EditValue
|
public string EditValue
|
||||||
{
|
{
|
||||||
get => _editValue;
|
get => this._editValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_editValue != value)
|
if (this._editValue != value)
|
||||||
{
|
{
|
||||||
_editValue = value;
|
this._editValue = value;
|
||||||
_isModified = true;
|
this._isModified = true;
|
||||||
OnPropertyChanged();
|
this.OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(IsModified));
|
this.OnPropertyChanged(nameof(this.IsModified));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,15 +63,15 @@ namespace GameLauncher.Models
|
|||||||
/// <summary>値がユーザーによって変更されたかどうか</summary>
|
/// <summary>値がユーザーによって変更されたかどうか</summary>
|
||||||
public bool IsModified
|
public bool IsModified
|
||||||
{
|
{
|
||||||
get => _isModified;
|
get => this._isModified;
|
||||||
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
|
set { if (this._isModified != value) { this._isModified = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>備考・説明・オフセット位置など</summary>
|
/// <summary>備考・説明・オフセット位置など</summary>
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get => _description;
|
get => this._description;
|
||||||
set { if (_description != value) { _description = value; OnPropertyChanged(); } }
|
set { if (this._description != value) { this._description = value; this.OnPropertyChanged(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>内部保持用の生データや元データ(再エンコード用)</summary>
|
/// <summary>内部保持用の生データや元データ(再エンコード用)</summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# GameLauncher (ツクールMV・MZ・ティラノ & Unity 統合ゲームランチャー)
|
# GameLauncher (ツクールMV・MZ・ティラノ & Unity 統合ゲームランチャー)
|
||||||
|
|
||||||
RPGツクール(MV・MZ)、ティラノスクリプト、およびUnity製ゲームを1つの洗練された画面で一元管理・高速起動できる統合ランチャーです。
|
RPGツクール(MV・MZ)、ティラノスクリプト、およびUnity製ゲームを1つの洗練された画面で一元管理・高速起動できる統合ランチャーです。
|
||||||
従来の **TkoolLauncher** と **UnityLauncher** の全機能(スクリプト改造、ASAR解凍・復元、PlayerPrefsレジストリ編集、セーブファイル編集、バックアップ)が欠けることなく完全に統合されています。
|
従来の **TkoolLauncher** と **UnityLauncher** の全機能(スクリプト改造、ASAR解凍・復元、PlayerPrefsレジストリ編集、セーブファイル編集、バックアップ)が欠けることなく完全に統合されています。
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="GameLauncher.SaveEditorWindow"
|
<Window x:Class="GameLauncher.SaveEditorWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
|||||||
+162
-162
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -33,7 +33,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
// PlayerPrefs データ
|
// PlayerPrefs データ
|
||||||
private readonly ObservableCollection<PlayerPrefsEntry> _allPrefs = [];
|
private readonly ObservableCollection<PlayerPrefsEntry> _allPrefs = [];
|
||||||
private ListCollectionView _prefsView = null!;
|
private readonly ListCollectionView _prefsView = null!;
|
||||||
|
|
||||||
// ファイル一覧データ
|
// ファイル一覧データ
|
||||||
private readonly ObservableCollection<SaveFileEntry> _saveFiles = [];
|
private readonly ObservableCollection<SaveFileEntry> _saveFiles = [];
|
||||||
@@ -41,7 +41,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
// GUIセーブプロパティデータ
|
// GUIセーブプロパティデータ
|
||||||
private readonly ObservableCollection<SaveDataPropertyEntry> _guiProperties = [];
|
private readonly ObservableCollection<SaveDataPropertyEntry> _guiProperties = [];
|
||||||
private ListCollectionView _guiPropsView = null!;
|
private readonly ListCollectionView _guiPropsView = null!;
|
||||||
private ISaveDataCodec? _currentCodec;
|
private ISaveDataCodec? _currentCodec;
|
||||||
|
|
||||||
// バックアップ一覧データ
|
// バックアップ一覧データ
|
||||||
@@ -49,36 +49,36 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public SaveEditorWindow(UnityGameItem game)
|
public SaveEditorWindow(UnityGameItem game)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.InitializeComponent();
|
||||||
Game = game;
|
this.Game = game;
|
||||||
|
|
||||||
lblGameTitle.Text = game.Title;
|
this.lblGameTitle.Text = game.Title;
|
||||||
lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})";
|
this.lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})";
|
||||||
|
|
||||||
// PlayerPrefs ビュー
|
// PlayerPrefs ビュー
|
||||||
_prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_allPrefs);
|
this._prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._allPrefs);
|
||||||
_prefsView.Filter = FilterPrefs;
|
this._prefsView.Filter = this.FilterPrefs;
|
||||||
dgPlayerPrefs.ItemsSource = _prefsView;
|
this.dgPlayerPrefs.ItemsSource = this._prefsView;
|
||||||
|
|
||||||
// ファイル一覧
|
// ファイル一覧
|
||||||
lstSaveFiles.ItemsSource = _saveFiles;
|
this.lstSaveFiles.ItemsSource = this._saveFiles;
|
||||||
|
|
||||||
// GUI プロパティビュー
|
// GUI プロパティビュー
|
||||||
_guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_guiProperties);
|
this._guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._guiProperties);
|
||||||
_guiPropsView.Filter = FilterGuiProperties;
|
this._guiPropsView.Filter = this.FilterGuiProperties;
|
||||||
dgGuiProperties.ItemsSource = _guiPropsView;
|
this.dgGuiProperties.ItemsSource = this._guiPropsView;
|
||||||
|
|
||||||
// バックアップ一覧
|
// バックアップ一覧
|
||||||
dgBackups.ItemsSource = _backups;
|
this.dgBackups.ItemsSource = this._backups;
|
||||||
|
|
||||||
Loaded += SaveEditorWindow_Loaded;
|
Loaded += this.SaveEditorWindow_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveEditorWindow_Loaded(object sender, RoutedEventArgs e)
|
private void SaveEditorWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ReloadPlayerPrefs();
|
this.ReloadPlayerPrefs();
|
||||||
ReloadSaveFiles();
|
this.ReloadSaveFiles();
|
||||||
ReloadBackups();
|
this.ReloadBackups();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
@@ -87,26 +87,26 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public void ReloadPlayerPrefs()
|
public void ReloadPlayerPrefs()
|
||||||
{
|
{
|
||||||
_allPrefs.Clear();
|
this._allPrefs.Clear();
|
||||||
if (string.IsNullOrEmpty(Game.RegistryPath))
|
if (string.IsNullOrEmpty(this.Game.RegistryPath))
|
||||||
{
|
{
|
||||||
lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)";
|
this.lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entries = _saveService.GetPlayerPrefs(Game.RegistryPath);
|
var entries = this._saveService.GetPlayerPrefs(this.Game.RegistryPath);
|
||||||
foreach (var entry in entries)
|
foreach (var entry in entries)
|
||||||
{
|
{
|
||||||
_allPrefs.Add(entry);
|
this._allPrefs.Add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
lblStatus.Text = $"PlayerPrefs: {entries.Count} 件のキーを読み込みました (HKCU\\{Game.RegistryPath})";
|
this.lblStatus.Text = $"PlayerPrefs: {entries.Count} 件のキーを読み込みました (HKCU\\{this.Game.RegistryPath})";
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FilterPrefs(object obj)
|
private bool FilterPrefs(object obj)
|
||||||
{
|
{
|
||||||
if (obj is not PlayerPrefsEntry entry) return false;
|
if (obj is not PlayerPrefsEntry entry) return false;
|
||||||
var query = txtSearchPrefs.Text.Trim();
|
var query = this.txtSearchPrefs.Text.Trim();
|
||||||
if (string.IsNullOrEmpty(query)) return true;
|
if (string.IsNullOrEmpty(query)) return true;
|
||||||
|
|
||||||
return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
@@ -116,26 +116,26 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e)
|
private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_prefsView.Refresh();
|
this._prefsView.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgPlayerPrefs_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void dgPlayerPrefs_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
{
|
{
|
||||||
lblSelectedKeyName.Text = entry.CleanKey;
|
this.lblSelectedKeyName.Text = entry.CleanKey;
|
||||||
txtEditValueBar.Text = entry.EditValue;
|
this.txtEditValueBar.Text = entry.EditValue;
|
||||||
txtEditValueBar.IsEnabled = true;
|
this.txtEditValueBar.IsEnabled = true;
|
||||||
btnSaveCurrentPref.IsEnabled = true;
|
this.btnSaveCurrentPref.IsEnabled = true;
|
||||||
btnDeleteCurrentPref.IsEnabled = true;
|
this.btnDeleteCurrentPref.IsEnabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lblSelectedKeyName.Text = "(なし)";
|
this.lblSelectedKeyName.Text = "(なし)";
|
||||||
txtEditValueBar.Text = string.Empty;
|
this.txtEditValueBar.Text = string.Empty;
|
||||||
txtEditValueBar.IsEnabled = false;
|
this.txtEditValueBar.IsEnabled = false;
|
||||||
btnSaveCurrentPref.IsEnabled = false;
|
this.btnSaveCurrentPref.IsEnabled = false;
|
||||||
btnDeleteCurrentPref.IsEnabled = false;
|
this.btnDeleteCurrentPref.IsEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,25 +143,25 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
SaveCurrentSelectedPref();
|
this.SaveCurrentSelectedPref();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e)
|
private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SaveCurrentSelectedPref();
|
this.SaveCurrentSelectedPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveCurrentSelectedPref()
|
private void SaveCurrentSelectedPref()
|
||||||
{
|
{
|
||||||
if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
if (this.dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
||||||
|
|
||||||
entry.EditValue = txtEditValueBar.Text;
|
entry.EditValue = this.txtEditValueBar.Text;
|
||||||
bool success = _saveService.SavePlayerPref(Game.RegistryPath, entry);
|
bool success = this._saveService.SavePlayerPref(this.Game.RegistryPath, entry);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。";
|
this.lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。";
|
||||||
dgPlayerPrefs.Items.Refresh();
|
this.dgPlayerPrefs.Items.Refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -172,16 +172,16 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnDeleteCurrentPref_Click(object sender, RoutedEventArgs e)
|
private void btnDeleteCurrentPref_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
if (this.dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
||||||
|
|
||||||
var res = MessageBox.Show($"キー '{entry.CleanKey}' ({entry.RawKey}) をレジストリから削除しますか?",
|
var res = MessageBox.Show($"キー '{entry.CleanKey}' ({entry.RawKey}) をレジストリから削除しますか?",
|
||||||
"キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
"キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
if (res != MessageBoxResult.Yes) return;
|
if (res != MessageBoxResult.Yes) return;
|
||||||
|
|
||||||
if (_saveService.DeletePlayerPref(Game.RegistryPath, entry.RawKey))
|
if (this._saveService.DeletePlayerPref(this.Game.RegistryPath, entry.RawKey))
|
||||||
{
|
{
|
||||||
_allPrefs.Remove(entry);
|
this._allPrefs.Remove(entry);
|
||||||
lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。";
|
this.lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -194,10 +194,10 @@ namespace GameLauncher
|
|||||||
var dlg = new AddKeyDialog { Owner = this };
|
var dlg = new AddKeyDialog { Owner = this };
|
||||||
if (dlg.ShowDialog() == true)
|
if (dlg.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
if (_saveService.AddPlayerPref(Game.RegistryPath, dlg.KeyName, dlg.KeyType, dlg.KeyValue, out string rawKey))
|
if (this._saveService.AddPlayerPref(this.Game.RegistryPath, dlg.KeyName, dlg.KeyType, dlg.KeyValue, out string rawKey))
|
||||||
{
|
{
|
||||||
ReloadPlayerPrefs();
|
this.ReloadPlayerPrefs();
|
||||||
lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。";
|
this.lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -208,12 +208,12 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnBackupPrefs_Click(object sender, RoutedEventArgs e)
|
private void btnBackupPrefs_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
|
||||||
var result = _saveService.BackupRegistry(Game.RegistryPath, backupDir);
|
var result = this._saveService.BackupRegistry(this.Game.RegistryPath, backupDir);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
ReloadBackups();
|
this.ReloadBackups();
|
||||||
lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}";
|
this.lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}";
|
||||||
MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -224,7 +224,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnRestorePrefs_Click(object sender, RoutedEventArgs e)
|
private void btnRestorePrefs_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
|
||||||
var dlg = new OpenFileDialog
|
var dlg = new OpenFileDialog
|
||||||
{
|
{
|
||||||
Title = "復元する .reg ファイルを選択",
|
Title = "復元する .reg ファイルを選択",
|
||||||
@@ -238,10 +238,10 @@ namespace GameLauncher
|
|||||||
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
if (res != MessageBoxResult.Yes) return;
|
if (res != MessageBoxResult.Yes) return;
|
||||||
|
|
||||||
if (_saveService.RestoreRegistry(dlg.FileName))
|
if (this._saveService.RestoreRegistry(dlg.FileName))
|
||||||
{
|
{
|
||||||
ReloadPlayerPrefs();
|
this.ReloadPlayerPrefs();
|
||||||
lblStatus.Text = "レジストリを正常に復元しました。";
|
this.lblStatus.Text = "レジストリを正常に復元しました。";
|
||||||
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -253,17 +253,17 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnReloadPrefs_Click(object sender, RoutedEventArgs e)
|
private void btnReloadPrefs_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ReloadPlayerPrefs();
|
this.ReloadPlayerPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ctxSavePref_Click(object sender, RoutedEventArgs e)
|
private void ctxSavePref_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SaveCurrentSelectedPref();
|
this.SaveCurrentSelectedPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ctxCopyKey_Click(object sender, RoutedEventArgs e)
|
private void ctxCopyKey_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
{
|
{
|
||||||
Clipboard.SetText(entry.CleanKey);
|
Clipboard.SetText(entry.CleanKey);
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void ctxCopyValue_Click(object sender, RoutedEventArgs e)
|
private void ctxCopyValue_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
{
|
{
|
||||||
Clipboard.SetText(entry.EditValue);
|
Clipboard.SetText(entry.EditValue);
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void ctxDeletePref_Click(object sender, RoutedEventArgs e)
|
private void ctxDeletePref_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
btnDeleteCurrentPref_Click(sender, e);
|
this.btnDeleteCurrentPref_Click(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
@@ -288,98 +288,98 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public void ReloadSaveFiles()
|
public void ReloadSaveFiles()
|
||||||
{
|
{
|
||||||
_saveFiles.Clear();
|
this._saveFiles.Clear();
|
||||||
var files = _saveService.GetSaveFiles(Game);
|
var files = this._saveService.GetSaveFiles(this.Game);
|
||||||
foreach (var f in files)
|
foreach (var f in files)
|
||||||
{
|
{
|
||||||
_saveFiles.Add(f);
|
this._saveFiles.Add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_saveFiles.Count > 0)
|
if (this._saveFiles.Count > 0)
|
||||||
{
|
{
|
||||||
lstSaveFiles.SelectedIndex = 0;
|
this.lstSaveFiles.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lblCurrentFileName.Text = "セーブファイルは見つかりませんでした";
|
this.lblCurrentFileName.Text = "セーブファイルは見つかりませんでした";
|
||||||
lblCurrentFilePath.Text = string.Empty;
|
this.lblCurrentFilePath.Text = string.Empty;
|
||||||
txtFileContent.Text = string.Empty;
|
this.txtFileContent.Text = string.Empty;
|
||||||
HideAllEditorPanels();
|
this.HideAllEditorPanels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HideAllEditorPanels()
|
private void HideAllEditorPanels()
|
||||||
{
|
{
|
||||||
pnlGuiEditor.Visibility = Visibility.Collapsed;
|
this.pnlGuiEditor.Visibility = Visibility.Collapsed;
|
||||||
pnlTextEditor.Visibility = Visibility.Collapsed;
|
this.pnlTextEditor.Visibility = Visibility.Collapsed;
|
||||||
pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
||||||
btnFormatJson.Visibility = Visibility.Collapsed;
|
this.btnFormatJson.Visibility = Visibility.Collapsed;
|
||||||
btnSaveFileContent.Visibility = Visibility.Collapsed;
|
this.btnSaveFileContent.Visibility = Visibility.Collapsed;
|
||||||
btnSaveGuiProperties.Visibility = Visibility.Collapsed;
|
this.btnSaveGuiProperties.Visibility = Visibility.Collapsed;
|
||||||
badgeCodec.Visibility = Visibility.Collapsed;
|
this.badgeCodec.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (lstSaveFiles.SelectedItem is not SaveFileEntry entry) return;
|
if (this.lstSaveFiles.SelectedItem is not SaveFileEntry entry) return;
|
||||||
_currentSelectedFile = entry;
|
this._currentSelectedFile = entry;
|
||||||
|
|
||||||
lblCurrentFileName.Text = entry.FileName;
|
this.lblCurrentFileName.Text = entry.FileName;
|
||||||
lblCurrentFilePath.Text = entry.FilePath;
|
this.lblCurrentFilePath.Text = entry.FilePath;
|
||||||
HideAllEditorPanels();
|
this.HideAllEditorPanels();
|
||||||
|
|
||||||
// 1. コーデック(対応形式)が存在するか判定
|
// 1. コーデック(対応形式)が存在するか判定
|
||||||
var codec = SaveDataCodecManager.Instance.FindCodec(Game, entry);
|
var codec = SaveDataCodecManager.Instance.FindCodec(this.Game, entry);
|
||||||
if (codec != null)
|
if (codec != null)
|
||||||
{
|
{
|
||||||
// GUI エディタモードをアクティブ化
|
// GUI エディタモードをアクティブ化
|
||||||
_currentCodec = codec;
|
this._currentCodec = codec;
|
||||||
badgeCodec.Visibility = Visibility.Visible;
|
this.badgeCodec.Visibility = Visibility.Visible;
|
||||||
lblCodecName.Text = codec.CodecName;
|
this.lblCodecName.Text = codec.CodecName;
|
||||||
|
|
||||||
LoadGuiPropertiesFromCodec(codec, entry.FilePath);
|
this.LoadGuiPropertiesFromCodec(codec, entry.FilePath);
|
||||||
pnlGuiEditor.Visibility = Visibility.Visible;
|
this.pnlGuiEditor.Visibility = Visibility.Visible;
|
||||||
btnSaveGuiProperties.Visibility = Visibility.Visible;
|
this.btnSaveGuiProperties.Visibility = Visibility.Visible;
|
||||||
lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}";
|
this.lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. プレーンテキスト/JSON形式の場合
|
// 2. プレーンテキスト/JSON形式の場合
|
||||||
if (entry.IsTextOrJson)
|
if (entry.IsTextOrJson)
|
||||||
{
|
{
|
||||||
pnlTextEditor.Visibility = Visibility.Visible;
|
this.pnlTextEditor.Visibility = Visibility.Visible;
|
||||||
txtFileContent.Text = _saveService.ReadSaveFileText(entry.FilePath);
|
this.txtFileContent.Text = this._saveService.ReadSaveFileText(entry.FilePath);
|
||||||
btnFormatJson.Visibility = Visibility.Visible;
|
this.btnFormatJson.Visibility = Visibility.Visible;
|
||||||
btnSaveFileContent.Visibility = Visibility.Visible;
|
this.btnSaveFileContent.Visibility = Visibility.Visible;
|
||||||
lblStatus.Text = $"テキストとして開きました: {entry.FileName}";
|
this.lblStatus.Text = $"テキストとして開きました: {entry.FileName}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 未対応のバイナリセーブデータ形式の場合
|
// 3. 未対応のバイナリセーブデータ形式の場合
|
||||||
pnlUnsupportedBinary.Visibility = Visibility.Visible;
|
this.pnlUnsupportedBinary.Visibility = Visibility.Visible;
|
||||||
DisplayUnsupportedBinaryInfo(entry);
|
this.DisplayUnsupportedBinaryInfo(entry);
|
||||||
lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}";
|
this.lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath)
|
private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath)
|
||||||
{
|
{
|
||||||
_guiProperties.Clear();
|
this._guiProperties.Clear();
|
||||||
var props = codec.LoadProperties(filePath);
|
var props = codec.LoadProperties(filePath);
|
||||||
foreach (var p in props)
|
foreach (var p in props)
|
||||||
{
|
{
|
||||||
_guiProperties.Add(p);
|
this._guiProperties.Add(p);
|
||||||
}
|
}
|
||||||
lblGuiPropCount.Text = $"{props.Count} 項目";
|
this.lblGuiPropCount.Text = $"{props.Count} 項目";
|
||||||
if (props.Count > 0)
|
if (props.Count > 0)
|
||||||
{
|
{
|
||||||
dgGuiProperties.SelectedIndex = 0;
|
this.dgGuiProperties.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FilterGuiProperties(object obj)
|
private bool FilterGuiProperties(object obj)
|
||||||
{
|
{
|
||||||
if (obj is not SaveDataPropertyEntry prop) return false;
|
if (obj is not SaveDataPropertyEntry prop) return false;
|
||||||
var query = txtSearchGuiProps.Text.Trim();
|
var query = this.txtSearchGuiProps.Text.Trim();
|
||||||
if (string.IsNullOrEmpty(query)) return true;
|
if (string.IsNullOrEmpty(query)) return true;
|
||||||
|
|
||||||
return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
@@ -389,26 +389,26 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e)
|
private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_guiPropsView.Refresh();
|
this._guiPropsView.Refresh();
|
||||||
int visibleCount = _guiPropsView.Cast<object>().Count();
|
int visibleCount = this._guiPropsView.Cast<object>().Count();
|
||||||
lblGuiPropCount.Text = $"{visibleCount} / {_guiProperties.Count} 項目";
|
this.lblGuiPropCount.Text = $"{visibleCount} / {this._guiProperties.Count} 項目";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgGuiProperties_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void dgGuiProperties_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
if (this.dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
||||||
{
|
{
|
||||||
lblSelectedPropKey.Text = prop.Key;
|
this.lblSelectedPropKey.Text = prop.Key;
|
||||||
txtEditPropValueBar.Text = prop.EditValue;
|
this.txtEditPropValueBar.Text = prop.EditValue;
|
||||||
txtEditPropValueBar.IsEnabled = true;
|
this.txtEditPropValueBar.IsEnabled = true;
|
||||||
btnApplyPropValue.IsEnabled = true;
|
this.btnApplyPropValue.IsEnabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lblSelectedPropKey.Text = "(未選択)";
|
this.lblSelectedPropKey.Text = "(未選択)";
|
||||||
txtEditPropValueBar.Text = string.Empty;
|
this.txtEditPropValueBar.Text = string.Empty;
|
||||||
txtEditPropValueBar.IsEnabled = false;
|
this.txtEditPropValueBar.IsEnabled = false;
|
||||||
btnApplyPropValue.IsEnabled = false;
|
this.btnApplyPropValue.IsEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,28 +416,28 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
btnApplyPropValue_Click(sender, e);
|
this.btnApplyPropValue_Click(sender, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnApplyPropValue_Click(object sender, RoutedEventArgs e)
|
private void btnApplyPropValue_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
if (this.dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
||||||
{
|
{
|
||||||
prop.EditValue = txtEditPropValueBar.Text;
|
prop.EditValue = this.txtEditPropValueBar.Text;
|
||||||
dgGuiProperties.Items.Refresh();
|
this.dgGuiProperties.Items.Refresh();
|
||||||
lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)";
|
this.lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSaveGuiProperties_Click(object sender, RoutedEventArgs e)
|
private void btnSaveGuiProperties_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSelectedFile == null || _currentCodec == null) return;
|
if (this._currentSelectedFile == null || this._currentCodec == null) return;
|
||||||
|
|
||||||
bool success = _currentCodec.SaveProperties(_currentSelectedFile.FilePath, _guiProperties.ToList());
|
bool success = this._currentCodec.SaveProperties(this._currentSelectedFile.FilePath, [.. this._guiProperties]);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}";
|
this.lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}";
|
||||||
MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)",
|
MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)",
|
||||||
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
@@ -460,41 +460,41 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
hexList.Add(bytes[i].ToString("X2"));
|
hexList.Add(bytes[i].ToString("X2"));
|
||||||
}
|
}
|
||||||
lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : "");
|
this.lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
lblHexPreview.Text = "(読み込み失敗)";
|
this.lblHexPreview.Text = "(読み込み失敗)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCopyIdePrompt_Click(object sender, RoutedEventArgs e)
|
private void btnCopyIdePrompt_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSelectedFile == null) return;
|
if (this._currentSelectedFile == null) return;
|
||||||
|
|
||||||
string prompt = SaveDataCodecManager.Instance.GenerateAntigravityPrompt(Game, _currentSelectedFile);
|
string prompt = SaveDataCodecManager.Instance.GenerateAntigravityPrompt(this.Game, this._currentSelectedFile);
|
||||||
Clipboard.SetText(prompt);
|
Clipboard.SetText(prompt);
|
||||||
|
|
||||||
lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!";
|
this.lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!";
|
||||||
MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。",
|
MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。",
|
||||||
"プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information);
|
"プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnForceShowBinary_Click(object sender, RoutedEventArgs e)
|
private void btnForceShowBinary_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSelectedFile == null) return;
|
if (this._currentSelectedFile == null) return;
|
||||||
pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
||||||
pnlTextEditor.Visibility = Visibility.Visible;
|
this.pnlTextEditor.Visibility = Visibility.Visible;
|
||||||
btnSaveFileContent.Visibility = Visibility.Visible;
|
this.btnSaveFileContent.Visibility = Visibility.Visible;
|
||||||
txtFileContent.Text = _saveService.ReadSaveFileText(_currentSelectedFile.FilePath);
|
this.txtFileContent.Text = this._saveService.ReadSaveFileText(this._currentSelectedFile.FilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnFormatJson_Click(object sender, RoutedEventArgs e)
|
private void btnFormatJson_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var raw = txtFileContent.Text;
|
var raw = this.txtFileContent.Text;
|
||||||
if (string.IsNullOrWhiteSpace(raw)) return;
|
if (string.IsNullOrWhiteSpace(raw)) return;
|
||||||
|
|
||||||
using var doc = JsonDocument.Parse(raw);
|
using var doc = JsonDocument.Parse(raw);
|
||||||
@@ -503,8 +503,8 @@ namespace GameLauncher
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
});
|
});
|
||||||
txtFileContent.Text = formatted;
|
this.txtFileContent.Text = formatted;
|
||||||
lblStatus.Text = "JSONを整形しました。";
|
this.lblStatus.Text = "JSONを整形しました。";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -514,12 +514,12 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnSaveFileContent_Click(object sender, RoutedEventArgs e)
|
private void btnSaveFileContent_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSelectedFile == null) return;
|
if (this._currentSelectedFile == null) return;
|
||||||
|
|
||||||
bool success = _saveService.WriteSaveFileText(_currentSelectedFile.FilePath, txtFileContent.Text);
|
bool success = this._saveService.WriteSaveFileText(this._currentSelectedFile.FilePath, this.txtFileContent.Text);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}";
|
this.lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}";
|
||||||
MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)",
|
MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)",
|
||||||
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
@@ -532,14 +532,14 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnBackupSingleFile_Click(object sender, RoutedEventArgs e)
|
private void btnBackupSingleFile_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSelectedFile == null) return;
|
if (this._currentSelectedFile == null) return;
|
||||||
|
|
||||||
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
|
||||||
var result = _saveService.BackupSaveFile(_currentSelectedFile.FilePath, backupDir);
|
var result = this._saveService.BackupSaveFile(this._currentSelectedFile.FilePath, backupDir);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
ReloadBackups();
|
this.ReloadBackups();
|
||||||
lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}";
|
this.lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}";
|
||||||
MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -550,7 +550,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e)
|
private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ReloadSaveFiles();
|
this.ReloadSaveFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
@@ -559,22 +559,22 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public void ReloadBackups()
|
public void ReloadBackups()
|
||||||
{
|
{
|
||||||
_backups.Clear();
|
this._backups.Clear();
|
||||||
var list = _saveService.GetBackupList(Game);
|
var list = this._saveService.GetBackupList(this.Game);
|
||||||
foreach (var b in list)
|
foreach (var b in list)
|
||||||
{
|
{
|
||||||
_backups.Add(b);
|
this._backups.Add(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnReloadBackups_Click(object sender, RoutedEventArgs e)
|
private void btnReloadBackups_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ReloadBackups();
|
this.ReloadBackups();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOpenBackupDir_Click(object sender, RoutedEventArgs e)
|
private void btnOpenBackupDir_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
|
||||||
UnitySaveManagerService.OpenFolderInExplorer(backupDir);
|
UnitySaveManagerService.OpenFolderInExplorer(backupDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,9 +588,9 @@ namespace GameLauncher
|
|||||||
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
if (res == MessageBoxResult.Yes)
|
if (res == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
if (_saveService.RestoreRegistry(backup.BackupPath))
|
if (this._saveService.RestoreRegistry(backup.BackupPath))
|
||||||
{
|
{
|
||||||
ReloadPlayerPrefs();
|
this.ReloadPlayerPrefs();
|
||||||
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -613,29 +613,29 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e)
|
private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Game.LocalLowPath))
|
if (!string.IsNullOrEmpty(this.Game.LocalLowPath))
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Game.LocalLowPath))
|
if (!Directory.Exists(this.Game.LocalLowPath))
|
||||||
{
|
{
|
||||||
var parent = Path.GetDirectoryName(Game.LocalLowPath);
|
var parent = Path.GetDirectoryName(this.Game.LocalLowPath);
|
||||||
if (parent != null && Directory.Exists(parent))
|
if (parent != null && Directory.Exists(parent))
|
||||||
{
|
{
|
||||||
UnitySaveManagerService.OpenFolderInExplorer(parent);
|
UnitySaveManagerService.OpenFolderInExplorer(parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UnitySaveManagerService.OpenFolderInExplorer(Game.LocalLowPath);
|
UnitySaveManagerService.OpenFolderInExplorer(this.Game.LocalLowPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOpenGameFolder_Click(object sender, RoutedEventArgs e)
|
private void btnOpenGameFolder_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
UnitySaveManagerService.OpenFolderInExplorer(Game.RootDirectory);
|
UnitySaveManagerService.OpenFolderInExplorer(this.Game.RootDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOpenRegedit_Click(object sender, RoutedEventArgs e)
|
private void btnOpenRegedit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_saveService.OpenRegistryEditor(Game.RegistryPath);
|
this._saveService.OpenRegistryEditor(this.Game.RegistryPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
@@ -7,8 +7,8 @@ using System.Text;
|
|||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using GameLauncher.Models;
|
|
||||||
using GameLauncher.Engines.Unity;
|
using GameLauncher.Engines.Unity;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
namespace GameLauncher.Services.Codecs
|
namespace GameLauncher.Services.Codecs
|
||||||
{
|
{
|
||||||
@@ -17,10 +17,19 @@ namespace GameLauncher.Services.Codecs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EasySave3Codec : ISaveDataCodec
|
public class EasySave3Codec : ISaveDataCodec
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// コーデックの表示名を取得します。
|
||||||
|
/// </summary>
|
||||||
public string CodecName => "Easy Save 3 (ES3) コーデック";
|
public string CodecName => "Easy Save 3 (ES3) コーデック";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パスワード入力が必要かどうかを取得します。
|
||||||
|
/// </summary>
|
||||||
public bool RequiresPassword => false;
|
public bool RequiresPassword => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パスワード入力ダイアログに表示する案内メッセージを取得します。
|
||||||
|
/// </summary>
|
||||||
public string? PasswordPromptMessage => "暗号化パスワードが設定されている場合は入力してください(未設定・既定の場合は空欄):";
|
public string? PasswordPromptMessage => "暗号化パスワードが設定されている場合は入力してください(未設定・既定の場合は空欄):";
|
||||||
|
|
||||||
// キャッシュ用の最新平文JSONノード
|
// キャッシュ用の最新平文JSONノード
|
||||||
@@ -28,6 +37,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
private bool _wasEncrypted;
|
private bool _wasEncrypted;
|
||||||
private string? _usedPassword;
|
private string? _usedPassword;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたセーブファイルが本コーデックで処理可能かを判定します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="game">対象のUnityゲーム情報</param>
|
||||||
|
/// <param name="file">対象のセーブファイル情報</param>
|
||||||
|
/// <returns>処理可能な場合は true、それ以外は false</returns>
|
||||||
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
||||||
{
|
{
|
||||||
var ext = Path.GetExtension(file.FilePath).ToLowerInvariant();
|
var ext = Path.GetExtension(file.FilePath).ToLowerInvariant();
|
||||||
@@ -43,6 +58,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブファイルからプロパティ一覧を読み込みます。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>展開されたセーブデータプロパティのリスト</returns>
|
||||||
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
||||||
{
|
{
|
||||||
var list = new List<SaveDataPropertyEntry>();
|
var list = new List<SaveDataPropertyEntry>();
|
||||||
@@ -52,8 +73,8 @@ namespace GameLauncher.Services.Codecs
|
|||||||
if (fileBytes.Length == 0) return list;
|
if (fileBytes.Length == 0) return list;
|
||||||
|
|
||||||
string? jsonText = null;
|
string? jsonText = null;
|
||||||
_wasEncrypted = false;
|
this._wasEncrypted = false;
|
||||||
_usedPassword = null;
|
this._usedPassword = null;
|
||||||
|
|
||||||
// 1. まず平文 JSON または Gzip 解凍を試みる
|
// 1. まず平文 JSON または Gzip 解凍を試みる
|
||||||
try
|
try
|
||||||
@@ -91,12 +112,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
|
|
||||||
foreach (var pwd in candidatePasswords)
|
foreach (var pwd in candidatePasswords)
|
||||||
{
|
{
|
||||||
var decrypted = TryDecryptAes(fileBytes, pwd);
|
var decrypted = this.TryDecryptAes(fileBytes, pwd);
|
||||||
if (!string.IsNullOrEmpty(decrypted))
|
if (!string.IsNullOrEmpty(decrypted))
|
||||||
{
|
{
|
||||||
jsonText = decrypted;
|
jsonText = decrypted;
|
||||||
_wasEncrypted = true;
|
this._wasEncrypted = true;
|
||||||
_usedPassword = pwd;
|
this._usedPassword = pwd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,30 +126,36 @@ namespace GameLauncher.Services.Codecs
|
|||||||
if (string.IsNullOrEmpty(jsonText))
|
if (string.IsNullOrEmpty(jsonText))
|
||||||
{
|
{
|
||||||
// JSON展開ができなかった場合、バイナリキー・バリュー形式として先頭・重要オフセットを抽出
|
// JSON展開ができなかった場合、バイナリキー・バリュー形式として先頭・重要オフセットを抽出
|
||||||
return ExtractBinaryPropertiesFallback(fileBytes);
|
return this.ExtractBinaryPropertiesFallback(fileBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON からプロパティを再帰的に展開
|
// JSON からプロパティを再帰的に展開
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_cachedRootNode = JsonNode.Parse(jsonText);
|
this._cachedRootNode = JsonNode.Parse(jsonText);
|
||||||
if (_cachedRootNode is JsonObject rootObj)
|
if (this._cachedRootNode is JsonObject rootObj)
|
||||||
{
|
{
|
||||||
FlattenJsonObject(rootObj, "", list);
|
this.FlattenJsonObject(rootObj, "", list);
|
||||||
}
|
}
|
||||||
else if (_cachedRootNode is JsonArray rootArr)
|
else if (this._cachedRootNode is JsonArray rootArr)
|
||||||
{
|
{
|
||||||
FlattenJsonArray(rootArr, "Array", list);
|
this.FlattenJsonArray(rootArr, "Array", list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return ExtractBinaryPropertiesFallback(fileBytes);
|
return this.ExtractBinaryPropertiesFallback(fileBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSONオブジェクトを再帰的に走査し、プロパティ一覧に追加します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">対象のJSONオブジェクト</param>
|
||||||
|
/// <param name="prefix">現在のキー階層プレフィックス</param>
|
||||||
|
/// <param name="list">追加先のプロパティリスト</param>
|
||||||
private void FlattenJsonObject(JsonObject obj, string prefix, List<SaveDataPropertyEntry> list)
|
private void FlattenJsonObject(JsonObject obj, string prefix, List<SaveDataPropertyEntry> list)
|
||||||
{
|
{
|
||||||
foreach (var kvp in obj)
|
foreach (var kvp in obj)
|
||||||
@@ -181,14 +208,14 @@ namespace GameLauncher.Services.Codecs
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlattenJsonObject(childObj, key, list);
|
this.FlattenJsonObject(childObj, key, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node is JsonArray childArr)
|
else if (node is JsonArray childArr)
|
||||||
{
|
{
|
||||||
if (childArr.Count <= 20)
|
if (childArr.Count <= 20)
|
||||||
{
|
{
|
||||||
FlattenJsonArray(childArr, key, list);
|
this.FlattenJsonArray(childArr, key, list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -206,6 +233,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSON配列を再帰的に走査し、プロパティ一覧に追加します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="arr">対象のJSON配列</param>
|
||||||
|
/// <param name="prefix">現在のキー階層プレフィックス</param>
|
||||||
|
/// <param name="list">追加先のプロパティリスト</param>
|
||||||
private void FlattenJsonArray(JsonArray arr, string prefix, List<SaveDataPropertyEntry> list)
|
private void FlattenJsonArray(JsonArray arr, string prefix, List<SaveDataPropertyEntry> list)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < arr.Count; i++)
|
for (int i = 0; i < arr.Count; i++)
|
||||||
@@ -225,22 +258,29 @@ namespace GameLauncher.Services.Codecs
|
|||||||
}
|
}
|
||||||
else if (node is JsonObject childObj)
|
else if (node is JsonObject childObj)
|
||||||
{
|
{
|
||||||
FlattenJsonObject(childObj, key, list);
|
this.FlattenJsonObject(childObj, key, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSON展開に失敗した場合のフォールバックとしてバイナリ値を抽出します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">ファイル全体のバイナリデータ</param>
|
||||||
|
/// <returns>バイナリ情報プロパティのリスト</returns>
|
||||||
private List<SaveDataPropertyEntry> ExtractBinaryPropertiesFallback(byte[] bytes)
|
private List<SaveDataPropertyEntry> ExtractBinaryPropertiesFallback(byte[] bytes)
|
||||||
{
|
{
|
||||||
var list = new List<SaveDataPropertyEntry>();
|
var list = new List<SaveDataPropertyEntry>
|
||||||
list.Add(new SaveDataPropertyEntry
|
{
|
||||||
|
new SaveDataPropertyEntry
|
||||||
{
|
{
|
||||||
Key = "FileSize",
|
Key = "FileSize",
|
||||||
Category = "ファイル情報",
|
Category = "ファイル情報",
|
||||||
Type = "Int",
|
Type = "Int",
|
||||||
EditValue = bytes.Length.ToString(),
|
EditValue = bytes.Length.ToString(),
|
||||||
Description = "ファイルサイズ (bytes)"
|
Description = "ファイルサイズ (bytes)"
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化
|
// 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化
|
||||||
int limit = Math.Min(bytes.Length - 4, 128);
|
int limit = Math.Min(bytes.Length - 4, 128);
|
||||||
@@ -261,18 +301,25 @@ namespace GameLauncher.Services.Codecs
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 編集後のプロパティ一覧をセーブファイルへ書き戻して保存します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">保存先セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="properties">編集されたプロパティ一覧</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>保存に成功した場合は true、それ以外は false</returns>
|
||||||
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_cachedRootNode != null)
|
if (this._cachedRootNode != null)
|
||||||
{
|
{
|
||||||
// JSON の値を更新
|
// JSON の値を更新
|
||||||
foreach (var prop in properties)
|
foreach (var prop in properties)
|
||||||
{
|
{
|
||||||
if (prop.RawData is string keyPath)
|
if (prop.RawData is string keyPath)
|
||||||
{
|
{
|
||||||
UpdateJsonNodeByPath(_cachedRootNode, keyPath, prop.EditValue, prop.Type);
|
this.UpdateJsonNodeByPath(this._cachedRootNode, keyPath, prop.EditValue, prop.Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,15 +328,15 @@ namespace GameLauncher.Services.Codecs
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
};
|
};
|
||||||
string updatedJson = _cachedRootNode.ToJsonString(options);
|
string updatedJson = this._cachedRootNode.ToJsonString(options);
|
||||||
|
|
||||||
byte[] outputBytes = Encoding.UTF8.GetBytes(updatedJson);
|
byte[] outputBytes = Encoding.UTF8.GetBytes(updatedJson);
|
||||||
|
|
||||||
// もともと暗号化されていた場合は再暗号化
|
// もともと暗号化されていた場合は再暗号化
|
||||||
if (_wasEncrypted)
|
if (this._wasEncrypted)
|
||||||
{
|
{
|
||||||
string pwd = !string.IsNullOrEmpty(optionalPassword) ? optionalPassword : (_usedPassword ?? "Moodkie");
|
string pwd = !string.IsNullOrEmpty(optionalPassword) ? optionalPassword : (this._usedPassword ?? "Moodkie");
|
||||||
outputBytes = EncryptAes(outputBytes, pwd);
|
outputBytes = this.EncryptAes(outputBytes, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// バックアップ作成
|
// バックアップ作成
|
||||||
@@ -331,12 +378,19 @@ namespace GameLauncher.Services.Codecs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// キーパスに基づいてJSONノードの値を更新します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="root">ルートのJSONノード</param>
|
||||||
|
/// <param name="path">ドット区切りのキーパス</param>
|
||||||
|
/// <param name="newValue">更新後の値文字列</param>
|
||||||
|
/// <param name="type">値の型名</param>
|
||||||
private void UpdateJsonNodeByPath(JsonNode root, string path, string newValue, string type)
|
private void UpdateJsonNodeByPath(JsonNode root, string path, string newValue, string type)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// ドットと角括弧でパスを分割
|
// ドットと角括弧でパスを分割
|
||||||
var parts = path.Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = path.Split(['.', '[', ']'], StringSplitOptions.RemoveEmptyEntries);
|
||||||
JsonNode? current = root;
|
JsonNode? current = root;
|
||||||
|
|
||||||
for (int i = 0; i < parts.Length - 1; i++)
|
for (int i = 0; i < parts.Length - 1; i++)
|
||||||
@@ -358,16 +412,22 @@ namespace GameLauncher.Services.Codecs
|
|||||||
string lastKey = parts[^1];
|
string lastKey = parts[^1];
|
||||||
if (current is JsonObject finalObj)
|
if (current is JsonObject finalObj)
|
||||||
{
|
{
|
||||||
finalObj[lastKey] = ParseJsonValue(newValue, type);
|
finalObj[lastKey] = this.ParseJsonValue(newValue, type);
|
||||||
}
|
}
|
||||||
else if (current is JsonArray finalArr && int.TryParse(lastKey, out int finalIdx) && finalIdx < finalArr.Count)
|
else if (current is JsonArray finalArr && int.TryParse(lastKey, out int finalIdx) && finalIdx < finalArr.Count)
|
||||||
{
|
{
|
||||||
finalArr[finalIdx] = ParseJsonValue(newValue, type);
|
finalArr[finalIdx] = this.ParseJsonValue(newValue, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文字列値と型名から対応するJSONノードを生成します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">値文字列</param>
|
||||||
|
/// <param name="type">型名</param>
|
||||||
|
/// <returns>生成されたJSONノード</returns>
|
||||||
private JsonNode? ParseJsonValue(string value, string type)
|
private JsonNode? ParseJsonValue(string value, string type)
|
||||||
{
|
{
|
||||||
if (type == "Int" && int.TryParse(value, out int i)) return JsonValue.Create(i);
|
if (type == "Int" && int.TryParse(value, out int i)) return JsonValue.Create(i);
|
||||||
@@ -389,6 +449,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
return JsonValue.Create(value);
|
return JsonValue.Create(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AESアルゴリズムによるセーブデータの復号を試みます。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">暗号化バイナリデータ</param>
|
||||||
|
/// <param name="password">復号パスワード</param>
|
||||||
|
/// <returns>復号された平文文字列。失敗時は null</returns>
|
||||||
private string? TryDecryptAes(byte[] data, string password)
|
private string? TryDecryptAes(byte[] data, string password)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -424,6 +490,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 平文バイト配列をAESアルゴリズムで暗号化します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plainBytes">平文バイナリデータ</param>
|
||||||
|
/// <param name="password">暗号化パスワード</param>
|
||||||
|
/// <returns>暗号化されたバイナリデータ</returns>
|
||||||
private byte[] EncryptAes(byte[] plainBytes, string password)
|
private byte[] EncryptAes(byte[] plainBytes, string password)
|
||||||
{
|
{
|
||||||
byte[] rawUtf8 = Encoding.UTF8.GetBytes(password);
|
byte[] rawUtf8 = Encoding.UTF8.GetBytes(password);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GameLauncher.Models;
|
|
||||||
using GameLauncher.Engines.Unity;
|
using GameLauncher.Engines.Unity;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
namespace GameLauncher.Services.Codecs
|
namespace GameLauncher.Services.Codecs
|
||||||
{
|
{
|
||||||
@@ -9,22 +9,44 @@ namespace GameLauncher.Services.Codecs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISaveDataCodec
|
public interface ISaveDataCodec
|
||||||
{
|
{
|
||||||
/// <summary>コーデックの識別名称(例: "Easy Save 3 (ES3)", "YU-RIS セーブデータ")</summary>
|
/// <summary>
|
||||||
|
/// コーデックの識別名称(例: "Easy Save 3 (ES3)", "YU-RIS セーブデータ")を取得します。
|
||||||
|
/// </summary>
|
||||||
string CodecName { get; }
|
string CodecName { get; }
|
||||||
|
|
||||||
/// <summary>このコーデックで指定ファイルを処理可能か判定</summary>
|
/// <summary>
|
||||||
|
/// このコーデックで指定ファイルを処理可能か判定します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="game">対象のUnityゲーム情報</param>
|
||||||
|
/// <param name="file">対象のセーブファイル情報</param>
|
||||||
|
/// <returns>処理可能な場合は true、それ以外は false</returns>
|
||||||
bool CanHandle(UnityGameItem game, SaveFileEntry file);
|
bool CanHandle(UnityGameItem game, SaveFileEntry file);
|
||||||
|
|
||||||
/// <summary>セーブファイルからGUI編集用プロパティ一覧をロード・解析</summary>
|
/// <summary>
|
||||||
|
/// セーブファイルからGUI編集用プロパティ一覧をロード・解析します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>展開されたセーブデータプロパティのリスト</returns>
|
||||||
List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null);
|
List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null);
|
||||||
|
|
||||||
/// <summary>GUI編集されたプロパティ一覧をファイルへ再エンコード・保存</summary>
|
/// <summary>
|
||||||
|
/// GUI編集されたプロパティ一覧をファイルへ再エンコード・保存します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">保存先セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="properties">編集されたプロパティ一覧</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>保存に成功した場合は true、それ以外は false</returns>
|
||||||
bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null);
|
bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null);
|
||||||
|
|
||||||
/// <summary>復号にパスワードやキーが必要かどうか</summary>
|
/// <summary>
|
||||||
|
/// 復号にパスワードやキーが必要かどうかを取得します。
|
||||||
|
/// </summary>
|
||||||
bool RequiresPassword { get; }
|
bool RequiresPassword { get; }
|
||||||
|
|
||||||
/// <summary>パスワード入力時の案内メッセージ</summary>
|
/// <summary>
|
||||||
|
/// パスワード入力時の案内メッセージを取得します。
|
||||||
|
/// </summary>
|
||||||
string? PasswordPromptMessage { get; }
|
string? PasswordPromptMessage { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GameLauncher.Models;
|
|
||||||
using GameLauncher.Engines.Unity;
|
using GameLauncher.Engines.Unity;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
namespace GameLauncher.Services.Codecs
|
namespace GameLauncher.Services.Codecs
|
||||||
{
|
{
|
||||||
@@ -12,12 +12,27 @@ namespace GameLauncher.Services.Codecs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class YurisSaveCodec : ISaveDataCodec
|
public class YurisSaveCodec : ISaveDataCodec
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// コーデックの表示名を取得します。
|
||||||
|
/// </summary>
|
||||||
public string CodecName => "YU-RIS セーブデータ (YSSD) コーデック";
|
public string CodecName => "YU-RIS セーブデータ (YSSD) コーデック";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パスワード入力が必要かどうかを取得します。
|
||||||
|
/// </summary>
|
||||||
public bool RequiresPassword => false;
|
public bool RequiresPassword => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パスワード入力ダイアログに表示する案内メッセージを取得します。
|
||||||
|
/// </summary>
|
||||||
public string? PasswordPromptMessage => null;
|
public string? PasswordPromptMessage => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたセーブファイルが本コーデックで処理可能かを判定します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="game">対象のUnityゲーム情報</param>
|
||||||
|
/// <param name="file">対象のセーブファイル情報</param>
|
||||||
|
/// <returns>処理可能な場合は true、それ以外は false</returns>
|
||||||
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
||||||
{
|
{
|
||||||
if (!File.Exists(file.FilePath)) return false;
|
if (!File.Exists(file.FilePath)) return false;
|
||||||
@@ -39,6 +54,12 @@ namespace GameLauncher.Services.Codecs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブファイルからプロパティ一覧を読み込みます。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>展開されたセーブデータプロパティのリスト</returns>
|
||||||
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
||||||
{
|
{
|
||||||
var list = new List<SaveDataPropertyEntry>();
|
var list = new List<SaveDataPropertyEntry>();
|
||||||
@@ -101,6 +122,13 @@ namespace GameLauncher.Services.Codecs
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 編集後のプロパティ一覧をセーブファイルへ書き戻して保存します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">保存先セーブファイルの絶対パス</param>
|
||||||
|
/// <param name="properties">編集されたプロパティ一覧</param>
|
||||||
|
/// <param name="optionalPassword">任意の暗号化パスワード</param>
|
||||||
|
/// <returns>保存に成功した場合は true、それ以外は false</returns>
|
||||||
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -0,0 +1,312 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 高速検索ソフト「Everything」のIPC (WM_COPYDATA) APIを利用して、
|
||||||
|
/// 指定フォルダ配下の全ファイルおよびサブディレクトリを0.1秒未満で一括取得するサービス
|
||||||
|
/// </summary>
|
||||||
|
public class EverythingSearchService
|
||||||
|
{
|
||||||
|
#region □定数(Private)
|
||||||
|
private const int WM_COPYDATA = 0x004A;
|
||||||
|
private const int EVERYTHING_IPC_COPYDATA_QUERYW = 2;
|
||||||
|
private const uint EVERYTHING_IPC_ALLRESULTS = 0xFFFFFFFF;
|
||||||
|
private const uint EVERYTHING_IPC_FOLDER = 0x00000002;
|
||||||
|
private const uint EVERYTHING_IPC_DRIVE = 0x00000004;
|
||||||
|
private const uint PM_REMOVE = 0x0001;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □構造体(Private)
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct COPYDATASTRUCT
|
||||||
|
{
|
||||||
|
public IntPtr dwData;
|
||||||
|
public int cbData;
|
||||||
|
public IntPtr lpData;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
private struct EVERYTHING_IPC_QUERYW_HEADER
|
||||||
|
{
|
||||||
|
public uint max_results;
|
||||||
|
public uint offset;
|
||||||
|
public uint reply_copydata_message;
|
||||||
|
public uint search_flags;
|
||||||
|
public IntPtr reply_hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct MSG
|
||||||
|
{
|
||||||
|
public IntPtr hwnd;
|
||||||
|
public uint message;
|
||||||
|
public IntPtr wParam;
|
||||||
|
public IntPtr lParam;
|
||||||
|
public uint time;
|
||||||
|
public int pt_x;
|
||||||
|
public int pt_y;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Public)
|
||||||
|
/// <summary>
|
||||||
|
/// Everything が現在システム上で実行中であるか判定します。
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsEverythingRunning()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var procs = Process.GetProcessesByName("Everything");
|
||||||
|
if (procs != null && procs.Length > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var hwnd = FindWindowW("EVERYTHING_TASKBAR_NOTIFICATION", null);
|
||||||
|
if (hwnd != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたパス群(例: C:\..., Z:\...)に対して、Everything IPCを用いて高速スナップショットを生成します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetDirectories">走査対象のディレクトリルート一覧</param>
|
||||||
|
/// <param name="timeoutMs">タイムアウト(ミリ秒)</param>
|
||||||
|
/// <returns>生成されたスナップショット。Everything未稼働または失敗時は null</returns>
|
||||||
|
public static FastDirectorySnapshot? TryScanTargetsFast(IEnumerable<string> targetDirectories, int timeoutMs = 3000)
|
||||||
|
{
|
||||||
|
var everythingHwnd = FindWindowW("EVERYTHING_TASKBAR_NOTIFICATION", null);
|
||||||
|
if (everythingHwnd == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var snapshot = new FastDirectorySnapshot();
|
||||||
|
bool anySuccess = false;
|
||||||
|
|
||||||
|
foreach (var targetDir in targetDirectories)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(targetDir)) continue;
|
||||||
|
string cleanDir = Path.GetFullPath(targetDir).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool ok = QueryDirectory(everythingHwnd, cleanDir, snapshot, timeoutMs);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
anySuccess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 個別パスのクエリ失敗時はスキップ
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return anySuccess ? snapshot : null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Private)
|
||||||
|
/// <summary>
|
||||||
|
/// Everything IPC を用いて1つのディレクトリ配下のファイル・フォルダ一覧を取得し、スナップショットに格納します。
|
||||||
|
/// </summary>
|
||||||
|
private static bool QueryDirectory(IntPtr everythingHwnd, string targetDirectory, FastDirectorySnapshot snapshot, int timeoutMs)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
var resetEvent = new ManualResetEvent(false);
|
||||||
|
|
||||||
|
// STAスレッド上でメッセージ受信用 HwndSource を作成
|
||||||
|
var thread = new Thread(() =>
|
||||||
|
{
|
||||||
|
HwndSource? source = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var parameters = new HwndSourceParameters("GameLauncher_Everything_Receiver")
|
||||||
|
{
|
||||||
|
Width = 0,
|
||||||
|
Height = 0,
|
||||||
|
PositionX = -100,
|
||||||
|
PositionY = -100,
|
||||||
|
WindowStyle = 0x800000 // WS_BORDER (非表示)
|
||||||
|
};
|
||||||
|
source = new HwndSource(parameters);
|
||||||
|
source.AddHook((IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
|
||||||
|
{
|
||||||
|
if (msg == WM_COPYDATA)
|
||||||
|
{
|
||||||
|
var cds = Marshal.PtrToStructure<COPYDATASTRUCT>(lParam);
|
||||||
|
if (cds.lpData != IntPtr.Zero && cds.cbData > 12)
|
||||||
|
{
|
||||||
|
ParseEverythingIpcList(cds.lpData, targetDirectory, snapshot);
|
||||||
|
success = true;
|
||||||
|
handled = true;
|
||||||
|
resetEvent.Set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return IntPtr.Zero;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Everything への検索文字列構築(指定パス配下の全エントリ)
|
||||||
|
string searchQuery = $"path:\"{targetDirectory}\"";
|
||||||
|
|
||||||
|
byte[] queryBytes = BuildQueryPayload(source.Handle, searchQuery);
|
||||||
|
GCHandle pinnedQuery = GCHandle.Alloc(queryBytes, GCHandleType.Pinned);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cdsSend = new COPYDATASTRUCT
|
||||||
|
{
|
||||||
|
dwData = (IntPtr)EVERYTHING_IPC_COPYDATA_QUERYW,
|
||||||
|
cbData = queryBytes.Length,
|
||||||
|
lpData = pinnedQuery.AddrOfPinnedObject()
|
||||||
|
};
|
||||||
|
|
||||||
|
SendMessage(everythingHwnd, WM_COPYDATA, source.Handle, ref cdsSend);
|
||||||
|
|
||||||
|
// メッセージループを回して結果を待つ
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
while (sw.ElapsedMilliseconds < timeoutMs && !success)
|
||||||
|
{
|
||||||
|
while (PeekMessage(out var msg, IntPtr.Zero, 0, 0, PM_REMOVE))
|
||||||
|
{
|
||||||
|
TranslateMessage(ref msg);
|
||||||
|
DispatchMessage(ref msg);
|
||||||
|
}
|
||||||
|
Thread.Sleep(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (pinnedQuery.IsAllocated) pinnedQuery.Free();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// クエリ処理中の例外
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
source?.Dispose();
|
||||||
|
resetEvent.Set();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
thread.SetApartmentState(ApartmentState.STA);
|
||||||
|
thread.IsBackground = true;
|
||||||
|
thread.Start();
|
||||||
|
|
||||||
|
resetEvent.WaitOne(timeoutMs);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Everything IPC 送信用クエリバイナリペイロードを構築します。
|
||||||
|
/// </summary>
|
||||||
|
private static byte[] BuildQueryPayload(IntPtr replyHwnd, string searchQuery)
|
||||||
|
{
|
||||||
|
var header = new EVERYTHING_IPC_QUERYW_HEADER
|
||||||
|
{
|
||||||
|
max_results = EVERYTHING_IPC_ALLRESULTS,
|
||||||
|
offset = 0,
|
||||||
|
reply_copydata_message = 0,
|
||||||
|
search_flags = 0,
|
||||||
|
reply_hwnd = replyHwnd
|
||||||
|
};
|
||||||
|
|
||||||
|
int headerSize = Marshal.SizeOf(typeof(EVERYTHING_IPC_QUERYW_HEADER));
|
||||||
|
byte[] queryStrBytes = Encoding.Unicode.GetBytes(searchQuery + "\0");
|
||||||
|
|
||||||
|
byte[] payload = new byte[headerSize + queryStrBytes.Length];
|
||||||
|
|
||||||
|
IntPtr headerPtr = Marshal.AllocHGlobal(headerSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Marshal.StructureToPtr(header, headerPtr, false);
|
||||||
|
Marshal.Copy(headerPtr, payload, 0, headerSize);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(headerPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer.BlockCopy(queryStrBytes, 0, payload, headerSize, queryStrBytes.Length);
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Everything から返信された EVERYTHING_IPC_LISTW バイナリをパースし、スナップショットに登録します。
|
||||||
|
/// </summary>
|
||||||
|
private static void ParseEverythingIpcList(IntPtr pList, string targetDirectory, FastDirectorySnapshot snapshot)
|
||||||
|
{
|
||||||
|
int totitems = Marshal.ReadInt32(pList, 0);
|
||||||
|
int numitems = Marshal.ReadInt32(pList, 4);
|
||||||
|
int offset = Marshal.ReadInt32(pList, 8);
|
||||||
|
|
||||||
|
if (numitems <= 0) return;
|
||||||
|
|
||||||
|
int itemHeaderBase = 12; // sizeof(DWORD) * 3
|
||||||
|
int itemSize = 12; // sizeof(DWORD) * 3 (flags, filename_offset, path_offset)
|
||||||
|
|
||||||
|
for (int i = 0; i < numitems; i++)
|
||||||
|
{
|
||||||
|
int itemOffset = itemHeaderBase + (i * itemSize);
|
||||||
|
uint flags = (uint)Marshal.ReadInt32(pList, itemOffset);
|
||||||
|
int filenameOffset = Marshal.ReadInt32(pList, itemOffset + 4);
|
||||||
|
int pathOffset = Marshal.ReadInt32(pList, itemOffset + 8);
|
||||||
|
|
||||||
|
string filename = Marshal.PtrToStringUni(IntPtr.Add(pList, filenameOffset)) ?? string.Empty;
|
||||||
|
string dirPath = Marshal.PtrToStringUni(IntPtr.Add(pList, pathOffset)) ?? string.Empty;
|
||||||
|
|
||||||
|
bool isFolder = (flags & EVERYTHING_IPC_FOLDER) != 0 || (flags & EVERYTHING_IPC_DRIVE) != 0;
|
||||||
|
|
||||||
|
if (isFolder)
|
||||||
|
{
|
||||||
|
string fullSubDir = Path.Combine(dirPath, filename);
|
||||||
|
snapshot.AddDirectory(dirPath, fullSubDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snapshot.AddFile(dirPath, filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □P/Invoke(Private)
|
||||||
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||||
|
private static extern IntPtr FindWindowW(string lpClassName, string? lpWindowName);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, ref COPYDATASTRUCT lParam);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static extern bool PeekMessage(out MSG lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool TranslateMessage([In] ref MSG lpMsg);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr DispatchMessage([In] ref MSG lpmsg);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// メモリ上に展開されたディレクトリおよびファイル構成の高速インメモリスナップショット
|
||||||
|
/// </summary>
|
||||||
|
public class FastDirectorySnapshot
|
||||||
|
{
|
||||||
|
#region □プロパティ(Public)
|
||||||
|
/// <summary>
|
||||||
|
/// ディレクトリパス -> 直下のファイル名(ファイル名のみ)のハッシュセット
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, HashSet<string>> FilesByDir { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ディレクトリパス -> 直下のサブディレクトリのフルパスリスト
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, List<string>> SubDirsByDir { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 登録されている総ディレクトリ数
|
||||||
|
/// </summary>
|
||||||
|
public int TotalDirectoryCount => this.SubDirsByDir.Count;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 登録されている総ファイル数
|
||||||
|
/// </summary>
|
||||||
|
public int TotalFileCount => this.FilesByDir.Values.Sum(set => set.Count);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Public)
|
||||||
|
/// <summary>
|
||||||
|
/// ファイルをスナップショットに登録します。
|
||||||
|
/// </summary>
|
||||||
|
public void AddFile(string dirPath, string fileName)
|
||||||
|
{
|
||||||
|
var normalizedDir = NormalizePath(dirPath);
|
||||||
|
if (!this.FilesByDir.TryGetValue(normalizedDir, out var files))
|
||||||
|
{
|
||||||
|
files = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
this.FilesByDir[normalizedDir] = files;
|
||||||
|
}
|
||||||
|
files.Add(fileName);
|
||||||
|
|
||||||
|
if (!this.SubDirsByDir.ContainsKey(normalizedDir))
|
||||||
|
{
|
||||||
|
this.SubDirsByDir[normalizedDir] = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// サブディレクトリを親ディレクトリのスナップショットに登録します。
|
||||||
|
/// </summary>
|
||||||
|
public void AddDirectory(string parentDirPath, string childDirPath)
|
||||||
|
{
|
||||||
|
var normalizedParent = NormalizePath(parentDirPath);
|
||||||
|
var normalizedChild = NormalizePath(childDirPath);
|
||||||
|
|
||||||
|
if (!this.SubDirsByDir.TryGetValue(normalizedParent, out var children))
|
||||||
|
{
|
||||||
|
children = new List<string>();
|
||||||
|
this.SubDirsByDir[normalizedParent] = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!children.Contains(normalizedChild, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
children.Add(normalizedChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.SubDirsByDir.ContainsKey(normalizedChild))
|
||||||
|
{
|
||||||
|
this.SubDirsByDir[normalizedChild] = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたディレクトリが存在するかどうかをインメモリで判定します。
|
||||||
|
/// </summary>
|
||||||
|
public bool DirectoryExists(string dirPath)
|
||||||
|
{
|
||||||
|
var normalized = NormalizePath(dirPath);
|
||||||
|
return this.SubDirsByDir.ContainsKey(normalized) || this.FilesByDir.ContainsKey(normalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたファイルが存在するかどうかをインメモリで判定します。
|
||||||
|
/// </summary>
|
||||||
|
public bool FileExists(string filePath)
|
||||||
|
{
|
||||||
|
var dir = NormalizePath(Path.GetDirectoryName(filePath) ?? string.Empty);
|
||||||
|
var name = Path.GetFileName(filePath);
|
||||||
|
if (this.FilesByDir.TryGetValue(dir, out var files))
|
||||||
|
{
|
||||||
|
return files.Contains(name);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたディレクトリ直下のサブディレクトリ一覧を取得します。
|
||||||
|
/// </summary>
|
||||||
|
public string[] GetDirectories(string dirPath)
|
||||||
|
{
|
||||||
|
var normalized = NormalizePath(dirPath);
|
||||||
|
if (this.SubDirsByDir.TryGetValue(normalized, out var subDirs))
|
||||||
|
{
|
||||||
|
return subDirs.ToArray();
|
||||||
|
}
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたディレクトリ直下のファイルフルパス一覧を取得します。
|
||||||
|
/// </summary>
|
||||||
|
public string[] GetFiles(string dirPath, string searchPattern = "*")
|
||||||
|
{
|
||||||
|
var normalized = NormalizePath(dirPath);
|
||||||
|
if (!this.FilesByDir.TryGetValue(normalized, out var files))
|
||||||
|
{
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(searchPattern) || searchPattern == "*")
|
||||||
|
{
|
||||||
|
return files.Select(f => Path.Combine(normalized, f)).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchPattern.StartsWith("*.") && searchPattern.IndexOf('*', 1) < 0 && searchPattern.IndexOf('?', 1) < 0)
|
||||||
|
{
|
||||||
|
string ext = searchPattern.Substring(1);
|
||||||
|
return files
|
||||||
|
.Where(f => f.EndsWith(ext, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.Select(f => Path.Combine(normalized, f))
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
var regex = WildcardToRegex(searchPattern);
|
||||||
|
return files
|
||||||
|
.Where(f => regex.IsMatch(f))
|
||||||
|
.Select(f => Path.Combine(normalized, f))
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 別のスナップショットの内容を現在のスナップショットにマージします。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">マージ元のスナップショット</param>
|
||||||
|
public void MergeFrom(FastDirectorySnapshot other)
|
||||||
|
{
|
||||||
|
if (other == null) return;
|
||||||
|
|
||||||
|
foreach (var kvp in other.FilesByDir)
|
||||||
|
{
|
||||||
|
if (!this.FilesByDir.TryGetValue(kvp.Key, out var files))
|
||||||
|
{
|
||||||
|
files = new HashSet<string>(kvp.Value, StringComparer.OrdinalIgnoreCase);
|
||||||
|
this.FilesByDir[kvp.Key] = files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
files.UnionWith(kvp.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var kvp in other.SubDirsByDir)
|
||||||
|
{
|
||||||
|
if (!this.SubDirsByDir.TryGetValue(kvp.Key, out var subDirs))
|
||||||
|
{
|
||||||
|
subDirs = new List<string>(kvp.Value);
|
||||||
|
this.SubDirsByDir[kvp.Key] = subDirs;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var dir in kvp.Value)
|
||||||
|
{
|
||||||
|
if (!subDirs.Contains(dir, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
subDirs.Add(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Private)
|
||||||
|
/// <summary>
|
||||||
|
/// パス末尾の区切り文字を除去し、正規化します。
|
||||||
|
/// </summary>
|
||||||
|
private static string NormalizePath(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(path)) return string.Empty;
|
||||||
|
return path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ワイルドカードパターンを正規表現に変換します。
|
||||||
|
/// </summary>
|
||||||
|
private static Regex WildcardToRegex(string pattern)
|
||||||
|
{
|
||||||
|
string escaped = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", ".");
|
||||||
|
return new Regex("^" + escaped + "$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
+889
-152
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,399 @@
|
|||||||
|
using System;
|
||||||
|
using System.Buffers.Binary;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Win32.SafeHandles;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NTFS の MFT (USN Journal: FSCTL_ENUM_USN_DATA) を直接読み取り、
|
||||||
|
/// ドライブ内のファイルおよびディレクトリツリーを爆速で一括抽出するサービス
|
||||||
|
/// </summary>
|
||||||
|
public class NtfsMftScanService
|
||||||
|
{
|
||||||
|
#region □定数(Private)
|
||||||
|
private const uint GENERIC_READ = 0x80000000;
|
||||||
|
private const uint FILE_SHARE_READ = 0x00000001;
|
||||||
|
private const uint FILE_SHARE_WRITE = 0x00000002;
|
||||||
|
private const uint OPEN_EXISTING = 3;
|
||||||
|
private const uint FSCTL_QUERY_USN_JOURNAL = 0x000900f4;
|
||||||
|
private const uint FSCTL_ENUM_USN_DATA = 0x000900b3;
|
||||||
|
private const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MFT読み込みバッファサイズ(2MB)。1回のDeviceIoControl呼び出しで最大効率を引き出します。
|
||||||
|
/// </summary>
|
||||||
|
private const int BufferSize = 2048 * 1024;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □構造体(Private)
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct USN_JOURNAL_DATA
|
||||||
|
{
|
||||||
|
public ulong UsnJournalID;
|
||||||
|
public long FirstUsn;
|
||||||
|
public long NextUsn;
|
||||||
|
public long LowestValidUsn;
|
||||||
|
public long MaxUsn;
|
||||||
|
public ulong MaximumSize;
|
||||||
|
public ulong AllocationDelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct MFT_ENUM_DATA_V0
|
||||||
|
{
|
||||||
|
public ulong StartFileReferenceNumber;
|
||||||
|
public long LowUsn;
|
||||||
|
public long HighUsn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MFTディレクトリ情報ノード
|
||||||
|
/// </summary>
|
||||||
|
private struct DirNode
|
||||||
|
{
|
||||||
|
public ulong Id;
|
||||||
|
public ulong ParentId;
|
||||||
|
public string Name;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Public)
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたパス群(例: C:\..., Z:\...)に対して、NTFS MFT 直接読み取りを用いて高速スナップショットを生成します。
|
||||||
|
/// 複数ドライブが存在する場合は、各ドライブを並列処理してディスクアクセス速度を極限まで高めます。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetDirectories">走査対象のディレクトリルート一覧</param>
|
||||||
|
/// <returns>生成されたスナップショット。失敗または非NTFS時は null</returns>
|
||||||
|
public static FastDirectorySnapshot? TryScanTargetsFast(IEnumerable<string> targetDirectories)
|
||||||
|
{
|
||||||
|
var targetsByDrive = new Dictionary<char, List<string>>();
|
||||||
|
|
||||||
|
foreach (var dir in targetDirectories)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(dir)) continue;
|
||||||
|
var full = Path.GetFullPath(dir).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
if (full.Length >= 2 && full[1] == ':')
|
||||||
|
{
|
||||||
|
char driveLetter = char.ToUpperInvariant(full[0]);
|
||||||
|
if (!targetsByDrive.TryGetValue(driveLetter, out var list))
|
||||||
|
{
|
||||||
|
list = new List<string>();
|
||||||
|
targetsByDrive[driveLetter] = list;
|
||||||
|
}
|
||||||
|
list.Add(full);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetsByDrive.Count == 0) return null;
|
||||||
|
|
||||||
|
var snapshots = new ConcurrentBag<FastDirectorySnapshot>();
|
||||||
|
|
||||||
|
// ドライブごとに並列処理を実行(物理/論理ドライブ間のI/OおよびCPUを限界まで同時並行化)
|
||||||
|
Parallel.ForEach(targetsByDrive, kvp =>
|
||||||
|
{
|
||||||
|
char driveLetter = kvp.Key;
|
||||||
|
var targetPaths = kvp.Value;
|
||||||
|
var driveSnapshot = new FastDirectorySnapshot();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool ok = ScanVolumeMft(driveLetter, targetPaths, driveSnapshot);
|
||||||
|
if (ok && (driveSnapshot.TotalDirectoryCount > 0 || driveSnapshot.TotalFileCount > 0))
|
||||||
|
{
|
||||||
|
snapshots.Add(driveSnapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ドライブスキャン失敗時はスキップ
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (snapshots.IsEmpty) return null;
|
||||||
|
|
||||||
|
var merged = new FastDirectorySnapshot();
|
||||||
|
foreach (var snap in snapshots)
|
||||||
|
{
|
||||||
|
merged.MergeFrom(snap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return merged;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □メソッド(Private)
|
||||||
|
/// <summary>
|
||||||
|
/// 1つのドライブボリュームのMFTを読み込み、指定されたターゲットパス配下のファイルをスナップショットに登録します。
|
||||||
|
/// </summary>
|
||||||
|
private static bool ScanVolumeMft(char driveLetter, List<string> targetPaths, FastDirectorySnapshot snapshot)
|
||||||
|
{
|
||||||
|
string volumePath = @"\\.\" + driveLetter + ":";
|
||||||
|
using var hVolume = CreateFile(
|
||||||
|
volumePath,
|
||||||
|
GENERIC_READ,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
IntPtr.Zero,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
0,
|
||||||
|
IntPtr.Zero);
|
||||||
|
|
||||||
|
if (hVolume.IsInvalid)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. USNジャーナル情報の取得
|
||||||
|
var journalData = new USN_JOURNAL_DATA();
|
||||||
|
int journalDataSize = Marshal.SizeOf(typeof(USN_JOURNAL_DATA));
|
||||||
|
if (!DeviceIoControl(hVolume, FSCTL_QUERY_USN_JOURNAL, IntPtr.Zero, 0, out journalData, journalDataSize, out _, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. MFT列挙用パラメータの準備
|
||||||
|
var enumData = new MFT_ENUM_DATA_V0
|
||||||
|
{
|
||||||
|
StartFileReferenceNumber = 0,
|
||||||
|
LowUsn = 0,
|
||||||
|
HighUsn = journalData.NextUsn
|
||||||
|
};
|
||||||
|
|
||||||
|
int enumDataSize = Marshal.SizeOf(typeof(MFT_ENUM_DATA_V0));
|
||||||
|
IntPtr enumDataPtr = Marshal.AllocHGlobal(enumDataSize);
|
||||||
|
Marshal.StructureToPtr(enumData, enumDataPtr, false);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[BufferSize];
|
||||||
|
GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||||
|
IntPtr bufferPtr = bufferHandle.AddrOfPinnedObject();
|
||||||
|
|
||||||
|
// 読み込んだ全MFTデータチャンクを保持(I/Oを最優先で一括連続完了させる)
|
||||||
|
var chunks = new List<(byte[] Buffer, int Length)>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (DeviceIoControl(hVolume, FSCTL_ENUM_USN_DATA, enumDataPtr, enumDataSize, bufferPtr, BufferSize, out uint bytesReturned, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
if (bytesReturned <= 8) break;
|
||||||
|
|
||||||
|
// 次の開始参照番号を取得
|
||||||
|
ulong nextId = (ulong)Marshal.ReadInt64(bufferPtr);
|
||||||
|
Marshal.WriteInt64(enumDataPtr, (long)nextId);
|
||||||
|
|
||||||
|
byte[] chunkCopy = new byte[bytesReturned];
|
||||||
|
Buffer.BlockCopy(buffer, 0, chunkCopy, 0, (int)bytesReturned);
|
||||||
|
chunks.Add((chunkCopy, (int)bytesReturned));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (bufferHandle.IsAllocated) bufferHandle.Free();
|
||||||
|
if (enumDataPtr != IntPtr.Zero) Marshal.FreeHGlobal(enumDataPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chunks.Count == 0) return false;
|
||||||
|
|
||||||
|
// 3. 【第1パス】ディレクトリのみを収集(ディレクトリは全体の数%に過ぎないため極めて高速)
|
||||||
|
var dirNodes = new Dictionary<ulong, DirNode>(65536);
|
||||||
|
var childrenByParent = new Dictionary<ulong, List<ulong>>(65536);
|
||||||
|
|
||||||
|
foreach (var chunk in chunks)
|
||||||
|
{
|
||||||
|
ReadOnlySpan<byte> span = chunk.Buffer.AsSpan(0, chunk.Length);
|
||||||
|
int offset = 8;
|
||||||
|
while (offset < chunk.Length)
|
||||||
|
{
|
||||||
|
if (offset + 60 > chunk.Length) break;
|
||||||
|
ReadOnlySpan<byte> record = span.Slice(offset);
|
||||||
|
int recordLength = BinaryPrimitives.ReadInt32LittleEndian(record);
|
||||||
|
if (recordLength <= 0 || offset + recordLength > chunk.Length) break;
|
||||||
|
|
||||||
|
uint fileAttributes = BinaryPrimitives.ReadUInt32LittleEndian(record.Slice(52));
|
||||||
|
if ((fileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
||||||
|
{
|
||||||
|
ulong fileRef = BinaryPrimitives.ReadUInt64LittleEndian(record.Slice(8)) & 0x0000FFFFFFFFFFFFUL;
|
||||||
|
ulong parentRef = BinaryPrimitives.ReadUInt64LittleEndian(record.Slice(16)) & 0x0000FFFFFFFFFFFFUL;
|
||||||
|
ushort fileNameLength = BinaryPrimitives.ReadUInt16LittleEndian(record.Slice(56));
|
||||||
|
ushort fileNameOffset = BinaryPrimitives.ReadUInt16LittleEndian(record.Slice(58));
|
||||||
|
|
||||||
|
if (fileNameLength > 0 && fileNameOffset + fileNameLength <= recordLength)
|
||||||
|
{
|
||||||
|
string dirName = Encoding.Unicode.GetString(record.Slice(fileNameOffset, fileNameLength));
|
||||||
|
dirNodes[fileRef] = new DirNode { Id = fileRef, ParentId = parentRef, Name = dirName };
|
||||||
|
|
||||||
|
if (!childrenByParent.TryGetValue(parentRef, out var childList))
|
||||||
|
{
|
||||||
|
childList = new List<ulong>();
|
||||||
|
childrenByParent[parentRef] = childList;
|
||||||
|
}
|
||||||
|
childList.Add(fileRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += recordLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. ターゲットパスのNodeId特定と、配下の子孫ディレクトリパスの確定
|
||||||
|
var targetDirIds = new HashSet<ulong>();
|
||||||
|
var dirIdToFullPath = new Dictionary<ulong, string>();
|
||||||
|
|
||||||
|
foreach (var targetPath in targetPaths)
|
||||||
|
{
|
||||||
|
ulong? targetNodeId = FindDirNodeIdByPath(driveLetter, targetPath, dirNodes, childrenByParent);
|
||||||
|
if (targetNodeId.HasValue)
|
||||||
|
{
|
||||||
|
CollectDescendantDirectories(targetNodeId.Value, targetPath, dirNodes, childrenByParent, targetDirIds, dirIdToFullPath, snapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 該当するターゲットディレクトリが存在しなければ終了
|
||||||
|
if (targetDirIds.Count == 0) return true;
|
||||||
|
|
||||||
|
// 5. 【第2パス】ターゲット配下のファイルのみを高速抽出
|
||||||
|
// (ターゲット外の数百万個の無関係なファイルは名前取得やオブジェクト生成を完全にスキップ!)
|
||||||
|
foreach (var chunk in chunks)
|
||||||
|
{
|
||||||
|
ReadOnlySpan<byte> span = chunk.Buffer.AsSpan(0, chunk.Length);
|
||||||
|
int offset = 8;
|
||||||
|
while (offset < chunk.Length)
|
||||||
|
{
|
||||||
|
if (offset + 60 > chunk.Length) break;
|
||||||
|
ReadOnlySpan<byte> record = span.Slice(offset);
|
||||||
|
int recordLength = BinaryPrimitives.ReadInt32LittleEndian(record);
|
||||||
|
if (recordLength <= 0 || offset + recordLength > chunk.Length) break;
|
||||||
|
|
||||||
|
uint fileAttributes = BinaryPrimitives.ReadUInt32LittleEndian(record.Slice(52));
|
||||||
|
// ディレクトリは第1パスですでに登録済みのためスキップ
|
||||||
|
if ((fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||||
|
{
|
||||||
|
ulong parentRef = BinaryPrimitives.ReadUInt64LittleEndian(record.Slice(16)) & 0x0000FFFFFFFFFFFFUL;
|
||||||
|
|
||||||
|
// ターゲット配下のディレクトリに属するファイルのみを抽出
|
||||||
|
if (targetDirIds.Contains(parentRef) && dirIdToFullPath.TryGetValue(parentRef, out string? parentDirPath))
|
||||||
|
{
|
||||||
|
ushort fileNameLength = BinaryPrimitives.ReadUInt16LittleEndian(record.Slice(56));
|
||||||
|
ushort fileNameOffset = BinaryPrimitives.ReadUInt16LittleEndian(record.Slice(58));
|
||||||
|
|
||||||
|
if (fileNameLength > 0 && fileNameOffset + fileNameLength <= recordLength)
|
||||||
|
{
|
||||||
|
string fileName = Encoding.Unicode.GetString(record.Slice(fileNameOffset, fileNameLength));
|
||||||
|
snapshot.AddFile(parentDirPath, fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += recordLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// パス文字列から対応するディレクトリのノードIDを特定します。
|
||||||
|
/// </summary>
|
||||||
|
private static ulong? FindDirNodeIdByPath(
|
||||||
|
char driveLetter,
|
||||||
|
string path,
|
||||||
|
Dictionary<ulong, DirNode> dirNodes,
|
||||||
|
Dictionary<ulong, List<ulong>> childrenByParent)
|
||||||
|
{
|
||||||
|
string rootStr = driveLetter + @":\";
|
||||||
|
if (path.Equals(rootStr.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase) || path.Equals(rootStr, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return 5UL; // ルートディレクトリID
|
||||||
|
}
|
||||||
|
|
||||||
|
var parts = path.Substring(3).Split(new[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
ulong currentParent = 5UL;
|
||||||
|
|
||||||
|
foreach (var part in parts)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
if (childrenByParent.TryGetValue(currentParent, out var childIds))
|
||||||
|
{
|
||||||
|
foreach (var childId in childIds)
|
||||||
|
{
|
||||||
|
if (dirNodes.TryGetValue(childId, out var node) && string.Equals(node.Name, part, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
currentParent = node.Id;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ターゲットディレクトリ配下の子孫ディレクトリIDおよびフルパスを再帰的に収集し、スナップショットに登録します。
|
||||||
|
/// </summary>
|
||||||
|
private static void CollectDescendantDirectories(
|
||||||
|
ulong parentNodeId,
|
||||||
|
string currentPath,
|
||||||
|
Dictionary<ulong, DirNode> dirNodes,
|
||||||
|
Dictionary<ulong, List<ulong>> childrenByParent,
|
||||||
|
HashSet<ulong> targetDirIds,
|
||||||
|
Dictionary<ulong, string> dirIdToFullPath,
|
||||||
|
FastDirectorySnapshot snapshot)
|
||||||
|
{
|
||||||
|
targetDirIds.Add(parentNodeId);
|
||||||
|
dirIdToFullPath[parentNodeId] = currentPath;
|
||||||
|
|
||||||
|
if (!childrenByParent.TryGetValue(parentNodeId, out var childIds)) return;
|
||||||
|
|
||||||
|
foreach (var childId in childIds)
|
||||||
|
{
|
||||||
|
if (!dirNodes.TryGetValue(childId, out var childNode)) continue;
|
||||||
|
|
||||||
|
string childPath = Path.Combine(currentPath, childNode.Name);
|
||||||
|
snapshot.AddDirectory(currentPath, childPath);
|
||||||
|
CollectDescendantDirectories(childId, childPath, dirNodes, childrenByParent, targetDirIds, dirIdToFullPath, snapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region □P/Invoke(Private)
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
private static extern SafeFileHandle CreateFile(
|
||||||
|
string lpFileName,
|
||||||
|
uint dwDesiredAccess,
|
||||||
|
uint dwShareMode,
|
||||||
|
IntPtr lpSecurityAttributes,
|
||||||
|
uint dwCreationDisposition,
|
||||||
|
uint dwFlagsAndAttributes,
|
||||||
|
IntPtr hTemplateFile);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
private static extern bool DeviceIoControl(
|
||||||
|
SafeFileHandle hDevice,
|
||||||
|
uint dwIoControlCode,
|
||||||
|
IntPtr lpInBuffer,
|
||||||
|
int nInBufferSize,
|
||||||
|
out USN_JOURNAL_DATA lpOutBuffer,
|
||||||
|
int nOutBufferSize,
|
||||||
|
out uint lpBytesReturned,
|
||||||
|
IntPtr lpOverlapped);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
private static extern bool DeviceIoControl(
|
||||||
|
SafeFileHandle hDevice,
|
||||||
|
uint dwIoControlCode,
|
||||||
|
IntPtr lpInBuffer,
|
||||||
|
int nInBufferSize,
|
||||||
|
IntPtr lpOutBuffer,
|
||||||
|
int nOutBufferSize,
|
||||||
|
out uint lpBytesReturned,
|
||||||
|
IntPtr lpOverlapped);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using GameLauncher.Engines.Unity;
|
||||||
using GameLauncher.Models;
|
using GameLauncher.Models;
|
||||||
using GameLauncher.Services.Codecs;
|
using GameLauncher.Services.Codecs;
|
||||||
using GameLauncher.Engines.Unity;
|
|
||||||
using GameLauncher.Engines.Wolf;
|
|
||||||
|
|
||||||
namespace GameLauncher.Services
|
namespace GameLauncher.Services
|
||||||
{
|
{
|
||||||
@@ -15,23 +14,32 @@ namespace GameLauncher.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SaveDataCodecManager
|
public class SaveDataCodecManager
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// シングルトンインスタンスを取得します。
|
||||||
|
/// </summary>
|
||||||
public static readonly SaveDataCodecManager Instance = new();
|
public static readonly SaveDataCodecManager Instance = new();
|
||||||
|
|
||||||
private readonly List<ISaveDataCodec> _codecs = [];
|
private readonly List<ISaveDataCodec> _codecs = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="SaveDataCodecManager"/> クラスの新しいインスタンスを初期化します。
|
||||||
|
/// </summary>
|
||||||
public SaveDataCodecManager()
|
public SaveDataCodecManager()
|
||||||
{
|
{
|
||||||
// コーデックの登録
|
// コーデックの登録
|
||||||
_codecs.Add(new EasySave3Codec());
|
this._codecs.Add(new EasySave3Codec());
|
||||||
_codecs.Add(new YurisSaveCodec());
|
this._codecs.Add(new YurisSaveCodec());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 指定されたゲームおよびセーブファイルに対応するコーデックを検索します。
|
/// 指定されたゲームおよびセーブファイルに対応するコーデックを検索します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="game">対象のUnityゲーム情報</param>
|
||||||
|
/// <param name="file">対象のセーブファイル情報</param>
|
||||||
|
/// <returns>対応するコーデック。見つからない場合は null</returns>
|
||||||
public ISaveDataCodec? FindCodec(UnityGameItem game, SaveFileEntry file)
|
public ISaveDataCodec? FindCodec(UnityGameItem game, SaveFileEntry file)
|
||||||
{
|
{
|
||||||
foreach (var codec in _codecs)
|
foreach (var codec in this._codecs)
|
||||||
{
|
{
|
||||||
if (codec.CanHandle(game, file))
|
if (codec.CanHandle(game, file))
|
||||||
{
|
{
|
||||||
@@ -44,6 +52,9 @@ namespace GameLauncher.Services
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 未対応セーブデータについて、Antigravity IDE に依頼できる安全なプロンプトを自動生成します。
|
/// 未対応セーブデータについて、Antigravity IDE に依頼できる安全なプロンプトを自動生成します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="game">対象のUnityゲーム情報</param>
|
||||||
|
/// <param name="file">対象のセーブファイル情報</param>
|
||||||
|
/// <returns>生成された依頼プロンプト文字列</returns>
|
||||||
public string GenerateAntigravityPrompt(UnityGameItem game, SaveFileEntry file)
|
public string GenerateAntigravityPrompt(UnityGameItem game, SaveFileEntry file)
|
||||||
{
|
{
|
||||||
// ポリシー配慮: 会社名・タイトル名からセンシティブ表現を除去/安全な別名に変換
|
// ポリシー配慮: 会社名・タイトル名からセンシティブ表現を除去/安全な別名に変換
|
||||||
@@ -98,8 +109,10 @@ namespace GameLauncher.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AIプロンプト向けに文字列を安全・中立的な表現にサニタイズ
|
/// AIプロンプト向けに文字列を安全・中立的な表現にサニタイズします。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="input">元の文字列</param>
|
||||||
|
/// <returns>サニタイズされた安全な文字列</returns>
|
||||||
private static string SanitizeForPrompt(string input)
|
private static string SanitizeForPrompt(string input)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(input)) return "Game";
|
if (string.IsNullOrWhiteSpace(input)) return "Game";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -67,12 +67,12 @@ namespace GameLauncher.Services
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// 外部ツール起動失敗時は内蔵方式にフォールバック
|
// 外部ツール起動失敗時は内蔵方式にフォールバック
|
||||||
var (ok, msg) = await ApplyBuiltInResizeAsync(process);
|
var (ok, msg) = await this.ApplyBuiltInResizeAsync(process);
|
||||||
return (ok, $"外部ツール起動に失敗したため内蔵方式を使用: {ex.Message} / {msg}");
|
return (ok, $"外部ツール起動に失敗したため内蔵方式を使用: {ex.Message} / {msg}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await ApplyBuiltInResizeAsync(process);
|
return await this.ApplyBuiltInResizeAsync(process);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="GameLauncher.WolfSaveEditorDialog"
|
<Window x:Class="GameLauncher.WolfSaveEditorDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -27,15 +27,15 @@ namespace GameLauncher
|
|||||||
|
|
||||||
public WolfSaveEditorDialog(TkoolGameItem game, WolfSaveService saveService)
|
public WolfSaveEditorDialog(TkoolGameItem game, WolfSaveService saveService)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.InitializeComponent();
|
||||||
_game = game;
|
this._game = game;
|
||||||
_saveService = saveService;
|
this._saveService = saveService;
|
||||||
|
|
||||||
lblGameTitle.Text = _game.Title;
|
this.lblGameTitle.Text = this._game.Title;
|
||||||
lblGamePath.Text = _game.RootDirectory;
|
this.lblGamePath.Text = this._game.RootDirectory;
|
||||||
txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory);
|
this.txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory);
|
||||||
|
|
||||||
LoadSaveFileList();
|
this.LoadSaveFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -45,36 +45,36 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var files = _saveService.GetSaveFiles(_game.RootDirectory);
|
var files = this._saveService.GetSaveFiles(this._game.RootDirectory);
|
||||||
cboSaveFiles.Items.Clear();
|
this.cboSaveFiles.Items.Clear();
|
||||||
|
|
||||||
foreach (var f in files)
|
foreach (var f in files)
|
||||||
{
|
{
|
||||||
cboSaveFiles.Items.Add(Path.GetFileName(f));
|
this.cboSaveFiles.Items.Add(Path.GetFileName(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cboSaveFiles.Items.Count > 0)
|
if (this.cboSaveFiles.Items.Count > 0)
|
||||||
{
|
{
|
||||||
cboSaveFiles.SelectedIndex = 0;
|
this.cboSaveFiles.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。";
|
this.lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}";
|
this.lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cboSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void cboSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (cboSaveFiles.SelectedItem == null) return;
|
if (this.cboSaveFiles.SelectedItem == null) return;
|
||||||
var fileName = cboSaveFiles.SelectedItem.ToString();
|
var fileName = this.cboSaveFiles.SelectedItem.ToString();
|
||||||
if (string.IsNullOrEmpty(fileName)) return;
|
if (string.IsNullOrEmpty(fileName)) return;
|
||||||
|
|
||||||
LoadSaveFile(fileName);
|
this.LoadSaveFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -84,46 +84,46 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var files = _saveService.GetSaveFiles(_game.RootDirectory);
|
var files = this._saveService.GetSaveFiles(this._game.RootDirectory);
|
||||||
var fullPath = files.FirstOrDefault(f => string.Equals(Path.GetFileName(f), fileName, StringComparison.OrdinalIgnoreCase));
|
var fullPath = files.FirstOrDefault(f => string.Equals(Path.GetFileName(f), fileName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath))
|
if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
lblStatus.Text = $"ファイルが存在しません: {fileName}";
|
this.lblStatus.Text = $"ファイルが存在しません: {fileName}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentSaveData = _saveService.LoadSave(fullPath);
|
this._currentSaveData = this._saveService.LoadSave(fullPath);
|
||||||
_allVariables = [.. _currentSaveData.Variables];
|
this._allVariables = [.. this._currentSaveData.Variables];
|
||||||
_allStrings = [.. _currentSaveData.Strings];
|
this._allStrings = [.. this._currentSaveData.Strings];
|
||||||
|
|
||||||
// メタ情報表示
|
// メタ情報表示
|
||||||
txtInfoTitle.Text = string.IsNullOrEmpty(_currentSaveData.GameTitle) ? "(不明)" : _currentSaveData.GameTitle;
|
this.txtInfoTitle.Text = string.IsNullOrEmpty(this._currentSaveData.GameTitle) ? "(不明)" : this._currentSaveData.GameTitle;
|
||||||
txtInfoVersion.Text = $"0x{_currentSaveData.FileVersion:X4}";
|
this.txtInfoVersion.Text = $"0x{this._currentSaveData.FileVersion:X4}";
|
||||||
txtInfoEncoding.Text = _currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)";
|
this.txtInfoEncoding.Text = this._currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)";
|
||||||
txtInfoSize.Text = $"{_currentSaveData.RawDecryptedBytes.Length:N0} バイト";
|
this.txtInfoSize.Text = $"{this._currentSaveData.RawDecryptedBytes.Length:N0} バイト";
|
||||||
|
|
||||||
ApplyFilter();
|
this.ApplyFilter();
|
||||||
|
|
||||||
lblStatus.Text = $"'{fileName}' を正常に読み込みました。";
|
this.lblStatus.Text = $"'{fileName}' を正常に読み込みました。";
|
||||||
lblSaveCount.Text = $"変数項目: {_allVariables.Count}件, 文字列項目: {_allStrings.Count}件";
|
this.lblSaveCount.Text = $"変数項目: {this._allVariables.Count}件, 文字列項目: {this._allStrings.Count}件";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"セーブデータの読み込みに失敗しました:\n{ex.Message}", "読み込みエラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"セーブデータの読み込みに失敗しました:\n{ex.Message}", "読み込みエラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
lblStatus.Text = $"読み込みエラー: {ex.Message}";
|
this.lblStatus.Text = $"読み込みエラー: {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnReload_Click(object sender, RoutedEventArgs e)
|
private void btnReload_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (cboSaveFiles.SelectedItem != null)
|
if (this.cboSaveFiles.SelectedItem != null)
|
||||||
{
|
{
|
||||||
LoadSaveFile(cboSaveFiles.SelectedItem.ToString()!);
|
this.LoadSaveFile(this.cboSaveFiles.SelectedItem.ToString()!);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadSaveFileList();
|
this.LoadSaveFileList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,23 +132,23 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ApplyFilter()
|
private void ApplyFilter()
|
||||||
{
|
{
|
||||||
var filter = txtFilter.Text?.Trim() ?? string.Empty;
|
var filter = this.txtFilter.Text?.Trim() ?? string.Empty;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(filter))
|
if (string.IsNullOrEmpty(filter))
|
||||||
{
|
{
|
||||||
dgVariables.ItemsSource = _allVariables;
|
this.dgVariables.ItemsSource = this._allVariables;
|
||||||
dgStrings.ItemsSource = _allStrings;
|
this.dgStrings.ItemsSource = this._allStrings;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dgVariables.ItemsSource = _allVariables
|
this.dgVariables.ItemsSource = this._allVariables
|
||||||
.Where(v => v.DisplayName.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
.Where(v => v.DisplayName.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
||||||
v.Category.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
v.Category.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
||||||
v.Value.ToString().Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
v.Value.ToString().Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
||||||
v.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
|
v.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
dgStrings.ItemsSource = _allStrings
|
this.dgStrings.ItemsSource = this._allStrings
|
||||||
.Where(s => s.Value.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
.Where(s => s.Value.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
|
||||||
s.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
|
s.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -157,7 +157,7 @@ namespace GameLauncher
|
|||||||
|
|
||||||
private void txtFilter_TextChanged(object sender, TextChangedEventArgs e)
|
private void txtFilter_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ApplyFilter();
|
this.ApplyFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -165,21 +165,21 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void btnSearchValue_Click(object sender, RoutedEventArgs e)
|
private void btnSearchValue_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!int.TryParse(txtTargetValue.Text.Trim(), out int target))
|
if (!int.TryParse(this.txtTargetValue.Text.Trim(), out int target))
|
||||||
{
|
{
|
||||||
MessageBox.Show("検索する数値を半角数字で入力してください。(例: 現在の所持金やステータス)", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("検索する数値を半角数字で入力してください。(例: 現在の所持金やステータス)", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var matches = _allVariables.Where(v => v.Value == target).ToList();
|
var matches = this._allVariables.Where(v => v.Value == target).ToList();
|
||||||
if (matches.Count == 0)
|
if (matches.Count == 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"値が {target:N0} と一致する変数が見つかりませんでした。", "検索結果", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show($"値が {target:N0} と一致する変数が見つかりませんでした。", "検索結果", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dgVariables.ItemsSource = matches;
|
this.dgVariables.ItemsSource = matches;
|
||||||
lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。";
|
this.lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -187,7 +187,7 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void btnSetMaxTarget_Click(object sender, RoutedEventArgs e)
|
private void btnSetMaxTarget_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (dgVariables.ItemsSource is not IEnumerable<WolfVariableItem> currentList) return;
|
if (this.dgVariables.ItemsSource is not IEnumerable<WolfVariableItem> currentList) return;
|
||||||
var list = currentList.ToList();
|
var list = currentList.ToList();
|
||||||
if (list.Count == 0) return;
|
if (list.Count == 0) return;
|
||||||
|
|
||||||
@@ -201,8 +201,8 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
item.Value = 9999999;
|
item.Value = 9999999;
|
||||||
}
|
}
|
||||||
dgVariables.Items.Refresh();
|
this.dgVariables.Items.Refresh();
|
||||||
lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。";
|
this.lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,14 +214,14 @@ namespace GameLauncher
|
|||||||
if (sender is Button btn && btn.Tag is WolfVariableItem item)
|
if (sender is Button btn && btn.Tag is WolfVariableItem item)
|
||||||
{
|
{
|
||||||
item.Value = 9999999;
|
item.Value = 9999999;
|
||||||
dgVariables.Items.Refresh();
|
this.dgVariables.Items.Refresh();
|
||||||
lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。";
|
this.lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgVariables_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
private void dgVariables_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。";
|
this.lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -229,7 +229,7 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void btnSave_Click(object sender, RoutedEventArgs e)
|
private void btnSave_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSaveData == null)
|
if (this._currentSaveData == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("保存対象のセーブデータがありません。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("保存対象のセーブデータがありません。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
@@ -238,19 +238,19 @@ namespace GameLauncher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 変数リストの最新値をモデルへ反映
|
// 変数リストの最新値をモデルへ反映
|
||||||
_currentSaveData.Variables = _allVariables;
|
this._currentSaveData.Variables = this._allVariables;
|
||||||
|
|
||||||
// 保存実行 (自動バックアップ)
|
// 保存実行 (自動バックアップ)
|
||||||
string backupPath = _saveService.SaveToFile(_currentSaveData, _game.FolderName, _game.RootDirectory);
|
string backupPath = this._saveService.SaveToFile(this._currentSaveData, this._game.FolderName, this._game.RootDirectory);
|
||||||
|
|
||||||
var msg = $"セーブデータ '{_currentSaveData.FileName}' を安全に上書き保存しました!\n\n【バックアップ保存先】\n{backupPath}";
|
var msg = $"セーブデータ '{this._currentSaveData.FileName}' を安全に上書き保存しました!\n\n【バックアップ保存先】\n{backupPath}";
|
||||||
MessageBox.Show(msg, "保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show(msg, "保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})";
|
this.lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"保存中にエラーが発生しました:\n{ex.Message}", "保存エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"保存中にエラーが発生しました:\n{ex.Message}", "保存エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
lblStatus.Text = $"保存エラー: {ex.Message}";
|
this.lblStatus.Text = $"保存エラー: {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,20 +259,20 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void btnExportJson_Click(object sender, RoutedEventArgs e)
|
private void btnExportJson_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSaveData == null) return;
|
if (this._currentSaveData == null) return;
|
||||||
|
|
||||||
var sfd = new SaveFileDialog
|
var sfd = new SaveFileDialog
|
||||||
{
|
{
|
||||||
Title = "セーブデータを JSON としてエクスポート",
|
Title = "セーブデータを JSON としてエクスポート",
|
||||||
Filter = "JSON ファイル (*.json)|*.json",
|
Filter = "JSON ファイル (*.json)|*.json",
|
||||||
FileName = $"{Path.GetFileNameWithoutExtension(_currentSaveData.FileName)}_export.json"
|
FileName = $"{Path.GetFileNameWithoutExtension(this._currentSaveData.FileName)}_export.json"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sfd.ShowDialog() == true)
|
if (sfd.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_saveService.ExportToJson(_currentSaveData, sfd.FileName);
|
this._saveService.ExportToJson(this._currentSaveData, sfd.FileName);
|
||||||
MessageBox.Show($"JSON ファイルをエクスポートしました:\n{sfd.FileName}", "エクスポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show($"JSON ファイルをエクスポートしました:\n{sfd.FileName}", "エクスポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -287,7 +287,7 @@ namespace GameLauncher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void btnImportJson_Click(object sender, RoutedEventArgs e)
|
private void btnImportJson_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_currentSaveData == null) return;
|
if (this._currentSaveData == null) return;
|
||||||
|
|
||||||
var ofd = new OpenFileDialog
|
var ofd = new OpenFileDialog
|
||||||
{
|
{
|
||||||
@@ -299,9 +299,9 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_saveService.ImportFromJson(_currentSaveData, ofd.FileName);
|
this._saveService.ImportFromJson(this._currentSaveData, ofd.FileName);
|
||||||
_allVariables = [.. _currentSaveData.Variables];
|
this._allVariables = [.. this._currentSaveData.Variables];
|
||||||
ApplyFilter();
|
this.ApplyFilter();
|
||||||
MessageBox.Show("JSON データを正常に取り込みました。「上書き保存」を押すとファイルへ反映されます。", "インポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("JSON データを正常に取り込みました。「上書き保存」を押すとファイルへ反映されます。", "インポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -318,7 +318,7 @@ namespace GameLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dir = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory);
|
var dir = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory);
|
||||||
if (!Directory.Exists(dir))
|
if (!Directory.Exists(dir))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(dir);
|
Directory.CreateDirectory(dir);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="GameLauncher.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- 常に管理者権限で実行する -->
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- Windows 10 / Windows 11 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
</assembly>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ
|
* @target MZ
|
||||||
* @plugindesc プリンセスシナジー専用: 主人公のHPを常時最大に固定する
|
* @plugindesc プリンセスシナジー専用: 主人公のHPを常時最大に固定する
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ
|
* @target MZ
|
||||||
* @plugindesc プリンセスシナジー専用: 主人公のMPを常時最大に固定する
|
* @plugindesc プリンセスシナジー専用: 主人公のMPを常時最大に固定する
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ
|
* @target MZ
|
||||||
* @plugindesc 戦闘高速化・ウェイト削除・アニメーション早送り
|
* @plugindesc 戦闘高速化・ウェイト削除・アニメーション早送り
|
||||||
* @author Antigravity
|
* @author Antigravity
|
||||||
@@ -207,4 +207,3 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のHPを全回復します。
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のHPを全回復します。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
@@ -28,4 +28,3 @@
|
|||||||
_BattleManager_startInput.call(this);
|
_BattleManager_startInput.call(this);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のMPを全回復します。
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のMPを全回復します。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
@@ -28,4 +28,3 @@
|
|||||||
_BattleManager_startInput.call(this);
|
_BattleManager_startInput.call(this);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のTPを全回復します。
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のTPを全回復します。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
@@ -28,4 +28,3 @@
|
|||||||
_BattleManager_startInput.call(this);
|
_BattleManager_startInput.call(this);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc マップ移動時のダッシュ速度を通常より大幅に高速化します。
|
* @plugindesc マップ移動時のダッシュ速度を通常より大幅に高速化します。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc 経験値を獲得した際、即座に最大レベル(99)まで成長させます。
|
* @plugindesc 経験値を獲得した際、即座に最大レベル(99)まで成長させます。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
/*:
|
|
||||||
* @plugindesc GameLauncher mod (HP once at self turn start / MP always MAX / speed).
|
|
||||||
* @author GameLauncher
|
|
||||||
*
|
|
||||||
* @param EnableHpRecover
|
|
||||||
* @text HP自動回復(自ターン開始時のみ)
|
|
||||||
* @type boolean
|
|
||||||
* @default true
|
|
||||||
*
|
|
||||||
* @param EnableMpRecover
|
|
||||||
* @text MP常時MAX
|
|
||||||
* @type boolean
|
|
||||||
* @default true
|
|
||||||
*
|
|
||||||
* @param SpeedMultiplier
|
|
||||||
* @text 速度倍率
|
|
||||||
* @type number
|
|
||||||
* @decimals 2
|
|
||||||
* @default 3.0
|
|
||||||
*/
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var pluginName = 'GameLauncher_Mod';
|
|
||||||
var params = PluginManager.parameters(pluginName) || {};
|
|
||||||
|
|
||||||
function toBool(v, def) {
|
|
||||||
if (v === undefined || v === null || v === '') return def;
|
|
||||||
return String(v).toLowerCase() === 'true';
|
|
||||||
}
|
|
||||||
|
|
||||||
var ENABLE_HP = toBool(params['EnableHpRecover'], true);
|
|
||||||
var ENABLE_MP = toBool(params['EnableMpRecover'], true);
|
|
||||||
var SPEED = parseFloat(params['SpeedMultiplier']);
|
|
||||||
if (isNaN(SPEED) || SPEED <= 0) SPEED = 3.0;
|
|
||||||
|
|
||||||
// 自パーティのアクターかどうか(他ゲーム・敵などへ影響しないよう厳密判定)
|
|
||||||
function isPlayerActor(battler) {
|
|
||||||
return battler && typeof battler.isActor === 'function' && battler.isActor();
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
|
||||||
// HP: 自ターン開始時に1度だけ MAX まで回復する。
|
|
||||||
// 毎フレーム回復はしない(次ターンまでプレイヤーは自由にHPを減らせる)。
|
|
||||||
// =========================================================================
|
|
||||||
if (ENABLE_HP && typeof BattleManager !== 'undefined' && BattleManager.startTurn) {
|
|
||||||
var _GameLauncher_startTurn = BattleManager.startTurn;
|
|
||||||
BattleManager.startTurn = function () {
|
|
||||||
_GameLauncher_startTurn.call(this);
|
|
||||||
var battler = this.actor && this.actor();
|
|
||||||
if (isPlayerActor(battler)) {
|
|
||||||
// この瞬間に一度だけ全回復(以降はダメージで減らせる)
|
|
||||||
battler.setHp(battler.mhp);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
|
||||||
// MP: 常時 MAX を維持する(自アクターのみ、値が mmp 未満なら即座に戻す)。
|
|
||||||
// =========================================================================
|
|
||||||
if (ENABLE_MP && typeof Game_Battler !== 'undefined' && Game_Battler.prototype) {
|
|
||||||
var _GameLauncher_setMp = Game_Battler.prototype.setMp;
|
|
||||||
Game_Battler.prototype.setMp = function (value) {
|
|
||||||
_GameLauncher_setMp.call(this, value);
|
|
||||||
if (isPlayerActor(this)) {
|
|
||||||
this._mp = this.mmp;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var _GameLauncher_refresh = Game_Battler.prototype.refresh;
|
|
||||||
Game_Battler.prototype.refresh = function () {
|
|
||||||
_GameLauncher_refresh.call(this);
|
|
||||||
if (isPlayerActor(this)) {
|
|
||||||
this._mp = this.mmp;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
|
||||||
// 速度倍率: シーン更新のデルタタイムを実質的に乗算する(speedhack)。
|
|
||||||
// =========================================================================
|
|
||||||
if (SPEED !== 1.0 && typeof SceneManager !== 'undefined' && SceneManager.updateMain) {
|
|
||||||
var _GameLauncher_updateMain = SceneManager.updateMain;
|
|
||||||
SceneManager.updateMain = function () {
|
|
||||||
var scene = this._scene;
|
|
||||||
if (scene && scene.isActive && scene.isActive()) {
|
|
||||||
var delta = this._deltaTime || (1000 / 60);
|
|
||||||
if (scene.update) {
|
|
||||||
scene.update(delta * SPEED);
|
|
||||||
}
|
|
||||||
if (scene.isActive && scene.isActive()) {
|
|
||||||
_GameLauncher_updateMain.call(this);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_GameLauncher_updateMain.call(this);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc お金(ゴールド)を入手した際、所持金を即座に最大値(9999999)にします。
|
* @plugindesc お金(ゴールド)を入手した際、所持金を即座に最大値(9999999)にします。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc アイテム・武器・防具を入手した際、自動的に所持数を最大値(99個)にします。
|
* @plugindesc アイテム・武器・防具を入手した際、自動的に所持数を最大値(99個)にします。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc 通常アイテム使用時の消費を無効化します(減らずに何度でも使用可能)。
|
* @plugindesc 通常アイテム使用時の消費を無効化します(減らずに何度でも使用可能)。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc メッセージを常に瞬間表示し、文章中のウェイトを無効化します。
|
* @plugindesc メッセージを常に瞬間表示し、文章中のウェイトを無効化します。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
@@ -0,0 +1,263 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 日本語・URLエンコード・文字化け・機種依存文字(丸数字等)の素材読み込み失敗を自動修復・救済します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 日本語ファイル名がURLエンコード(%E3%...)されたり、ファイル名と要求パスが
|
||||||
|
* 一致せず「Loading Error Failed to load」で停止してしまう現象を自動的に修復・救済します。
|
||||||
|
* 丸数字(①②...)と通常数字(1, 2...)の表記揺れやNW.jsのファイルシステム探索に対応しています。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const hasNode = typeof require === 'function' && typeof process === 'object';
|
||||||
|
const fs = hasNode ? require('fs') : null;
|
||||||
|
const path = hasNode ? require('path') : null;
|
||||||
|
|
||||||
|
// 1x1 透明 PNG (Data URL) - 万が一ファイルが見つからない場合のフォールバック用
|
||||||
|
const BLANK_PNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
||||||
|
|
||||||
|
// 丸数字・ローマ数字・全角数字のマッピングテーブル
|
||||||
|
const CIRCLE_NUMBERS = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文字列内の丸数字や全角数字、波ダッシュ等を正規化して比較用キーを生成します。
|
||||||
|
* @param {string} str - 対象文字列
|
||||||
|
* @returns {string} 正規化文字列
|
||||||
|
*/
|
||||||
|
function normalizeFuzzy(str) {
|
||||||
|
if (!str) return '';
|
||||||
|
let res = str.normalize('NFC').toLowerCase();
|
||||||
|
|
||||||
|
// 丸数字 -> 通常数字
|
||||||
|
for (let i = 0; i < CIRCLE_NUMBERS.length; i++) {
|
||||||
|
res = res.replaceAll(CIRCLE_NUMBERS[i], String(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全角数字 -> 半角数字
|
||||||
|
res = res.replace(/[0-9]/g, s => String.fromCharCode(s.charCodeAt(0) - 0xFEE0));
|
||||||
|
|
||||||
|
// 波ダッシュ・チルダ
|
||||||
|
res = res.replaceAll('\u301C', '\uFF5E');
|
||||||
|
|
||||||
|
// 全角カッコ -> 半角カッコ
|
||||||
|
res = res.replaceAll('(', '(').replaceAll(')', ')');
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URLからファイルシステム上の実ファイルを探索します。
|
||||||
|
* @param {string} url - 読み込み対象のURL/相対パス
|
||||||
|
* @returns {string|null} 実ファイルの絶対パスまたは相対パス(見つからない場合はnull)
|
||||||
|
*/
|
||||||
|
function findActualFile(url) {
|
||||||
|
if (!fs || !path || !url) return null;
|
||||||
|
|
||||||
|
// クエリパラメータやハッシュを除去
|
||||||
|
const cleanUrl = url.split('?')[0].split('#')[0];
|
||||||
|
let decodedUrl = cleanUrl;
|
||||||
|
try {
|
||||||
|
decodedUrl = decodeURIComponent(cleanUrl);
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
// 中途半端に % が残っている場合の再デコード
|
||||||
|
if (decodedUrl.includes('%')) {
|
||||||
|
try {
|
||||||
|
decodedUrl = decodedUrl.replace(/(%[0-9A-Fa-f]{2})+/g, match => {
|
||||||
|
try { return decodeURIComponent(match); } catch (e) { return match; }
|
||||||
|
});
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
let encodedUrl = cleanUrl;
|
||||||
|
try {
|
||||||
|
const parts = cleanUrl.split('/');
|
||||||
|
encodedUrl = parts.map(p => encodeURIComponent(decodeURIComponent(p))).join('/');
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
// 1. そのままのパスで存在するか
|
||||||
|
if (fs.existsSync(cleanUrl)) return cleanUrl;
|
||||||
|
|
||||||
|
// 2. URLデコードしたパスで存在するか
|
||||||
|
if (fs.existsSync(decodedUrl)) return decodedUrl;
|
||||||
|
|
||||||
|
// 3. URLエンコードしたパスで存在するか
|
||||||
|
if (fs.existsSync(encodedUrl)) return encodedUrl;
|
||||||
|
|
||||||
|
// 4. ディレクトリ内の実ファイルを走査して柔軟に検索(丸数字・表記揺れ対応)
|
||||||
|
try {
|
||||||
|
const dir = path.dirname(decodedUrl);
|
||||||
|
const targetBase = path.basename(decodedUrl);
|
||||||
|
const targetExt = path.extname(decodedUrl);
|
||||||
|
const targetNameWithoutExt = path.basename(decodedUrl, targetExt);
|
||||||
|
|
||||||
|
if (fs.existsSync(dir)) {
|
||||||
|
const files = fs.readdirSync(dir);
|
||||||
|
const fuzzyTarget = normalizeFuzzy(targetBase);
|
||||||
|
const fuzzyTargetWithoutExt = normalizeFuzzy(targetNameWithoutExt);
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const fileExt = path.extname(file);
|
||||||
|
const fileNameWithoutExt = path.basename(file, fileExt);
|
||||||
|
|
||||||
|
// A. 通常比較
|
||||||
|
if (file.toLowerCase() === targetBase.toLowerCase()) {
|
||||||
|
return path.join(dir, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// B. 表記揺れ(丸数字①⇔1、全角数字等)のファジーマッチ
|
||||||
|
const fuzzyFile = normalizeFuzzy(file);
|
||||||
|
const fuzzyFileWithoutExt = normalizeFuzzy(fileNameWithoutExt);
|
||||||
|
|
||||||
|
if (fuzzyFile === fuzzyTarget) {
|
||||||
|
return path.join(dir, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fuzzyFileWithoutExt === fuzzyTargetWithoutExt && fileExt.toLowerCase() === targetExt.toLowerCase()) {
|
||||||
|
return path.join(dir, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// C. URLエンコード/デコードされたファイル名との比較
|
||||||
|
try {
|
||||||
|
const decodedFile = decodeURIComponent(file);
|
||||||
|
if (normalizeFuzzy(decodedFile) === fuzzyTarget) {
|
||||||
|
return path.join(dir, file);
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 実ファイルをBase64 DataURLとして読み込みます。
|
||||||
|
* @param {string} filePath - 実ファイルのパス
|
||||||
|
* @param {string} mimeType - MIMEタイプ
|
||||||
|
* @returns {string|null} DataURL
|
||||||
|
*/
|
||||||
|
function readFileAsDataUrl(filePath, mimeType = 'image/png') {
|
||||||
|
if (!fs || !filePath) return null;
|
||||||
|
try {
|
||||||
|
const buf = fs.readFileSync(filePath);
|
||||||
|
return `data:${mimeType};base64,${buf.toString('base64')}`;
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// 1. Bitmap ロードの救済 (ツクールMV / MZ)
|
||||||
|
// =========================================================================
|
||||||
|
if (typeof Bitmap !== 'undefined') {
|
||||||
|
const _Bitmap_load = Bitmap.load;
|
||||||
|
Bitmap.load = function(url) {
|
||||||
|
if (fs && url) {
|
||||||
|
const actual = findActualFile(url);
|
||||||
|
if (actual && actual !== url) {
|
||||||
|
try {
|
||||||
|
const actualUrl = actual.replace(/\\/g, '/');
|
||||||
|
return _Bitmap_load.call(this, actualUrl);
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _Bitmap_load.call(this, url);
|
||||||
|
};
|
||||||
|
|
||||||
|
const _Bitmap_prototype_onError = Bitmap.prototype._onError;
|
||||||
|
Bitmap.prototype._onError = function() {
|
||||||
|
if (!this._recoveryAttempted && this._url) {
|
||||||
|
this._recoveryAttempted = true;
|
||||||
|
|
||||||
|
const actualFile = findActualFile(this._url);
|
||||||
|
if (actualFile) {
|
||||||
|
const dataUrl = readFileAsDataUrl(actualFile, 'image/png');
|
||||||
|
if (dataUrl && this._image) {
|
||||||
|
console.log(`[GameLauncher] 画像の実ファイルを特定して自動救済: ${this._url} -> ${actualFile}`);
|
||||||
|
this._isLoading = true;
|
||||||
|
this._hasError = false;
|
||||||
|
this._image.src = dataUrl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// URLデコード版を直接 image.src に設定してリトライ
|
||||||
|
try {
|
||||||
|
const decoded = decodeURIComponent(this._url);
|
||||||
|
if (decoded !== this._url && this._image) {
|
||||||
|
this._isLoading = true;
|
||||||
|
this._hasError = false;
|
||||||
|
this._url = decoded;
|
||||||
|
this._image.src = decoded;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
// 最終手段: ゲーム停止・クラッシュを回避するため透明PNGで代替
|
||||||
|
if (this._image) {
|
||||||
|
console.warn(`[GameLauncher] 未存在画像の透過代替を適用(エラー停止回避): ${this._url}`);
|
||||||
|
this._isLoading = false;
|
||||||
|
this._hasError = false;
|
||||||
|
this._image.src = BLANK_PNG;
|
||||||
|
if (typeof this._onLoad === 'function') {
|
||||||
|
try { this._onLoad(); } catch (e) { }
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_Bitmap_prototype_onError.call(this);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// 2. WebAudio / AudioManager ロードの救済 (ツクールMV / MZ)
|
||||||
|
// =========================================================================
|
||||||
|
if (typeof WebAudio !== 'undefined') {
|
||||||
|
const _WebAudio_prototype_load = WebAudio.prototype._load;
|
||||||
|
WebAudio.prototype._load = function(url) {
|
||||||
|
let targetUrl = url;
|
||||||
|
if (fs && url) {
|
||||||
|
const actual = findActualFile(url);
|
||||||
|
if (actual) {
|
||||||
|
targetUrl = actual.replace(/\\/g, '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _WebAudio_prototype_load.call(this, targetUrl);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// 3. Graphics.printLoadingError のエラー停止緩和
|
||||||
|
// =========================================================================
|
||||||
|
if (typeof Graphics !== 'undefined' && Graphics.printLoadingError) {
|
||||||
|
const _Graphics_printLoadingError = Graphics.printLoadingError;
|
||||||
|
Graphics.printLoadingError = function(url) {
|
||||||
|
console.warn(`[GameLauncher] Loading Error が検出されました: ${url}`);
|
||||||
|
_Graphics_printLoadingError.call(this, url);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// 4. PluginManager スクリプト読み込みの救済
|
||||||
|
// =========================================================================
|
||||||
|
if (typeof PluginManager !== 'undefined' && PluginManager.loadScript) {
|
||||||
|
const _PluginManager_loadScript = PluginManager.loadScript;
|
||||||
|
PluginManager.loadScript = function(name) {
|
||||||
|
if (fs && name) {
|
||||||
|
const target = 'js/plugins/' + name;
|
||||||
|
const actual = findActualFile(target);
|
||||||
|
if (actual) {
|
||||||
|
const baseName = path.basename(actual);
|
||||||
|
return _PluginManager_loadScript.call(this, baseName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _PluginManager_loadScript.call(this, name);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[GameLauncher] ResourceLoaderFix プラグインが正常にロードされました。');
|
||||||
|
})();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/*:
|
/*:
|
||||||
* @target MZ MV
|
* @target MZ MV
|
||||||
* @plugindesc ショップでのアイテム購入時、個数入力の初期値を最大購入可能数にします。
|
* @plugindesc ショップでのアイテム購入時、個数入力の初期値を最大購入可能数にします。
|
||||||
* @author GameLauncher
|
* @author GameLauncher
|
||||||
|
|||||||
Reference in new issue
Block a user