From 152abae1f853ff0dadd258557a57ef45ddd5e076 Mon Sep 17 00:00:00 2001 From: uduki Date: Fri, 20 Nov 2026 19:55:34 +0900 Subject: [PATCH] =?UTF-8?q?=E6=A9=9F=E8=83=BD=E8=BF=BD=E5=8A=A0:=20Bakin?= =?UTF-8?q?=E3=83=BBNW.js=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E3=81=8A?= =?UTF-8?q?=E3=82=88=E3=81=B3=E3=82=BB=E3=83=BC=E3=83=96=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=E3=80=81ES3=E3=83=91=E3=82=B9=E3=83=AF?= =?UTF-8?q?=E3=83=BC=E3=83=89=E8=A7=A3=E6=B1=BA=E6=A9=9F=E8=83=BD=E3=81=A8?= =?UTF-8?q?RPG=E3=83=84=E3=82=AF=E3=83=BC=E3=83=ABMZ=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=93=E3=82=B9=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engines/Bakin/BakinDetector.cs | 252 +++ Engines/Bakin/BakinEngineModule.cs | 49 + Engines/Bakin/BakinSaveEditorDialog.xaml | 237 +++ Engines/Bakin/BakinSaveEditorDialog.xaml.cs | 510 ++++++ Engines/Bakin/BakinSaveService.cs | 1657 +++++++++++++++++++ Engines/Common/EngineDetectionHelper.cs | 14 + Engines/Evb/EvbUnpackService.cs | 21 +- Engines/Nwjs/NwjsDetector.cs | 97 +- Engines/Nwjs/NwjsModService.cs | 1581 ++++++++++++++++++ Engines/Nwjs/NwjsSaveEditorDialog.xaml | 260 +++ Engines/Nwjs/NwjsSaveEditorDialog.xaml.cs | 504 ++++++ Engines/Nwjs/NwjsSaveService.cs | 1446 ++++++++++++++++ Engines/Tkool/TkoolGameItem.cs | 82 +- Engines/Tkool/TkoolModService.cs | 2 +- Engines/Tkool/TkoolMzFixService.cs | 747 +++++++++ Engines/Unity/UnityEnums.cs | 2 + Engines/Unity/UnitySaveManagerService.cs | 3 +- Helpers/Converters.cs | 19 + MainWindow.xaml | 83 +- MainWindow.xaml.cs | 225 ++- Models/GameItemBase.cs | 19 +- Models/ModPluginDefinition.cs | 2 + Models/SaveDataPropertyEntry.cs | 72 + SaveEditorWindow.xaml | 55 +- SaveEditorWindow.xaml.cs | 138 +- Services/Codecs/EasySave3Codec.cs | 347 +++- Services/Codecs/Es3/Es3PasswordExtractor.cs | 585 +++++++ Services/Codecs/Es3/Es3PasswordResolver.cs | 559 +++++++ Services/Codecs/Es3/Es3PasswordStore.cs | 214 +++ Services/Codecs/Es3/Es3SaveDocument.cs | 891 ++++++++++ Services/GameScannerService.cs | 487 +++++- plugins/ResourceLoaderFix.js | 54 + plugins/SpineDebugTrace.js | 317 ++++ 33 files changed, 11356 insertions(+), 175 deletions(-) create mode 100644 Engines/Bakin/BakinDetector.cs create mode 100644 Engines/Bakin/BakinEngineModule.cs create mode 100644 Engines/Bakin/BakinSaveEditorDialog.xaml create mode 100644 Engines/Bakin/BakinSaveEditorDialog.xaml.cs create mode 100644 Engines/Bakin/BakinSaveService.cs create mode 100644 Engines/Nwjs/NwjsModService.cs create mode 100644 Engines/Nwjs/NwjsSaveEditorDialog.xaml create mode 100644 Engines/Nwjs/NwjsSaveEditorDialog.xaml.cs create mode 100644 Engines/Nwjs/NwjsSaveService.cs create mode 100644 Engines/Tkool/TkoolMzFixService.cs create mode 100644 Services/Codecs/Es3/Es3PasswordExtractor.cs create mode 100644 Services/Codecs/Es3/Es3PasswordResolver.cs create mode 100644 Services/Codecs/Es3/Es3PasswordStore.cs create mode 100644 Services/Codecs/Es3/Es3SaveDocument.cs create mode 100644 plugins/SpineDebugTrace.js diff --git a/Engines/Bakin/BakinDetector.cs b/Engines/Bakin/BakinDetector.cs new file mode 100644 index 0000000..7573b8f --- /dev/null +++ b/Engines/Bakin/BakinDetector.cs @@ -0,0 +1,252 @@ +// Engines/Bakin/BakinDetector.cs — RPG Developer Bakin (Smile Game Builder 系 YUKRDATA) ゲーム検出ヘルパー +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Windows.Media; +using GameLauncher.Engines.Tkool; +using GameLauncher.Engines.Unity; + +namespace GameLauncher.Engines.Bakin +{ + /// + /// RPG Developer Bakin / Smile Game Builder 系ゲームの検出およびメタデータ解決を行うヘルパークラス。 + /// + public static class BakinDetector + { + #region □変数(Private) + + private static readonly HashSet ExcludedExeNames = new(StringComparer.OrdinalIgnoreCase) + { + "bakinplayer.exe", + "notification_helper.exe", + "crashpad_handler.exe", + "elevate.exe", + "UnityCrashHandler32.exe", + "UnityCrashHandler64.exe" + }; + + #endregion + + #region □メソッド(Public) + + /// + /// 指定されたディレクトリが RPG Developer Bakin 製ゲームであるかを判定します。 + /// + /// 対象ディレクトリパス + /// Bakin ゲームであれば true + public static bool IsBakinGame(string dirPath) + { + try + { + if (string.IsNullOrWhiteSpace(dirPath) || !Directory.Exists(dirPath)) + { + return false; + } + + var dataSubDir = Path.Combine(dirPath, "data"); + + // data/ サブフォルダまたはルート直下に Bakin 固有ファイルが存在するか確認 + if (File.Exists(Path.Combine(dataSubDir, "bakinplayer.exe")) || + File.Exists(Path.Combine(dataSubDir, "bakinengine.dll")) || + File.Exists(Path.Combine(dataSubDir, "data.rbpack")) || + File.Exists(Path.Combine(dirPath, "bakinplayer.exe")) || + File.Exists(Path.Combine(dirPath, "bakinengine.dll")) || + File.Exists(Path.Combine(dirPath, "data.rbpack"))) + { + return true; + } + } + catch + { + return false; + } + + return false; + } + + /// + /// 指定ディレクトリ内の RPG Developer Bakin ゲームを検出し、TkoolGameItem を生成します。 + /// + /// ゲームフォルダの絶対パス + /// フォルダ名 + /// フォルダ更新日時 + /// アイコン読み込み関数 + /// 検出されたゲームアイテム。該当しない場合は null + public static TkoolGameItem? DetectBakinGame( + string dirPath, + string folderName, + DateTime? folderModified, + Func? iconLoader) + { + try + { + if (!BakinDetector.IsBakinGame(dirPath)) + { + return null; + } + + var exePath = BakinDetector.FindBakinExecutable(dirPath, folderName); + string title = folderName; + if (!string.IsNullOrEmpty(exePath)) + { + var exeName = Path.GetFileNameWithoutExtension(exePath); + if (!string.IsNullOrWhiteSpace(exeName) && + !string.Equals(exeName, "bakinplayer", StringComparison.OrdinalIgnoreCase) && + !string.Equals(exeName, "Game", StringComparison.OrdinalIgnoreCase)) + { + title = folderName; + } + } + + ImageSource? icon = null; + if (iconLoader != null) + { + icon = iconLoader(exePath, dirPath); + } + + bool hasSave = BakinSaveService.HasAnySaveData(dirPath); + + return new TkoolGameItem + { + Title = title, + FolderName = folderName, + RootDirectory = dirPath, + ExecutablePath = exePath ?? string.Empty, + EngineType = TkoolEngineType.Bakin, + IsModded = false, + ApplyMod = false, + HasSaveData = hasSave, + IconImage = icon, + FolderLastModified = folderModified + }; + } + catch + { + return null; + } + } + + /// + /// Bakin ゲームの起動用実行ファイル(ランチャー .exe または bakinplayer.exe)を検索します。 + /// + /// ゲームルートディレクトリ + /// フォルダ名(省略可) + /// 実行ファイルのフルパス。見つからない場合は null + public static string? FindBakinExecutable(string dirPath, string? folderName = null) + { + try + { + if (string.IsNullOrWhiteSpace(dirPath) || !Directory.Exists(dirPath)) + { + return null; + } + + var topExes = Directory.GetFiles(dirPath, "*.exe", SearchOption.TopDirectoryOnly) + .Where(p => !BakinDetector.IsExcludedLauncherCandidate(p)) + .ToList(); + + if (topExes.Count == 1) + { + return topExes[0]; + } + + if (topExes.Count > 1) + { + if (!string.IsNullOrWhiteSpace(folderName)) + { + var match = topExes.FirstOrDefault(p => + folderName.Contains(Path.GetFileNameWithoutExtension(p), StringComparison.OrdinalIgnoreCase) || + Path.GetFileNameWithoutExtension(p).Contains(folderName, StringComparison.OrdinalIgnoreCase)); + if (match != null) + { + return match; + } + } + + return topExes + .OrderByDescending(p => + { + try { return new FileInfo(p).Length; } catch { return 0L; } + }) + .First(); + } + + var dataPlayer = Path.Combine(dirPath, "data", "bakinplayer.exe"); + if (File.Exists(dataPlayer)) + { + return dataPlayer; + } + + var rootPlayer = Path.Combine(dirPath, "bakinplayer.exe"); + if (File.Exists(rootPlayer)) + { + return rootPlayer; + } + } + catch + { + // 無視 + } + + return null; + } + + /// + /// Bakin ゲームのセーブデータ格納ディレクトリ (`data/savedata` または `savedata`) を解決します。 + /// + /// ゲームルートディレクトリ + /// セーブデータディレクトリのフルパス + public static string ResolveSaveDirectory(string dirPath) + { + if (string.IsNullOrWhiteSpace(dirPath)) + { + return string.Empty; + } + + var dataSaveDir = Path.Combine(dirPath, "data", "savedata"); + if (Directory.Exists(dataSaveDir)) + { + return dataSaveDir; + } + + var rootSaveDir = Path.Combine(dirPath, "savedata"); + if (Directory.Exists(rootSaveDir)) + { + return rootSaveDir; + } + + if (Directory.Exists(Path.Combine(dirPath, "data"))) + { + return dataSaveDir; + } + + return rootSaveDir; + } + + #endregion + + #region □メソッド(Private) + + private static bool IsExcludedLauncherCandidate(string exePath) + { + var fileName = Path.GetFileName(exePath); + if (BakinDetector.ExcludedExeNames.Contains(fileName)) + { + return true; + } + + if (fileName.StartsWith("unins", StringComparison.OrdinalIgnoreCase) || + fileName.Contains("setup", StringComparison.OrdinalIgnoreCase) || + fileName.Contains("config", StringComparison.OrdinalIgnoreCase) || + fileName.Contains("軽量化", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + return false; + } + + #endregion + } +} diff --git a/Engines/Bakin/BakinEngineModule.cs b/Engines/Bakin/BakinEngineModule.cs new file mode 100644 index 0000000..842fe7e --- /dev/null +++ b/Engines/Bakin/BakinEngineModule.cs @@ -0,0 +1,49 @@ +// Engines/Bakin/BakinEngineModule.cs — RPG Developer Bakin エンジンモジュール実装 +using GameLauncher.Engines.Common; +using GameLauncher.Helpers; +using GameLauncher.Models; + +namespace GameLauncher.Engines.Bakin +{ + /// + /// RPG Developer Bakin エンジン用の 実装クラス。 + /// + public sealed class BakinEngineModule : IEngineModule + { + #region □プロパティ(Public) + + /// + public string EngineName => EngineDetectionHelper.EngineBakin; + + #endregion + + #region □メソッド(Public) + + /// + public bool Detect(string gameDirectory) + { + return BakinDetector.IsBakinGame(gameDirectory); + } + + /// + public bool ApplyMod(string gameDirectory, ModPluginDefinition plugin) + { + // Bakin はセーブデータエディタ方式で改造を行うため、スクリプト注入は不要 + return false; + } + + /// + public bool IsModApplied(string gameDirectory) + { + return false; + } + + /// + public string ResolveToolPath(string toolFileName) + { + return AppPathHelper.ResolveEngineTool(this.EngineName, toolFileName) ?? string.Empty; + } + + #endregion + } +} diff --git a/Engines/Bakin/BakinSaveEditorDialog.xaml b/Engines/Bakin/BakinSaveEditorDialog.xaml new file mode 100644 index 0000000..4405a87 --- /dev/null +++ b/Engines/Bakin/BakinSaveEditorDialog.xaml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +