feat: 初回コミット (GameLauncher)
This commit is contained in:
commit
7ac4dbc825
45 files changed
+9779
No files matched your search
+10
@@ -0,0 +1,10 @@
|
|||||||
|
## Visual Studio 2026 / .NET .gitignore
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
.vs/
|
||||||
|
*.user
|
||||||
|
*.suo
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<Window x:Class="GameLauncher.AddKeyDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:models="clr-namespace:GameLauncher.Models"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="PlayerPrefs 新規キーの追加" Height="280" Width="440"
|
||||||
|
WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
|
||||||
|
Background="#1C1C26" Foreground="#E0E0E6"
|
||||||
|
FontFamily="Segoe UI, Meiryo UI, Yu Gothic UI">
|
||||||
|
|
||||||
|
<Grid Margin="20">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- キー名 -->
|
||||||
|
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
||||||
|
<TextBlock Text="キー名 (ハッシュは自動付与されます):" FontSize="12" Foreground="#9E9EB4" Margin="0,0,0,4"/>
|
||||||
|
<TextBox x:Name="txtKeyName" Background="#262636" Foreground="#FFFFFF" BorderBrush="#38384C" BorderThickness="1" Padding="6,4" FontSize="12"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- データ型 -->
|
||||||
|
<StackPanel Grid.Row="1" Margin="0,0,0,12">
|
||||||
|
<TextBlock Text="データ型:" FontSize="12" Foreground="#9E9EB4" Margin="0,0,0,4"/>
|
||||||
|
<ComboBox x:Name="cmbKeyType" SelectedIndex="0" Background="#262636" Foreground="#FFFFFF" Padding="6,4" FontSize="12">
|
||||||
|
<ComboBoxItem Content="Int (32ビット整数)" Tag="Int"/>
|
||||||
|
<ComboBoxItem Content="Float (単精度浮動小数点数)" Tag="Float"/>
|
||||||
|
<ComboBoxItem Content="String (文字列)" Tag="String"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 初期値 -->
|
||||||
|
<StackPanel Grid.Row="2" Margin="0,0,0,16">
|
||||||
|
<TextBlock Text="値:" FontSize="12" Foreground="#9E9EB4" Margin="0,0,0,4"/>
|
||||||
|
<TextBox x:Name="txtKeyValue" Text="1" Background="#262636" Foreground="#FFFFFF" BorderBrush="#38384C" BorderThickness="1" Padding="6,4" FontSize="12"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- ボタン群 -->
|
||||||
|
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Content="キャンセル" Width="90" Height="30" Margin="0,0,10,0" Background="#2E2E3E" Foreground="#E0E0E6" BorderThickness="1" BorderBrush="#44445A" Click="btnCancel_Click" Cursor="Hand"/>
|
||||||
|
<Button Content="追加" Width="90" Height="30" Background="#00B894" Foreground="#FFFFFF" BorderThickness="0" FontWeight="Bold" Click="btnOk_Click" Cursor="Hand"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefsキー追加ダイアログ
|
||||||
|
/// </summary>
|
||||||
|
public partial class AddKeyDialog : Window
|
||||||
|
{
|
||||||
|
public string KeyName { get; private set; } = string.Empty;
|
||||||
|
public PlayerPrefsType KeyType { get; private set; } = PlayerPrefsType.Int;
|
||||||
|
public string KeyValue { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public AddKeyDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
txtKeyName.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var keyName = txtKeyName.Text.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(keyName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyName = keyName;
|
||||||
|
var selectedTag = (cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString();
|
||||||
|
KeyType = selectedTag switch
|
||||||
|
{
|
||||||
|
"Float" => PlayerPrefsType.Float,
|
||||||
|
"String" => PlayerPrefsType.String,
|
||||||
|
_ => PlayerPrefsType.Int
|
||||||
|
};
|
||||||
|
KeyValue = txtKeyValue.Text;
|
||||||
|
|
||||||
|
DialogResult = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Application x:Class="GameLauncher.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:GameLauncher"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using GameLauncher.Helpers;
|
||||||
|
|
||||||
|
namespace GameLauncher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnStartup(e);
|
||||||
|
|
||||||
|
// 作業ディレクトリを exe のあるフォルダに確実に設定
|
||||||
|
AppPathHelper.SetCurrentDirectoryToExeDirectory();
|
||||||
|
|
||||||
|
// 未処理例外をグローバルに捕捉してサイレント終了を防ぐ
|
||||||
|
DispatcherUnhandledException += (s, args) =>
|
||||||
|
{
|
||||||
|
var ex = args.Exception;
|
||||||
|
LogError("DispatcherUnhandledException", ex);
|
||||||
|
MessageBox.Show($"アプリケーションエラーが発生しました:\n\n{ex.Message}\n\n詳細:\n{ex}",
|
||||||
|
"GameLauncher エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
args.Handled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += (s, args) =>
|
||||||
|
{
|
||||||
|
if (args.ExceptionObject is Exception ex)
|
||||||
|
{
|
||||||
|
LogError("AppDomain.UnhandledException", ex);
|
||||||
|
MessageBox.Show($"致命的なエラーが発生しました:\n\n{ex.Message}\n\n詳細:\n{ex}",
|
||||||
|
"GameLauncher 致命的エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LogError(string source, Exception ex)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var baseDir = AppPathHelper.GetExeDirectory();
|
||||||
|
var logFile = Path.Combine(baseDir, "error.log");
|
||||||
|
File.AppendAllText(logFile, $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{source}] {ex}\n\n");
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
//ティラノビルダーによる自動ビルド
|
||||||
|
;debugMenu.visible=false
|
||||||
|
;configSave=file
|
||||||
|
;global.config_version=5.00
|
||||||
|
;System.title=特命少女アイギス・ブルー 全話収録版
|
||||||
|
;projectID=aigisfull
|
||||||
|
;game_version=0.0
|
||||||
|
;ScreenRatio=fix
|
||||||
|
;patch_apply_auto=true
|
||||||
|
;ScreenCentering=true
|
||||||
|
;useCamera=true
|
||||||
|
;use3D=false
|
||||||
|
;scWidth=1280
|
||||||
|
;scHeight=720
|
||||||
|
;vchat=false
|
||||||
|
;vchatMenuVisible=false
|
||||||
|
;chSpeed=30
|
||||||
|
;chSpeeds.fast=10
|
||||||
|
;chSpeeds.normal=30
|
||||||
|
;chSpeeds.slow=50
|
||||||
|
;defaultChEffect=none
|
||||||
|
;defaultChEffectSpeed=0.2s
|
||||||
|
;skipSpeed=30
|
||||||
|
;skipEffectIgnore=true
|
||||||
|
;autoSpeed=1300
|
||||||
|
;autoClickStop=true
|
||||||
|
;autoSpeedWithText=60
|
||||||
|
;cursorDefault=default
|
||||||
|
;mediaFormatDefault=ogg
|
||||||
|
;defaultBgmVolume=3
|
||||||
|
;defaultSeVolume=50
|
||||||
|
;defaultMovieVolume=100
|
||||||
|
;defaultBgmSlotNum=1
|
||||||
|
;defaultSoundSlotNum=3
|
||||||
|
;configVisible=false
|
||||||
|
;configLeft=-1
|
||||||
|
;configTop=-1
|
||||||
|
;configThumbnail=true
|
||||||
|
;configThumbnailQuality=middle
|
||||||
|
;configSaveSlotNum=10
|
||||||
|
;configSaveOverwrite=false
|
||||||
|
;maxBackLogNum=50
|
||||||
|
;autoRecordLabel=true
|
||||||
|
;unReadTextSkip=false
|
||||||
|
;alreadyReadTextColor=0x87cefa
|
||||||
|
;numCharacterLayers=3
|
||||||
|
;scPositionX.left=160
|
||||||
|
;scPositionX.left_center=240
|
||||||
|
;scPositionX.center=320
|
||||||
|
;scPositionX.right_center=400
|
||||||
|
;scPositionX.right=480
|
||||||
|
;scPositionX.l=scPositionX.left
|
||||||
|
;scPositionX.lc=scPositionX.left_center
|
||||||
|
;scPositionX.c=scPositionX.center
|
||||||
|
;scPositionX.rc=scPositionX.right_center
|
||||||
|
;scPositionX.r=scPositionX.right
|
||||||
|
;numMessageLayers=2
|
||||||
|
;initialMessageLayerVisible=true
|
||||||
|
;marginL=8
|
||||||
|
;marginT=8
|
||||||
|
;marginR=8
|
||||||
|
;marginB=8
|
||||||
|
;ml=16
|
||||||
|
;mt=16
|
||||||
|
;mw=960-32
|
||||||
|
;mh=640-32
|
||||||
|
;frameColor=0x000000
|
||||||
|
;frameOpacity=128
|
||||||
|
;defaultAutoReturn=true
|
||||||
|
;marginRCh=2
|
||||||
|
;defaultFontSize=22
|
||||||
|
;defaultLineSpacing=8
|
||||||
|
;defaultPitch=0
|
||||||
|
;userFace=Quicksand, 游ゴシック体, Yu Gothic, YuGothic, ヒラギノ角ゴシック Pro, Hiragino Kaku Gothic Pro, メイリオ, Meiryo, Osaka, MS Pゴシック, MS PGothic, sans-serif, Arial
|
||||||
|
;defaultChColor=0xffffff
|
||||||
|
;defaultBold=false
|
||||||
|
;defaultRubySize=10
|
||||||
|
;defaultRubyOffset=-2
|
||||||
|
;defaultAntialiased=1
|
||||||
|
;defaultShadow=false
|
||||||
|
;defaultShadowColor=0x000000
|
||||||
|
;defaultEdge=false
|
||||||
|
;defaultEdgeColor=0x000000
|
||||||
|
;defaultLinkColor=0x0080ff
|
||||||
|
;defaultLinkOpacity=64
|
||||||
|
;vertical=false
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ApplicationTitle>統合ゲームランチャー (Game Launcher)</ApplicationTitle>
|
||||||
|
<AssemblyName>GameLauncher</AssemblyName>
|
||||||
|
<RootNamespace>GameLauncher</RootNamespace>
|
||||||
|
|
||||||
|
<!-- 単一ファイル発行の設定 -->
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="plugins\**">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Config.tjs">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<Solution>
|
||||||
|
<Project Path="GameLauncher.csproj" />
|
||||||
|
</Solution>
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GameLauncher.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// アプリケーションの物理配置パス、プロファイル、およびバックアップディレクトリを管理するヘルパー
|
||||||
|
/// </summary>
|
||||||
|
public static class AppPathHelper
|
||||||
|
{
|
||||||
|
private static string? _exeDirectory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 実行ファイル(.exe)が実際に配置されている物理ディレクトリを取得します。
|
||||||
|
/// 単一ファイル発行(Single-File)の一時展開フォルダではなく、常に実体の .exe が置かれているフォルダを返します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetExeDirectory()
|
||||||
|
{
|
||||||
|
if (_exeDirectory != null)
|
||||||
|
{
|
||||||
|
return _exeDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var processPath = Environment.ProcessPath;
|
||||||
|
if (!string.IsNullOrEmpty(processPath))
|
||||||
|
{
|
||||||
|
var dir = Path.GetDirectoryName(processPath);
|
||||||
|
if (!string.IsNullOrEmpty(dir) && Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
_exeDirectory = dir;
|
||||||
|
return _exeDirectory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var proc = System.Diagnostics.Process.GetCurrentProcess();
|
||||||
|
var mainModuleFile = proc.MainModule?.FileName;
|
||||||
|
if (!string.IsNullOrEmpty(mainModuleFile))
|
||||||
|
{
|
||||||
|
var dir = Path.GetDirectoryName(mainModuleFile);
|
||||||
|
if (!string.IsNullOrEmpty(dir) && Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
_exeDirectory = dir;
|
||||||
|
return _exeDirectory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// フォールバック
|
||||||
|
_exeDirectory = AppContext.BaseDirectory;
|
||||||
|
return _exeDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 作業ディレクトリ(カレントディレクトリ)を exe の配置フォルダに設定します。
|
||||||
|
/// </summary>
|
||||||
|
public static void SetCurrentDirectoryToExeDirectory()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var exeDir = GetExeDirectory();
|
||||||
|
if (!string.IsNullOrEmpty(exeDir) && Directory.Exists(exeDir))
|
||||||
|
{
|
||||||
|
Directory.SetCurrentDirectory(exeDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ツクール/ティラノ用のプロファイル全体の格納ルートディレクトリを取得します。
|
||||||
|
/// GameLauncher.exe のあるフォルダ直下の「Profiles」フォルダを使用・作成します。
|
||||||
|
/// 旧 TkoolLauncher や本番フォルダの Profiles からのシームレスな移行もサポートします。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetProfilesDirectory()
|
||||||
|
{
|
||||||
|
var exeProfiles = Path.Combine(GetExeDirectory(), "Profiles");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(exeProfiles))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(exeProfiles);
|
||||||
|
|
||||||
|
// 旧TkoolLauncherや本番配置の既存プロファイルがあれば自動移行
|
||||||
|
var candidateOldPaths = new[]
|
||||||
|
{
|
||||||
|
@"Z:\自作ソフト\GameLauncher\Profiles",
|
||||||
|
@"Z:\自作ソフト\TkoolLauncher\Profiles"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var oldPath in candidateOldPaths)
|
||||||
|
{
|
||||||
|
if (string.Equals(oldPath, exeProfiles, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.Exists(oldPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var dir in Directory.EnumerateDirectories(oldPath))
|
||||||
|
{
|
||||||
|
var name = Path.GetFileName(dir);
|
||||||
|
var dest = Path.Combine(exeProfiles, name);
|
||||||
|
if (!Directory.Exists(dest))
|
||||||
|
{
|
||||||
|
CopyDirectory(dir, dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return exeProfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたツクールゲーム専用のプロファイルディレクトリパスを取得します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetGameProfileDirectory(string folderName, string rootDirectory)
|
||||||
|
{
|
||||||
|
var profilesRoot = GetProfilesDirectory();
|
||||||
|
|
||||||
|
var invalidChars = Path.GetInvalidFileNameChars();
|
||||||
|
var cleanName = string.Concat(folderName.Split(invalidChars, StringSplitOptions.RemoveEmptyEntries)).Trim();
|
||||||
|
if (string.IsNullOrEmpty(cleanName))
|
||||||
|
{
|
||||||
|
cleanName = "Game";
|
||||||
|
}
|
||||||
|
if (cleanName.Length > 25)
|
||||||
|
{
|
||||||
|
cleanName = cleanName[..25];
|
||||||
|
}
|
||||||
|
|
||||||
|
using var md5 = System.Security.Cryptography.MD5.Create();
|
||||||
|
var hashBytes = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(rootDirectory.ToLowerInvariant()));
|
||||||
|
var hashStr = Convert.ToHexString(hashBytes)[..8];
|
||||||
|
|
||||||
|
var dirName = $"{cleanName}_{hashStr}";
|
||||||
|
var path = Path.Combine(profilesRoot, dirName);
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
try { Directory.CreateDirectory(path); } catch { }
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unityセーブデータバックアップ全体の格納ルートディレクトリを取得します。
|
||||||
|
/// GameLauncher.exe のあるフォルダ直下の「Backups」フォルダを使用・作成します。
|
||||||
|
/// 旧 UnityLauncher や本番フォルダの Backups からのシームレスな移行もサポートします。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetBackupsDirectory()
|
||||||
|
{
|
||||||
|
var exeBackups = Path.Combine(GetExeDirectory(), "Backups");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(exeBackups))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(exeBackups);
|
||||||
|
|
||||||
|
// 旧UnityLauncherや本番配置の既存バックアップがあれば自動移行
|
||||||
|
var candidateOldPaths = new[]
|
||||||
|
{
|
||||||
|
@"Z:\自作ソフト\GameLauncher\Backups",
|
||||||
|
@"Z:\自作ソフト\UnityLauncher\Backups"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var oldPath in candidateOldPaths)
|
||||||
|
{
|
||||||
|
if (string.Equals(oldPath, exeBackups, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.Exists(oldPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var dir in Directory.EnumerateDirectories(oldPath))
|
||||||
|
{
|
||||||
|
var name = Path.GetFileName(dir);
|
||||||
|
var dest = Path.Combine(exeBackups, name);
|
||||||
|
if (!Directory.Exists(dest))
|
||||||
|
{
|
||||||
|
CopyDirectory(dir, dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return exeBackups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたUnityゲーム専用のセーブバックアップディレクトリパスを取得します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetGameBackupDirectory(string folderName, string rootDirectory)
|
||||||
|
{
|
||||||
|
var backupsRoot = GetBackupsDirectory();
|
||||||
|
|
||||||
|
var invalidChars = Path.GetInvalidFileNameChars();
|
||||||
|
var cleanName = string.Concat(folderName.Split(invalidChars, StringSplitOptions.RemoveEmptyEntries)).Trim();
|
||||||
|
if (string.IsNullOrEmpty(cleanName))
|
||||||
|
{
|
||||||
|
cleanName = "UnityGame";
|
||||||
|
}
|
||||||
|
if (cleanName.Length > 25)
|
||||||
|
{
|
||||||
|
cleanName = cleanName[..25];
|
||||||
|
}
|
||||||
|
|
||||||
|
using var md5 = System.Security.Cryptography.MD5.Create();
|
||||||
|
var hashBytes = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(rootDirectory.ToLowerInvariant()));
|
||||||
|
var hashStr = Convert.ToHexString(hashBytes)[..8];
|
||||||
|
|
||||||
|
var dirName = $"{cleanName}_{hashStr}";
|
||||||
|
var path = Path.Combine(backupsRoot, dirName);
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
try { Directory.CreateDirectory(path); } catch { }
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CopyDirectory(string sourceDir, string destDir)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destDir);
|
||||||
|
foreach (var file in Directory.EnumerateFiles(sourceDir))
|
||||||
|
{
|
||||||
|
var destFile = Path.Combine(destDir, Path.GetFileName(file));
|
||||||
|
File.Copy(file, destFile, true);
|
||||||
|
}
|
||||||
|
foreach (var sub in Directory.EnumerateDirectories(sourceDir))
|
||||||
|
{
|
||||||
|
var destSub = Path.Combine(destDir, Path.GetFileName(sub));
|
||||||
|
CopyDirectory(sub, destSub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 値が null の場合に Visible、非 null の場合に Collapsed を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class NullToVisibleConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly NullToVisibleConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value == null ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 値が null の場合に Collapsed、非 null の場合に Visible を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class NullToCollapsedConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly NullToCollapsedConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value != null ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UnityGameItem から "CompanyName / ProductName" の表示文字列を生成するコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class CompanyProductConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly CompanyProductConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is UnityGameItem game)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(game.CompanyName) && !string.IsNullOrEmpty(game.ProductName))
|
||||||
|
{
|
||||||
|
return $"{game.CompanyName} / {game.ProductName}";
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(game.ProductName))
|
||||||
|
{
|
||||||
|
return game.ProductName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "(app.info なし)";
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// アイテムが TkoolGameItem の場合に Visible を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class IsTkoolToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly IsTkoolToVisibilityConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value is TkoolGameItem ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// アイテムが UnityGameItem の場合に Visible を返すコンバーター
|
||||||
|
/// </summary>
|
||||||
|
public class IsUnityToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public static readonly IsUnityToVisibilityConverter Instance = new();
|
||||||
|
|
||||||
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value is UnityGameItem ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+986
@@ -0,0 +1,986 @@
|
|||||||
|
<Window x:Class="GameLauncher.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:GameLauncher"
|
||||||
|
xmlns:helpers="clr-namespace:GameLauncher.Helpers"
|
||||||
|
xmlns:models="clr-namespace:GameLauncher.Models"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="統合ゲームランチャー (Game Launcher)"
|
||||||
|
Height="840" Width="1280"
|
||||||
|
MinHeight="620" MinWidth="960"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Background="#181820"
|
||||||
|
Foreground="#E0E0E6"
|
||||||
|
FontFamily="Segoe UI, Meiryo UI, Yu Gothic UI">
|
||||||
|
|
||||||
|
<Window.Resources>
|
||||||
|
<!-- カラーパレット定義 -->
|
||||||
|
<SolidColorBrush x:Key="BgDark" Color="#181820"/>
|
||||||
|
<SolidColorBrush x:Key="CardBg" Color="#22222C"/>
|
||||||
|
<SolidColorBrush x:Key="CardHoverBg" Color="#2C2C3A"/>
|
||||||
|
<SolidColorBrush x:Key="CardSelectedBg" Color="#333348"/>
|
||||||
|
<SolidColorBrush x:Key="SidePanelBg" Color="#1F1F2A"/>
|
||||||
|
<SolidColorBrush x:Key="BorderBrushColor" Color="#38384C"/>
|
||||||
|
<SolidColorBrush x:Key="TextPrimary" Color="#F2F2F7"/>
|
||||||
|
<SolidColorBrush x:Key="TextSecondary" Color="#9E9EB4"/>
|
||||||
|
<SolidColorBrush x:Key="AccentPrimary" Color="#6C5CE7"/>
|
||||||
|
<SolidColorBrush x:Key="AccentHover" Color="#7D6DF8"/>
|
||||||
|
<SolidColorBrush x:Key="AccentGreen" Color="#00B894"/>
|
||||||
|
<SolidColorBrush x:Key="AccentGreenHover" Color="#10D3AC"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeMvBg" Color="#8B1E3F"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeMzBg" Color="#1E5F8B"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeTyranoBg" Color="#D35400"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeModdedBg" Color="#8B571E"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeIl2cppBg" Color="#5A368B"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeMonoBg" Color="#1E5F8B"/>
|
||||||
|
<SolidColorBrush x:Key="BadgeSaveBg" Color="#0D735E"/>
|
||||||
|
|
||||||
|
<!-- スクロールバースタイル定義 -->
|
||||||
|
<Style TargetType="ScrollBar">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="#4A4A60"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- ボタン標準スタイル -->
|
||||||
|
<Style x:Key="ModernButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#2E2E3E"/>
|
||||||
|
<Setter Property="Foreground" Value="#E0E0E6"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#44445A"/>
|
||||||
|
<Setter Property="Padding" Value="14,8"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#3D3D52"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 起動大ボタンスタイル(緑) -->
|
||||||
|
<Style x:Key="LaunchBigButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentGreen}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="20,12"/>
|
||||||
|
<Setter Property="FontSize" Value="16"/>
|
||||||
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="8"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentGreenHover}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- セーブエディタ紫ボタンスタイル -->
|
||||||
|
<Style x:Key="EditorBigButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="16,10"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="8"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentHover}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- ナビゲーションタブボタンスタイル(ピル型ラジオボタン) -->
|
||||||
|
<Style x:Key="NavTabRadioButton" TargetType="RadioButton">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Padding" Value="14,7"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="RadioButton">
|
||||||
|
<Border x:Name="tabBorder" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}" Margin="2,0">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="tabBorder" Property="Background" Value="#2E2E3E"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="tabBorder" Property="Background" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- チェックボックススタイル -->
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="Margin" Value="0,4"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- ダークモダン ComboBox スタイル -->
|
||||||
|
<ControlTemplate x:Key="DarkComboBoxToggleButton" TargetType="ToggleButton">
|
||||||
|
<Border Background="#252535" BorderBrush="#44445A" BorderThickness="1" CornerRadius="6">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="26"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Path Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Data="M 0 0 L 4 4 L 8 0 Z" Fill="#A29BFE"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<Style x:Key="DarkModernComboBox" TargetType="ComboBox">
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Setter Property="Background" Value="#252535"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#44445A"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBox">
|
||||||
|
<Grid>
|
||||||
|
<ToggleButton Template="{StaticResource DarkComboBoxToggleButton}"
|
||||||
|
Focusable="False"
|
||||||
|
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
ClickMode="Press"/>
|
||||||
|
<ContentPresenter Content="{TemplateBinding SelectionBoxItem}"
|
||||||
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||||
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Margin="10,0,26,0"
|
||||||
|
IsHitTestVisible="False"/>
|
||||||
|
<Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||||
|
AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
|
||||||
|
<Grid Name="DropDown" SnapsToDevicePixels="True"
|
||||||
|
MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
|
||||||
|
<Border Background="#20202C" BorderBrush="#555570" BorderThickness="1" CornerRadius="6" Margin="0,2,0,4">
|
||||||
|
<ScrollViewer SnapsToDevicePixels="True">
|
||||||
|
<StackPanel IsItemsHost="True" Margin="2"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="ComboBoxItem">
|
||||||
|
<Setter Property="Background" Value="#20202C"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="Padding" Value="10,6"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBoxItem">
|
||||||
|
<Border x:Name="itemBorder" Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="itemBorder" Property="Background" Value="#3D3D54"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="itemBorder" Property="Background" Value="#4C3FB8"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ヘッダーツールバー -->
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ナビゲーションタブ & フィルターバー -->
|
||||||
|
<RowDefinition Height="*"/> <!-- メインコンテンツ -->
|
||||||
|
<RowDefinition Height="115"/> <!-- リアルタイムログコンソール -->
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ステータスバー -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- ================= ヘッダーバー (最上部) ================= -->
|
||||||
|
<Border Grid.Row="0" Background="#1C1C26" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,0,0,1" Padding="16,10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- タイトルロゴ -->
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,20,0">
|
||||||
|
<TextBlock Text="🎮⚡" FontSize="22" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="Game Launcher" FontSize="18" FontWeight="Bold" Foreground="{StaticResource TextPrimary}"/>
|
||||||
|
<TextBlock Text="ツクールMV・MZ・ティラノ & Unity 統合ランチャー" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 検索バー & ソート順 -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||||
|
<!-- 検索ボックス -->
|
||||||
|
<Border Background="#252533" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Width="280" Height="34" Margin="0,0,14,0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="30"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="🔍" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox x:Name="txtSearch" Grid.Column="1" Background="Transparent" BorderThickness="0"
|
||||||
|
Foreground="{StaticResource TextPrimary}" VerticalAlignment="Center" FontSize="13"
|
||||||
|
TextChanged="txtSearch_TextChanged"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="タイトル、フォルダ名、開発元で検索..." Foreground="#666680"
|
||||||
|
VerticalAlignment="Center" IsHitTestVisible="False" Margin="2,0,0,0">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Text, ElementName=txtSearch}" Value="">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
<Button x:Name="btnClearSearch" Grid.Column="2" Content="✕" Width="26" Height="26" Background="Transparent"
|
||||||
|
BorderThickness="0" Foreground="{StaticResource TextSecondary}" Cursor="Hand" Click="btnClearSearch_Click">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Text, ElementName=txtSearch}" Value="">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ソート順選択ドロップダウン -->
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<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}"
|
||||||
|
SelectionChanged="cmbSortOrder_SelectionChanged">
|
||||||
|
<ComboBoxItem Content="最終実行日時 (新しい順)" Tag="LastLaunchedDesc" IsSelected="True"/>
|
||||||
|
<ComboBoxItem Content="最終実行日時 (古い順)" Tag="LastLaunchedAsc"/>
|
||||||
|
<ComboBoxItem Content="フォルダ更新日時 (新しい順)" Tag="FolderLastModifiedDesc"/>
|
||||||
|
<ComboBoxItem Content="フォルダ更新日時 (古い順)" Tag="FolderLastModifiedAsc"/>
|
||||||
|
<ComboBoxItem Content="タイトル (昇順 A→Z)" Tag="TitleAsc"/>
|
||||||
|
<ComboBoxItem Content="タイトル (降順 Z→A)" Tag="TitleDesc"/>
|
||||||
|
<ComboBoxItem Content="フォルダ名 (昇順)" Tag="FolderNameAsc"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 再スキャンボタン -->
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Button x:Name="btnRescan" Style="{StaticResource ModernButton}" Content="🔄 再スキャン" Click="btnRescan_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ================= ナビゲーションタブ & フィルターバー ================= -->
|
||||||
|
<Border Grid.Row="1" Background="#181824" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,0,0,1" Padding="16,8">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- メインタブセレクター(ピル型) -->
|
||||||
|
<Border Grid.Column="0" Background="#12121A" CornerRadius="8" Padding="3" Margin="0,0,20,0" BorderBrush="#303040" BorderThickness="1">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<RadioButton x:Name="tabAll" Style="{StaticResource NavTabRadioButton}" Content="🎮⚡ すべて" IsChecked="True" Checked="MainTab_Checked"/>
|
||||||
|
<RadioButton x:Name="tabTkool" Style="{StaticResource NavTabRadioButton}" Content="🎮 ツクール・ティラノ" Checked="MainTab_Checked"/>
|
||||||
|
<RadioButton x:Name="tabUnity" Style="{StaticResource NavTabRadioButton}" Content="⚡ Unity" Checked="MainTab_Checked"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 連動サブフィルター群 -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<!-- 1. ツクール/ティラノ用サブフィルター -->
|
||||||
|
<StackPanel x:Name="pnlTkoolFilters" Orientation="Horizontal" VerticalAlignment="Center" Visibility="Collapsed">
|
||||||
|
<TextBlock Text="エンジン:" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||||
|
<RadioButton x:Name="rbTkoolAll" Content="すべて" IsChecked="True" GroupName="TkoolEngineFilter" Margin="0,0,8,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<RadioButton x:Name="rbTkoolMV" Content="MV" GroupName="TkoolEngineFilter" Margin="0,0,8,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<RadioButton x:Name="rbTkoolMZ" Content="MZ" GroupName="TkoolEngineFilter" Margin="0,0,8,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<RadioButton x:Name="rbTkoolTyrano" Content="ティラノ" GroupName="TkoolEngineFilter" Margin="0,0,14,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<CheckBox x:Name="chkFilterModdedOnly" Content="改造中のみ" Margin="0,0,10,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"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 2. Unity用サブフィルター -->
|
||||||
|
<StackPanel x:Name="pnlUnityFilters" Orientation="Horizontal" VerticalAlignment="Center" Visibility="Collapsed">
|
||||||
|
<TextBlock Text="バックエンド:" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||||
|
<RadioButton x:Name="rbUnityAll" Content="すべて" IsChecked="True" GroupName="UnityBackendFilter" Margin="0,0,8,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<RadioButton x:Name="rbUnityIL2CPP" Content="IL2CPP" GroupName="UnityBackendFilter" Margin="0,0,8,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<RadioButton x:Name="rbUnityMono" Content="Mono" GroupName="UnityBackendFilter" Margin="0,0,14,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged"/>
|
||||||
|
<CheckBox x:Name="chkFilterSaveOnly" Content="セーブありのみ" Margin="0,0,10,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 3. 「すべて」選択時の共通フィルター -->
|
||||||
|
<StackPanel x:Name="pnlAllFilters" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<CheckBox x:Name="chkFilterAllModded" Content="改造中のみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
|
<CheckBox x:Name="chkFilterAllAsar" Content="ASAR形式のみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
|
<CheckBox x:Name="chkFilterAllSave" Content="セーブありのみ" Margin="0,0,12,0" Foreground="{StaticResource TextSecondary}" Checked="FilterChanged" Unchecked="FilterChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ================= メインコンテンツ ================= -->
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="3*" MinWidth="350"/> <!-- ゲーム一覧 -->
|
||||||
|
<ColumnDefinition Width="Auto"/> <!-- スプリッター -->
|
||||||
|
<ColumnDefinition Width="2*" MinWidth="340"/> <!-- 詳細&起動パネル -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左側:ゲーム一覧 -->
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<ListBox x:Name="lstGames" Background="Transparent" BorderThickness="0"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
|
SelectionChanged="lstGames_SelectionChanged"
|
||||||
|
MouseDoubleClick="lstGames_MouseDoubleClick"
|
||||||
|
Padding="12">
|
||||||
|
<!-- コンテキストメニュー(クリックされたアイテムに応じて動的に出し分け) -->
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu x:Name="listContextMenu" ContextMenuOpening="listContextMenu_ContextMenuOpening">
|
||||||
|
<MenuItem Header="🚀 このゲームを起動" Click="MenuLaunch_Click"/>
|
||||||
|
<Separator Background="{StaticResource BorderBrushColor}"/>
|
||||||
|
|
||||||
|
<!-- ツクール専用メニュー項目 -->
|
||||||
|
<MenuItem x:Name="menuTkoolOpenFolder" Header="📁 ゲームフォルダを開く" Click="MenuOpenFolder_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolOpenProfile" Header="📂 プロファイルフォルダを開く" Click="MenuOpenProfileFolder_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolOpenPluginsJs" Header="📄 plugins.js を開く" Click="MenuOpenPluginsJs_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolRestoreOriginal" Header="↩ 改造を解除してオリジナルに復元" Click="MenuRestoreOriginal_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolExtractAsar" Header="📦 ASARを解凍する" Click="MenuExtractAsar_Click"/>
|
||||||
|
<MenuItem x:Name="menuTkoolRestoreAsar" Header="↩ ASAR状態に戻す(復元)" Click="MenuRestoreAsar_Click"/>
|
||||||
|
|
||||||
|
<!-- Unity専用メニュー項目 -->
|
||||||
|
<MenuItem x:Name="menuUnitySaveEditor" Header="🛠 セーブエディタを開く" Click="MenuOpenSaveEditor_Click"/>
|
||||||
|
<MenuItem x:Name="menuUnityOpenFolder" Header="📁 ゲームフォルダを開く" Click="MenuOpenFolder_Click"/>
|
||||||
|
<MenuItem x:Name="menuUnityOpenLocalLow" Header="📂 LocalLowセーブフォルダを開く" Click="MenuOpenLocalLow_Click"/>
|
||||||
|
<MenuItem x:Name="menuUnityOpenRegedit" Header="🌐 regeditでPlayerPrefsを開く" Click="MenuOpenRegedit_Click"/>
|
||||||
|
<MenuItem x:Name="menuUnityBackupSave" Header="📦 セーブデータを一括バックアップ" Click="MenuBackupSave_Click"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
|
|
||||||
|
<ListBox.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,0,8"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
|
<Border x:Name="border" Background="{StaticResource CardBg}"
|
||||||
|
BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1"
|
||||||
|
CornerRadius="8" Padding="12,10" SnapsToDevicePixels="True">
|
||||||
|
<ContentPresenter/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="{StaticResource CardHoverBg}"/>
|
||||||
|
<Setter TargetName="border" Property="BorderBrush" Value="#555570"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="{StaticResource CardSelectedBg}"/>
|
||||||
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type models:GameItemBase}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="52"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- ゲームアイコン -->
|
||||||
|
<Border Grid.Column="0" Width="44" Height="44" CornerRadius="6" Background="#16161E"
|
||||||
|
BorderBrush="#303040" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="🎮" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
||||||
|
Visibility="{Binding IconImage, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
||||||
|
<Image Source="{Binding IconImage}" Width="36" Height="36" Stretch="Uniform" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- タイトル・フォルダ名・日付 -->
|
||||||
|
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="10,0,10,0">
|
||||||
|
<TextBlock Text="{Binding Title}" FontSize="14" FontWeight="SemiBold"
|
||||||
|
Foreground="{StaticResource TextPrimary}" TextTrimming="CharacterEllipsis"/>
|
||||||
|
<Grid Margin="0,3,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</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">
|
||||||
|
<!-- MVバッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="{StaticResource BadgeMvBg}"/>
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsMV}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="MV" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- MZバッジ -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- ティラノバッジ -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- IL2CPPバッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="{StaticResource BadgeIl2cppBg}"/>
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsIL2CPP}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="IL2CPP" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Monoバッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="{StaticResource BadgeMonoBg}"/>
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsMono}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="Mono" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ASARバッジ(ツクール専用) -->
|
||||||
|
<Border Background="{Binding AsarBadgeBackground}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding AsarBadgeVisibility}">
|
||||||
|
<TextBlock Text="{Binding AsarBadgeText}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 改造適用中インジケータ(ツクール専用) -->
|
||||||
|
<Border Background="{StaticResource BadgeModdedBg}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsModded}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="改造適用中" FontSize="10" FontWeight="SemiBold" Foreground="#FFDEAA"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- セーブデータありインジケータ(Unity専用) -->
|
||||||
|
<Border Background="{StaticResource BadgeSaveBg}" CornerRadius="4" Padding="6,2">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding HasSaveData}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="💾 セーブあり" FontSize="10" FontWeight="SemiBold" Foreground="#81ECEC"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<!-- 0件表示 -->
|
||||||
|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="0.5">
|
||||||
|
<StackPanel.Style>
|
||||||
|
<Style TargetType="StackPanel">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Items.Count, ElementName=lstGames}" Value="0">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</StackPanel.Style>
|
||||||
|
<TextBlock Text="📂" FontSize="48" HorizontalAlignment="Center" Margin="0,0,0,10"/>
|
||||||
|
<TextBlock Text="表示できるゲームがありません" FontSize="15" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Text="検索条件を変更するか、再スキャンを実行してください" FontSize="12" HorizontalAlignment="Center" Margin="0,4,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- グリッドスプリッター -->
|
||||||
|
<GridSplitter Grid.Column="1" Width="3" Background="{StaticResource BorderBrushColor}"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
|
||||||
|
|
||||||
|
<!-- 右側:詳細 & 操作パネル -->
|
||||||
|
<Border Grid.Column="2" Background="{StaticResource SidePanelBg}" Padding="20">
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<Grid x:Name="pnlGameDetails" Margin="0,0,14,0">
|
||||||
|
<!-- 未選択時メッセージ -->
|
||||||
|
<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="16" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Text="ダブルクリックで即時起動することもできます" FontSize="12" HorizontalAlignment="Center" Margin="0,6,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 選択時コンテンツ -->
|
||||||
|
<StackPanel x:Name="pnlSelectedContent" Margin="0,0,0,16" Visibility="Collapsed">
|
||||||
|
<!-- 1. ゲームアイコン・タイトル・バッジ(共通) -->
|
||||||
|
<Grid Margin="0,0,0,16">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="64"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border Grid.Column="0" Width="56" Height="56" CornerRadius="8" Background="#14141C"
|
||||||
|
BorderBrush="#38384C" BorderThickness="1" HorizontalAlignment="Left">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="🎮" FontSize="26" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.4"
|
||||||
|
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"
|
||||||
|
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="lblSelectedTitle" Text="{Binding SelectedItem.Title, ElementName=lstGames}"
|
||||||
|
FontSize="17" FontWeight="Bold" Foreground="{StaticResource TextPrimary}" TextWrapping="Wrap"/>
|
||||||
|
|
||||||
|
<!-- 種別バッジライン -->
|
||||||
|
<WrapPanel Orientation="Horizontal" Margin="0,4,0,0">
|
||||||
|
<!-- ツクールMVバッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeMvBg}">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- ツクールMZバッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Margin="0,0,6,0" Background="{StaticResource BadgeMzBg}">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<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 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>
|
||||||
|
|
||||||
|
<!-- Unityバックエンドバッジ -->
|
||||||
|
<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}}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.BackendBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Unityバージョン -->
|
||||||
|
<TextBlock Text="{Binding SelectedItem.UnityVersion, ElementName=lstGames, StringFormat='Unity {0}'}"
|
||||||
|
FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="0,0,8,0"
|
||||||
|
Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsUnityToVisibilityConverter.Instance}}"/>
|
||||||
|
|
||||||
|
<!-- ASARバッジ -->
|
||||||
|
<Border Background="{Binding SelectedItem.AsarBadgeBackground, ElementName=lstGames}" CornerRadius="4" Padding="6,2" Margin="0,0,6,0"
|
||||||
|
Visibility="{Binding SelectedItem.AsarBadgeVisibility, ElementName=lstGames}">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="11" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 改造中バッジ -->
|
||||||
|
<Border CornerRadius="4" Padding="6,2" Background="{StaticResource BadgeModdedBg}" Margin="0,0,6,0">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem.IsModded, ElementName=lstGames}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<TextBlock Text="現在: 改造適用中" FontSize="10" FontWeight="SemiBold" Foreground="#FFDEAA"/>
|
||||||
|
</Border>
|
||||||
|
</WrapPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 2. 起動ボタン(大・共通) -->
|
||||||
|
<Button x:Name="btnLaunchGame" Style="{StaticResource LaunchBigButton}" Height="48" Margin="0,0,0,12" Click="btnLaunchGame_Click">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="🚀" FontSize="20" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="ゲームを起動" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- ================= A. ツクール / ティラノ 選択時の個別UI ================= -->
|
||||||
|
<StackPanel x:Name="pnlTkoolDetails" Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsTkoolToVisibilityConverter.Instance}}">
|
||||||
|
<!-- クイックボタン -->
|
||||||
|
<Grid Margin="0,0,0,14">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="8"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Grid.Column="0" Style="{StaticResource ModernButton}" Content="📁 フォルダを開く" Click="btnOpenFolder_Click"/>
|
||||||
|
<Button Grid.Column="2" Style="{StaticResource ModernButton}" Content="↩ 改造を解除(復元)" Click="btnRestoreOriginal_Click"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- パス・日時情報 -->
|
||||||
|
<Border Background="#14141C" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="12,10" Margin="0,0,0,14">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="フォルダ:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.RootDirectory, ElementName=lstGames}" FontSize="11" Foreground="{StaticResource TextPrimary}" TextWrapping="Wrap" Margin="0,2,0,6"/>
|
||||||
|
<TextBlock Text="実行ファイル:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.ExecutablePath, ElementName=lstGames}" FontSize="11" Foreground="{StaticResource TextPrimary}" TextWrapping="Wrap" Margin="0,2,0,6"/>
|
||||||
|
|
||||||
|
<Grid Margin="0,2,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Text="最終実行日時:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.LastLaunchedDetailDisplay, ElementName=lstGames}" FontSize="11" Foreground="#81ECEC" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<TextBlock Text="フォルダ更新日時:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.FolderLastModifiedDetailDisplay, ElementName=lstGames}" FontSize="11" Foreground="#FAB1A0" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ASARパッケージ管理セクション(IsAsar時のみ表示) -->
|
||||||
|
<Border Background="#1E1E2E" BorderBrush="#6C5CE7" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14"
|
||||||
|
Visibility="{Binding SelectedItem.AsarBadgeVisibility, ElementName=lstGames}">
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
|
||||||
|
<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">
|
||||||
|
<TextBlock Text="{Binding SelectedItem.AsarBadgeText, ElementName=lstGames}" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding SelectedItem.AsarDetailStatusText, ElementName=lstGames}"
|
||||||
|
FontSize="11" Foreground="{StaticResource TextSecondary}" TextWrapping="Wrap" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<Grid Margin="0,0,0,4">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="8"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button x:Name="btnExtractAsar" Grid.Column="0" Style="{StaticResource ModernButton}"
|
||||||
|
Content="📦 ASARを解凍" Click="btnExtractAsar_Click"/>
|
||||||
|
<Button x:Name="btnRestoreAsar" Grid.Column="2" Style="{StaticResource ModernButton}"
|
||||||
|
Content="↩ ASARに戻す" Click="btnRestoreAsar_Click"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ProgressBar x:Name="pbAsarProgress" Height="6" Margin="0,8,0,4" Visibility="Collapsed"
|
||||||
|
Foreground="{StaticResource AccentGreen}" Background="#252535" BorderThickness="0"/>
|
||||||
|
<TextBlock x:Name="lblAsarProgressStatus" Text="" FontSize="11" Foreground="#81ECEC" Visibility="Collapsed" TextWrapping="Wrap"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- スクリプト改造セクション -->
|
||||||
|
<Border Background="#252535" BorderBrush="{StaticResource AccentPrimary}" BorderThickness="1.5" CornerRadius="8" Padding="14" Margin="0,0,0,14">
|
||||||
|
<StackPanel>
|
||||||
|
<CheckBox x:Name="chkApplyMod" IsChecked="{Binding SelectedItem.ApplyMod, ElementName=lstGames, Mode=TwoWay}"
|
||||||
|
FontSize="15" FontWeight="Bold" Foreground="#A29BFE">
|
||||||
|
<TextBlock Text="⚡ スクリプト改造を適用して起動" Margin="4,0,0,0"/>
|
||||||
|
</CheckBox>
|
||||||
|
<TextBlock Text="チェックONで改造プラグインを適用して起動します。チェックOFFで改造前の状態に完全復元して起動します。"
|
||||||
|
FontSize="11" Foreground="{StaticResource TextSecondary}" TextWrapping="Wrap" Margin="24,4,0,10"/>
|
||||||
|
|
||||||
|
<!-- 個別プラグインアコーディオン -->
|
||||||
|
<Expander Header="プラグイン個別設定(詳細)" IsExpanded="True" Foreground="{StaticResource TextSecondary}" FontSize="12">
|
||||||
|
<ItemsControl ItemsSource="{Binding SelectedItem.PluginOptions, ElementName=lstGames}" Margin="4,8,0,0">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type models:ModPluginOptionItem}">
|
||||||
|
<Border Margin="0,0,0,6" Background="#1B1B26" CornerRadius="5" Padding="10,7" BorderBrush="#35354A" 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="{StaticResource TextPrimary}"/>
|
||||||
|
<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>
|
||||||
|
</Expander>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- ================= B. Unity 選択時の個別UI ================= -->
|
||||||
|
<StackPanel x:Name="pnlUnityDetails" Visibility="{Binding SelectedItem, ElementName=lstGames, Converter={x:Static helpers:IsUnityToVisibilityConverter.Instance}}">
|
||||||
|
<!-- セーブエディタ起動ボタン(紫・大) -->
|
||||||
|
<Button x:Name="btnOpenSaveEditor" Style="{StaticResource EditorBigButton}" Height="44" Margin="0,0,0,16" Click="btnOpenSaveEditor_Click">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="🛠" FontSize="18" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="セーブデータを編集する" FontSize="14" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- クイックアクセスボタン 2x2 -->
|
||||||
|
<TextBlock Text="クイックアクセス" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource TextSecondary}" Margin="0,0,0,8"/>
|
||||||
|
<UniformGrid Columns="2" Margin="0,0,0,16">
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📁 ゲームフォルダ" Margin="0,0,4,6" Click="btnOpenFolder_Click"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📂 LocalLowフォルダ" Margin="4,0,0,6" Click="btnOpenLocalLow_Click"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="🌐 regeditで開く" Margin="0,0,4,0" Click="btnOpenRegedit_Click"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📦 即時バックアップ" Margin="4,0,0,0" Click="btnQuickBackup_Click"/>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
<!-- Unityゲーム詳細メタデータ -->
|
||||||
|
<Border Background="#1A1A24" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="8" Padding="14">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Unity 詳細情報" FontSize="13" FontWeight="SemiBold" Foreground="{StaticResource TextPrimary}" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<TextBlock Text="フォルダ名:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox Text="{Binding SelectedItem.FolderName, ElementName=lstGames, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Foreground="#FFFFFF" FontSize="11" Margin="0,1,0,8"/>
|
||||||
|
|
||||||
|
<TextBlock Text="会社名 / 製品名 (app.info):" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox Text="{Binding Path=SelectedItem, ElementName=lstGames, Converter={x:Static helpers:CompanyProductConverter.Instance}, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Foreground="#A29BFE" FontSize="11" Margin="0,1,0,8"/>
|
||||||
|
|
||||||
|
<TextBlock Text="実行ファイルパス:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox Text="{Binding SelectedItem.ExecutablePath, ElementName=lstGames, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Foreground="#FFFFFF" FontSize="11" TextWrapping="Wrap" Margin="0,1,0,8"/>
|
||||||
|
|
||||||
|
<TextBlock Text="レジストリパス:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox Text="{Binding SelectedItem.RegistryPath, ElementName=lstGames, StringFormat='HKCU\\{0}', Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Foreground="#81ECEC" FontSize="11" TextWrapping="Wrap" Margin="0,1,0,8"/>
|
||||||
|
|
||||||
|
<TextBlock Text="LocalLowパス:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBox Text="{Binding SelectedItem.LocalLowPath, ElementName=lstGames, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Foreground="#81ECEC" FontSize="11" TextWrapping="Wrap" Margin="0,1,0,8"/>
|
||||||
|
|
||||||
|
<Grid Margin="0,6,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Text="最終起動日時:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.LastLaunchedDetailDisplay, ElementName=lstGames}" FontSize="11" Foreground="#81ECEC" FontWeight="SemiBold" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<TextBlock Text="フォルダ更新日時:" FontSize="11" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock Text="{Binding SelectedItem.FolderLastModifiedDetailDisplay, ElementName=lstGames}" FontSize="11" Foreground="#FAB1A0" FontWeight="SemiBold" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- ================= リアルタイムログコンソール ================= -->
|
||||||
|
<Border Grid.Row="3" Background="#111118" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,1,0,0" Padding="12,6">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0" Margin="0,0,0,4">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="📋 動作ログ & イベントコンソール" FontSize="11" FontWeight="Bold" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock x:Name="lblLogActivity" Text="" FontSize="11" Foreground="{StaticResource AccentGreen}" Margin="10,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Button Grid.Column="1" Content="クリア" FontSize="10" Background="Transparent" Foreground="{StaticResource TextSecondary}"
|
||||||
|
BorderThickness="0" Cursor="Hand" Click="btnClearLog_Click"/>
|
||||||
|
</Grid>
|
||||||
|
<ScrollViewer x:Name="scrollLog" Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||||
|
<TextBox x:Name="txtLog" Background="Transparent" BorderThickness="0" IsReadOnly="True"
|
||||||
|
Foreground="#66E19E" FontSize="11" FontFamily="Cascadia Code, Consolas, Meiryo UI, Courier New, monospace"
|
||||||
|
TextWrapping="Wrap" CaretBrush="Transparent"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ================= ステータスバー ================= -->
|
||||||
|
<Border Grid.Row="4" Background="#14141C" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,1,0,0" Padding="14,6">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="lblStatusSummary" Text="総ゲーム数: 0 件 | 表示: 0 件" FontSize="12" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<TextBlock x:Name="lblStatusBreakdown" Text=" (ツクール: 0, ティラノ: 0, Unity: 0)" FontSize="11" Foreground="#7D6DF8" Margin="8,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock x:Name="lblStatusEngine" Grid.Column="1" Text="待機中" FontSize="12" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
+1118
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,216 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// すべてのゲームアイテムの共通基底クラス
|
||||||
|
/// </summary>
|
||||||
|
public abstract class GameItemBase : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private static readonly ObservableCollection<ModPluginOptionItem> _emptyPluginOptions = [];
|
||||||
|
private string _title = string.Empty;
|
||||||
|
private string _folderName = string.Empty;
|
||||||
|
private string _rootDirectory = string.Empty;
|
||||||
|
private string _executablePath = string.Empty;
|
||||||
|
private ImageSource? _iconImage;
|
||||||
|
private DateTime? _lastLaunched;
|
||||||
|
private DateTime? _folderLastModified;
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ゲームの表示タイトル</summary>
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get => _title;
|
||||||
|
set { if (_title != value) { _title = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>フォルダ名</summary>
|
||||||
|
public string FolderName
|
||||||
|
{
|
||||||
|
get => _folderName;
|
||||||
|
set { if (_folderName != value) { _folderName = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ゲームのルートディレクトリ絶対パス</summary>
|
||||||
|
public string RootDirectory
|
||||||
|
{
|
||||||
|
get => _rootDirectory;
|
||||||
|
set { if (_rootDirectory != value) { _rootDirectory = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ゲームの実行ファイル(.exe等)絶対パス</summary>
|
||||||
|
public string ExecutablePath
|
||||||
|
{
|
||||||
|
get => _executablePath;
|
||||||
|
set { if (_executablePath != value) { _executablePath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>アプリアイコン画像</summary>
|
||||||
|
public ImageSource? IconImage
|
||||||
|
{
|
||||||
|
get => _iconImage;
|
||||||
|
set { if (_iconImage != value) { _iconImage = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ランチャーからの最終起動日時</summary>
|
||||||
|
public DateTime? LastLaunched
|
||||||
|
{
|
||||||
|
get => _lastLaunched;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_lastLaunched != value)
|
||||||
|
{
|
||||||
|
_lastLaunched = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(LastLaunchedDisplay));
|
||||||
|
OnPropertyChanged(nameof(LastLaunchedCardDisplay));
|
||||||
|
OnPropertyChanged(nameof(LastLaunchedDetailDisplay));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>フォルダ更新日時</summary>
|
||||||
|
public DateTime? FolderLastModified
|
||||||
|
{
|
||||||
|
get => _folderLastModified;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_folderLastModified != value)
|
||||||
|
{
|
||||||
|
_folderLastModified = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(FolderLastModifiedDisplay));
|
||||||
|
OnPropertyChanged(nameof(FolderLastModifiedCardDisplay));
|
||||||
|
OnPropertyChanged(nameof(FolderLastModifiedDetailDisplay));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ゲームエンジンの種別</summary>
|
||||||
|
public abstract GameEngineKind EngineKind { get; }
|
||||||
|
|
||||||
|
public bool IsTkoolOrTyrano => EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano;
|
||||||
|
public bool IsUnity => EngineKind == GameEngineKind.Unity;
|
||||||
|
|
||||||
|
public string LastLaunchedDisplay => LastLaunched.HasValue
|
||||||
|
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm")
|
||||||
|
: "未起動";
|
||||||
|
|
||||||
|
public string LastLaunchedCardDisplay => LastLaunched.HasValue
|
||||||
|
? $"▶ {LastLaunched.Value:yy/MM/dd HH:mm}"
|
||||||
|
: "▶ 未起動";
|
||||||
|
|
||||||
|
public string LastLaunchedDetailDisplay => LastLaunched.HasValue
|
||||||
|
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
|
: "まだ起動されていません";
|
||||||
|
|
||||||
|
public string FolderLastModifiedDisplay => FolderLastModified.HasValue
|
||||||
|
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm")
|
||||||
|
: "-";
|
||||||
|
|
||||||
|
public string FolderLastModifiedCardDisplay => FolderLastModified.HasValue
|
||||||
|
? $"📁 {FolderLastModified.Value:yy/MM/dd HH:mm}"
|
||||||
|
: "📁 -";
|
||||||
|
|
||||||
|
public string FolderLastModifiedDetailDisplay => FolderLastModified.HasValue
|
||||||
|
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
|
: "不明";
|
||||||
|
|
||||||
|
// ================= バッジ・UIバインディング共通仮想プロパティ =================
|
||||||
|
/// <summary>ツクールMVか</summary>
|
||||||
|
public virtual bool IsMV => false;
|
||||||
|
|
||||||
|
/// <summary>ツクールMZか</summary>
|
||||||
|
public virtual bool IsMZ => false;
|
||||||
|
|
||||||
|
/// <summary>ティラノスクリプトか</summary>
|
||||||
|
public virtual bool IsTyrano => false;
|
||||||
|
|
||||||
|
/// <summary>Unity IL2CPPか</summary>
|
||||||
|
public virtual bool IsIL2CPP => false;
|
||||||
|
|
||||||
|
/// <summary>Unity Monoか</summary>
|
||||||
|
public virtual bool IsMono => false;
|
||||||
|
|
||||||
|
/// <summary>Unity バックエンドバッジテキスト</summary>
|
||||||
|
public virtual string BackendBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>Unity バージョン</summary>
|
||||||
|
public virtual string UnityVersion
|
||||||
|
{
|
||||||
|
get => string.Empty;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Unity レジストリパス (HKCU)</summary>
|
||||||
|
public virtual string RegistryPath => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>Unity LocalLowパス</summary>
|
||||||
|
public virtual string LocalLowPath => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>Unity セーブデータ検出フラグ</summary>
|
||||||
|
public virtual bool HasSaveData
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ASARパッケージ形式か</summary>
|
||||||
|
public virtual bool IsAsar
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ASAR解凍済みか</summary>
|
||||||
|
public virtual bool IsAsarExtracted
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>ASARバッジのテキスト</summary>
|
||||||
|
public virtual string AsarBadgeText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>ASARバッジの背景色</summary>
|
||||||
|
public virtual Brush AsarBadgeBackground => Brushes.Transparent;
|
||||||
|
|
||||||
|
/// <summary>ASARバッジの可視性</summary>
|
||||||
|
public virtual Visibility AsarBadgeVisibility => Visibility.Collapsed;
|
||||||
|
|
||||||
|
/// <summary>ASAR詳細状態テキスト</summary>
|
||||||
|
public virtual string AsarDetailStatusText => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>改造適用中か</summary>
|
||||||
|
public virtual bool IsModded
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>改造適用フラグ</summary>
|
||||||
|
public virtual bool ApplyMod
|
||||||
|
{
|
||||||
|
get => false;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>プラグイン設定項目リスト</summary>
|
||||||
|
public virtual ObservableCollection<ModPluginOptionItem> PluginOptions
|
||||||
|
{
|
||||||
|
get => _emptyPluginOptions;
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// アプリケーション設定DTO
|
||||||
|
/// </summary>
|
||||||
|
public class LauncherConfig
|
||||||
|
{
|
||||||
|
public GameSortOrder SortOrder { get; set; } = GameSortOrder.LastLaunchedDesc;
|
||||||
|
|
||||||
|
/// <summary>選択中のメインタブ (0: すべて, 1: ツクール・ティラノ, 2: Unity)</summary>
|
||||||
|
public int SelectedTab { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>一度も変更していないゲームにおける「起動時に改造を適用する」の初期値</summary>
|
||||||
|
public bool DefaultApplyMod { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>一度も変更していないゲームにおける各改造プラグインの個別有効/無効の初期値</summary>
|
||||||
|
public Dictionary<string, bool> DefaultPluginSettings { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
/// <summary>追加のスキャン対象ルートディレクトリ一覧</summary>
|
||||||
|
public List<string> TargetDirectories { get; set; } = [];
|
||||||
|
|
||||||
|
// フィルター状態の保存(再起動時復元用)
|
||||||
|
public string TkoolEngineFilter { get; set; } = "All";
|
||||||
|
public bool TkoolFilterModdedOnly { get; set; }
|
||||||
|
public bool TkoolFilterAsarOnly { get; set; }
|
||||||
|
public string UnityBackendFilter { get; set; } = "All";
|
||||||
|
public bool UnityFilterSaveOnly { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲーム一覧のソート用カスタムComparer(GameItemBase全般に対応)
|
||||||
|
/// </summary>
|
||||||
|
public class GameItemComparer : IComparer
|
||||||
|
{
|
||||||
|
public GameSortOrder SortOrder { get; set; } = GameSortOrder.LastLaunchedDesc;
|
||||||
|
|
||||||
|
public int Compare(object? x, object? y)
|
||||||
|
{
|
||||||
|
if (x is not GameItemBase a || y is not GameItemBase b)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return SortOrder switch
|
||||||
|
{
|
||||||
|
GameSortOrder.LastLaunchedDesc => CompareNullableDateTimeDesc(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.FolderLastModifiedAsc => CompareNullableDateTimeAsc(a.FolderLastModified, b.FolderLastModified, a.Title, b.Title),
|
||||||
|
GameSortOrder.TitleAsc => string.Compare(a.Title, b.Title, StringComparison.CurrentCultureIgnoreCase),
|
||||||
|
GameSortOrder.TitleDesc => string.Compare(b.Title, a.Title, StringComparison.CurrentCultureIgnoreCase),
|
||||||
|
GameSortOrder.FolderNameAsc => string.Compare(a.FolderName, b.FolderName, StringComparison.CurrentCultureIgnoreCase),
|
||||||
|
_ => string.Compare(a.Title, b.Title, StringComparison.CurrentCultureIgnoreCase)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int CompareNullableDateTimeDesc(DateTime? d1, DateTime? d2, string title1, string title2)
|
||||||
|
{
|
||||||
|
if (d1.HasValue && d2.HasValue)
|
||||||
|
{
|
||||||
|
int cmp = d2.Value.CompareTo(d1.Value);
|
||||||
|
if (cmp != 0) return cmp;
|
||||||
|
}
|
||||||
|
else if (d1.HasValue)
|
||||||
|
{
|
||||||
|
return -1; // 値がある方を上に
|
||||||
|
}
|
||||||
|
else if (d2.HasValue)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Compare(title1, title2, StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int CompareNullableDateTimeAsc(DateTime? d1, DateTime? d2, string title1, string title2)
|
||||||
|
{
|
||||||
|
if (d1.HasValue && d2.HasValue)
|
||||||
|
{
|
||||||
|
int cmp = d1.Value.CompareTo(d2.Value);
|
||||||
|
if (cmp != 0) return cmp;
|
||||||
|
}
|
||||||
|
else if (d1.HasValue)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (d2.HasValue)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Compare(title1, title2, StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 動的プラグインの定義情報
|
||||||
|
/// </summary>
|
||||||
|
public class ModPluginDefinition
|
||||||
|
{
|
||||||
|
public string Id { get; set; } = string.Empty; // プラグイン識別名 (例: "BattleSpeedUp")
|
||||||
|
public string Name { get; set; } = string.Empty; // 表示名
|
||||||
|
public string Description { get; set; } = string.Empty; // 説明文
|
||||||
|
public string FileName { get; set; } = string.Empty; // ファイル名 (例: "BattleSpeedUp.js")
|
||||||
|
public string FilePath { get; set; } = string.Empty; // フルパス
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// .js ファイルから定義情報を解析・生成します。
|
||||||
|
/// </summary>
|
||||||
|
public static ModPluginDefinition FromFile(string filePath)
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
var id = Path.GetFileNameWithoutExtension(filePath);
|
||||||
|
string desc = string.Empty;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string text = File.ReadAllText(filePath);
|
||||||
|
var match = Regex.Match(text, @"@plugindesc\s+(.*)");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
desc = match.Groups[1].Value.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
string displayName = GetFriendlyName(id, desc);
|
||||||
|
|
||||||
|
return new ModPluginDefinition
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = displayName,
|
||||||
|
Description = desc,
|
||||||
|
FileName = fileName,
|
||||||
|
FilePath = filePath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetFriendlyName(string id, string desc)
|
||||||
|
{
|
||||||
|
return id switch
|
||||||
|
{
|
||||||
|
"BattleSpeedUp" => "戦闘高速化 (ウェイト削除・アニメ早送り)",
|
||||||
|
"DashSpeedUp" => "ダッシュ高速化 (移動速度+2)",
|
||||||
|
"ItemNoConsume" => "アイテム消費無効 (何度でも使用可能)",
|
||||||
|
"ShopMaxBuy" => "ショップ初期個数最大 (購入初期値をMAXに)",
|
||||||
|
"ItemGainMax" => "アイテム入手時MAX (所持数最大99個)",
|
||||||
|
"BattleTurnRecoverHp" => "ターン開始時HP全回復 (味方HP全快)",
|
||||||
|
"BattleTurnRecoverMp" => "ターン開始時MP全回復 (味方MP全快)",
|
||||||
|
"BattleTurnRecoverTp" => "ターン開始時TP全回復 (味方TP全快)",
|
||||||
|
"BattleTurnRecover" => "ターン開始時全回復 (HP/MP/TP全快)",
|
||||||
|
"GoldGainMax" => "所持金増減時MAX (9999999G)",
|
||||||
|
"ExpGainMax" => "経験値獲得時MAX (一気にLv99)",
|
||||||
|
"MessageInstant" => "メッセージ瞬間表示 (ウェイトスキップ)",
|
||||||
|
_ => !string.IsNullOrEmpty(desc) ? $"{id} ({desc})" : id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲームごとのプラグイン有効/無効設定アイテム(UIバインド用)
|
||||||
|
/// </summary>
|
||||||
|
public class ModPluginOptionItem : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private bool _isEnabled = true;
|
||||||
|
|
||||||
|
public ModPluginDefinition Definition { get; set; } = null!;
|
||||||
|
public string Id => Definition.Id;
|
||||||
|
public string Name => Definition.Name;
|
||||||
|
public string Description => Definition.Description;
|
||||||
|
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get => _isEnabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isEnabled != value)
|
||||||
|
{
|
||||||
|
_isEnabled = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string? name = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// セーブデータ内の1つのプロパティ(変数・項目)を表すGUI表示・編集モデル
|
||||||
|
/// </summary>
|
||||||
|
public class SaveDataPropertyEntry : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private string _key = string.Empty;
|
||||||
|
private string _category = string.Empty;
|
||||||
|
private string _type = string.Empty;
|
||||||
|
private string _editValue = string.Empty;
|
||||||
|
private bool _isModified;
|
||||||
|
private string _description = string.Empty;
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>項目名(キー名、変数名)</summary>
|
||||||
|
public string Key
|
||||||
|
{
|
||||||
|
get => _key;
|
||||||
|
set { if (_key != value) { _key = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary>
|
||||||
|
public string Category
|
||||||
|
{
|
||||||
|
get => _category;
|
||||||
|
set { if (_category != value) { _category = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>データ型(Int, Float, Bool, String など)</summary>
|
||||||
|
public string Type
|
||||||
|
{
|
||||||
|
get => _type;
|
||||||
|
set { if (_type != value) { _type = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>GUI編集用の値文字列</summary>
|
||||||
|
public string EditValue
|
||||||
|
{
|
||||||
|
get => _editValue;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_editValue != value)
|
||||||
|
{
|
||||||
|
_editValue = value;
|
||||||
|
_isModified = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(IsModified));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>値がユーザーによって変更されたかどうか</summary>
|
||||||
|
public bool IsModified
|
||||||
|
{
|
||||||
|
get => _isModified;
|
||||||
|
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>備考・説明・オフセット位置など</summary>
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => _description;
|
||||||
|
set { if (_description != value) { _description = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>内部保持用の生データや元データ(再エンコード用)</summary>
|
||||||
|
public object? RawData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,348 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 各プラグイン改造の個別有効/無効オプション(互換用)
|
||||||
|
/// </summary>
|
||||||
|
public class ModPluginOptions : System.ComponentModel.INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private bool _speedUp = true;
|
||||||
|
private bool _antigravityGameTweaks = true;
|
||||||
|
private bool _dropItem99 = true;
|
||||||
|
private bool _turnStartFullRecover = true;
|
||||||
|
private bool _turnStartFullRecoverHp = true;
|
||||||
|
private bool _turnStartFullRecoverMp = true;
|
||||||
|
private bool _turnStartFullRecoverTp = true;
|
||||||
|
private bool _maxGainGold = true;
|
||||||
|
private bool _maxGainExp = true;
|
||||||
|
private bool _instantMessage = true;
|
||||||
|
|
||||||
|
public bool SpeedUp
|
||||||
|
{
|
||||||
|
get => _speedUp;
|
||||||
|
set { if (_speedUp != value) { _speedUp = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AntigravityGameTweaks
|
||||||
|
{
|
||||||
|
get => _antigravityGameTweaks;
|
||||||
|
set { if (_antigravityGameTweaks != value) { _antigravityGameTweaks = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DropItem99
|
||||||
|
{
|
||||||
|
get => _dropItem99;
|
||||||
|
set { if (_dropItem99 != value) { _dropItem99 = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TurnStartFullRecover
|
||||||
|
{
|
||||||
|
get => _turnStartFullRecover;
|
||||||
|
set { if (_turnStartFullRecover != value) { _turnStartFullRecover = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TurnStartFullRecoverHp
|
||||||
|
{
|
||||||
|
get => _turnStartFullRecoverHp;
|
||||||
|
set { if (_turnStartFullRecoverHp != value) { _turnStartFullRecoverHp = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TurnStartFullRecoverMp
|
||||||
|
{
|
||||||
|
get => _turnStartFullRecoverMp;
|
||||||
|
set { if (_turnStartFullRecoverMp != value) { _turnStartFullRecoverMp = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TurnStartFullRecoverTp
|
||||||
|
{
|
||||||
|
get => _turnStartFullRecoverTp;
|
||||||
|
set { if (_turnStartFullRecoverTp != value) { _turnStartFullRecoverTp = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MaxGainGold
|
||||||
|
{
|
||||||
|
get => _maxGainGold;
|
||||||
|
set { if (_maxGainGold != value) { _maxGainGold = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MaxGainExp
|
||||||
|
{
|
||||||
|
get => _maxGainExp;
|
||||||
|
set { if (_maxGainExp != value) { _maxGainExp = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool InstantMessage
|
||||||
|
{
|
||||||
|
get => _instantMessage;
|
||||||
|
set { if (_instantMessage != value) { _instantMessage = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
protected void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string? name = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ツクールおよびティラノスクリプトゲームのデータモデル
|
||||||
|
/// </summary>
|
||||||
|
public class TkoolGameItem : GameItemBase
|
||||||
|
{
|
||||||
|
private string _pluginsJsPath = string.Empty;
|
||||||
|
private string _pluginsDirPath = string.Empty;
|
||||||
|
private TkoolEngineType _engineType = TkoolEngineType.Unknown;
|
||||||
|
private bool _isModded;
|
||||||
|
private bool _applyMod = true;
|
||||||
|
private bool _hasCustomApplyMod;
|
||||||
|
private bool _isInitializingApplyMod;
|
||||||
|
private ModPluginOptions _modOptions = new();
|
||||||
|
|
||||||
|
// app.asar 関連プロパティ
|
||||||
|
private bool _isAsar;
|
||||||
|
private bool _isAsarExtracted;
|
||||||
|
private string? _asarPath;
|
||||||
|
private string? _asarExtractedDirPath;
|
||||||
|
private string? _relativePluginsJsInAsar;
|
||||||
|
|
||||||
|
public override GameEngineKind EngineKind => EngineType == TkoolEngineType.Tyrano
|
||||||
|
? GameEngineKind.Tyrano
|
||||||
|
: GameEngineKind.Tkool;
|
||||||
|
|
||||||
|
public string PluginsJsPath
|
||||||
|
{
|
||||||
|
get => _pluginsJsPath;
|
||||||
|
set { if (_pluginsJsPath != value) { _pluginsJsPath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PluginsDirPath
|
||||||
|
{
|
||||||
|
get => _pluginsDirPath;
|
||||||
|
set { if (_pluginsDirPath != value) { _pluginsDirPath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsMV => EngineType == TkoolEngineType.MV;
|
||||||
|
public override bool IsMZ => EngineType == TkoolEngineType.MZ;
|
||||||
|
public override bool IsTyrano => EngineType == TkoolEngineType.Tyrano;
|
||||||
|
|
||||||
|
public TkoolEngineType EngineType
|
||||||
|
{
|
||||||
|
get => _engineType;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_engineType != value)
|
||||||
|
{
|
||||||
|
_engineType = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(EngineKind));
|
||||||
|
OnPropertyChanged(nameof(EngineDisplayName));
|
||||||
|
OnPropertyChanged(nameof(IsMV));
|
||||||
|
OnPropertyChanged(nameof(IsMZ));
|
||||||
|
OnPropertyChanged(nameof(IsTyrano));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsModded
|
||||||
|
{
|
||||||
|
get => _isModded;
|
||||||
|
set { if (_isModded != value) { _isModded = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasCustomApplyMod
|
||||||
|
{
|
||||||
|
get => _hasCustomApplyMod;
|
||||||
|
set { if (_hasCustomApplyMod != value) { _hasCustomApplyMod = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool ApplyMod
|
||||||
|
{
|
||||||
|
get => _applyMod;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_applyMod != value)
|
||||||
|
{
|
||||||
|
_applyMod = value;
|
||||||
|
if (!_isInitializingApplyMod)
|
||||||
|
{
|
||||||
|
HasCustomApplyMod = true;
|
||||||
|
}
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDefaultApplyMod(bool defaultVal)
|
||||||
|
{
|
||||||
|
if (!_hasCustomApplyMod)
|
||||||
|
{
|
||||||
|
_isInitializingApplyMod = true;
|
||||||
|
_applyMod = defaultVal;
|
||||||
|
_isInitializingApplyMod = false;
|
||||||
|
OnPropertyChanged(nameof(ApplyMod));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsAsar
|
||||||
|
{
|
||||||
|
get => _isAsar;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isAsar != value)
|
||||||
|
{
|
||||||
|
_isAsar = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(AsarBadgeVisibility));
|
||||||
|
OnPropertyChanged(nameof(AsarBadgeText));
|
||||||
|
OnPropertyChanged(nameof(AsarBadgeBackground));
|
||||||
|
OnPropertyChanged(nameof(AsarDetailStatusText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsAsarExtracted
|
||||||
|
{
|
||||||
|
get => _isAsarExtracted;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isAsarExtracted != value)
|
||||||
|
{
|
||||||
|
_isAsarExtracted = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(AsarBadgeText));
|
||||||
|
OnPropertyChanged(nameof(AsarBadgeBackground));
|
||||||
|
OnPropertyChanged(nameof(AsarDetailStatusText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? AsarPath
|
||||||
|
{
|
||||||
|
get => _asarPath;
|
||||||
|
set { if (_asarPath != value) { _asarPath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? AsarExtractedDirPath
|
||||||
|
{
|
||||||
|
get => _asarExtractedDirPath;
|
||||||
|
set { if (_asarExtractedDirPath != value) { _asarExtractedDirPath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? RelativePluginsJsInAsar
|
||||||
|
{
|
||||||
|
get => _relativePluginsJsInAsar;
|
||||||
|
set { if (_relativePluginsJsInAsar != value) { _relativePluginsJsInAsar = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Visibility AsarBadgeVisibility => IsAsar ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
|
public override string AsarBadgeText => !IsAsar ? string.Empty : (IsAsarExtracted ? "ASAR (解凍済)" : "ASAR (圧縮)");
|
||||||
|
|
||||||
|
public override Brush AsarBadgeBackground => IsAsarExtracted
|
||||||
|
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
|
||||||
|
: new SolidColorBrush(Color.FromRgb(0x5E, 0x35, 0xB1));
|
||||||
|
|
||||||
|
public override string AsarDetailStatusText => !IsAsar
|
||||||
|
? string.Empty
|
||||||
|
: (IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)");
|
||||||
|
|
||||||
|
private Dictionary<string, bool> _pluginSettings = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
private ObservableCollection<ModPluginOptionItem> _pluginOptions = [];
|
||||||
|
|
||||||
|
public Dictionary<string, bool> PluginSettings
|
||||||
|
{
|
||||||
|
get => _pluginSettings;
|
||||||
|
set { if (_pluginSettings != value) { _pluginSettings = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ObservableCollection<ModPluginOptionItem> PluginOptions
|
||||||
|
{
|
||||||
|
get => _pluginOptions;
|
||||||
|
set { if (_pluginOptions != value) { _pluginOptions = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPluginEnabled(string pluginId, Dictionary<string, bool>? defaultSettings = null, bool fallbackVal = true)
|
||||||
|
{
|
||||||
|
if (_pluginSettings.TryGetValue(pluginId, out var val))
|
||||||
|
{
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp")
|
||||||
|
{
|
||||||
|
if (_pluginSettings.TryGetValue("BattleTurnRecover", out var legacyVal))
|
||||||
|
{
|
||||||
|
return legacyVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultSettings != null && defaultSettings.TryGetValue(pluginId, out var defVal))
|
||||||
|
{
|
||||||
|
return defVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp")
|
||||||
|
{
|
||||||
|
if (defaultSettings != null && defaultSettings.TryGetValue("BattleTurnRecover", out var legacyDefVal))
|
||||||
|
{
|
||||||
|
return legacyDefVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallbackVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly ModPluginDefinition[] DefaultTyranoPlugins =
|
||||||
|
[
|
||||||
|
new() { Id = "TyranoUnlockAllCg", Name = "🔓 全CG・全回想の全開放", Description = "システム変数(sf)のCG・回想フラグを全開放し、最初からCG・シーン鑑賞を可能にします。" },
|
||||||
|
new() { Id = "TyranoFastMessage", Name = "⚡ メッセージ超高速化・演出ウェイト短縮", Description = "文字送り速度を最大化し、[wait]演出の停止時間を短縮して快適にスキップ可能にします。" },
|
||||||
|
new() { Id = "TyranoDevTools", Name = "🛠 開発者ツール (F12) の有効化", Description = "F12キーでブラウザ・アプリの開発者ツールコンソールを開けるようにします。" },
|
||||||
|
new() { Id = "TyranoCheatMenu", Name = "🎛 画面上変数(f)チートエディタ表示", Description = "画面右上にボタンを配置し、ゲーム内変数・フラグの閲覧と直接書き換えができるメニューを表示します。" }
|
||||||
|
];
|
||||||
|
|
||||||
|
public void SyncPluginOptions(IEnumerable<ModPluginDefinition> availablePlugins, Dictionary<string, bool>? defaultSettings = null)
|
||||||
|
{
|
||||||
|
_pluginOptions.Clear();
|
||||||
|
var targetDefs = EngineType == TkoolEngineType.Tyrano ? DefaultTyranoPlugins : availablePlugins;
|
||||||
|
|
||||||
|
foreach (var def in targetDefs)
|
||||||
|
{
|
||||||
|
bool isEnabled = IsPluginEnabled(def.Id, defaultSettings, fallbackVal: true);
|
||||||
|
var item = new ModPluginOptionItem
|
||||||
|
{
|
||||||
|
Definition = def,
|
||||||
|
IsEnabled = isEnabled
|
||||||
|
};
|
||||||
|
item.PropertyChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(ModPluginOptionItem.IsEnabled))
|
||||||
|
{
|
||||||
|
_pluginSettings[def.Id] = item.IsEnabled;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_pluginOptions.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModPluginOptions ModOptions
|
||||||
|
{
|
||||||
|
get => _modOptions;
|
||||||
|
set { if (_modOptions != value) { _modOptions = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string EngineDisplayName => EngineType switch
|
||||||
|
{
|
||||||
|
TkoolEngineType.MV => "RPGツクールMV",
|
||||||
|
TkoolEngineType.MZ => "RPGツクールMZ",
|
||||||
|
TkoolEngineType.Tyrano => "ティラノスクリプト",
|
||||||
|
_ => "ツクール/ティラノ"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ゲームエンジンの大分類
|
||||||
|
/// </summary>
|
||||||
|
public enum GameEngineKind
|
||||||
|
{
|
||||||
|
Tkool,
|
||||||
|
Tyrano,
|
||||||
|
Unity
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ツクールのエンジンの種類
|
||||||
|
/// </summary>
|
||||||
|
public enum TkoolEngineType
|
||||||
|
{
|
||||||
|
MV,
|
||||||
|
MZ,
|
||||||
|
Tyrano,
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unityのビルドバックエンド形式
|
||||||
|
/// </summary>
|
||||||
|
public enum UnityBackendType
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Mono = 1,
|
||||||
|
IL2CPP = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲーム一覧のソート順
|
||||||
|
/// </summary>
|
||||||
|
public enum GameSortOrder
|
||||||
|
{
|
||||||
|
LastLaunchedDesc = 0, // 最終実行 (新しい順)
|
||||||
|
LastLaunchedAsc = 1, // 最終実行 (古い順)
|
||||||
|
FolderLastModifiedDesc = 2, // フォルダ更新日時 (新しい順)
|
||||||
|
FolderLastModifiedAsc = 3, // フォルダ更新日時 (古い順)
|
||||||
|
TitleAsc = 4, // タイトル (昇順)
|
||||||
|
TitleDesc = 5, // タイトル (降順)
|
||||||
|
FolderNameAsc = 6 // フォルダ名 (昇順)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブデータの格納ソース種別
|
||||||
|
/// </summary>
|
||||||
|
public enum SaveSourceType
|
||||||
|
{
|
||||||
|
RegistryPlayerPrefs = 0,
|
||||||
|
LocalLowFile = 1,
|
||||||
|
GameFolderFile = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefs値のデータ型
|
||||||
|
/// </summary>
|
||||||
|
public enum PlayerPrefsType
|
||||||
|
{
|
||||||
|
Int = 0,
|
||||||
|
Float = 1,
|
||||||
|
String = 2,
|
||||||
|
Binary = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブデータコーデック種別
|
||||||
|
/// </summary>
|
||||||
|
public enum SaveCodecType
|
||||||
|
{
|
||||||
|
RawText = 0,
|
||||||
|
Json = 1,
|
||||||
|
EasySave3 = 2,
|
||||||
|
YurisSave = 3,
|
||||||
|
Binary = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unityゲームのデータモデル
|
||||||
|
/// </summary>
|
||||||
|
public class UnityGameItem : GameItemBase
|
||||||
|
{
|
||||||
|
private string _dataDirectoryPath = string.Empty;
|
||||||
|
private string _companyName = string.Empty;
|
||||||
|
private string _productName = string.Empty;
|
||||||
|
private UnityBackendType _backendType = UnityBackendType.Unknown;
|
||||||
|
private string _unityVersion = string.Empty;
|
||||||
|
private bool _hasSaveData;
|
||||||
|
|
||||||
|
public override GameEngineKind EngineKind => GameEngineKind.Unity;
|
||||||
|
|
||||||
|
/// <summary>[Game]_Data ディレクトリ絶対パス</summary>
|
||||||
|
public string DataDirectoryPath
|
||||||
|
{
|
||||||
|
get => _dataDirectoryPath;
|
||||||
|
set { if (_dataDirectoryPath != value) { _dataDirectoryPath = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>app.info 由来の会社名/開発者名</summary>
|
||||||
|
public string CompanyName
|
||||||
|
{
|
||||||
|
get => _companyName;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_companyName != value)
|
||||||
|
{
|
||||||
|
_companyName = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(RegistryPath));
|
||||||
|
OnPropertyChanged(nameof(LocalLowPath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>app.info 由来の製品名</summary>
|
||||||
|
public string ProductName
|
||||||
|
{
|
||||||
|
get => _productName;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_productName != value)
|
||||||
|
{
|
||||||
|
_productName = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(RegistryPath));
|
||||||
|
OnPropertyChanged(nameof(LocalLowPath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsIL2CPP => BackendType == UnityBackendType.IL2CPP;
|
||||||
|
public override bool IsMono => BackendType == UnityBackendType.Mono;
|
||||||
|
|
||||||
|
/// <summary>バックエンド形式 (IL2CPP / Mono)</summary>
|
||||||
|
public UnityBackendType BackendType
|
||||||
|
{
|
||||||
|
get => _backendType;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_backendType != value)
|
||||||
|
{
|
||||||
|
_backendType = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(BackendBadgeText));
|
||||||
|
OnPropertyChanged(nameof(IsIL2CPP));
|
||||||
|
OnPropertyChanged(nameof(IsMono));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Unityバージョン文字列</summary>
|
||||||
|
public override string UnityVersion
|
||||||
|
{
|
||||||
|
get => _unityVersion;
|
||||||
|
set { if (_unityVersion != value) { _unityVersion = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>セーブデータ(レジストリまたはファイル)が検出されたかどうか</summary>
|
||||||
|
public override bool HasSaveData
|
||||||
|
{
|
||||||
|
get => _hasSaveData;
|
||||||
|
set { if (_hasSaveData != value) { _hasSaveData = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// レジストリ (PlayerPrefs) のキーパス
|
||||||
|
/// HKCU\Software\[CompanyName]\[ProductName]
|
||||||
|
/// </summary>
|
||||||
|
public override string RegistryPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName))
|
||||||
|
return string.Empty;
|
||||||
|
return $@"Software\{CompanyName}\{ProductName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LocalLow のセーブデータ保存ディレクトリ
|
||||||
|
/// %USERPROFILE%\AppData\LocalLow\[CompanyName]\[ProductName]
|
||||||
|
/// </summary>
|
||||||
|
public override string LocalLowPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
|
var appData = Path.GetDirectoryName(localAppData);
|
||||||
|
if (string.IsNullOrEmpty(appData)) return string.Empty;
|
||||||
|
|
||||||
|
return Path.Combine(appData, "LocalLow", CompanyName, ProductName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string BackendBadgeText => BackendType switch
|
||||||
|
{
|
||||||
|
UnityBackendType.IL2CPP => "IL2CPP",
|
||||||
|
UnityBackendType.Mono => "Mono",
|
||||||
|
_ => "Unity"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace GameLauncher.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefs(レジストリ)の1エントリを表すモデル
|
||||||
|
/// </summary>
|
||||||
|
public class PlayerPrefsEntry : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private string _rawKey = string.Empty;
|
||||||
|
private string _cleanKey = string.Empty;
|
||||||
|
private PlayerPrefsType _type = PlayerPrefsType.Int;
|
||||||
|
private object? _value;
|
||||||
|
private string _editValue = string.Empty;
|
||||||
|
private bool _isModified;
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary>
|
||||||
|
public string RawKey
|
||||||
|
{
|
||||||
|
get => _rawKey;
|
||||||
|
set { if (_rawKey != value) { _rawKey = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary>
|
||||||
|
public string CleanKey
|
||||||
|
{
|
||||||
|
get => _cleanKey;
|
||||||
|
set { if (_cleanKey != value) { _cleanKey = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>値のデータ型</summary>
|
||||||
|
public PlayerPrefsType Type
|
||||||
|
{
|
||||||
|
get => _type;
|
||||||
|
set { if (_type != value) { _type = value; OnPropertyChanged(); OnPropertyChanged(nameof(TypeDisplay)); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>実際の値(int, float, string, byte[])</summary>
|
||||||
|
public object? Value
|
||||||
|
{
|
||||||
|
get => _value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Equals(_value, value))
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
UpdateEditValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>UI表示・編集用の文字列値</summary>
|
||||||
|
public string EditValue
|
||||||
|
{
|
||||||
|
get => _editValue;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_editValue != value)
|
||||||
|
{
|
||||||
|
_editValue = value;
|
||||||
|
_isModified = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(IsModified));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>値が変更されたかどうか</summary>
|
||||||
|
public bool IsModified
|
||||||
|
{
|
||||||
|
get => _isModified;
|
||||||
|
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TypeDisplay => Type switch
|
||||||
|
{
|
||||||
|
PlayerPrefsType.Int => "Int (数値)",
|
||||||
|
PlayerPrefsType.Float => "Float (小数)",
|
||||||
|
PlayerPrefsType.String => "String (文字列)",
|
||||||
|
PlayerPrefsType.Binary => "Binary (バイナリ)",
|
||||||
|
_ => "Unknown"
|
||||||
|
};
|
||||||
|
|
||||||
|
private void UpdateEditValue()
|
||||||
|
{
|
||||||
|
if (_value == null)
|
||||||
|
{
|
||||||
|
_editValue = string.Empty;
|
||||||
|
}
|
||||||
|
else if (_value is byte[] bytes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0');
|
||||||
|
if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t'))
|
||||||
|
{
|
||||||
|
_editValue = text;
|
||||||
|
_type = PlayerPrefsType.String;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (bytes.Length == 4)
|
||||||
|
{
|
||||||
|
float f = BitConverter.ToSingle(bytes, 0);
|
||||||
|
if (!float.IsNaN(f) && !float.IsInfinity(f))
|
||||||
|
{
|
||||||
|
_editValue = f.ToString("G");
|
||||||
|
_type = PlayerPrefsType.Float;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_editValue = BitConverter.ToString(bytes).Replace("-", " ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_editValue = _value.ToString() ?? string.Empty;
|
||||||
|
}
|
||||||
|
_isModified = false;
|
||||||
|
OnPropertyChanged(nameof(EditValue));
|
||||||
|
OnPropertyChanged(nameof(IsModified));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ディスク上のセーブファイル(LocalLow または ゲームフォルダ内)を表すモデル
|
||||||
|
/// </summary>
|
||||||
|
public class SaveFileEntry
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string FilePath { get; set; } = string.Empty;
|
||||||
|
public long FileSize { get; set; }
|
||||||
|
public DateTime LastModified { get; set; }
|
||||||
|
public string LocationType { get; set; } = string.Empty; // "LocalLow" または "ゲームフォルダ"
|
||||||
|
public bool IsTextOrJson { get; set; }
|
||||||
|
|
||||||
|
public string FileSizeDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (FileSize < 1024) return $"{FileSize} B";
|
||||||
|
if (FileSize < 1024 * 1024) return $"{FileSize / 1024.0:F1} KB";
|
||||||
|
return $"{FileSize / (1024.0 * 1024.0):F2} MB";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LastModifiedDisplay => LastModified.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブデータのバックアップ履歴モデル
|
||||||
|
/// </summary>
|
||||||
|
public class SaveBackupEntry
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string BackupPath { get; set; } = string.Empty;
|
||||||
|
public DateTime Timestamp { get; set; }
|
||||||
|
public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル"
|
||||||
|
public string Note { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string TimestampDisplay => Timestamp.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# GameLauncher (ツクールMV・MZ・ティラノ & Unity 統合ゲームランチャー)
|
||||||
|
|
||||||
|
RPGツクール(MV・MZ)、ティラノスクリプト、およびUnity製ゲームを1つの洗練された画面で一元管理・高速起動できる統合ランチャーです。
|
||||||
|
従来の **TkoolLauncher** と **UnityLauncher** の全機能(スクリプト改造、ASAR解凍・復元、PlayerPrefsレジストリ編集、セーブファイル編集、バックアップ)が欠けることなく完全に統合されています。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🌟 主な機能一覧
|
||||||
|
|
||||||
|
### 1. 高速ゲーム検出 & キャッシュロード
|
||||||
|
- **対象ディレクトリ**:
|
||||||
|
- `C:\Users\uduki\Downloads\Brave\@Game\`
|
||||||
|
- `Z:\game\R18同人\`
|
||||||
|
- (設定ファイル `config.json` により任意の追加ディレクトリに対応)
|
||||||
|
- **瞬時起動(0秒ロード)**: `games_cache.json` によるキャッシュ起動と、バックグラウンドでの実在検証・差分スキャン。
|
||||||
|
- **自動インポート**: 初回起動時に旧 TkoolLauncher および UnityLauncher のキャッシュを自動認識・統合インポート。
|
||||||
|
|
||||||
|
### 2. 直感的なUI & 切り替え
|
||||||
|
- **上部ナビゲーションタブ**:
|
||||||
|
- `🎮⚡ すべて`: 検出された全ゲームをまとめて一覧表示
|
||||||
|
- `🎮 ツクール・ティラノ`: ツクールMV/MZおよびティラノスクリプトのみに絞り込み
|
||||||
|
- `⚡ Unity`: Unity製ゲームのみに絞り込み
|
||||||
|
- **インクリメンタル検索 & ソート**:
|
||||||
|
- タイトル、フォルダ名、開発元(会社名・製品名)によるリアルタイム検索
|
||||||
|
- 最終実行日時(新しい順/古い順)、フォルダ更新日時(新しい順/古い順)、タイトル順、フォルダ名順でのソート
|
||||||
|
- **連動フィルター**:
|
||||||
|
- ツクール選択時: MV / MZ / ティラノ / 改造中のみ / ASAR形式のみ
|
||||||
|
- Unity選択時: IL2CPP / Mono / セーブデータありのみ
|
||||||
|
|
||||||
|
### 3. ツクール & ティラノスクリプト機能(旧 TkoolLauncher 完全継承)
|
||||||
|
- **app.asar パッケージ管理**:
|
||||||
|
- Electronパッケージ(`app.asar`)の自動検出とバッジ表示(圧縮 / 解凍済)
|
||||||
|
- ワンクリックでの ASAR 解凍(`resources\app` に展開、元ファイルを安全にリネームバックアップ)
|
||||||
|
- ワンクリックでの ASAR 復元(元状態に戻す)
|
||||||
|
- **動的スクリプト改造(MOD)**:
|
||||||
|
- `plugins/` フォルダ内のスクリプトを動的検出し、個別ON/OFF可能
|
||||||
|
- 戦闘高速化、ダッシュ速度+2、アイテム消費無効、所持金最大、経験値最大、メッセージ瞬間表示など
|
||||||
|
- ティラノスクリプト専用: 全CG・全回想の全開放、演出短縮、F12開発者ツール有効化、チートメニュー表示
|
||||||
|
- ワンクリックでのオリジナル復元(改造解除)
|
||||||
|
- プロファイルフォルダ・`plugins.js` へのクイックアクセス
|
||||||
|
|
||||||
|
### 4. Unity セーブデータ統合エディタ & 管理(旧 UnityLauncher 完全継承)
|
||||||
|
- **セーブエディタ(SaveEditorWindow)**:
|
||||||
|
- **PlayerPrefs(レジストリ)**: 数値(Int)、浮動小数点(Float)、文字列(String)、バイナリ(Hex)の直接編集・新規キー追加(MurmurHash2自動付与)・削除
|
||||||
|
- **セーブファイル(LocalLow / ゲームフォルダ内)**: テキスト・JSONセーブデータのインライン閲覧・編集・保存・JSON整形
|
||||||
|
- **専用コーデック**: EasySave3 (ES3)、YU-RIS セーブデータの自動判定・復号編集
|
||||||
|
- **クイックアクセス & バックアップ**:
|
||||||
|
- ゲームフォルダを開く
|
||||||
|
- LocalLow セーブフォルダを開く
|
||||||
|
- regedit で PlayerPrefs を直接開く
|
||||||
|
- セーブデータ(レジストリ & ファイル)の即時一括バックアップ(`Backups/` ディレクトリ)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💻 動作環境 & 技術スタック
|
||||||
|
- **プラットフォーム**: Windows (x64)
|
||||||
|
- **ターゲットフレームワーク**: .NET 10.0 (`net10.0-windows`)
|
||||||
|
- **UIフレームワーク**: WPF (Windows Presentation Foundation)
|
||||||
|
- **UIテーマ**: ダークモダンデザイン
|
||||||
|
- **配布形態**: 単一ファイル実行可能ファイル (`GameLauncher.exe`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 発行(ビルド)先 & 実行方法
|
||||||
|
|
||||||
|
- **プロジェクトパス**: `c:\VS2026\GameLauncher`
|
||||||
|
- **公開先**: `Z:\自作ソフト\GameLauncher\GameLauncher.exe`
|
||||||
|
- **プロファイル格納先**: `Z:\自作ソフト\GameLauncher\Profiles\`
|
||||||
|
- **セーブバックアップ先**: `Z:\自作ソフト\GameLauncher\Backups\`
|
||||||
|
- **プラグイン格納先**: `Z:\自作ソフト\GameLauncher\plugins\`
|
||||||
|
|
||||||
|
### 発行方法
|
||||||
|
`publish.bat` または `publish.ps1` を実行することで、自動的に単一ファイルとして `Z:\自作ソフト\GameLauncher\` に出力されます。
|
||||||
|
```powershell
|
||||||
|
dotnet publish "c:\VS2026\GameLauncher\GameLauncher.csproj" -c Release -r win-x64 --self-contained false -o "Z:\自作ソフト\GameLauncher"
|
||||||
|
```
|
||||||
@@ -0,0 +1,541 @@
|
|||||||
|
<Window x:Class="GameLauncher.SaveEditorWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:GameLauncher"
|
||||||
|
xmlns:helpers="clr-namespace:GameLauncher.Helpers"
|
||||||
|
xmlns:models="clr-namespace:GameLauncher.Models"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Unity セーブエディタ" Height="720" Width="1080"
|
||||||
|
MinHeight="550" MinWidth="850"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
Background="#181820" Foreground="#E0E0E6"
|
||||||
|
FontFamily="Segoe UI, Meiryo UI, Yu Gothic UI">
|
||||||
|
|
||||||
|
<Window.Resources>
|
||||||
|
<!-- カラーパレット -->
|
||||||
|
<SolidColorBrush x:Key="BgDark" Color="#181820"/>
|
||||||
|
<SolidColorBrush x:Key="CardBg" Color="#22222C"/>
|
||||||
|
<SolidColorBrush x:Key="CardHoverBg" Color="#2C2C3A"/>
|
||||||
|
<SolidColorBrush x:Key="CardSelectedBg" Color="#333348"/>
|
||||||
|
<SolidColorBrush x:Key="SidePanelBg" Color="#1F1F2A"/>
|
||||||
|
<SolidColorBrush x:Key="BorderBrushColor" Color="#38384C"/>
|
||||||
|
<SolidColorBrush x:Key="TextPrimary" Color="#F2F2F7"/>
|
||||||
|
<SolidColorBrush x:Key="TextSecondary" Color="#9E9EB4"/>
|
||||||
|
<SolidColorBrush x:Key="AccentPrimary" Color="#6C5CE7"/>
|
||||||
|
<SolidColorBrush x:Key="AccentHover" Color="#7D6DF8"/>
|
||||||
|
<SolidColorBrush x:Key="AccentGreen" Color="#00B894"/>
|
||||||
|
<SolidColorBrush x:Key="AccentGreenHover" Color="#10D3AC"/>
|
||||||
|
<SolidColorBrush x:Key="AccentRed" Color="#D63031"/>
|
||||||
|
|
||||||
|
<!-- ボタン標準スタイル -->
|
||||||
|
<Style x:Key="ModernButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#2E2E3E"/>
|
||||||
|
<Setter Property="Foreground" Value="#E0E0E6"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#44445A"/>
|
||||||
|
<Setter Property="Padding" Value="12,6"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#3D3D52"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- プライマリ緑ボタンスタイル -->
|
||||||
|
<Style x:Key="PrimaryGreenButton" TargetType="Button" BasedOn="{StaticResource ModernButton}">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentGreen}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource AccentGreen}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentGreenHover}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource AccentGreenHover}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- タブコントロールスタイル -->
|
||||||
|
<Style TargetType="TabControl">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="TabItem">
|
||||||
|
<Setter Property="Background" Value="#1E1E28"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Padding" Value="16,8"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,2"/>
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,6,0"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TabItem">
|
||||||
|
<Border x:Name="border" Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="6,6,0,0" Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
ContentSource="Header"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#292938"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#252535"/>
|
||||||
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource AccentPrimary}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- DataGridスタイル -->
|
||||||
|
<Style TargetType="DataGrid">
|
||||||
|
<Setter Property="Background" Value="#1C1C26"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushColor}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="RowBackground" Value="#20202C"/>
|
||||||
|
<Setter Property="AlternatingRowBackground" Value="#242434"/>
|
||||||
|
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
|
||||||
|
<Setter Property="HorizontalGridLinesBrush" Value="#2D2D3E"/>
|
||||||
|
<Setter Property="CanUserAddRows" Value="False"/>
|
||||||
|
<Setter Property="AutoGenerateColumns" Value="False"/>
|
||||||
|
<Setter Property="SelectionMode" Value="Single"/>
|
||||||
|
<Setter Property="RowHeight" Value="32"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="DataGridColumnHeader">
|
||||||
|
<Setter Property="Background" Value="#171720"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushColor}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||||
|
<Setter Property="Padding" Value="10,6"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource CardSelectedBg}"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="Padding" Value="8,2"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="DataGridCell">
|
||||||
|
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ヘッダー情報 -->
|
||||||
|
<RowDefinition Height="*"/> <!-- メインコンテンツ(タブ) -->
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ステータスバー -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- ================= ヘッダー情報 ================= -->
|
||||||
|
<Border Grid.Row="0" Background="#1C1C26" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,0,0,1" Padding="18,12">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,16,0">
|
||||||
|
<Border Width="40" Height="40" CornerRadius="6" Background="#14141E" BorderBrush="#38384C" BorderThickness="1" Margin="0,0,12,0">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="🛠" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.5"
|
||||||
|
Visibility="{Binding Game.IconImage, RelativeSource={RelativeSource AncestorType=local:SaveEditorWindow}, Converter={x:Static helpers:NullToVisibleConverter.Instance}}"/>
|
||||||
|
<Image Source="{Binding Game.IconImage, RelativeSource={RelativeSource AncestorType=local:SaveEditorWindow}}" Stretch="Uniform" Width="32" Height="32"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="lblGameTitle" Text="ゲームタイトル" FontSize="16" FontWeight="Bold" Foreground="{StaticResource TextPrimary}"/>
|
||||||
|
<TextBlock x:Name="lblGameInfo" Text="会社名 / 製品名" FontSize="11" Foreground="{StaticResource TextSecondary}" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- フォルダクイックオープン群 -->
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📂 LocalLowを開く" Click="btnOpenLocalLow_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📁 ゲームフォルダを開く" Click="btnOpenGameFolder_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="🌐 regeditで開く" Click="btnOpenRegedit_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- ================= メインコンテンツ(タブ) ================= -->
|
||||||
|
<TabControl x:Name="tabMain" Grid.Row="1" Margin="14,10,14,10">
|
||||||
|
<!-- [タブ1: PlayerPrefs (レジストリ)] -->
|
||||||
|
<TabItem Header="🔑 PlayerPrefs (レジストリ)">
|
||||||
|
<Grid Margin="0,8,0,0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ツールバー -->
|
||||||
|
<RowDefinition Height="*"/> <!-- グリッド一覧 -->
|
||||||
|
<RowDefinition Height="Auto"/> <!-- 編集パネル -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- ツールバー -->
|
||||||
|
<Border Grid.Row="0" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="10,8" Margin="0,0,0,10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 検索バー -->
|
||||||
|
<Border Grid.Column="0" Background="#262636" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Width="240" Height="30">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="26"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="🔍" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextSecondary}" FontSize="11"/>
|
||||||
|
<TextBox x:Name="txtSearchPrefs" Grid.Column="1" Background="Transparent" BorderThickness="0"
|
||||||
|
Foreground="{StaticResource TextPrimary}" VerticalAlignment="Center" FontSize="12"
|
||||||
|
TextChanged="txtSearchPrefs_TextChanged"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- アクションボタン群 -->
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="➕ 新規キー追加" Click="btnAddPref_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📦 レジストリバックアップ" Click="btnBackupPrefs_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="↩ バックアップから復元" Click="btnRestorePrefs_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="🔄 再読み込み" Click="btnReloadPrefs_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- PlayerPrefs 一覧 DataGrid -->
|
||||||
|
<DataGrid x:Name="dgPlayerPrefs" Grid.Row="1" SelectionChanged="dgPlayerPrefs_SelectionChanged">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="💾 選択した値を保存" Click="ctxSavePref_Click"/>
|
||||||
|
<MenuItem Header="📋 キー名をコピー" Click="ctxCopyKey_Click"/>
|
||||||
|
<MenuItem Header="📋 値をコピー" Click="ctxCopyValue_Click"/>
|
||||||
|
<Separator Background="{StaticResource BorderBrushColor}"/>
|
||||||
|
<MenuItem Header="❌ このキーを削除" Click="ctxDeletePref_Click" Foreground="#FF7675"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!-- キー名 (ハッシュ除去済み) -->
|
||||||
|
<DataGridTextColumn Header="キー名" Binding="{Binding CleanKey}" Width="2*" IsReadOnly="True"/>
|
||||||
|
<!-- 型 -->
|
||||||
|
<DataGridTextColumn Header="データ型" Binding="{Binding TypeDisplay}" Width="110" IsReadOnly="True"/>
|
||||||
|
<!-- 編集可能値 -->
|
||||||
|
<DataGridTextColumn Header="値 (ダブルクリックで直接編集可能)" Binding="{Binding EditValue, UpdateSourceTrigger=PropertyChanged}" Width="3*"/>
|
||||||
|
<!-- レジストリ生キー -->
|
||||||
|
<DataGridTextColumn Header="生キー名 (レジストリ上)" Binding="{Binding RawKey}" Width="2*" IsReadOnly="True" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<!-- 選択中エントリのインライン詳細編集バー -->
|
||||||
|
<Border Grid.Row="2" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="12,10" Margin="0,10,0,0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,12,0">
|
||||||
|
<TextBlock Text="選択キー:" Foreground="{StaticResource TextSecondary}" FontSize="12" Margin="0,0,6,0"/>
|
||||||
|
<TextBlock x:Name="lblSelectedKeyName" Text="(なし)" FontWeight="SemiBold" Foreground="{StaticResource TextPrimary}" FontSize="12"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBox x:Name="txtEditValueBar" Grid.Column="1" Background="#262636" BorderBrush="{StaticResource BorderBrushColor}"
|
||||||
|
BorderThickness="1" Padding="8,4" Foreground="{StaticResource TextPrimary}" FontSize="12"
|
||||||
|
VerticalAlignment="Center" KeyDown="txtEditValueBar_KeyDown"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="10,0,0,0">
|
||||||
|
<Button x:Name="btnSaveCurrentPref" Style="{StaticResource PrimaryGreenButton}" Content="💾 値を保存 (Ctrl+S)" Click="btnSaveCurrentPref_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button x:Name="btnDeleteCurrentPref" Style="{StaticResource ModernButton}" Content="🗑 削除" Click="btnDeleteCurrentPref_Click" Foreground="#FF7675"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<!-- [タブ2: セーブファイル (LocalLow / ゲームフォルダ)] -->
|
||||||
|
<TabItem Header="📁 セーブファイル">
|
||||||
|
<Grid Margin="0,8,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="340" MinWidth="260"/> <!-- ファイル一覧 -->
|
||||||
|
<ColumnDefinition Width="Auto"/> <!-- スプリッター -->
|
||||||
|
<ColumnDefinition Width="*" MinWidth="350"/> <!-- エディタ領域 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左側:セーブファイル一覧 -->
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="8" Margin="0,0,0,8">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="検出されたセーブファイル" FontWeight="SemiBold" FontSize="12" VerticalAlignment="Center" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="🔄 更新" HorizontalAlignment="Right" Click="btnReloadSaveFiles_Click" Padding="8,3"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<ListBox x:Name="lstSaveFiles" Grid.Row="1" Background="#1C1C26" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1"
|
||||||
|
SelectionChanged="lstSaveFiles_SelectionChanged">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type models:SaveFileEntry}">
|
||||||
|
<Border Padding="8,6" CornerRadius="4" BorderBrush="#2D2D3E" BorderThickness="0,0,0,1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Text="{Binding FileName}" FontWeight="SemiBold" FontSize="12" Foreground="{StaticResource TextPrimary}" TextTrimming="CharacterEllipsis"/>
|
||||||
|
<TextBlock Text="{Binding LocationType}" FontSize="10" Foreground="#81ECEC" Margin="0,2,0,0"/>
|
||||||
|
<TextBlock Text="{Binding LastModifiedDisplay}" FontSize="10" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding FileSizeDisplay}" FontSize="11" Foreground="#FAB1A0" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<GridSplitter Grid.Column="1" Width="4" Background="{StaticResource BorderBrushColor}" HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
|
||||||
|
|
||||||
|
<!-- 右側:ファイル内容エディタ(GUI / テキスト / 未対応プロンプト) -->
|
||||||
|
<Grid Grid.Column="2" Margin="10,0,0,0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/> <!-- ファイルツールバー -->
|
||||||
|
<RowDefinition Height="*"/> <!-- コンテンツ表示領域 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- ファイルツールバー -->
|
||||||
|
<Border Grid.Row="0" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="10,8" Margin="0,0,0,8">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock x:Name="lblCurrentFileName" Text="ファイルを選択してください" FontWeight="Bold" FontSize="13" Foreground="{StaticResource TextPrimary}" TextTrimming="CharacterEllipsis"/>
|
||||||
|
<!-- コーデック名バッジ -->
|
||||||
|
<Border x:Name="badgeCodec" Background="{StaticResource AccentPrimary}" CornerRadius="4" Padding="6,1" Margin="8,0,0,0" Visibility="Collapsed">
|
||||||
|
<TextBlock x:Name="lblCodecName" Text="ES3" FontSize="10" FontWeight="Bold" Foreground="#FFFFFF"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock x:Name="lblCurrentFilePath" Text="" FontSize="10" Foreground="{StaticResource TextSecondary}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Button x:Name="btnFormatJson" Style="{StaticResource ModernButton}" Content="✨ JSON整形" Click="btnFormatJson_Click" Margin="0,0,6,0" Visibility="Collapsed"/>
|
||||||
|
<Button x:Name="btnBackupSingleFile" Style="{StaticResource ModernButton}" Content="📦 バックアップ" Click="btnBackupSingleFile_Click" Margin="0,0,6,0"/>
|
||||||
|
<!-- テキスト保存ボタン -->
|
||||||
|
<Button x:Name="btnSaveFileContent" Style="{StaticResource PrimaryGreenButton}" Content="💾 ファイルを保存" Click="btnSaveFileContent_Click" Visibility="Collapsed"/>
|
||||||
|
<!-- GUI保存ボタン -->
|
||||||
|
<Button x:Name="btnSaveGuiProperties" Style="{StaticResource PrimaryGreenButton}" Content="💾 変更を保存 (再暗号化)" Click="btnSaveGuiProperties_Click" Visibility="Collapsed"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- コンテンツ表示領域(モード切替) -->
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<!-- ================= 1. GUI セーブエディタ ================= -->
|
||||||
|
<Grid x:Name="pnlGuiEditor" Visibility="Collapsed">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 検索バー -->
|
||||||
|
<Border Grid.Row="0" Background="#1C1C26" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="8,6" Margin="0,0,0,8">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="26"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="🔍" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextSecondary}" FontSize="11"/>
|
||||||
|
<TextBox x:Name="txtSearchGuiProps" Grid.Column="1" Background="Transparent" BorderThickness="0"
|
||||||
|
Foreground="{StaticResource TextPrimary}" VerticalAlignment="Center" FontSize="12"
|
||||||
|
TextChanged="txtSearchGuiProps_TextChanged"/>
|
||||||
|
<TextBlock Grid.Column="2" x:Name="lblGuiPropCount" Text="0 項目" FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center" Margin="6,0,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- プロパティ DataGrid -->
|
||||||
|
<DataGrid x:Name="dgGuiProperties" Grid.Row="1" SelectionChanged="dgGuiProperties_SelectionChanged">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="分類" Binding="{Binding Category}" Width="120" IsReadOnly="True" Foreground="#A29BFE"/>
|
||||||
|
<DataGridTextColumn Header="変数名 (キー)" Binding="{Binding Key}" Width="2*" IsReadOnly="True" FontWeight="SemiBold"/>
|
||||||
|
<DataGridTextColumn Header="型" Binding="{Binding Type}" Width="80" IsReadOnly="True" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<DataGridTextColumn Header="値 (ダブルクリックで直接編集)" Binding="{Binding EditValue, UpdateSourceTrigger=PropertyChanged}" Width="2*"/>
|
||||||
|
<DataGridTextColumn Header="備考" Binding="{Binding Description}" Width="140" IsReadOnly="True" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<!-- インライン編集バー -->
|
||||||
|
<Border Grid.Row="2" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="10,8" Margin="0,8,0,0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0">
|
||||||
|
<TextBlock Text="選択:" Foreground="{StaticResource TextSecondary}" FontSize="12" Margin="0,0,6,0"/>
|
||||||
|
<TextBlock x:Name="lblSelectedPropKey" Text="(未選択)" FontWeight="SemiBold" Foreground="{StaticResource TextPrimary}" FontSize="12"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBox x:Name="txtEditPropValueBar" Grid.Column="1" Background="#262636" BorderBrush="{StaticResource BorderBrushColor}"
|
||||||
|
BorderThickness="1" Padding="8,4" Foreground="{StaticResource TextPrimary}" FontSize="12"
|
||||||
|
VerticalAlignment="Center" KeyDown="txtEditPropValueBar_KeyDown"/>
|
||||||
|
<Button x:Name="btnApplyPropValue" Grid.Column="2" Style="{StaticResource PrimaryGreenButton}" Content="適用" Margin="8,0,0,0" Click="btnApplyPropValue_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- ================= 2. テキスト / JSON エディタ ================= -->
|
||||||
|
<Grid x:Name="pnlTextEditor" Visibility="Collapsed">
|
||||||
|
<Border Background="#14141C" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6">
|
||||||
|
<TextBox x:Name="txtFileContent" Background="Transparent" Foreground="#E0E0E6" BorderThickness="0"
|
||||||
|
FontFamily="Cascadia Code, Consolas, Courier New, monospace" FontSize="13"
|
||||||
|
AcceptsReturn="True" AcceptsTab="True" TextWrapping="NoWrap"
|
||||||
|
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
|
||||||
|
Padding="10"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- ================= 3. 未対応バイナリ解析依頼パネル ================= -->
|
||||||
|
<Border x:Name="pnlUnsupportedBinary" Background="#1D1D28" Padding="24" CornerRadius="8" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" Visibility="Collapsed">
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
|
<StackPanel HorizontalAlignment="Center" MaxWidth="620">
|
||||||
|
<TextBlock Text="⚡" FontSize="40" HorizontalAlignment="Center" Margin="0,0,0,8"/>
|
||||||
|
<TextBlock Text="バイナリ形式のセーブデータです" FontWeight="Bold" FontSize="16" HorizontalAlignment="Center" Foreground="{StaticResource TextPrimary}"/>
|
||||||
|
<TextBlock Text="このセーブデータ形式はまだ個別解析プラグインが登録されていません。" Foreground="{StaticResource TextSecondary}" FontSize="12" HorizontalAlignment="Center" Margin="0,4,0,16"/>
|
||||||
|
|
||||||
|
<!-- ヘッダーHexプレビュー -->
|
||||||
|
<Border Background="#14141C" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="12" Margin="0,0,0,16">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="先頭バイト列 (Hex):" FontSize="11" Foreground="{StaticResource TextSecondary}" Margin="0,0,0,4"/>
|
||||||
|
<TextBlock x:Name="lblHexPreview" Text="59 53 53 44 ..." FontFamily="Cascadia Code, Consolas, monospace" FontSize="12" Foreground="#81ECEC" TextWrapping="Wrap"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Antigravity IDE 解析依頼プロンプトコピー大ボタン -->
|
||||||
|
<Button x:Name="btnCopyIdePrompt" Style="{StaticResource PrimaryGreenButton}" Padding="16,12" Margin="0,0,0,12" Click="btnCopyIdePrompt_Click">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="📋" FontSize="16" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="Antigravity IDE 解析用プロンプトをコピー" FontSize="13" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<TextBlock Text="※コピーしたプロンプトを Antigravity IDE のチャットに貼り付けると、AIがセーブ構造を解析してGUI編集プラグインを即座に追加してくれます。"
|
||||||
|
Foreground="#A29BFE" FontSize="11" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center" Margin="0,0,0,16"/>
|
||||||
|
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="強制的にテキストとして開く" Click="btnForceShowBinary_Click" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<!-- [タブ3: バックアップ履歴 & 復元] -->
|
||||||
|
<TabItem Header="📦 バックアップ履歴">
|
||||||
|
<Grid Margin="0,8,0,0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Background="#1E1E2A" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="1" CornerRadius="6" Padding="10,8" Margin="0,0,0,10">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="このゲームのセーブデータバックアップ一覧" FontWeight="SemiBold" FontSize="12" VerticalAlignment="Center" Foreground="{StaticResource TextSecondary}"/>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="📂 バックアップフォルダを開く" Click="btnOpenBackupDir_Click" Margin="0,0,6,0"/>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="🔄 更新" Click="btnReloadBackups_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<DataGrid x:Name="dgBackups" Grid.Row="1">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="バックアップ日時" Binding="{Binding TimestampDisplay}" Width="160" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="種別" Binding="{Binding BackupType}" Width="140" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="ファイル名" Binding="{Binding Name}" Width="2*" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="サイズ" Binding="{Binding Note}" Width="100" IsReadOnly="True"/>
|
||||||
|
<DataGridTemplateColumn Header="操作" Width="140">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Style="{StaticResource ModernButton}" Content="↩ このバックアップを復元" Click="btnRestoreFromBackupRow_Click" Padding="8,2"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
|
||||||
|
<!-- ================= ステータスバー ================= -->
|
||||||
|
<Border Grid.Row="2" Background="#14141C" BorderBrush="{StaticResource BorderBrushColor}" BorderThickness="0,1,0,0" Padding="12,6">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock x:Name="lblStatus" Text="準備完了" FontSize="11" Foreground="{StaticResource TextSecondary}" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,636 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using GameLauncher.Helpers;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
using GameLauncher.Services;
|
||||||
|
using GameLauncher.Services.Codecs;
|
||||||
|
|
||||||
|
namespace GameLauncher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unityゲームのセーブデータ(PlayerPrefs & ファイル)統合エディタウィンドウ
|
||||||
|
/// </summary>
|
||||||
|
public partial class SaveEditorWindow : Window
|
||||||
|
{
|
||||||
|
private readonly UnitySaveManagerService _saveService = new();
|
||||||
|
public UnityGameItem Game { get; }
|
||||||
|
|
||||||
|
// PlayerPrefs データ
|
||||||
|
private readonly ObservableCollection<PlayerPrefsEntry> _allPrefs = [];
|
||||||
|
private ListCollectionView _prefsView = null!;
|
||||||
|
|
||||||
|
// ファイル一覧データ
|
||||||
|
private readonly ObservableCollection<SaveFileEntry> _saveFiles = [];
|
||||||
|
private SaveFileEntry? _currentSelectedFile;
|
||||||
|
|
||||||
|
// GUIセーブプロパティデータ
|
||||||
|
private readonly ObservableCollection<SaveDataPropertyEntry> _guiProperties = [];
|
||||||
|
private ListCollectionView _guiPropsView = null!;
|
||||||
|
private ISaveDataCodec? _currentCodec;
|
||||||
|
|
||||||
|
// バックアップ一覧データ
|
||||||
|
private readonly ObservableCollection<SaveBackupEntry> _backups = [];
|
||||||
|
|
||||||
|
public SaveEditorWindow(UnityGameItem game)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Game = game;
|
||||||
|
|
||||||
|
lblGameTitle.Text = game.Title;
|
||||||
|
lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})";
|
||||||
|
|
||||||
|
// PlayerPrefs ビュー
|
||||||
|
_prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_allPrefs);
|
||||||
|
_prefsView.Filter = FilterPrefs;
|
||||||
|
dgPlayerPrefs.ItemsSource = _prefsView;
|
||||||
|
|
||||||
|
// ファイル一覧
|
||||||
|
lstSaveFiles.ItemsSource = _saveFiles;
|
||||||
|
|
||||||
|
// GUI プロパティビュー
|
||||||
|
_guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_guiProperties);
|
||||||
|
_guiPropsView.Filter = FilterGuiProperties;
|
||||||
|
dgGuiProperties.ItemsSource = _guiPropsView;
|
||||||
|
|
||||||
|
// バックアップ一覧
|
||||||
|
dgBackups.ItemsSource = _backups;
|
||||||
|
|
||||||
|
Loaded += SaveEditorWindow_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveEditorWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ReloadPlayerPrefs();
|
||||||
|
ReloadSaveFiles();
|
||||||
|
ReloadBackups();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// PlayerPrefs タブ処理
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
public void ReloadPlayerPrefs()
|
||||||
|
{
|
||||||
|
_allPrefs.Clear();
|
||||||
|
if (string.IsNullOrEmpty(Game.RegistryPath))
|
||||||
|
{
|
||||||
|
lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var entries = _saveService.GetPlayerPrefs(Game.RegistryPath);
|
||||||
|
foreach (var entry in entries)
|
||||||
|
{
|
||||||
|
_allPrefs.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"PlayerPrefs: {entries.Count} 件のキーを読み込みました (HKCU\\{Game.RegistryPath})";
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterPrefs(object obj)
|
||||||
|
{
|
||||||
|
if (obj is not PlayerPrefsEntry entry) return false;
|
||||||
|
var query = txtSearchPrefs.Text.Trim();
|
||||||
|
if (string.IsNullOrEmpty(query)) return true;
|
||||||
|
|
||||||
|
return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
entry.RawKey.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
entry.EditValue.Contains(query, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
_prefsView.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dgPlayerPrefs_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
|
{
|
||||||
|
lblSelectedKeyName.Text = entry.CleanKey;
|
||||||
|
txtEditValueBar.Text = entry.EditValue;
|
||||||
|
txtEditValueBar.IsEnabled = true;
|
||||||
|
btnSaveCurrentPref.IsEnabled = true;
|
||||||
|
btnDeleteCurrentPref.IsEnabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblSelectedKeyName.Text = "(なし)";
|
||||||
|
txtEditValueBar.Text = string.Empty;
|
||||||
|
txtEditValueBar.IsEnabled = false;
|
||||||
|
btnSaveCurrentPref.IsEnabled = false;
|
||||||
|
btnDeleteCurrentPref.IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtEditValueBar_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
SaveCurrentSelectedPref();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SaveCurrentSelectedPref();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveCurrentSelectedPref()
|
||||||
|
{
|
||||||
|
if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
||||||
|
|
||||||
|
entry.EditValue = txtEditValueBar.Text;
|
||||||
|
bool success = _saveService.SavePlayerPref(Game.RegistryPath, entry);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。";
|
||||||
|
dgPlayerPrefs.Items.Refresh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show($"キー '{entry.CleanKey}' の値の更新に失敗しました。型が正しいか確認してください。",
|
||||||
|
"保存失敗", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnDeleteCurrentPref_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return;
|
||||||
|
|
||||||
|
var res = MessageBox.Show($"キー '{entry.CleanKey}' ({entry.RawKey}) をレジストリから削除しますか?",
|
||||||
|
"キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
|
if (res != MessageBoxResult.Yes) return;
|
||||||
|
|
||||||
|
if (_saveService.DeletePlayerPref(Game.RegistryPath, entry.RawKey))
|
||||||
|
{
|
||||||
|
_allPrefs.Remove(entry);
|
||||||
|
lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("キーの削除に失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAddPref_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var dlg = new AddKeyDialog { Owner = this };
|
||||||
|
if (dlg.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
if (_saveService.AddPlayerPref(Game.RegistryPath, dlg.KeyName, dlg.KeyType, dlg.KeyValue, out string rawKey))
|
||||||
|
{
|
||||||
|
ReloadPlayerPrefs();
|
||||||
|
lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("キーの追加に失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnBackupPrefs_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
||||||
|
var result = _saveService.BackupRegistry(Game.RegistryPath, backupDir);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
ReloadBackups();
|
||||||
|
lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}";
|
||||||
|
MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("レジストリのバックアップに失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnRestorePrefs_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
||||||
|
var dlg = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Title = "復元する .reg ファイルを選択",
|
||||||
|
InitialDirectory = Directory.Exists(backupDir) ? backupDir : AppPathHelper.GetBackupsDirectory(),
|
||||||
|
Filter = "レジストリファイル (*.reg)|*.reg|すべてのファイル (*.*)|*.*"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dlg.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
var res = MessageBox.Show($"ファイル '{Path.GetFileName(dlg.FileName)}' からレジストリを復元しますか?\n現在のPlayerPrefs値は上書きされます。",
|
||||||
|
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
|
if (res != MessageBoxResult.Yes) return;
|
||||||
|
|
||||||
|
if (_saveService.RestoreRegistry(dlg.FileName))
|
||||||
|
{
|
||||||
|
ReloadPlayerPrefs();
|
||||||
|
lblStatus.Text = "レジストリを正常に復元しました。";
|
||||||
|
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("レジストリの復元に失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReloadPrefs_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ReloadPlayerPrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ctxSavePref_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SaveCurrentSelectedPref();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ctxCopyKey_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
|
{
|
||||||
|
Clipboard.SetText(entry.CleanKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ctxCopyValue_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry)
|
||||||
|
{
|
||||||
|
Clipboard.SetText(entry.EditValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ctxDeletePref_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
btnDeleteCurrentPref_Click(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// セーブファイル タブ処理(GUI / テキスト / 未対応プロンプト)
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
public void ReloadSaveFiles()
|
||||||
|
{
|
||||||
|
_saveFiles.Clear();
|
||||||
|
var files = _saveService.GetSaveFiles(Game);
|
||||||
|
foreach (var f in files)
|
||||||
|
{
|
||||||
|
_saveFiles.Add(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_saveFiles.Count > 0)
|
||||||
|
{
|
||||||
|
lstSaveFiles.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblCurrentFileName.Text = "セーブファイルは見つかりませんでした";
|
||||||
|
lblCurrentFilePath.Text = string.Empty;
|
||||||
|
txtFileContent.Text = string.Empty;
|
||||||
|
HideAllEditorPanels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideAllEditorPanels()
|
||||||
|
{
|
||||||
|
pnlGuiEditor.Visibility = Visibility.Collapsed;
|
||||||
|
pnlTextEditor.Visibility = Visibility.Collapsed;
|
||||||
|
pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
||||||
|
btnFormatJson.Visibility = Visibility.Collapsed;
|
||||||
|
btnSaveFileContent.Visibility = Visibility.Collapsed;
|
||||||
|
btnSaveGuiProperties.Visibility = Visibility.Collapsed;
|
||||||
|
badgeCodec.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (lstSaveFiles.SelectedItem is not SaveFileEntry entry) return;
|
||||||
|
_currentSelectedFile = entry;
|
||||||
|
|
||||||
|
lblCurrentFileName.Text = entry.FileName;
|
||||||
|
lblCurrentFilePath.Text = entry.FilePath;
|
||||||
|
HideAllEditorPanels();
|
||||||
|
|
||||||
|
// 1. コーデック(対応形式)が存在するか判定
|
||||||
|
var codec = SaveDataCodecManager.Instance.FindCodec(Game, entry);
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
// GUI エディタモードをアクティブ化
|
||||||
|
_currentCodec = codec;
|
||||||
|
badgeCodec.Visibility = Visibility.Visible;
|
||||||
|
lblCodecName.Text = codec.CodecName;
|
||||||
|
|
||||||
|
LoadGuiPropertiesFromCodec(codec, entry.FilePath);
|
||||||
|
pnlGuiEditor.Visibility = Visibility.Visible;
|
||||||
|
btnSaveGuiProperties.Visibility = Visibility.Visible;
|
||||||
|
lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. プレーンテキスト/JSON形式の場合
|
||||||
|
if (entry.IsTextOrJson)
|
||||||
|
{
|
||||||
|
pnlTextEditor.Visibility = Visibility.Visible;
|
||||||
|
txtFileContent.Text = _saveService.ReadSaveFileText(entry.FilePath);
|
||||||
|
btnFormatJson.Visibility = Visibility.Visible;
|
||||||
|
btnSaveFileContent.Visibility = Visibility.Visible;
|
||||||
|
lblStatus.Text = $"テキストとして開きました: {entry.FileName}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 未対応のバイナリセーブデータ形式の場合
|
||||||
|
pnlUnsupportedBinary.Visibility = Visibility.Visible;
|
||||||
|
DisplayUnsupportedBinaryInfo(entry);
|
||||||
|
lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath)
|
||||||
|
{
|
||||||
|
_guiProperties.Clear();
|
||||||
|
var props = codec.LoadProperties(filePath);
|
||||||
|
foreach (var p in props)
|
||||||
|
{
|
||||||
|
_guiProperties.Add(p);
|
||||||
|
}
|
||||||
|
lblGuiPropCount.Text = $"{props.Count} 項目";
|
||||||
|
if (props.Count > 0)
|
||||||
|
{
|
||||||
|
dgGuiProperties.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterGuiProperties(object obj)
|
||||||
|
{
|
||||||
|
if (obj is not SaveDataPropertyEntry prop) return false;
|
||||||
|
var query = txtSearchGuiProps.Text.Trim();
|
||||||
|
if (string.IsNullOrEmpty(query)) return true;
|
||||||
|
|
||||||
|
return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
prop.Category.Contains(query, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
prop.EditValue.Contains(query, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
_guiPropsView.Refresh();
|
||||||
|
int visibleCount = _guiPropsView.Cast<object>().Count();
|
||||||
|
lblGuiPropCount.Text = $"{visibleCount} / {_guiProperties.Count} 項目";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dgGuiProperties_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
||||||
|
{
|
||||||
|
lblSelectedPropKey.Text = prop.Key;
|
||||||
|
txtEditPropValueBar.Text = prop.EditValue;
|
||||||
|
txtEditPropValueBar.IsEnabled = true;
|
||||||
|
btnApplyPropValue.IsEnabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblSelectedPropKey.Text = "(未選択)";
|
||||||
|
txtEditPropValueBar.Text = string.Empty;
|
||||||
|
txtEditPropValueBar.IsEnabled = false;
|
||||||
|
btnApplyPropValue.IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtEditPropValueBar_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
btnApplyPropValue_Click(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnApplyPropValue_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop)
|
||||||
|
{
|
||||||
|
prop.EditValue = txtEditPropValueBar.Text;
|
||||||
|
dgGuiProperties.Items.Refresh();
|
||||||
|
lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSaveGuiProperties_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSelectedFile == null || _currentCodec == null) return;
|
||||||
|
|
||||||
|
bool success = _currentCodec.SaveProperties(_currentSelectedFile.FilePath, _guiProperties.ToList());
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}";
|
||||||
|
MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)",
|
||||||
|
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("セーブデータの保存・再エンコードに失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisplayUnsupportedBinaryInfo(SaveFileEntry entry)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(entry.FilePath))
|
||||||
|
{
|
||||||
|
byte[] bytes = File.ReadAllBytes(entry.FilePath);
|
||||||
|
int count = Math.Min(32, bytes.Length);
|
||||||
|
var hexList = new List<string>();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
hexList.Add(bytes[i].ToString("X2"));
|
||||||
|
}
|
||||||
|
lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
lblHexPreview.Text = "(読み込み失敗)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCopyIdePrompt_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSelectedFile == null) return;
|
||||||
|
|
||||||
|
string prompt = SaveDataCodecManager.Instance.GenerateAntigravityPrompt(Game, _currentSelectedFile);
|
||||||
|
Clipboard.SetText(prompt);
|
||||||
|
|
||||||
|
lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!";
|
||||||
|
MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。",
|
||||||
|
"プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnForceShowBinary_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSelectedFile == null) return;
|
||||||
|
pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
|
||||||
|
pnlTextEditor.Visibility = Visibility.Visible;
|
||||||
|
btnSaveFileContent.Visibility = Visibility.Visible;
|
||||||
|
txtFileContent.Text = _saveService.ReadSaveFileText(_currentSelectedFile.FilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnFormatJson_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var raw = txtFileContent.Text;
|
||||||
|
if (string.IsNullOrWhiteSpace(raw)) return;
|
||||||
|
|
||||||
|
using var doc = JsonDocument.Parse(raw);
|
||||||
|
var formatted = JsonSerializer.Serialize(doc.RootElement, new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
});
|
||||||
|
txtFileContent.Text = formatted;
|
||||||
|
lblStatus.Text = "JSONを整形しました。";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"JSONの解析に失敗しました:\n\n{ex.Message}", "フォーマット失敗", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSaveFileContent_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSelectedFile == null) return;
|
||||||
|
|
||||||
|
bool success = _saveService.WriteSaveFileText(_currentSelectedFile.FilePath, txtFileContent.Text);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}";
|
||||||
|
MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)",
|
||||||
|
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("ファイルの保存に失敗しました。書き込み権限等を確認してください。",
|
||||||
|
"エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnBackupSingleFile_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSelectedFile == null) return;
|
||||||
|
|
||||||
|
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
||||||
|
var result = _saveService.BackupSaveFile(_currentSelectedFile.FilePath, backupDir);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
ReloadBackups();
|
||||||
|
lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}";
|
||||||
|
MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("ファイルのバックアップに失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ReloadSaveFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// バックアップ履歴 タブ処理
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
public void ReloadBackups()
|
||||||
|
{
|
||||||
|
_backups.Clear();
|
||||||
|
var list = _saveService.GetBackupList(Game);
|
||||||
|
foreach (var b in list)
|
||||||
|
{
|
||||||
|
_backups.Add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReloadBackups_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ReloadBackups();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOpenBackupDir_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory);
|
||||||
|
UnitySaveManagerService.OpenFolderInExplorer(backupDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnRestoreFromBackupRow_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not Button btn || btn.DataContext is not SaveBackupEntry backup) return;
|
||||||
|
|
||||||
|
if (backup.BackupPath.EndsWith(".reg", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var res = MessageBox.Show($"レジストリバックアップ '{backup.Name}' を復元しますか?",
|
||||||
|
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||||
|
if (res == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
if (_saveService.RestoreRegistry(backup.BackupPath))
|
||||||
|
{
|
||||||
|
ReloadPlayerPrefs();
|
||||||
|
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("復元に失敗しました。", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show($"バックアップファイル:\n{backup.BackupPath}\n\nバックアップフォルダから復元したい場所へコピーしてください。",
|
||||||
|
"バックアップファイルの復元", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
UnitySaveManagerService.OpenFolderInExplorer(Path.GetDirectoryName(backup.BackupPath)!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// ヘッダークイックオープン
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Game.LocalLowPath))
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(Game.LocalLowPath))
|
||||||
|
{
|
||||||
|
var parent = Path.GetDirectoryName(Game.LocalLowPath);
|
||||||
|
if (parent != null && Directory.Exists(parent))
|
||||||
|
{
|
||||||
|
UnitySaveManagerService.OpenFolderInExplorer(parent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UnitySaveManagerService.OpenFolderInExplorer(Game.LocalLowPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOpenGameFolder_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
UnitySaveManagerService.OpenFolderInExplorer(Game.RootDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOpenRegedit_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_saveService.OpenRegistryEditor(Game.RegistryPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,608 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ASAR アーカイブ内のファイルエントリ情報
|
||||||
|
/// </summary>
|
||||||
|
public class AsarFileEntry
|
||||||
|
{
|
||||||
|
public string RelativePath { get; set; } = string.Empty;
|
||||||
|
public long Offset { get; set; }
|
||||||
|
public long Size { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASAR の解析結果情報
|
||||||
|
/// </summary>
|
||||||
|
public class AsarInspectResult
|
||||||
|
{
|
||||||
|
public bool IsValid { get; set; }
|
||||||
|
public bool IsTkoolGame { get; set; }
|
||||||
|
public bool IsTyranoGame { get; set; }
|
||||||
|
public TkoolEngineType EngineType { get; set; } = TkoolEngineType.Unknown;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string? RelativePluginsJsPath { get; set; }
|
||||||
|
public string? RelativeIndexPath { get; set; }
|
||||||
|
public long TotalFilesCount { get; set; }
|
||||||
|
public long TotalUnpackedBytes { get; set; }
|
||||||
|
public List<AsarFileEntry> FileEntries { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Electron 等で利用される app.asar 形式アーカイブの解析・解凍・復元を
|
||||||
|
/// 外部ツール不要かつ純粋な C# のみで安全・高速に行うサービス
|
||||||
|
/// </summary>
|
||||||
|
public class AsarArchiveService
|
||||||
|
{
|
||||||
|
/// <summary>ASARバックアップファイルの拡張子</summary>
|
||||||
|
public const string AsarBackupSuffix = ".original_launcher_backup";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたゲームフォルダ配下に app.asar または解凍済みバックアップが存在するか検索します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameRootDir">ゲームのルートディレクトリ</param>
|
||||||
|
/// <param name="asarPath">見つかった asar ファイルパス(または元の asar パス)</param>
|
||||||
|
/// <param name="isExtracted">現在解凍済み状態かどうか</param>
|
||||||
|
/// <returns>ASARパッケージが存在するかどうか</returns>
|
||||||
|
public static bool FindAsarPackage(string gameRootDir, out string? asarPath, out bool isExtracted, out string? extractedDirPath)
|
||||||
|
{
|
||||||
|
asarPath = null;
|
||||||
|
isExtracted = false;
|
||||||
|
extractedDirPath = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(gameRootDir) || !Directory.Exists(gameRootDir))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 検索候補パス: resources\app.asar または 直下の app.asar
|
||||||
|
var candidate1 = Path.Combine(gameRootDir, "resources", "app.asar");
|
||||||
|
var candidate2 = Path.Combine(gameRootDir, "app.asar");
|
||||||
|
|
||||||
|
// 1. 未解凍の app.asar が存在する場合
|
||||||
|
if (File.Exists(candidate1))
|
||||||
|
{
|
||||||
|
asarPath = candidate1;
|
||||||
|
extractedDirPath = Path.Combine(gameRootDir, "resources", "app");
|
||||||
|
isExtracted = Directory.Exists(extractedDirPath) && File.Exists(Path.Combine(extractedDirPath, "package.json"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (File.Exists(candidate2))
|
||||||
|
{
|
||||||
|
asarPath = candidate2;
|
||||||
|
extractedDirPath = Path.Combine(gameRootDir, "app");
|
||||||
|
isExtracted = Directory.Exists(extractedDirPath) && File.Exists(Path.Combine(extractedDirPath, "package.json"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 既に解凍済みで、app.asar がリネームバックアップされている場合
|
||||||
|
var backup1 = candidate1 + AsarBackupSuffix;
|
||||||
|
var appDir1 = Path.Combine(gameRootDir, "resources", "app");
|
||||||
|
if (File.Exists(backup1) && Directory.Exists(appDir1))
|
||||||
|
{
|
||||||
|
asarPath = candidate1;
|
||||||
|
extractedDirPath = appDir1;
|
||||||
|
isExtracted = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var backup2 = candidate2 + AsarBackupSuffix;
|
||||||
|
var appDir2 = Path.Combine(gameRootDir, "app");
|
||||||
|
if (File.Exists(backup2) && Directory.Exists(appDir2))
|
||||||
|
{
|
||||||
|
asarPath = candidate2;
|
||||||
|
extractedDirPath = appDir2;
|
||||||
|
isExtracted = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASAR ファイルのヘッダを解析し、ツクールゲームであるかの判定やタイトル・plugins.js位置を抽出します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="asarFilePath">app.asar ファイルの物理パス(またはバックアップパス)</param>
|
||||||
|
/// <param name="includeFileList">全ファイルエントリの収集を行うかどうか(解凍時用)</param>
|
||||||
|
public AsarInspectResult InspectAsar(string asarFilePath, bool includeFileList = false)
|
||||||
|
{
|
||||||
|
var result = new AsarInspectResult();
|
||||||
|
|
||||||
|
// バックアップファイルが指定された場合も対応
|
||||||
|
var targetFile = asarFilePath;
|
||||||
|
if (!File.Exists(ToExtendedPath(targetFile)) && File.Exists(ToExtendedPath(targetFile + AsarBackupSuffix)))
|
||||||
|
{
|
||||||
|
targetFile = asarFilePath + AsarBackupSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(ToExtendedPath(targetFile)))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var fs = new FileStream(ToExtendedPath(targetFile), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
|
using var br = new BinaryReader(fs);
|
||||||
|
|
||||||
|
if (fs.Length < 16) return result;
|
||||||
|
|
||||||
|
uint u1 = br.ReadUInt32();
|
||||||
|
uint headerSize = br.ReadUInt32();
|
||||||
|
uint u3 = br.ReadUInt32();
|
||||||
|
uint jsonSize = br.ReadUInt32();
|
||||||
|
|
||||||
|
// 妥当性チェック
|
||||||
|
if (u1 != 4 || jsonSize == 0 || jsonSize > 100_000_000 || jsonSize > fs.Length)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
long dataOffset = 8 + (long)headerSize;
|
||||||
|
byte[] jsonBytes = br.ReadBytes((int)jsonSize);
|
||||||
|
string jsonStr = Encoding.UTF8.GetString(jsonBytes);
|
||||||
|
|
||||||
|
using var doc = JsonDocument.Parse(jsonStr);
|
||||||
|
if (!doc.RootElement.TryGetProperty("files", out var filesRoot))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.IsValid = true;
|
||||||
|
|
||||||
|
// ツクール特有ファイルを探す
|
||||||
|
string? systemJsonRelative = null;
|
||||||
|
long systemJsonOffset = -1;
|
||||||
|
long systemJsonSize = -1;
|
||||||
|
|
||||||
|
string? packageJsonRelative = null;
|
||||||
|
long packageJsonOffset = -1;
|
||||||
|
long packageJsonSize = -1;
|
||||||
|
|
||||||
|
TraverseFiles(filesRoot, "", dataOffset, fs.Length, result, includeFileList,
|
||||||
|
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
||||||
|
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(result.RelativePluginsJsPath))
|
||||||
|
{
|
||||||
|
result.IsTkoolGame = true;
|
||||||
|
}
|
||||||
|
else if (result.IsTyranoGame)
|
||||||
|
{
|
||||||
|
result.EngineType = TkoolEngineType.Tyrano;
|
||||||
|
result.RelativePluginsJsPath = result.RelativeIndexPath ?? "index.html";
|
||||||
|
}
|
||||||
|
|
||||||
|
// タイトルの抽出(System.json または package.json から)
|
||||||
|
if (systemJsonOffset >= 0 && systemJsonSize > 0 && systemJsonSize < 5_000_000)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fs.Seek(dataOffset + systemJsonOffset, SeekOrigin.Begin);
|
||||||
|
byte[] sBytes = new byte[systemJsonSize];
|
||||||
|
fs.ReadExactly(sBytes, 0, (int)systemJsonSize);
|
||||||
|
string sJson = Encoding.UTF8.GetString(sBytes);
|
||||||
|
var match = Regex.Match(sJson, @"""gameTitle""\s*:\s*""([^""]+)""");
|
||||||
|
if (match.Success && !string.IsNullOrWhiteSpace(match.Groups[1].Value))
|
||||||
|
{
|
||||||
|
result.Title = match.Groups[1].Value.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(result.Title) && packageJsonOffset >= 0 && packageJsonSize > 0 && packageJsonSize < 5_000_000)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fs.Seek(dataOffset + packageJsonOffset, SeekOrigin.Begin);
|
||||||
|
byte[] pBytes = new byte[packageJsonSize];
|
||||||
|
fs.ReadExactly(pBytes, 0, (int)packageJsonSize);
|
||||||
|
string pJson = Encoding.UTF8.GetString(pBytes);
|
||||||
|
var matchTitle = Regex.Match(pJson, @"""title""\s*:\s*""([^""]+)""");
|
||||||
|
if (matchTitle.Success && !string.IsNullOrWhiteSpace(matchTitle.Groups[1].Value) &&
|
||||||
|
!matchTitle.Groups[1].Value.Contains("ティラノスタジオ", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.Title = matchTitle.Groups[1].Value.Trim();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var matchDesc = Regex.Match(pJson, @"""description""\s*:\s*""([^""]+)""");
|
||||||
|
if (matchDesc.Success && !string.IsNullOrWhiteSpace(matchDesc.Groups[1].Value) &&
|
||||||
|
!matchDesc.Groups[1].Value.Contains("Electron for RPG", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!matchDesc.Groups[1].Value.Contains("TyranoScript", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!matchDesc.Groups[1].Value.Contains("ティラノスクリプト", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.Title = matchDesc.Groups[1].Value.Trim();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var matchName = Regex.Match(pJson, @"""name""\s*:\s*""([^""]+)""");
|
||||||
|
if (matchName.Success && !string.IsNullOrWhiteSpace(matchName.Groups[1].Value) &&
|
||||||
|
!matchName.Groups[1].Value.Equals("aigisfull", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!matchName.Groups[1].Value.Contains("tyrano", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.Title = matchName.Groups[1].Value.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 解析失敗時は無効
|
||||||
|
result.IsValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraverseFiles(
|
||||||
|
JsonElement element,
|
||||||
|
string currentPath,
|
||||||
|
long dataOffset,
|
||||||
|
long fileLength,
|
||||||
|
AsarInspectResult result,
|
||||||
|
bool includeFileList,
|
||||||
|
ref string? systemJsonRelative,
|
||||||
|
ref long systemJsonOffset,
|
||||||
|
ref long systemJsonSize,
|
||||||
|
ref string? packageJsonRelative,
|
||||||
|
ref long packageJsonOffset,
|
||||||
|
ref long packageJsonSize)
|
||||||
|
{
|
||||||
|
if (element.ValueKind != JsonValueKind.Object) return;
|
||||||
|
|
||||||
|
foreach (var prop in element.EnumerateObject())
|
||||||
|
{
|
||||||
|
string name = prop.Name;
|
||||||
|
string path = string.IsNullOrEmpty(currentPath) ? name : $"{currentPath}/{name}";
|
||||||
|
var val = prop.Value;
|
||||||
|
|
||||||
|
if (val.TryGetProperty("files", out var subFiles))
|
||||||
|
{
|
||||||
|
TraverseFiles(subFiles, path, dataOffset, fileLength, result, includeFileList,
|
||||||
|
ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
|
||||||
|
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ファイルエントリ
|
||||||
|
long offset = 0;
|
||||||
|
if (val.TryGetProperty("offset", out var offProp))
|
||||||
|
{
|
||||||
|
if (offProp.ValueKind == JsonValueKind.String && long.TryParse(offProp.GetString(), out var o))
|
||||||
|
offset = o;
|
||||||
|
else if (offProp.ValueKind == JsonValueKind.Number && offProp.TryGetInt64(out var oNum))
|
||||||
|
offset = oNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
long size = 0;
|
||||||
|
if (val.TryGetProperty("size", out var sizeProp) && sizeProp.ValueKind == JsonValueKind.Number)
|
||||||
|
{
|
||||||
|
sizeProp.TryGetInt64(out size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 異常値チェック(ダミーエントリや破損エントリのガード)
|
||||||
|
if (offset < 0 || size < 0 || dataOffset + offset + size > fileLength)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.TotalFilesCount++;
|
||||||
|
result.TotalUnpackedBytes += size;
|
||||||
|
|
||||||
|
if (includeFileList)
|
||||||
|
{
|
||||||
|
result.FileEntries.Add(new AsarFileEntry
|
||||||
|
{
|
||||||
|
RelativePath = path,
|
||||||
|
Offset = offset,
|
||||||
|
Size = size
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// plugins.js の検出
|
||||||
|
if (name.Equals("plugins.js", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.RelativePluginsJsPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// エンジン種別判定 (rmmz_core.js -> MZ, rpg_core.js -> MV, tyrano -> Tyrano)
|
||||||
|
if (name.Equals("rmmz_core.js", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.EngineType = TkoolEngineType.MZ;
|
||||||
|
}
|
||||||
|
else if (name.Equals("rpg_core.js", StringComparison.OrdinalIgnoreCase) && result.EngineType == TkoolEngineType.Unknown)
|
||||||
|
{
|
||||||
|
result.EngineType = TkoolEngineType.MV;
|
||||||
|
}
|
||||||
|
else if (name.Equals("tyrano.js", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
path.Contains("data/scenario", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Equals("KeyConfig.js", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
result.IsTyranoGame = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.Equals("index.html", StringComparison.OrdinalIgnoreCase) && result.RelativeIndexPath == null)
|
||||||
|
{
|
||||||
|
result.RelativeIndexPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// タイトル抽出用
|
||||||
|
if (name.Equals("System.json", StringComparison.OrdinalIgnoreCase) && systemJsonOffset < 0)
|
||||||
|
{
|
||||||
|
systemJsonRelative = path;
|
||||||
|
systemJsonOffset = offset;
|
||||||
|
systemJsonSize = size;
|
||||||
|
}
|
||||||
|
else if (name.Equals("package.json", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!path.Contains("node_modules", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// ルートの package.json または project/package.json を最優先
|
||||||
|
if (packageJsonOffset < 0 || path.Equals("package.json", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
packageJsonRelative = path;
|
||||||
|
packageJsonOffset = offset;
|
||||||
|
packageJsonSize = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Windowsの260文字制限(MAX_PATH)や予約デバイス名(CON, PRN, AUX, NUL, COM1-9, LPT1-9等)による
|
||||||
|
/// Win32例外(ハンドルが無効です。: '\\.\con' 等)を回避するため、拡張パスプレフィックス \\?\ を付与します。
|
||||||
|
/// </summary>
|
||||||
|
public static string ToExtendedPath(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(path)) return path;
|
||||||
|
|
||||||
|
// Windows 環境以外はそのまま
|
||||||
|
if (!OperatingSystem.IsWindows()) return path;
|
||||||
|
|
||||||
|
// 既に \\?\ または \\.\ で始まっている場合はそのまま
|
||||||
|
if (path.StartsWith(@"\\?\", StringComparison.Ordinal) || path.StartsWith(@"\\.\", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 区切り文字を Windows 標準のバックスラッシュに統一
|
||||||
|
string normalized = path.Replace('/', '\\');
|
||||||
|
|
||||||
|
// ドライブ文字付き絶対パス (例: C:\..., Z:\...) の場合
|
||||||
|
// ※ここで Path.GetFullPath を通すと、ファイル名が con.png などの場合に Win32 が '\\.\con' に解決してしまうため、
|
||||||
|
// 直接 \\?\ を前置することで予約デバイス名の解決を完全にバイパスします。
|
||||||
|
if (normalized.Length >= 2 && char.IsLetter(normalized[0]) && normalized[1] == ':')
|
||||||
|
{
|
||||||
|
return @"\\?\" + normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UNC パス (例: \\server\share\...) の場合
|
||||||
|
if (normalized.StartsWith(@"\\", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return @"\\?\UNC\" + normalized.Substring(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 相対パスの場合は安全に絶対パスを取得してからプレフィックスを付与
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string full = Path.GetFullPath(normalized);
|
||||||
|
if (full.StartsWith(@"\\?\", StringComparison.Ordinal) || full.StartsWith(@"\\.\", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return full;
|
||||||
|
}
|
||||||
|
if (full.StartsWith(@"\\", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return @"\\?\UNC\" + full.Substring(2);
|
||||||
|
}
|
||||||
|
return @"\\?\" + full;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASAR ファイルを解凍し、outputDir に展開します。
|
||||||
|
/// 展開成功後、元の app.asar を app.asar.original_launcher_backup にリネームして
|
||||||
|
/// Electron が確実に解凍先 app フォルダを読み込んで起動するように準備します。
|
||||||
|
/// </summary>
|
||||||
|
public async Task<(bool Success, string Message)> ExtractAsarAsync(
|
||||||
|
string asarPath,
|
||||||
|
string outputDir,
|
||||||
|
IProgress<(long extractedBytes, long totalBytes, int currentFileIndex, int totalFiles, string currentFileName)>? progress = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
return await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var targetAsar = asarPath;
|
||||||
|
var backupAsar = asarPath + AsarBackupSuffix;
|
||||||
|
|
||||||
|
if (!File.Exists(ToExtendedPath(targetAsar)))
|
||||||
|
{
|
||||||
|
if (File.Exists(ToExtendedPath(backupAsar)))
|
||||||
|
{
|
||||||
|
targetAsar = backupAsar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (false, $"解凍対象の asar ファイルが見つかりません: {asarPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ヘッダ詳細解析
|
||||||
|
var inspect = InspectAsar(targetAsar, includeFileList: true);
|
||||||
|
if (!inspect.IsValid || inspect.FileEntries.Count == 0)
|
||||||
|
{
|
||||||
|
return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 拡張パス(\\?\)を適用した出力先ルートディレクトリ
|
||||||
|
string extOutputDir = ToExtendedPath(Path.GetFullPath(outputDir));
|
||||||
|
|
||||||
|
if (!Directory.Exists(extOutputDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(extOutputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = new byte[128 * 1024]; // 128KB バッファ
|
||||||
|
long extractedBytes = 0;
|
||||||
|
long totalBytes = inspect.TotalUnpackedBytes;
|
||||||
|
int totalFiles = inspect.FileEntries.Count;
|
||||||
|
int skippedFilesCount = 0;
|
||||||
|
List<string> errorDetails = [];
|
||||||
|
|
||||||
|
using (var fs = new FileStream(ToExtendedPath(targetAsar), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
|
using (var br = new BinaryReader(fs))
|
||||||
|
{
|
||||||
|
uint u1 = br.ReadUInt32();
|
||||||
|
uint headerSize = br.ReadUInt32();
|
||||||
|
long dataOffset = 8 + (long)headerSize;
|
||||||
|
|
||||||
|
for (int i = 0; i < inspect.FileEntries.Count; i++)
|
||||||
|
{
|
||||||
|
if (ct.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return (false, "解凍処理が中断されました。");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entry = inspect.FileEntries[i];
|
||||||
|
|
||||||
|
// extOutputDir (\\?\C:\...) と entry.RelativePath を結合
|
||||||
|
// ※先頭に \\?\ が付いているため、con.png や aux.mp3 などの予約デバイス名があっても
|
||||||
|
// Win32 による \\.\con への置換が発生せず、正常にファイル作成が可能
|
||||||
|
string destFilePath = Path.Combine(extOutputDir, entry.RelativePath.Replace('/', Path.DirectorySeparatorChar));
|
||||||
|
string? parentDir = Path.GetDirectoryName(destFilePath);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(parentDir) && !Directory.Exists(parentDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(parentDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ファイル書き込み
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin);
|
||||||
|
long remaining = entry.Size;
|
||||||
|
|
||||||
|
using (var outFs = new FileStream(destFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
|
{
|
||||||
|
while (remaining > 0)
|
||||||
|
{
|
||||||
|
int toRead = (int)Math.Min(remaining, buffer.Length);
|
||||||
|
int read = fs.Read(buffer, 0, toRead);
|
||||||
|
if (read == 0) break;
|
||||||
|
|
||||||
|
outFs.Write(buffer, 0, read);
|
||||||
|
remaining -= read;
|
||||||
|
extractedBytes += read;
|
||||||
|
|
||||||
|
progress?.Report((extractedBytes, totalBytes, i + 1, totalFiles, Path.GetFileName(entry.RelativePath)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception fileEx)
|
||||||
|
{
|
||||||
|
// 予約文字や排他ロック等の例外が発生した場合、解凍全体を止めずに警告として記録
|
||||||
|
skippedFilesCount++;
|
||||||
|
if (errorDetails.Count < 5)
|
||||||
|
{
|
||||||
|
errorDetails.Add($"{entry.RelativePath} ({fileEx.Message})");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // ここで fs と br が確実に Dispose されてファイルハンドルが解放される
|
||||||
|
|
||||||
|
// 展開が正常完了したら、元の app.asar をリネームバックアップする
|
||||||
|
// (これにより Electron は同階層の解凍 app フォルダを最優先で読み込み、改造プラグインが確実に動作する)
|
||||||
|
string extAsarPath = ToExtendedPath(asarPath);
|
||||||
|
string extBackupAsar = ToExtendedPath(backupAsar);
|
||||||
|
|
||||||
|
if (File.Exists(extAsarPath) && !asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (File.Exists(extBackupAsar))
|
||||||
|
{
|
||||||
|
File.Delete(extBackupAsar);
|
||||||
|
}
|
||||||
|
File.Move(extAsarPath, extBackupAsar);
|
||||||
|
}
|
||||||
|
|
||||||
|
string summary = $"ASARの解凍が完了しました。(全 {totalFiles} ファイル展開完了)";
|
||||||
|
if (skippedFilesCount > 0)
|
||||||
|
{
|
||||||
|
summary += $" ※一部ファイル({skippedFilesCount}件)の展開をスキップ: {string.Join(", ", errorDetails)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return (true, summary);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (false, $"ASAR解凍中にエラーが発生しました: {ex.Message}");
|
||||||
|
}
|
||||||
|
}, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解凍された app フォルダを安全に削除し、バックアップされていた app.asar を元の名前に復元します。
|
||||||
|
/// これによりゲームは完全にオリジナルの app.asar 実行状態へ戻ります。
|
||||||
|
/// </summary>
|
||||||
|
public async Task<(bool Success, string Message)> RestoreAsarAsync(string asarPath, string extractedDir, CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
return await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var backupAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase)
|
||||||
|
? asarPath
|
||||||
|
: asarPath + AsarBackupSuffix;
|
||||||
|
|
||||||
|
var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase)
|
||||||
|
? asarPath.Substring(0, asarPath.Length - AsarBackupSuffix.Length)
|
||||||
|
: asarPath;
|
||||||
|
|
||||||
|
string extExtractedDir = ToExtendedPath(extractedDir);
|
||||||
|
string extBackupAsar = ToExtendedPath(backupAsar);
|
||||||
|
string extOriginalAsar = ToExtendedPath(originalAsar);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 1. 解凍ディレクトリの削除(con.png等の特殊名を含むフォルダも拡張パスで安全に削除)
|
||||||
|
if (!string.IsNullOrEmpty(extExtractedDir) && Directory.Exists(extExtractedDir))
|
||||||
|
{
|
||||||
|
Directory.Delete(extExtractedDir, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. バックアップした asar を元の名前に戻す
|
||||||
|
if (File.Exists(extBackupAsar))
|
||||||
|
{
|
||||||
|
if (File.Exists(extOriginalAsar))
|
||||||
|
{
|
||||||
|
File.Delete(extOriginalAsar);
|
||||||
|
}
|
||||||
|
File.Move(extBackupAsar, extOriginalAsar);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (true, "ゲームを元の app.asar 形式に復元しました。(解凍フォルダは綺麗に削除されました)");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (false, $"復元処理中にエラーが発生しました: {ex.Message}");
|
||||||
|
}
|
||||||
|
}, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,447 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services.Codecs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Easy Save 3 (ES3) 形式のセーブデータ(.sd, .es3, .save, .dat)用コーデック
|
||||||
|
/// </summary>
|
||||||
|
public class EasySave3Codec : ISaveDataCodec
|
||||||
|
{
|
||||||
|
public string CodecName => "Easy Save 3 (ES3) コーデック";
|
||||||
|
|
||||||
|
public bool RequiresPassword => false;
|
||||||
|
|
||||||
|
public string? PasswordPromptMessage => "暗号化パスワードが設定されている場合は入力してください(未設定・既定の場合は空欄):";
|
||||||
|
|
||||||
|
// キャッシュ用の最新平文JSONノード
|
||||||
|
private JsonNode? _cachedRootNode;
|
||||||
|
private bool _wasEncrypted;
|
||||||
|
private string? _usedPassword;
|
||||||
|
|
||||||
|
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
||||||
|
{
|
||||||
|
var ext = Path.GetExtension(file.FilePath).ToLowerInvariant();
|
||||||
|
if (ext is ".sd" or ".es3" or ".save" or ".dat")
|
||||||
|
{
|
||||||
|
// ES3 の特徴:ファイル名が 0.sd, s.sd, h.sd, SaveFile.es3 など、またはファイルサイズが適度
|
||||||
|
if (file.FileName.EndsWith(".sd", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.FileName.EndsWith(".es3", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
||||||
|
{
|
||||||
|
var list = new List<SaveDataPropertyEntry>();
|
||||||
|
if (!File.Exists(filePath)) return list;
|
||||||
|
|
||||||
|
byte[] fileBytes = File.ReadAllBytes(filePath);
|
||||||
|
if (fileBytes.Length == 0) return list;
|
||||||
|
|
||||||
|
string? jsonText = null;
|
||||||
|
_wasEncrypted = false;
|
||||||
|
_usedPassword = null;
|
||||||
|
|
||||||
|
// 1. まず平文 JSON または Gzip 解凍を試みる
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string text = Encoding.UTF8.GetString(fileBytes);
|
||||||
|
if (text.TrimStart().StartsWith("{") || text.TrimStart().StartsWith("["))
|
||||||
|
{
|
||||||
|
jsonText = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// 2. Gzip 圧縮の解凍を試みる
|
||||||
|
if (jsonText == null && fileBytes.Length > 2 && fileBytes[0] == 0x1F && fileBytes[1] == 0x8B)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var ms = new MemoryStream(fileBytes);
|
||||||
|
using var gzip = new GZipStream(ms, CompressionMode.Decompress);
|
||||||
|
using var reader = new StreamReader(gzip, Encoding.UTF8);
|
||||||
|
jsonText = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. パスワード指定または既定パスワードによる AES 復号を試みる
|
||||||
|
if (jsonText == null)
|
||||||
|
{
|
||||||
|
var candidatePasswords = new List<string>();
|
||||||
|
if (!string.IsNullOrEmpty(optionalPassword))
|
||||||
|
{
|
||||||
|
candidatePasswords.Add(optionalPassword);
|
||||||
|
}
|
||||||
|
candidatePasswords.AddRange(new[] { "Moodkie", "password", "", "SaveData" });
|
||||||
|
|
||||||
|
foreach (var pwd in candidatePasswords)
|
||||||
|
{
|
||||||
|
var decrypted = TryDecryptAes(fileBytes, pwd);
|
||||||
|
if (!string.IsNullOrEmpty(decrypted))
|
||||||
|
{
|
||||||
|
jsonText = decrypted;
|
||||||
|
_wasEncrypted = true;
|
||||||
|
_usedPassword = pwd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(jsonText))
|
||||||
|
{
|
||||||
|
// JSON展開ができなかった場合、バイナリキー・バリュー形式として先頭・重要オフセットを抽出
|
||||||
|
return ExtractBinaryPropertiesFallback(fileBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSON からプロパティを再帰的に展開
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_cachedRootNode = JsonNode.Parse(jsonText);
|
||||||
|
if (_cachedRootNode is JsonObject rootObj)
|
||||||
|
{
|
||||||
|
FlattenJsonObject(rootObj, "", list);
|
||||||
|
}
|
||||||
|
else if (_cachedRootNode is JsonArray rootArr)
|
||||||
|
{
|
||||||
|
FlattenJsonArray(rootArr, "Array", list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return ExtractBinaryPropertiesFallback(fileBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FlattenJsonObject(JsonObject obj, string prefix, List<SaveDataPropertyEntry> list)
|
||||||
|
{
|
||||||
|
foreach (var kvp in obj)
|
||||||
|
{
|
||||||
|
string key = string.IsNullOrEmpty(prefix) ? kvp.Key : $"{prefix}.{kvp.Key}";
|
||||||
|
var node = kvp.Value;
|
||||||
|
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Category = string.IsNullOrEmpty(prefix) ? "ルート" : prefix,
|
||||||
|
Type = "null",
|
||||||
|
EditValue = "null",
|
||||||
|
RawData = key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (node is JsonValue val)
|
||||||
|
{
|
||||||
|
string type = "String";
|
||||||
|
if (val.TryGetValue(out int intVal)) type = "Int";
|
||||||
|
else if (val.TryGetValue(out long longVal)) type = "Long";
|
||||||
|
else if (val.TryGetValue(out double dblVal)) type = "Float";
|
||||||
|
else if (val.TryGetValue(out bool boolVal)) type = "Bool";
|
||||||
|
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Category = string.IsNullOrEmpty(prefix) ? "基本変数" : prefix,
|
||||||
|
Type = type,
|
||||||
|
EditValue = val.ToString() ?? "",
|
||||||
|
RawData = key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (node is JsonObject childObj)
|
||||||
|
{
|
||||||
|
// ES3 特有の構造: { "__type": "...", "value": ... } の場合は中身を直接展開
|
||||||
|
if (childObj.ContainsKey("value") && childObj["value"] is JsonValue directVal)
|
||||||
|
{
|
||||||
|
string type = childObj["__type"]?.ToString() ?? "Object";
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Category = prefix,
|
||||||
|
Type = type,
|
||||||
|
EditValue = directVal.ToString() ?? "",
|
||||||
|
RawData = key + ".value"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FlattenJsonObject(childObj, key, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (node is JsonArray childArr)
|
||||||
|
{
|
||||||
|
if (childArr.Count <= 20)
|
||||||
|
{
|
||||||
|
FlattenJsonArray(childArr, key, list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Category = prefix,
|
||||||
|
Type = $"配列[{childArr.Count}]",
|
||||||
|
EditValue = childArr.ToJsonString(),
|
||||||
|
Description = "要素数が多いためJSON形式で直接編集できます",
|
||||||
|
RawData = key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FlattenJsonArray(JsonArray arr, string prefix, List<SaveDataPropertyEntry> list)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < arr.Count; i++)
|
||||||
|
{
|
||||||
|
string key = $"{prefix}[{i}]";
|
||||||
|
var node = arr[i];
|
||||||
|
if (node is JsonValue val)
|
||||||
|
{
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Category = prefix,
|
||||||
|
Type = "要素",
|
||||||
|
EditValue = val.ToString() ?? "",
|
||||||
|
RawData = key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (node is JsonObject childObj)
|
||||||
|
{
|
||||||
|
FlattenJsonObject(childObj, key, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SaveDataPropertyEntry> ExtractBinaryPropertiesFallback(byte[] bytes)
|
||||||
|
{
|
||||||
|
var list = new List<SaveDataPropertyEntry>();
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = "FileSize",
|
||||||
|
Category = "ファイル情報",
|
||||||
|
Type = "Int",
|
||||||
|
EditValue = bytes.Length.ToString(),
|
||||||
|
Description = "ファイルサイズ (bytes)"
|
||||||
|
});
|
||||||
|
|
||||||
|
// 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化
|
||||||
|
int limit = Math.Min(bytes.Length - 4, 128);
|
||||||
|
for (int i = 0; i < limit; i += 4)
|
||||||
|
{
|
||||||
|
int val = BitConverter.ToInt32(bytes, i);
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = $"Offset_0x{i:X2}",
|
||||||
|
Category = "バイナリ変数 (4バイト)",
|
||||||
|
Type = "Int32",
|
||||||
|
EditValue = val.ToString(),
|
||||||
|
Description = $"16進数オフセット 0x{i:X2} の数値",
|
||||||
|
RawData = i
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_cachedRootNode != null)
|
||||||
|
{
|
||||||
|
// JSON の値を更新
|
||||||
|
foreach (var prop in properties)
|
||||||
|
{
|
||||||
|
if (prop.RawData is string keyPath)
|
||||||
|
{
|
||||||
|
UpdateJsonNodeByPath(_cachedRootNode, keyPath, prop.EditValue, prop.Type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
};
|
||||||
|
string updatedJson = _cachedRootNode.ToJsonString(options);
|
||||||
|
|
||||||
|
byte[] outputBytes = Encoding.UTF8.GetBytes(updatedJson);
|
||||||
|
|
||||||
|
// もともと暗号化されていた場合は再暗号化
|
||||||
|
if (_wasEncrypted)
|
||||||
|
{
|
||||||
|
string pwd = !string.IsNullOrEmpty(optionalPassword) ? optionalPassword : (_usedPassword ?? "Moodkie");
|
||||||
|
outputBytes = EncryptAes(outputBytes, pwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// バックアップ作成
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
File.Copy(filePath, filePath + ".bak", overwrite: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllBytes(filePath, outputBytes);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// バイナリオフセット書き換え
|
||||||
|
byte[] fileBytes = File.ReadAllBytes(filePath);
|
||||||
|
foreach (var prop in properties)
|
||||||
|
{
|
||||||
|
if (prop.RawData is int offset && offset + 4 <= fileBytes.Length)
|
||||||
|
{
|
||||||
|
if (int.TryParse(prop.EditValue, out int val))
|
||||||
|
{
|
||||||
|
var b = BitConverter.GetBytes(val);
|
||||||
|
Array.Copy(b, 0, fileBytes, offset, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
File.Copy(filePath, filePath + ".bak", overwrite: true);
|
||||||
|
}
|
||||||
|
File.WriteAllBytes(filePath, fileBytes);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateJsonNodeByPath(JsonNode root, string path, string newValue, string type)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// ドットと角括弧でパスを分割
|
||||||
|
var parts = path.Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
JsonNode? current = root;
|
||||||
|
|
||||||
|
for (int i = 0; i < parts.Length - 1; i++)
|
||||||
|
{
|
||||||
|
if (current is JsonObject obj && obj.ContainsKey(parts[i]))
|
||||||
|
{
|
||||||
|
current = obj[parts[i]];
|
||||||
|
}
|
||||||
|
else if (current is JsonArray arr && int.TryParse(parts[i], out int arrIdx) && arrIdx < arr.Count)
|
||||||
|
{
|
||||||
|
current = arr[arrIdx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string lastKey = parts[^1];
|
||||||
|
if (current is JsonObject finalObj)
|
||||||
|
{
|
||||||
|
finalObj[lastKey] = ParseJsonValue(newValue, type);
|
||||||
|
}
|
||||||
|
else if (current is JsonArray finalArr && int.TryParse(lastKey, out int finalIdx) && finalIdx < finalArr.Count)
|
||||||
|
{
|
||||||
|
finalArr[finalIdx] = ParseJsonValue(newValue, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonNode? ParseJsonValue(string value, string type)
|
||||||
|
{
|
||||||
|
if (type == "Int" && int.TryParse(value, out int i)) return JsonValue.Create(i);
|
||||||
|
if (type == "Long" && long.TryParse(value, out long l)) return JsonValue.Create(l);
|
||||||
|
if (type == "Float" && double.TryParse(value, out double d)) return JsonValue.Create(d);
|
||||||
|
if (type == "Bool" && bool.TryParse(value, out bool b)) return JsonValue.Create(b);
|
||||||
|
if (type == "null") return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// JSON オブジェクトや配列としてパース可能か試みる
|
||||||
|
if (value.StartsWith("{") || value.StartsWith("["))
|
||||||
|
{
|
||||||
|
return JsonNode.Parse(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return JsonValue.Create(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? TryDecryptAes(byte[] data, string password)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] rawUtf8 = Encoding.UTF8.GetBytes(password);
|
||||||
|
var key16 = new byte[16];
|
||||||
|
Array.Copy(rawUtf8, key16, Math.Min(rawUtf8.Length, 16));
|
||||||
|
|
||||||
|
if (data.Length > 16)
|
||||||
|
{
|
||||||
|
var iv = new byte[16];
|
||||||
|
Array.Copy(data, 0, iv, 0, 16);
|
||||||
|
var cipher = new byte[data.Length - 16];
|
||||||
|
Array.Copy(data, 16, cipher, 0, cipher.Length);
|
||||||
|
|
||||||
|
using var aes = Aes.Create();
|
||||||
|
aes.Mode = CipherMode.CBC;
|
||||||
|
aes.Padding = PaddingMode.PKCS7;
|
||||||
|
aes.Key = key16;
|
||||||
|
aes.IV = iv;
|
||||||
|
|
||||||
|
using var dec = aes.CreateDecryptor();
|
||||||
|
byte[] plain = dec.TransformFinalBlock(cipher, 0, cipher.Length);
|
||||||
|
string text = Encoding.UTF8.GetString(plain);
|
||||||
|
if (text.Contains("{") || text.Contains("__type") || text.Contains("version"))
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] EncryptAes(byte[] plainBytes, string password)
|
||||||
|
{
|
||||||
|
byte[] rawUtf8 = Encoding.UTF8.GetBytes(password);
|
||||||
|
var key16 = new byte[16];
|
||||||
|
Array.Copy(rawUtf8, key16, Math.Min(rawUtf8.Length, 16));
|
||||||
|
|
||||||
|
using var aes = Aes.Create();
|
||||||
|
aes.Mode = CipherMode.CBC;
|
||||||
|
aes.Padding = PaddingMode.PKCS7;
|
||||||
|
aes.Key = key16;
|
||||||
|
aes.GenerateIV();
|
||||||
|
|
||||||
|
using var enc = aes.CreateEncryptor();
|
||||||
|
byte[] cipher = enc.TransformFinalBlock(plainBytes, 0, plainBytes.Length);
|
||||||
|
|
||||||
|
var result = new byte[aes.IV.Length + cipher.Length];
|
||||||
|
Array.Copy(aes.IV, 0, result, 0, aes.IV.Length);
|
||||||
|
Array.Copy(cipher, 0, result, aes.IV.Length, cipher.Length);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services.Codecs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// バイナリ/暗号化セーブデータのGUI編集用デコーダー・エンコーダーインターフェース
|
||||||
|
/// </summary>
|
||||||
|
public interface ISaveDataCodec
|
||||||
|
{
|
||||||
|
/// <summary>コーデックの識別名称(例: "Easy Save 3 (ES3)", "YU-RIS セーブデータ")</summary>
|
||||||
|
string CodecName { get; }
|
||||||
|
|
||||||
|
/// <summary>このコーデックで指定ファイルを処理可能か判定</summary>
|
||||||
|
bool CanHandle(UnityGameItem game, SaveFileEntry file);
|
||||||
|
|
||||||
|
/// <summary>セーブファイルからGUI編集用プロパティ一覧をロード・解析</summary>
|
||||||
|
List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null);
|
||||||
|
|
||||||
|
/// <summary>GUI編集されたプロパティ一覧をファイルへ再エンコード・保存</summary>
|
||||||
|
bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null);
|
||||||
|
|
||||||
|
/// <summary>復号にパスワードやキーが必要かどうか</summary>
|
||||||
|
bool RequiresPassword { get; }
|
||||||
|
|
||||||
|
/// <summary>パスワード入力時の案内メッセージ</summary>
|
||||||
|
string? PasswordPromptMessage { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services.Codecs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// YU-RIS エンジン形式のセーブデータ(YSSD シグネチャ)用コーデック
|
||||||
|
/// </summary>
|
||||||
|
public class YurisSaveCodec : ISaveDataCodec
|
||||||
|
{
|
||||||
|
public string CodecName => "YU-RIS セーブデータ (YSSD) コーデック";
|
||||||
|
|
||||||
|
public bool RequiresPassword => false;
|
||||||
|
|
||||||
|
public string? PasswordPromptMessage => null;
|
||||||
|
|
||||||
|
public bool CanHandle(UnityGameItem game, SaveFileEntry file)
|
||||||
|
{
|
||||||
|
if (!File.Exists(file.FilePath)) return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var fs = File.OpenRead(file.FilePath);
|
||||||
|
if (fs.Length < 16) return false;
|
||||||
|
|
||||||
|
var magic = new byte[4];
|
||||||
|
fs.ReadExactly(magic);
|
||||||
|
|
||||||
|
// "YSSD" (0x59 0x53 0x53 0x44)
|
||||||
|
return magic[0] == 0x59 && magic[1] == 0x53 && magic[2] == 0x53 && magic[3] == 0x44;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SaveDataPropertyEntry> LoadProperties(string filePath, string? optionalPassword = null)
|
||||||
|
{
|
||||||
|
var list = new List<SaveDataPropertyEntry>();
|
||||||
|
if (!File.Exists(filePath)) return list;
|
||||||
|
|
||||||
|
byte[] bytes = File.ReadAllBytes(filePath);
|
||||||
|
if (bytes.Length < 16) return list;
|
||||||
|
|
||||||
|
int headerSize = BitConverter.ToInt32(bytes, 4);
|
||||||
|
int version = BitConverter.ToInt32(bytes, 8);
|
||||||
|
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = "Signature",
|
||||||
|
Category = "ヘッダー情報",
|
||||||
|
Type = "String",
|
||||||
|
EditValue = "YSSD (YU-RIS Save Data)",
|
||||||
|
Description = "セーブ識別子"
|
||||||
|
});
|
||||||
|
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = "HeaderSize",
|
||||||
|
Category = "ヘッダー情報",
|
||||||
|
Type = "Int32",
|
||||||
|
EditValue = headerSize.ToString(),
|
||||||
|
Description = "ヘッダーサイズ"
|
||||||
|
});
|
||||||
|
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = "SaveVersion",
|
||||||
|
Category = "ヘッダー情報",
|
||||||
|
Type = "Int32",
|
||||||
|
EditValue = version.ToString(),
|
||||||
|
Description = "セーブバージョン番号"
|
||||||
|
});
|
||||||
|
|
||||||
|
// 16バイト以降の変数領域から、4バイト整数および文字列をスキャン
|
||||||
|
int offset = 16;
|
||||||
|
int varIndex = 0;
|
||||||
|
|
||||||
|
while (offset + 4 <= bytes.Length && varIndex < 100)
|
||||||
|
{
|
||||||
|
int val = BitConverter.ToInt32(bytes, offset);
|
||||||
|
list.Add(new SaveDataPropertyEntry
|
||||||
|
{
|
||||||
|
Key = $"Var_{varIndex:D3} (0x{offset:X4})",
|
||||||
|
Category = "ゲーム変数 / フラグ",
|
||||||
|
Type = "Int32",
|
||||||
|
EditValue = val.ToString(),
|
||||||
|
Description = $"オフセット 0x{offset:X4} の4バイト値",
|
||||||
|
RawData = offset
|
||||||
|
});
|
||||||
|
|
||||||
|
offset += 4;
|
||||||
|
varIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SaveProperties(string filePath, List<SaveDataPropertyEntry> properties, string? optionalPassword = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] bytes = File.ReadAllBytes(filePath);
|
||||||
|
|
||||||
|
foreach (var prop in properties)
|
||||||
|
{
|
||||||
|
if (prop.RawData is int offset && offset + 4 <= bytes.Length)
|
||||||
|
{
|
||||||
|
if (int.TryParse(prop.EditValue, out int val))
|
||||||
|
{
|
||||||
|
var b = BitConverter.GetBytes(val);
|
||||||
|
Array.Copy(b, 0, bytes, offset, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
File.Copy(filePath, filePath + ".bak", overwrite: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllBytes(filePath, bytes);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
using GameLauncher.Services.Codecs;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 各種セーブデータコーデックの統括管理および未対応時のAIプロンプト自動生成を行うマネージャ
|
||||||
|
/// </summary>
|
||||||
|
public class SaveDataCodecManager
|
||||||
|
{
|
||||||
|
public static readonly SaveDataCodecManager Instance = new();
|
||||||
|
|
||||||
|
private readonly List<ISaveDataCodec> _codecs = [];
|
||||||
|
|
||||||
|
public SaveDataCodecManager()
|
||||||
|
{
|
||||||
|
// コーデックの登録
|
||||||
|
_codecs.Add(new EasySave3Codec());
|
||||||
|
_codecs.Add(new YurisSaveCodec());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたゲームおよびセーブファイルに対応するコーデックを検索します。
|
||||||
|
/// </summary>
|
||||||
|
public ISaveDataCodec? FindCodec(UnityGameItem game, SaveFileEntry file)
|
||||||
|
{
|
||||||
|
foreach (var codec in _codecs)
|
||||||
|
{
|
||||||
|
if (codec.CanHandle(game, file))
|
||||||
|
{
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 未対応セーブデータについて、Antigravity IDE に依頼できる安全なプロンプトを自動生成します。
|
||||||
|
/// </summary>
|
||||||
|
public string GenerateAntigravityPrompt(UnityGameItem game, SaveFileEntry file)
|
||||||
|
{
|
||||||
|
// ポリシー配慮: 会社名・タイトル名からセンシティブ表現を除去/安全な別名に変換
|
||||||
|
string safeGameName = SanitizeForPrompt(string.IsNullOrEmpty(game.ProductName) ? game.FolderName : game.ProductName);
|
||||||
|
string safeCompany = SanitizeForPrompt(game.CompanyName);
|
||||||
|
if (string.IsNullOrEmpty(safeCompany)) safeCompany = "UnknownDeveloper";
|
||||||
|
|
||||||
|
string fileName = Path.GetFileName(file.FilePath);
|
||||||
|
string ext = Path.GetExtension(file.FilePath).ToLowerInvariant();
|
||||||
|
|
||||||
|
// 先頭32バイトのHexダンプを取得
|
||||||
|
string hexDump = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(file.FilePath))
|
||||||
|
{
|
||||||
|
byte[] bytes = File.ReadAllBytes(file.FilePath);
|
||||||
|
int count = Math.Min(32, bytes.Length);
|
||||||
|
var hexList = new List<string>();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
hexList.Add(bytes[i].ToString("X2"));
|
||||||
|
}
|
||||||
|
hexDump = string.Join(" ", hexList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine("【GameLauncher セーブデータGUI編集プラグイン追加リクエスト】");
|
||||||
|
sb.AppendLine("GameLauncher で管理している以下のゲームのバイナリセーブデータについて、GUIで閲覧・編集できるようにコーデック(ISaveDataCodec)の実装を追加してください。");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine("■ 対象ゲーム情報:");
|
||||||
|
sb.AppendLine($"- 開発元/サークル: {safeCompany}");
|
||||||
|
sb.AppendLine($"- 作品名/識別子: {safeGameName}");
|
||||||
|
sb.AppendLine($"- バックエンド形式: {game.BackendBadgeText} (Unity {game.UnityVersion})");
|
||||||
|
sb.AppendLine($"- ゲームフォルダ: {game.RootDirectory}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine("■ セーブファイル情報:");
|
||||||
|
sb.AppendLine($"- ファイル名: {fileName} (拡張子: {ext})");
|
||||||
|
sb.AppendLine($"- 保存先パス: {file.FilePath}");
|
||||||
|
sb.AppendLine($"- ファイルサイズ: {file.FileSize} bytes");
|
||||||
|
sb.AppendLine($"- 先頭バイト列 (Hex): {hexDump}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine("■ 実装要件:");
|
||||||
|
sb.AppendLine("1. 上記セーブデータの内部構造(暗号化方式、シリアライズ形式、変数テーブルなど)を解析してください。");
|
||||||
|
sb.AppendLine("2. `Services/Codecs/` 配下に新規の `ISaveDataCodec` 実装クラスを作成し、`SaveDataCodecManager` に登録してください。");
|
||||||
|
sb.AppendLine("3. GameLauncher のセーブエディタ画面で、プロパティ一覧(所持金、ステータス、フラグ等)をGUI上で閲覧・編集・保存できるようにしてください。");
|
||||||
|
sb.AppendLine("4. 実装完了後はプロジェクトをビルドし、単一ファイル発行を行ってください。");
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AIプロンプト向けに文字列を安全・中立的な表現にサニタイズ
|
||||||
|
/// </summary>
|
||||||
|
private static string SanitizeForPrompt(string input)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(input)) return "Game";
|
||||||
|
|
||||||
|
// 記号や括弧を取り除き、英数字と安全な文字のみを抽出
|
||||||
|
var sanitized = Regex.Replace(input, @"[\[\]【】()()~~★☆!!??]", " ").Trim();
|
||||||
|
// 過度な空白の整理
|
||||||
|
sanitized = Regex.Replace(sanitized, @"\s+", " ");
|
||||||
|
|
||||||
|
if (sanitized.Length > 30)
|
||||||
|
{
|
||||||
|
sanitized = sanitized[..30];
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.IsNullOrEmpty(sanitized) ? "UnityGame" : sanitized;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,456 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using GameLauncher.Helpers;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ツクールスクリプト改造プラグインの動的検出・適用・復元・管理を行うサービス
|
||||||
|
/// </summary>
|
||||||
|
public class TkoolModService
|
||||||
|
{
|
||||||
|
/// <summary>バックアップファイルのサフィックス</summary>
|
||||||
|
public const string BackupSuffix = ".original_launcher_backup";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 過去のバージョンで使用されていたレガシープラグイン名一覧(完全削除・復元互換用)
|
||||||
|
/// 以前改造されたゲームの検知、復元時のクリーンアップ、新改造適用時の旧ゴミ削除に使用します。
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string[] LegacyPluginNames =
|
||||||
|
[
|
||||||
|
"SpeedUp",
|
||||||
|
"Antigravity_GameTweaks",
|
||||||
|
"DropItem99",
|
||||||
|
"TurnStartFullRecover",
|
||||||
|
"BattleTurnRecover",
|
||||||
|
"MaxGainGold",
|
||||||
|
"MaxGainExp",
|
||||||
|
"InstantMessage"
|
||||||
|
];
|
||||||
|
|
||||||
|
private List<ModPluginDefinition> _availablePlugins = [];
|
||||||
|
|
||||||
|
/// <summary>現在認識されている利用可能なプラグイン一覧</summary>
|
||||||
|
public IReadOnlyList<ModPluginDefinition> AvailablePlugins => _availablePlugins;
|
||||||
|
|
||||||
|
public TkoolModService()
|
||||||
|
{
|
||||||
|
LoadAvailablePlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// exe と同一階層にある plugins フォルダの物理パスを取得します。
|
||||||
|
/// </summary>
|
||||||
|
public static string GetPluginsDirectory()
|
||||||
|
{
|
||||||
|
// 1. 実行ファイルと同じ物理ディレクトリ
|
||||||
|
var exeDir = AppPathHelper.GetExeDirectory();
|
||||||
|
var primary = Path.Combine(exeDir, "plugins");
|
||||||
|
if (Directory.Exists(primary))
|
||||||
|
{
|
||||||
|
return primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 本番配置フォルダ(Z:\自作ソフト\GameLauncher\plugins)
|
||||||
|
const string prodPath = @"Z:\自作ソフト\GameLauncher\plugins";
|
||||||
|
if (Directory.Exists(prodPath))
|
||||||
|
{
|
||||||
|
return prodPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. AppContext.BaseDirectory 配下のフォールバック
|
||||||
|
var baseDir = AppContext.BaseDirectory;
|
||||||
|
var cand1 = Path.Combine(baseDir, "plugins");
|
||||||
|
if (Directory.Exists(cand1)) return cand1;
|
||||||
|
|
||||||
|
return primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// exe と同階層の plugins フォルダから動的にプラグイン一覧を読み込みます。
|
||||||
|
/// </summary>
|
||||||
|
public List<ModPluginDefinition> LoadAvailablePlugins()
|
||||||
|
{
|
||||||
|
var list = new List<ModPluginDefinition>();
|
||||||
|
var pluginsDir = GetPluginsDirectory();
|
||||||
|
|
||||||
|
if (Directory.Exists(pluginsDir))
|
||||||
|
{
|
||||||
|
foreach (var file in Directory.EnumerateFiles(pluginsDir, "*.js"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
list.Add(ModPluginDefinition.FromFile(file));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_availablePlugins = list;
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 現在有効なプラグイン名と旧レガシープラグイン名のすべてを合算した除去対象プラグイン名セットを取得します。
|
||||||
|
/// </summary>
|
||||||
|
public static HashSet<string> GetAllManagedPluginNames(IEnumerable<ModPluginDefinition>? currentPlugins = null)
|
||||||
|
{
|
||||||
|
var set = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
// 過去のレガシープラグイン名をすべて含める
|
||||||
|
foreach (var leg in LegacyPluginNames)
|
||||||
|
{
|
||||||
|
set.Add(leg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 現在のプラグイン群を含める
|
||||||
|
if (currentPlugins != null)
|
||||||
|
{
|
||||||
|
foreach (var p in currentPlugins)
|
||||||
|
{
|
||||||
|
set.Add(p.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dir = GetPluginsDirectory();
|
||||||
|
if (Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
foreach (var file in Directory.EnumerateFiles(dir, "*.js"))
|
||||||
|
{
|
||||||
|
set.Add(Path.GetFileNameWithoutExtension(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定されたゲームに対して、現在のチェック状態に応じた改造の適用または復元を行います。
|
||||||
|
/// </summary>
|
||||||
|
public (bool Success, string Message) ApplyOrRestoreMod(TkoolGameItem game, Dictionary<string, bool>? defaultSettings = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(game.PluginsJsPath) || !File.Exists(game.PluginsJsPath))
|
||||||
|
{
|
||||||
|
return (false, "plugins.js が見つかりません。");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (game.ApplyMod)
|
||||||
|
{
|
||||||
|
return ApplyMod(game, defaultSettings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RestoreOriginal(game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (false, $"スクリプト処理中にエラーが発生しました: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 改造プラグインを適用します。
|
||||||
|
/// </summary>
|
||||||
|
public (bool Success, string Message) ApplyMod(TkoolGameItem game, Dictionary<string, bool>? defaultSettings = null)
|
||||||
|
{
|
||||||
|
var pluginsJsPath = game.PluginsJsPath;
|
||||||
|
var pluginsDir = game.PluginsDirPath;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(pluginsDir))
|
||||||
|
{
|
||||||
|
pluginsDir = Path.Combine(Path.GetDirectoryName(pluginsJsPath)!, "plugins");
|
||||||
|
game.PluginsDirPath = pluginsDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(pluginsDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(pluginsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
var backupPath = pluginsJsPath + BackupSuffix;
|
||||||
|
|
||||||
|
// 1. バックアップが存在しない場合、バックアップを作成する
|
||||||
|
if (!File.Exists(backupPath))
|
||||||
|
{
|
||||||
|
string currentContent = File.ReadAllText(pluginsJsPath, Encoding.UTF8);
|
||||||
|
// 既に改造プラグイン(新旧問わず)が埋め込まれている場合はクリーンアップしたものをバックアップとして保持
|
||||||
|
string cleanContent = CleanManagedPluginsFromContent(currentContent);
|
||||||
|
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. バックアップ(クリーン状態)を元に編集を開始
|
||||||
|
string baseContent = File.ReadAllText(backupPath, Encoding.UTF8);
|
||||||
|
|
||||||
|
// 最新の動的プラグイン一覧を取得
|
||||||
|
if (_availablePlugins.Count == 0)
|
||||||
|
{
|
||||||
|
LoadAvailablePlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有効化対象のプラグインを取得
|
||||||
|
var pluginsToEnable = _availablePlugins
|
||||||
|
.Where(p => game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除
|
||||||
|
var allManaged = GetAllManagedPluginNames(_availablePlugins);
|
||||||
|
var enabledIds = new HashSet<string>(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
foreach (var pluginId in allManaged)
|
||||||
|
{
|
||||||
|
// 有効対象ではないプラグインファイル(旧プラグインや今回OFFにしたプラグイン)を削除
|
||||||
|
if (!enabledIds.Contains(pluginId))
|
||||||
|
{
|
||||||
|
var targetFile = Path.Combine(pluginsDir, $"{pluginId}.js");
|
||||||
|
if (File.Exists(targetFile))
|
||||||
|
{
|
||||||
|
try { File.Delete(targetFile); } catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 有効対象のプラグインファイルをゲーム側へ配置
|
||||||
|
foreach (var plugin in pluginsToEnable)
|
||||||
|
{
|
||||||
|
CopyPluginToGame(plugin, pluginsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. plugins.js をパース・再構築して有効プラグインを追加
|
||||||
|
var pluginNamesToAdd = pluginsToEnable.Select(p => p.Id).ToList();
|
||||||
|
string updatedContent = RebuildPluginsJs(baseContent, pluginNamesToAdd);
|
||||||
|
|
||||||
|
// 6. 保存
|
||||||
|
File.WriteAllText(pluginsJsPath, updatedContent, new UTF8Encoding(false));
|
||||||
|
game.IsModded = true;
|
||||||
|
|
||||||
|
return (true, $"ツクールスクリプト改造を正常に適用しました。(有効プラグイン: {pluginsToEnable.Count}個)");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 改造を解除し、ゲームを改造前のオリジナル状態に復元します。
|
||||||
|
/// 旧レガシープラグインも含めて完全にクリーンアップします。
|
||||||
|
/// </summary>
|
||||||
|
public (bool Success, string Message) RestoreOriginal(TkoolGameItem game)
|
||||||
|
{
|
||||||
|
var pluginsJsPath = game.PluginsJsPath;
|
||||||
|
var pluginsDir = game.PluginsDirPath;
|
||||||
|
var backupPath = pluginsJsPath + BackupSuffix;
|
||||||
|
|
||||||
|
// 1. バックアップが存在する場合はバックアップから復元(再構築を通すことで壊れたバックアップも修復)
|
||||||
|
if (File.Exists(backupPath))
|
||||||
|
{
|
||||||
|
string backupContent = File.ReadAllText(backupPath, Encoding.UTF8);
|
||||||
|
string cleanContent = RebuildPluginsJs(backupContent, null);
|
||||||
|
File.WriteAllText(pluginsJsPath, cleanContent, new UTF8Encoding(false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// バックアップがなくても、現在の plugins.js から新旧すべての管理プラグインを綺麗に除去
|
||||||
|
string currentContent = File.ReadAllText(pluginsJsPath, Encoding.UTF8);
|
||||||
|
string cleanContent = RebuildPluginsJs(currentContent, null);
|
||||||
|
File.WriteAllText(pluginsJsPath, cleanContent, new UTF8Encoding(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない)
|
||||||
|
if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir))
|
||||||
|
{
|
||||||
|
var allManaged = GetAllManagedPluginNames(_availablePlugins);
|
||||||
|
foreach (var pluginName in allManaged)
|
||||||
|
{
|
||||||
|
var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js");
|
||||||
|
if (File.Exists(targetFile))
|
||||||
|
{
|
||||||
|
try { File.Delete(targetFile); } catch { /* 削除不可時は無視 */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
game.IsModded = false;
|
||||||
|
return (true, "ゲームを改造前のオリジナル状態に正常に復元しました。(旧プラグインも完全削除済み)");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// plugins.js のテキストから新旧すべての管理対象プラグインの登録記述を除去します。
|
||||||
|
/// </summary>
|
||||||
|
public static string CleanManagedPluginsFromContent(string content)
|
||||||
|
{
|
||||||
|
return RebuildPluginsJs(content, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// plugins.js の内容を構文レベルで解析し、新旧管理対象プラグインの完全除去および新規追加を行って
|
||||||
|
/// 正常な JavaScript 配列構文として再構築します。
|
||||||
|
/// </summary>
|
||||||
|
public static string RebuildPluginsJs(string content, IReadOnlyList<string>? pluginsToAdd = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(content))
|
||||||
|
{
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
int arrayStart = content.IndexOf('[');
|
||||||
|
int arrayEnd = content.LastIndexOf(']');
|
||||||
|
if (arrayStart == -1 || arrayEnd == -1 || arrayEnd <= arrayStart)
|
||||||
|
{
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
string prefix = content.Substring(0, arrayStart + 1);
|
||||||
|
string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
|
||||||
|
string suffix = content.Substring(arrayEnd);
|
||||||
|
|
||||||
|
// 新旧すべてのプラグイン名を除去対象とする
|
||||||
|
var managedSet = GetAllManagedPluginNames();
|
||||||
|
var keptObjects = new List<string>();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < inner.Length)
|
||||||
|
{
|
||||||
|
// 次のオブジェクト開始 '{' を探す
|
||||||
|
while (i < inner.Length && inner[i] != '{')
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (i >= inner.Length) break;
|
||||||
|
|
||||||
|
int objStart = i;
|
||||||
|
int depth = 0;
|
||||||
|
bool inString = false;
|
||||||
|
bool isEscaped = false;
|
||||||
|
|
||||||
|
while (i < inner.Length)
|
||||||
|
{
|
||||||
|
char c = inner[i];
|
||||||
|
if (isEscaped)
|
||||||
|
{
|
||||||
|
isEscaped = false;
|
||||||
|
}
|
||||||
|
else if (c == '\\')
|
||||||
|
{
|
||||||
|
if (inString) isEscaped = true;
|
||||||
|
}
|
||||||
|
else if (c == '"')
|
||||||
|
{
|
||||||
|
inString = !inString;
|
||||||
|
}
|
||||||
|
else if (!inString)
|
||||||
|
{
|
||||||
|
if (c == '{') depth++;
|
||||||
|
else if (c == '}')
|
||||||
|
{
|
||||||
|
depth--;
|
||||||
|
if (depth == 0)
|
||||||
|
{
|
||||||
|
i++; // '}' を含める
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depth == 0)
|
||||||
|
{
|
||||||
|
string objText = inner.Substring(objStart, i - objStart).Trim();
|
||||||
|
// このオブジェクトが新旧管理対象プラグインかどうか判定
|
||||||
|
var match = Regex.Match(objText, @"""name""\s*:\s*""([^""]+)""");
|
||||||
|
if (match.Success && managedSet.Contains(match.Groups[1].Value))
|
||||||
|
{
|
||||||
|
// 管理対象プラグインのため除外
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
keptObjects.Add(objText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 追加対象のプラグインを登録
|
||||||
|
if (pluginsToAdd != null)
|
||||||
|
{
|
||||||
|
foreach (var pluginName in pluginsToAdd)
|
||||||
|
{
|
||||||
|
keptObjects.Add($"{{\"name\":\"{pluginName}\",\"status\":true,\"description\":\"\",\"parameters\":{{}}}}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 綺麗な JavaScript 配列として再構築
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.Append(prefix.TrimEnd()).AppendLine();
|
||||||
|
for (int k = 0; k < keptObjects.Count; k++)
|
||||||
|
{
|
||||||
|
sb.Append(keptObjects[k]);
|
||||||
|
if (k < keptObjects.Count - 1)
|
||||||
|
{
|
||||||
|
sb.Append(",");
|
||||||
|
}
|
||||||
|
sb.AppendLine();
|
||||||
|
}
|
||||||
|
sb.Append(suffix.TrimStart());
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// プラグインファイルをゲーム側の plugins ディレクトリへコピーします。
|
||||||
|
/// </summary>
|
||||||
|
private void CopyPluginToGame(ModPluginDefinition plugin, string targetDir)
|
||||||
|
{
|
||||||
|
var destinationPath = Path.Combine(targetDir, plugin.FileName);
|
||||||
|
|
||||||
|
// 1. 指定ファイルの物理パスからコピー
|
||||||
|
if (!string.IsNullOrEmpty(plugin.FilePath) && File.Exists(plugin.FilePath))
|
||||||
|
{
|
||||||
|
File.Copy(plugin.FilePath, destinationPath, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. plugins ディレクトリからのコピーを試行
|
||||||
|
var localPluginPath = Path.Combine(GetPluginsDirectory(), plugin.FileName);
|
||||||
|
if (File.Exists(localPluginPath))
|
||||||
|
{
|
||||||
|
File.Copy(localPluginPath, destinationPath, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new FileNotFoundException($"プラグインファイルが見つかりません: {plugin.FileName} (参照先: {GetPluginsDirectory()})");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 現在 plugins.js に改造プラグイン(新旧問わず)が記述されているか判定します。
|
||||||
|
/// </summary>
|
||||||
|
public static bool CheckIsModded(string pluginsJsPath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(pluginsJsPath) || !File.Exists(pluginsJsPath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string content = File.ReadAllText(pluginsJsPath);
|
||||||
|
var allManaged = GetAllManagedPluginNames();
|
||||||
|
foreach (var pluginName in allManaged)
|
||||||
|
{
|
||||||
|
if (content.Contains($"\"name\":\"{pluginName}\""))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 読み取り失敗時は false
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ティラノスクリプトゲームの個別改造設定オプション
|
||||||
|
/// </summary>
|
||||||
|
public class TyranoModOptions
|
||||||
|
{
|
||||||
|
public bool UnlockAllCg { get; set; } = true;
|
||||||
|
public bool FastMessage { get; set; } = true;
|
||||||
|
public bool EnableDevTools { get; set; } = true;
|
||||||
|
public bool ShowCheatMenu { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ティラノスクリプト(TyranoScript)ゲームのMOD適用・解除・管理を行うサービス
|
||||||
|
/// </summary>
|
||||||
|
public class TyranoModService
|
||||||
|
{
|
||||||
|
public const string ModScriptFileName = "tyrano_launcher_mod.js";
|
||||||
|
public const string IndexBackupSuffix = ".original_launcher_backup";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// index.html に改造スクリプトが適用されているかどうか判定します。
|
||||||
|
/// </summary>
|
||||||
|
public static bool CheckIsModded(string indexPath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(indexPath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string extPath = AsarArchiveService.ToExtendedPath(indexPath);
|
||||||
|
if (!File.Exists(extPath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string content = File.ReadAllText(extPath);
|
||||||
|
return content.Contains(ModScriptFileName);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ティラノスクリプトゲームに改造スクリプトを適用します。
|
||||||
|
/// </summary>
|
||||||
|
public (bool Success, string Message) ApplyMod(TkoolGameItem game, Dictionary<string, bool>? pluginSettings)
|
||||||
|
{
|
||||||
|
var rawIndexPath = game.PluginsJsPath; // ティラノの場合は index.html パス
|
||||||
|
if (string.IsNullOrEmpty(rawIndexPath))
|
||||||
|
{
|
||||||
|
return (false, "index.html が見つかりません。ASARを解凍してください。");
|
||||||
|
}
|
||||||
|
|
||||||
|
var indexPath = AsarArchiveService.ToExtendedPath(rawIndexPath);
|
||||||
|
if (!File.Exists(indexPath))
|
||||||
|
{
|
||||||
|
return (false, "index.html が見つかりません。ASARを解凍してください。");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dir = Path.GetDirectoryName(indexPath)!;
|
||||||
|
var backupPath = indexPath + IndexBackupSuffix;
|
||||||
|
|
||||||
|
// 1. バックアップの作成(存在しない場合)
|
||||||
|
if (!File.Exists(backupPath))
|
||||||
|
{
|
||||||
|
string originalContent = File.ReadAllText(indexPath, Encoding.UTF8);
|
||||||
|
// 既にタグが含まれていた場合は除去したものをバックアップとする
|
||||||
|
string cleanContent = RemoveScriptTag(originalContent);
|
||||||
|
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 有効化する機能の判定
|
||||||
|
bool unlockCg = game.IsPluginEnabled("TyranoUnlockAllCg", pluginSettings, fallbackVal: true);
|
||||||
|
bool fastMsg = game.IsPluginEnabled("TyranoFastMessage", pluginSettings, fallbackVal: true);
|
||||||
|
bool devTools = game.IsPluginEnabled("TyranoDevTools", pluginSettings, fallbackVal: true);
|
||||||
|
bool cheatMenu = game.IsPluginEnabled("TyranoCheatMenu", pluginSettings, fallbackVal: true);
|
||||||
|
|
||||||
|
// 3. tyrano_launcher_mod.js を生成して配置
|
||||||
|
string modJsContent = BuildModScript(unlockCg, fastMsg, devTools, cheatMenu);
|
||||||
|
string modJsPath = Path.Combine(dir, ModScriptFileName);
|
||||||
|
File.WriteAllText(modJsPath, modJsContent, new UTF8Encoding(false));
|
||||||
|
|
||||||
|
// 4. index.html にスクリプトタグを注入
|
||||||
|
string baseContent = File.ReadAllText(backupPath, Encoding.UTF8);
|
||||||
|
string injectedContent = InjectScriptTag(baseContent);
|
||||||
|
File.WriteAllText(indexPath, injectedContent, new UTF8Encoding(false));
|
||||||
|
|
||||||
|
game.IsModded = true;
|
||||||
|
return (true, "ティラノスクリプト用改造を正常に適用しました。(全CG解放/高速化/DevTools/チートメニュー)");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (false, $"ティラノ改造適用中にエラーが発生しました: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ティラノスクリプトゲームの改造を解除し、元のオリジナル状態に復元します。
|
||||||
|
/// </summary>
|
||||||
|
public (bool Success, string Message) RestoreOriginal(TkoolGameItem game)
|
||||||
|
{
|
||||||
|
var rawIndexPath = game.PluginsJsPath;
|
||||||
|
if (string.IsNullOrEmpty(rawIndexPath))
|
||||||
|
{
|
||||||
|
return (false, "index.html のパスが設定されていません。");
|
||||||
|
}
|
||||||
|
|
||||||
|
var indexPath = AsarArchiveService.ToExtendedPath(rawIndexPath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dir = Path.GetDirectoryName(indexPath)!;
|
||||||
|
var backupPath = indexPath + IndexBackupSuffix;
|
||||||
|
var modJsPath = Path.Combine(dir, ModScriptFileName);
|
||||||
|
|
||||||
|
// 1. index.html の復元
|
||||||
|
if (File.Exists(backupPath))
|
||||||
|
{
|
||||||
|
File.Copy(backupPath, indexPath, true);
|
||||||
|
}
|
||||||
|
else if (File.Exists(indexPath))
|
||||||
|
{
|
||||||
|
string content = File.ReadAllText(indexPath, Encoding.UTF8);
|
||||||
|
string clean = RemoveScriptTag(content);
|
||||||
|
File.WriteAllText(indexPath, clean, new UTF8Encoding(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. tyrano_launcher_mod.js の削除
|
||||||
|
if (File.Exists(modJsPath))
|
||||||
|
{
|
||||||
|
try { File.Delete(modJsPath); } catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
game.IsModded = false;
|
||||||
|
return (true, "ティラノスクリプトの改造を解除し、オリジナル状態に復元しました。");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (false, $"復元中にエラーが発生しました: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string InjectScriptTag(string html)
|
||||||
|
{
|
||||||
|
string tag = $"<script type=\"text/javascript\" src=\"./{ModScriptFileName}\"></script>";
|
||||||
|
if (html.Contains(ModScriptFileName))
|
||||||
|
{
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (html.Contains("</body>", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return Regex.Replace(html, @"(</body>)", tag + "\n$1", RegexOptions.IgnoreCase);
|
||||||
|
}
|
||||||
|
else if (html.Contains("</html>", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return Regex.Replace(html, @"(</html>)", tag + "\n$1", RegexOptions.IgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
return html + "\n" + tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string RemoveScriptTag(string html)
|
||||||
|
{
|
||||||
|
return Regex.Replace(html, @"<script[^>]*src=""\./" + Regex.Escape(ModScriptFileName) + @"""[^>]*></script>\r?\n?", "", RegexOptions.IgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildModScript(bool unlockCg, bool fastMessage, bool devTools, bool cheatMenu)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine("/* =============================================================== */");
|
||||||
|
sb.AppendLine("/* GameLauncher - TyranoScript Mod Plugin */");
|
||||||
|
sb.AppendLine("/* =============================================================== */");
|
||||||
|
sb.AppendLine("(function() {");
|
||||||
|
sb.AppendLine(" 'use strict';");
|
||||||
|
sb.AppendLine(" console.log('[GameLauncher] TyranoScript Mod active.');");
|
||||||
|
|
||||||
|
// 1. DevTools
|
||||||
|
if (devTools)
|
||||||
|
{
|
||||||
|
sb.AppendLine(@"
|
||||||
|
// F12キーで開発者ツールを開く
|
||||||
|
window.addEventListener('keydown', function(e) {
|
||||||
|
if (e.key === 'F12') {
|
||||||
|
try {
|
||||||
|
if (typeof require !== 'undefined') {
|
||||||
|
var electron = require('electron');
|
||||||
|
var remote = electron.remote || (electron.remote ? electron.remote : null);
|
||||||
|
var win = remote ? remote.getCurrentWindow() : null;
|
||||||
|
if (win && win.webContents) {
|
||||||
|
if (win.webContents.isDevToolsOpened()) win.webContents.closeDevTools();
|
||||||
|
else win.webContents.openDevTools({ mode: 'detach' });
|
||||||
|
}
|
||||||
|
} else if (typeof nw !== 'undefined') {
|
||||||
|
nw.Window.get().showDevTools();
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('[GameLauncher] DevTools open failed:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine(@"
|
||||||
|
function onTyranoReady() {
|
||||||
|
if (!window.TYRANO || !window.TYRANO.kag) {
|
||||||
|
setTimeout(onTyranoReady, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var kag = window.TYRANO.kag;
|
||||||
|
console.log('[GameLauncher] TYRANO.kag detected.');");
|
||||||
|
|
||||||
|
// 2. FastMessage
|
||||||
|
if (fastMessage)
|
||||||
|
{
|
||||||
|
sb.AppendLine(@"
|
||||||
|
// メッセージ高速化・ウェイト短縮
|
||||||
|
try {
|
||||||
|
if (kag.config) {
|
||||||
|
kag.config.defaultAutoSpeed = 10;
|
||||||
|
kag.config.defaultSkipSpeed = 5;
|
||||||
|
}
|
||||||
|
if (kag.stat && kag.stat.ch_speed !== undefined) {
|
||||||
|
kag.stat.ch_speed = 0;
|
||||||
|
}
|
||||||
|
if (kag.ftag && kag.ftag.master_tag && kag.ftag.master_tag.wait) {
|
||||||
|
var origWait = kag.ftag.master_tag.wait.start;
|
||||||
|
kag.ftag.master_tag.wait.start = function(pm) {
|
||||||
|
if (pm && pm.time) pm.time = Math.min(pm.time, 50);
|
||||||
|
return origWait.apply(this, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[GameLauncher] FastMessage hook error:', e);
|
||||||
|
}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. UnlockAllCg
|
||||||
|
if (unlockCg)
|
||||||
|
{
|
||||||
|
sb.AppendLine(@"
|
||||||
|
// 全CG・全回想フラグの全開放
|
||||||
|
try {
|
||||||
|
function unlockFlags() {
|
||||||
|
if (kag.variable && kag.variable.sf) {
|
||||||
|
var sf = kag.variable.sf;
|
||||||
|
for (var key in sf) {
|
||||||
|
if (sf.hasOwnProperty(key)) {
|
||||||
|
var val = sf[key];
|
||||||
|
if (typeof val === 'object' && val !== null) {
|
||||||
|
for (var sub in val) {
|
||||||
|
if (val.hasOwnProperty(sub)) {
|
||||||
|
if (typeof val[sub] === 'boolean') val[sub] = true;
|
||||||
|
else if (typeof val[sub] === 'number' && val[sub] === 0) val[sub] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('[GameLauncher] System variables (sf) unlocked for CG/scenes.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTimeout(unlockFlags, 1000);
|
||||||
|
setTimeout(unlockFlags, 3000);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[GameLauncher] UnlockAllCg error:', e);
|
||||||
|
}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. CheatMenu
|
||||||
|
if (cheatMenu)
|
||||||
|
{
|
||||||
|
sb.AppendLine(@"
|
||||||
|
// 画面上フローティングチートメニュー
|
||||||
|
try {
|
||||||
|
var btn = document.createElement('div');
|
||||||
|
btn.innerHTML = '⚙ チート';
|
||||||
|
btn.style.cssText = 'position:fixed;top:10px;right:10px;z-index:999999;background:rgba(20,20,30,0.85);color:#00B894;padding:6px 12px;border-radius:6px;font-size:12px;cursor:pointer;border:1px solid #00B894;font-family:sans-serif;user-select:none;font-weight:bold;box-shadow:0 2px 6px rgba(0,0,0,0.5);';
|
||||||
|
|
||||||
|
var modal = document.createElement('div');
|
||||||
|
modal.style.cssText = 'display:none;position:fixed;top:45px;right:10px;width:340px;max-height:480px;background:rgba(24,24,32,0.96);border:1px solid #555;border-radius:8px;z-index:999999;padding:12px;overflow-y:auto;color:#E0E0E6;font-size:12px;font-family:sans-serif;box-shadow:0 4px 12px rgba(0,0,0,0.7);';
|
||||||
|
|
||||||
|
btn.onclick = function() {
|
||||||
|
if (modal.style.display === 'none') {
|
||||||
|
renderVars();
|
||||||
|
modal.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function renderVars() {
|
||||||
|
modal.innerHTML = '<div style=""font-weight:bold;margin-bottom:8px;border-bottom:1px solid #444;padding-bottom:4px;display:flex;justify-content:space-between;""><span>🎮 ゲーム内変数 (f) エディタ</span><span id=""_tkl_close"" style=""cursor:pointer;color:#bbb;"">✕</span></div><div id=""_tkl_list""></div>';
|
||||||
|
document.getElementById('_tkl_close').onclick = function() { modal.style.display = 'none'; };
|
||||||
|
var list = document.getElementById('_tkl_list');
|
||||||
|
var f = (kag.stat && kag.stat.f) ? kag.stat.f : (kag.variable ? kag.variable.f : null);
|
||||||
|
if (!f || Object.keys(f).length === 0) {
|
||||||
|
list.innerHTML = '<div style=""color:#888;"">変数(f)が見つかりません。ゲームを開始してからお試しください。</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var k in f) {
|
||||||
|
if (!f.hasOwnProperty(k)) continue;
|
||||||
|
var val = f[k];
|
||||||
|
if (typeof val === 'number' || typeof val === 'string' || typeof val === 'boolean') {
|
||||||
|
(function(key, currentVal) {
|
||||||
|
var row = document.createElement('div');
|
||||||
|
row.style.cssText = 'display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;';
|
||||||
|
var nameSpan = document.createElement('span');
|
||||||
|
nameSpan.innerText = key;
|
||||||
|
nameSpan.style.cssText = 'max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#FAB1A0;';
|
||||||
|
var input = document.createElement('input');
|
||||||
|
input.value = currentVal;
|
||||||
|
input.style.cssText = 'width:120px;background:#16161E;color:#fff;border:1px solid #444;border-radius:4px;padding:2px 4px;font-size:11px;';
|
||||||
|
input.onchange = function() {
|
||||||
|
var n = Number(input.value);
|
||||||
|
f[key] = isNaN(n) ? input.value : n;
|
||||||
|
console.log('[GameLauncher] Updated f.' + key + ' =', f[key]);
|
||||||
|
};
|
||||||
|
row.appendChild(nameSpan);
|
||||||
|
row.appendChild(input);
|
||||||
|
list.appendChild(row);
|
||||||
|
})(k, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(btn);
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[GameLauncher] CheatMenu error:', e);
|
||||||
|
}");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine(" setTimeout(onTyranoReady, 300);");
|
||||||
|
sb.AppendLine("})();");
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,683 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using GameLauncher.Helpers;
|
||||||
|
using GameLauncher.Models;
|
||||||
|
|
||||||
|
namespace GameLauncher.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// UnityのPlayerPrefs(レジストリ)およびセーブファイル(LocalLow / ゲームフォルダ)の編集・バックアップを行うサービス
|
||||||
|
/// </summary>
|
||||||
|
public class UnitySaveManagerService
|
||||||
|
{
|
||||||
|
// ====================================================================
|
||||||
|
// 1. PlayerPrefs (レジストリ) 管理機能
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// レジストリ(HKCU\Software\[CompanyName]\[ProductName])からPlayerPrefsエントリ一覧を取得します。
|
||||||
|
/// </summary>
|
||||||
|
public List<PlayerPrefsEntry> GetPlayerPrefs(string registryPath)
|
||||||
|
{
|
||||||
|
var list = new List<PlayerPrefsEntry>();
|
||||||
|
if (string.IsNullOrEmpty(registryPath)) return list;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var key = Registry.CurrentUser.OpenSubKey(registryPath, writable: false);
|
||||||
|
if (key == null) return list;
|
||||||
|
|
||||||
|
var valueNames = key.GetValueNames();
|
||||||
|
foreach (var name in valueNames)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var kind = key.GetValueKind(name);
|
||||||
|
var rawValue = key.GetValue(name);
|
||||||
|
|
||||||
|
// キー名から "_h[数字]" のハッシュサフィックスを抽出・除去
|
||||||
|
string cleanKey = name;
|
||||||
|
var match = Regex.Match(name, @"^(.*)_h\d+$");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
cleanKey = match.Groups[1].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerPrefsType type = PlayerPrefsType.Int;
|
||||||
|
if (kind == RegistryValueKind.DWord)
|
||||||
|
{
|
||||||
|
type = PlayerPrefsType.Int;
|
||||||
|
}
|
||||||
|
else if (kind == RegistryValueKind.String)
|
||||||
|
{
|
||||||
|
type = PlayerPrefsType.String;
|
||||||
|
}
|
||||||
|
else if (kind == RegistryValueKind.Binary)
|
||||||
|
{
|
||||||
|
type = PlayerPrefsType.Binary;
|
||||||
|
}
|
||||||
|
|
||||||
|
var entry = new PlayerPrefsEntry
|
||||||
|
{
|
||||||
|
RawKey = name,
|
||||||
|
CleanKey = cleanKey,
|
||||||
|
Type = type,
|
||||||
|
Value = rawValue
|
||||||
|
};
|
||||||
|
|
||||||
|
list.Add(entry);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// キー名昇順でソート
|
||||||
|
return list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefsのエントリ値をレジストリに更新保存します。
|
||||||
|
/// </summary>
|
||||||
|
public bool SavePlayerPref(string registryPath, PlayerPrefsEntry entry)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(registryPath) || string.IsNullOrEmpty(entry.RawKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var key = Registry.CurrentUser.CreateSubKey(registryPath, writable: true);
|
||||||
|
if (key == null) return false;
|
||||||
|
|
||||||
|
switch (entry.Type)
|
||||||
|
{
|
||||||
|
case PlayerPrefsType.Int:
|
||||||
|
if (int.TryParse(entry.EditValue, out int intVal))
|
||||||
|
{
|
||||||
|
key.SetValue(entry.RawKey, intVal, RegistryValueKind.DWord);
|
||||||
|
entry.Value = intVal;
|
||||||
|
entry.IsModified = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlayerPrefsType.Float:
|
||||||
|
if (float.TryParse(entry.EditValue, out float floatVal))
|
||||||
|
{
|
||||||
|
// UnityのPlayerPrefsではfloatは4バイトバイナリとして格納される
|
||||||
|
byte[] floatBytes = BitConverter.GetBytes(floatVal);
|
||||||
|
key.SetValue(entry.RawKey, floatBytes, RegistryValueKind.Binary);
|
||||||
|
entry.Value = floatBytes;
|
||||||
|
entry.IsModified = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlayerPrefsType.String:
|
||||||
|
// 文字列として直接格納するか、UTF-8バイト列(末尾0)として格納
|
||||||
|
// 既存のレジストリ型に合わせる
|
||||||
|
var existingKind = RegistryValueKind.Unknown;
|
||||||
|
try { existingKind = key.GetValueKind(entry.RawKey); } catch { }
|
||||||
|
|
||||||
|
if (existingKind == RegistryValueKind.Binary)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(entry.EditValue + "\0");
|
||||||
|
key.SetValue(entry.RawKey, bytes, RegistryValueKind.Binary);
|
||||||
|
entry.Value = bytes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key.SetValue(entry.RawKey, entry.EditValue, RegistryValueKind.String);
|
||||||
|
entry.Value = entry.EditValue;
|
||||||
|
}
|
||||||
|
entry.IsModified = false;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case PlayerPrefsType.Binary:
|
||||||
|
// Hex文字列のパース(例: "AA BB CC" または "AABBCC")
|
||||||
|
var hexClean = entry.EditValue.Replace(" ", "").Replace("-", "");
|
||||||
|
if (hexClean.Length % 2 == 0)
|
||||||
|
{
|
||||||
|
byte[] rawBytes = Convert.FromHexString(hexClean);
|
||||||
|
key.SetValue(entry.RawKey, rawBytes, RegistryValueKind.Binary);
|
||||||
|
entry.Value = rawBytes;
|
||||||
|
entry.IsModified = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefsに新規キーを追加します。
|
||||||
|
/// </summary>
|
||||||
|
public bool AddPlayerPref(string registryPath, string keyName, PlayerPrefsType type, string value, out string outRawKey)
|
||||||
|
{
|
||||||
|
outRawKey = string.Empty;
|
||||||
|
if (string.IsNullOrEmpty(registryPath) || string.IsNullOrWhiteSpace(keyName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Unityハッシュの付加
|
||||||
|
uint hash = CalculateUnityHash(keyName);
|
||||||
|
string rawKey = $"{keyName}_h{hash}";
|
||||||
|
outRawKey = rawKey;
|
||||||
|
|
||||||
|
using var key = Registry.CurrentUser.CreateSubKey(registryPath, writable: true);
|
||||||
|
if (key == null) return false;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case PlayerPrefsType.Int:
|
||||||
|
int.TryParse(value, out int intVal);
|
||||||
|
key.SetValue(rawKey, intVal, RegistryValueKind.DWord);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case PlayerPrefsType.Float:
|
||||||
|
float.TryParse(value, out float floatVal);
|
||||||
|
byte[] floatBytes = BitConverter.GetBytes(floatVal);
|
||||||
|
key.SetValue(rawKey, floatBytes, RegistryValueKind.Binary);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case PlayerPrefsType.String:
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(value + "\0");
|
||||||
|
key.SetValue(rawKey, bytes, RegistryValueKind.Binary);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case PlayerPrefsType.Binary:
|
||||||
|
var hexClean = value.Replace(" ", "").Replace("-", "");
|
||||||
|
if (hexClean.Length % 2 == 0)
|
||||||
|
{
|
||||||
|
byte[] rawBytes = Convert.FromHexString(hexClean);
|
||||||
|
key.SetValue(rawKey, rawBytes, RegistryValueKind.Binary);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefsのエントリをレジストリから削除します。
|
||||||
|
/// </summary>
|
||||||
|
public bool DeletePlayerPref(string registryPath, string rawKey)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(registryPath) || string.IsNullOrEmpty(rawKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var key = Registry.CurrentUser.OpenSubKey(registryPath, writable: true);
|
||||||
|
if (key != null)
|
||||||
|
{
|
||||||
|
key.DeleteValue(rawKey, throwOnMissingValue: false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UnityのPlayerPrefsキー用ハッシュ値(MurmurHash2 32bit)を算出します。
|
||||||
|
/// </summary>
|
||||||
|
public static uint CalculateUnityHash(string key)
|
||||||
|
{
|
||||||
|
byte[] data = Encoding.UTF8.GetBytes(key);
|
||||||
|
const uint m = 0x5bd1e995;
|
||||||
|
const int r = 24;
|
||||||
|
uint h = (uint)data.Length;
|
||||||
|
|
||||||
|
int length = data.Length;
|
||||||
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
while (length >= 4)
|
||||||
|
{
|
||||||
|
uint k = BitConverter.ToUInt32(data, currentIndex);
|
||||||
|
|
||||||
|
k *= m;
|
||||||
|
k ^= k >> r;
|
||||||
|
k *= m;
|
||||||
|
|
||||||
|
h *= m;
|
||||||
|
h ^= k;
|
||||||
|
|
||||||
|
currentIndex += 4;
|
||||||
|
length -= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (length)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
h ^= (uint)(data[currentIndex + 2] << 16);
|
||||||
|
h ^= (uint)(data[currentIndex + 1] << 8);
|
||||||
|
h ^= data[currentIndex];
|
||||||
|
h *= m;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
h ^= (uint)(data[currentIndex + 1] << 8);
|
||||||
|
h ^= data[currentIndex];
|
||||||
|
h *= m;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
h ^= data[currentIndex];
|
||||||
|
h *= m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
h ^= h >> 13;
|
||||||
|
h *= m;
|
||||||
|
h ^= h >> 15;
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PlayerPrefsレジストリキー全体を .reg ファイルおよび JSON ファイルとしてバックアップします。
|
||||||
|
/// </summary>
|
||||||
|
public string? BackupRegistry(string registryPath, string backupDir)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(registryPath)) return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(backupDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(backupDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
|
var regBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.reg");
|
||||||
|
|
||||||
|
// reg.exe を用いて .reg ファイルを正確に出力
|
||||||
|
var fullRegKey = $@"HKEY_CURRENT_USER\{registryPath}";
|
||||||
|
var psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "reg.exe",
|
||||||
|
Arguments = $"export \"{fullRegKey}\" \"{regBackupFile}\" /y",
|
||||||
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = false
|
||||||
|
};
|
||||||
|
using var proc = Process.Start(psi);
|
||||||
|
proc?.WaitForExit(3000);
|
||||||
|
|
||||||
|
// JSONバックアップも併せて出力
|
||||||
|
var entries = GetPlayerPrefs(registryPath);
|
||||||
|
var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json");
|
||||||
|
var serializableList = entries.Select(e => new
|
||||||
|
{
|
||||||
|
e.RawKey,
|
||||||
|
e.CleanKey,
|
||||||
|
Type = e.Type.ToString(),
|
||||||
|
e.EditValue
|
||||||
|
});
|
||||||
|
var json = JsonSerializer.Serialize(serializableList, new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping });
|
||||||
|
File.WriteAllText(jsonBackupFile, json);
|
||||||
|
|
||||||
|
return File.Exists(regBackupFile) ? regBackupFile : jsonBackupFile;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// .reg ファイルからレジストリを復元します。
|
||||||
|
/// </summary>
|
||||||
|
public bool RestoreRegistry(string regFilePath)
|
||||||
|
{
|
||||||
|
if (!File.Exists(regFilePath)) return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "reg.exe",
|
||||||
|
Arguments = $"import \"{regFilePath}\"",
|
||||||
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = false
|
||||||
|
};
|
||||||
|
using var proc = Process.Start(psi);
|
||||||
|
proc?.WaitForExit(3000);
|
||||||
|
return proc?.ExitCode == 0;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Windows標準のレジストリエディタ(regedit)を起動して該当キーを表示します。
|
||||||
|
/// </summary>
|
||||||
|
public void OpenRegistryEditor(string registryPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// regedit の「前回開いたキー」を更新
|
||||||
|
var fullKey = $@"Computer\HKEY_CURRENT_USER\{registryPath}";
|
||||||
|
using (var lastKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"))
|
||||||
|
{
|
||||||
|
lastKey?.SetValue("LastKey", fullKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
Process.Start(new ProcessStartInfo("regedit.exe") { UseShellExecute = true });
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// 2. ディスク上のセーブファイル(LocalLow / ゲームフォルダ)管理機能
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲームに関連するディスク上のセーブファイルをすべて探索して取得します。
|
||||||
|
/// </summary>
|
||||||
|
public List<SaveFileEntry> GetSaveFiles(UnityGameItem game)
|
||||||
|
{
|
||||||
|
var list = new List<SaveFileEntry>();
|
||||||
|
|
||||||
|
// 1. LocalLow フォルダ
|
||||||
|
if (!string.IsNullOrEmpty(game.LocalLowPath) && Directory.Exists(game.LocalLowPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = Directory.EnumerateFiles(game.LocalLowPath, "*", SearchOption.AllDirectories);
|
||||||
|
foreach (var f in files)
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(f);
|
||||||
|
// ログファイルは除外(Player.log, Player-prev.log)
|
||||||
|
if (fileName.StartsWith("Player", StringComparison.OrdinalIgnoreCase) && fileName.EndsWith(".log", StringComparison.OrdinalIgnoreCase))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var fi = new FileInfo(f);
|
||||||
|
list.Add(new SaveFileEntry
|
||||||
|
{
|
||||||
|
FileName = fileName,
|
||||||
|
FilePath = f,
|
||||||
|
FileSize = fi.Length,
|
||||||
|
LastModified = fi.LastWriteTime,
|
||||||
|
LocationType = "LocalLow",
|
||||||
|
IsTextOrJson = CheckIsTextOrJson(f)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. ゲーム本体フォルダ及びサブフォルダ
|
||||||
|
if (Directory.Exists(game.RootDirectory))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// ルート直下
|
||||||
|
CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list);
|
||||||
|
|
||||||
|
// Save / SaveData / saves / savedata サブフォルダ
|
||||||
|
var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" };
|
||||||
|
foreach (var sub in subNames)
|
||||||
|
{
|
||||||
|
var subPath = Path.Combine(game.RootDirectory, sub);
|
||||||
|
if (Directory.Exists(subPath))
|
||||||
|
{
|
||||||
|
CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dataフォルダ直下のセーブファイル候補
|
||||||
|
if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath))
|
||||||
|
{
|
||||||
|
CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新日時降順でソート
|
||||||
|
return list.OrderByDescending(f => f.LastModified).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CollectCandidateFiles(string dir, string locationLabel, List<SaveFileEntry> list, bool isStrict = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = Directory.EnumerateFiles(dir);
|
||||||
|
foreach (var f in files)
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(f);
|
||||||
|
|
||||||
|
// 既に同パスが登録されていればスキップ
|
||||||
|
if (list.Any(x => x.FilePath.Equals(f, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// システムファイルや実行ファイル等は除外
|
||||||
|
var ext = Path.GetExtension(f).ToLowerInvariant();
|
||||||
|
if (ext is ".exe" or ".dll" or ".config" or ".manifest" or ".txt" or ".log" or ".info" or ".resS" or ".assets")
|
||||||
|
{
|
||||||
|
// readmeやapp.info等はセーブファイルではない
|
||||||
|
if (!fileName.Contains("save", StringComparison.OrdinalIgnoreCase))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStrict)
|
||||||
|
{
|
||||||
|
// セーブファイル候補のフィルタ
|
||||||
|
bool isCandidate = fileName.Contains("save", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
ext is ".sav" or ".save" or ".savegame" or ".dat";
|
||||||
|
|
||||||
|
if (!isCandidate) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fi = new FileInfo(f);
|
||||||
|
list.Add(new SaveFileEntry
|
||||||
|
{
|
||||||
|
FileName = fileName,
|
||||||
|
FilePath = f,
|
||||||
|
FileSize = fi.Length,
|
||||||
|
LastModified = fi.LastWriteTime,
|
||||||
|
LocationType = locationLabel,
|
||||||
|
IsTextOrJson = CheckIsTextOrJson(f)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ファイルがテキストまたはJSON形式か判定します。
|
||||||
|
/// </summary>
|
||||||
|
public bool CheckIsTextOrJson(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ext = Path.GetExtension(filePath).ToLowerInvariant();
|
||||||
|
if (ext is ".json" or ".xml" or ".txt" or ".ini" or ".yaml" or ".yml")
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// ファイルの先頭512バイトを検査
|
||||||
|
using var fs = File.OpenRead(filePath);
|
||||||
|
var buffer = new byte[Math.Min(512, fs.Length)];
|
||||||
|
int read = fs.Read(buffer, 0, buffer.Length);
|
||||||
|
if (read == 0) return true;
|
||||||
|
|
||||||
|
// ヌル文字がほとんど無ければテキスト判定
|
||||||
|
int nullCount = buffer.Take(read).Count(b => b == 0);
|
||||||
|
return nullCount == 0;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブファイルをテキストとして読み出します。
|
||||||
|
/// </summary>
|
||||||
|
public string ReadSaveFileText(string filePath)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath)) return string.Empty;
|
||||||
|
return File.ReadAllText(filePath, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// セーブファイルにテキストを書き込みます(書き込み前に自動で .bak バックアップを作成)。
|
||||||
|
/// </summary>
|
||||||
|
public bool WriteSaveFileText(string filePath, string newContent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
// 自動バックアップ作成
|
||||||
|
var bakPath = filePath + ".bak";
|
||||||
|
File.Copy(filePath, bakPath, overwrite: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(filePath, newContent, Encoding.UTF8);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 単一のセーブファイルをバックアップフォルダへコピー保存します。
|
||||||
|
/// </summary>
|
||||||
|
public string? BackupSaveFile(string filePath, string backupDir)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath)) return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(backupDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(backupDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
|
var destName = $"{Path.GetFileNameWithoutExtension(fileName)}_{timestamp}{Path.GetExtension(fileName)}";
|
||||||
|
var destPath = Path.Combine(backupDir, destName);
|
||||||
|
|
||||||
|
File.Copy(filePath, destPath, overwrite: true);
|
||||||
|
return destPath;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// バックアップファイルからセーブファイルを復元します。
|
||||||
|
/// </summary>
|
||||||
|
public bool RestoreSaveFile(string backupFilePath, string targetFilePath)
|
||||||
|
{
|
||||||
|
if (!File.Exists(backupFilePath)) return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 現在のファイルを退避
|
||||||
|
if (File.Exists(targetFilePath))
|
||||||
|
{
|
||||||
|
var tempBak = targetFilePath + ".pre_restore_bak";
|
||||||
|
File.Copy(targetFilePath, tempBak, overwrite: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Copy(backupFilePath, targetFilePath, overwrite: true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ゲーム専用のバックアップ一覧を取得します。
|
||||||
|
/// </summary>
|
||||||
|
public List<SaveBackupEntry> GetBackupList(UnityGameItem game)
|
||||||
|
{
|
||||||
|
var list = new List<SaveBackupEntry>();
|
||||||
|
var backupDir = AppPathHelper.GetGameBackupDirectory(game.FolderName, game.RootDirectory);
|
||||||
|
|
||||||
|
if (!Directory.Exists(backupDir)) return list;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = Directory.EnumerateFiles(backupDir);
|
||||||
|
foreach (var f in files)
|
||||||
|
{
|
||||||
|
var fi = new FileInfo(f);
|
||||||
|
var ext = fi.Extension.ToLowerInvariant();
|
||||||
|
string type = ext switch
|
||||||
|
{
|
||||||
|
".reg" => "レジストリ (.reg)",
|
||||||
|
".json" => "JSONバックアップ",
|
||||||
|
_ => "ファイルバックアップ"
|
||||||
|
};
|
||||||
|
|
||||||
|
list.Add(new SaveBackupEntry
|
||||||
|
{
|
||||||
|
Name = fi.Name,
|
||||||
|
BackupPath = f,
|
||||||
|
Timestamp = fi.LastWriteTime,
|
||||||
|
BackupType = type,
|
||||||
|
Note = $"{fi.Length / 1024.0:F1} KB"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return list.OrderByDescending(b => b.Timestamp).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// エクスプローラーで指定フォルダを開きます。
|
||||||
|
/// </summary>
|
||||||
|
public static void OpenFolderInExplorer(string folderPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Directory.Exists(folderPath))
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = folderPath,
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (File.Exists(folderPath))
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "explorer.exe",
|
||||||
|
Arguments = $"/select,\"{folderPath}\"",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ
|
||||||
|
* @plugindesc 戦闘高速化・ウェイト削除・アニメーション早送り
|
||||||
|
* @author Antigravity
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* このプラグインは、ウェイトの削除、テキスト速度の向上、アニメーションの早送りにより、
|
||||||
|
* ゲームのバトルを劇的に高速化します。
|
||||||
|
*
|
||||||
|
* 変更点:
|
||||||
|
* - Window_BattleLog のテキストを即時表示。
|
||||||
|
* - Window_BattleLog のウェイトを削除。
|
||||||
|
* - BattleManager のウェイトを可能な限り無視。
|
||||||
|
* - アニメーションを倍速(またはそれ以上)で再生。
|
||||||
|
*/
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Window_BattleLog のオーバーライド
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// メッセージ表示速度を即時に設定
|
||||||
|
Window_BattleLog.prototype.messageSpeed = function() {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 基本的なウェイトを削除
|
||||||
|
Window_BattleLog.prototype.wait = function() {
|
||||||
|
this._waitCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// エフェクト(振動/フラッシュなど)のウェイトを削除
|
||||||
|
Window_BattleLog.prototype.waitForEffect = function() {
|
||||||
|
this._waitCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 移動ウェイトを削除
|
||||||
|
Window_BattleLog.prototype.waitForMovement = function() {
|
||||||
|
this._waitCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 改行ウェイトを削除
|
||||||
|
Window_BattleLog.prototype.waitForNewLine = function() {
|
||||||
|
this._waitCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 常に早送りを有効化
|
||||||
|
Window_BattleLog.prototype.isFastForward = function() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 念のため、updateWaitCount をオーバーライドしてウェイトを即座に消費させる
|
||||||
|
const _Window_BattleLog_updateWaitCount = Window_BattleLog.prototype.updateWaitCount;
|
||||||
|
Window_BattleLog.prototype.updateWaitCount = function() {
|
||||||
|
if (this._waitCount > 0) {
|
||||||
|
this._waitCount = 0; // 0に強制
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Sprite_Animation のオーバーライド (アニメーションの高速化)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// MZでは、アニメーションはEffekseerかSprite_Animationによって処理されます。
|
||||||
|
// Effekseerの場合、速度を上げてみます。
|
||||||
|
|
||||||
|
// Sprite_AnimationMVのロジックが存在する場合、オーバーライド(レガシー)
|
||||||
|
if (Sprite_Animation.prototype.update) {
|
||||||
|
const _Sprite_Animation_update = Sprite_Animation.prototype.update;
|
||||||
|
Sprite_Animation.prototype.update = function() {
|
||||||
|
// フレームごとの更新回数を増やして高速化
|
||||||
|
_Sprite_Animation_update.call(this);
|
||||||
|
if (this.isPlaying()) _Sprite_Animation_update.call(this);
|
||||||
|
if (this.isPlaying()) _Sprite_Animation_update.call(this);
|
||||||
|
if (this.isPlaying()) _Sprite_Animation_update.call(this);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Scene_Battle のオーバーライド
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// バトルシーンでの早送りを強制
|
||||||
|
Scene_Battle.prototype.isFastForward = function() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Scene_Base のオーバーライド (トランジションの高速化)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// 標準フェードの高速化
|
||||||
|
Scene_Base.prototype.fadeSpeed = function() {
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 低速フェードの高速化
|
||||||
|
Scene_Base.prototype.slowFadeSpeed = function() {
|
||||||
|
return 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// SceneManager のオーバーライド (Effekseerの高速化)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Effekseerアニメーション(MZのバトルで使用)の高速化
|
||||||
|
if (SceneManager.updateEffekseer) {
|
||||||
|
SceneManager.updateEffekseer = function() {
|
||||||
|
if (Graphics.effekseer && this.isGameActive()) {
|
||||||
|
// フレームごとに3回更新して3倍速にする
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
// バトル中かどうかを確認して、追加の速度を適用
|
||||||
|
if (this._scene && this._scene.constructor.name === "Scene_Battle") {
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
Graphics.effekseer.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Game_CharacterBase のオーバーライド (移動の高速化)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// const _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
|
||||||
|
// Game_CharacterBase.prototype.initMembers = function() {
|
||||||
|
// _Game_CharacterBase_initMembers.call(this);
|
||||||
|
// // デフォルトは通常4です。5または6に増やすと大幅に速くなります。
|
||||||
|
// // 5は4の2倍速、6は4の4倍速です。
|
||||||
|
// // バランスの良い5(2倍速)に設定します。
|
||||||
|
// // プレイヤーにのみ高速化を適用したい場合でも、ここで適用するとデフォルトですべてのキャラクターに影響します。
|
||||||
|
// // プレイヤーのみに適用するには、Game_Player.prototype.initMembersなどをオーバーライドしてください。
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// // プレイヤーの速度を上げるためにrealMoveSpeedをオーバーライド
|
||||||
|
// Game_Player.prototype.realMoveSpeed = function() {
|
||||||
|
// // 標準移動速度 + 3(超高速)
|
||||||
|
// return this._moveSpeed + 2;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Window_Message のオーバーライド (テキスト即時表示)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// メッセージ更新時に常に高速表示を強制
|
||||||
|
const _Window_Message_updateMessage = Window_Message.prototype.updateMessage;
|
||||||
|
Window_Message.prototype.updateMessage = function() {
|
||||||
|
this._showFast = true; // 常時高速
|
||||||
|
this._lineShowFast = true; // 行待ちをスキップ
|
||||||
|
// this._pauseSkip = true; // テキスト後の入力待ちを許可するために削除
|
||||||
|
return _Window_Message_updateMessage.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
// メッセージ内のウェイト(\.や\|など)を無視するようにstartWaitをオーバーライド
|
||||||
|
Window_Message.prototype.startWait = function(count) {
|
||||||
|
// ウェイトを無視
|
||||||
|
this._waitCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Scene_Battle のオーバーライド (自動戦闘 & 自動開始)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// バトル開始メッセージをスキップ
|
||||||
|
BattleManager.displayStartMessages = function() {
|
||||||
|
// 何もしない
|
||||||
|
};
|
||||||
|
|
||||||
|
// // パーティーコマンド(戦う/逃げる)をスキップ -> 「戦う」をデフォルトに
|
||||||
|
// Scene_Battle.prototype.startPartyCommandSelection = function() {
|
||||||
|
// this.commandFight();
|
||||||
|
// };
|
||||||
|
|
||||||
|
// // アクターコマンドをスキップ -> 全員「攻撃」を実行
|
||||||
|
// Scene_Battle.prototype.startActorCommandSelection = function() {
|
||||||
|
// const actor = BattleManager.actor();
|
||||||
|
// if (actor) {
|
||||||
|
// // アクターの持つすべてのアクションスロットに対して「攻撃」を設定
|
||||||
|
// for (let i = 0; i < actor.numActions(); i++) {
|
||||||
|
// const action = actor.action(i);
|
||||||
|
// if (action) {
|
||||||
|
// action.setAttack(); // 通常攻撃をセット
|
||||||
|
// action.decideRandomTarget(); // ターゲットをランダムに決定
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // 次のコマンドへ進む(UI操作をスキップ)
|
||||||
|
// this.selectNextCommand();
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Window_Message のオーバーライド (バトル結果の自動スキップ)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// バトル終了時(勝利メッセージ)に自動的に「OK」をトリガー
|
||||||
|
const _Window_Message_isTriggered = Window_Message.prototype.isTriggered;
|
||||||
|
Window_Message.prototype.isTriggered = function() {
|
||||||
|
if (SceneManager._scene instanceof Scene_Battle && BattleManager.isBattleEnd()) {
|
||||||
|
return true; // OKボタン押下をシミュレート
|
||||||
|
}
|
||||||
|
return _Window_Message_isTriggered.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のHPを全回復します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 戦闘中、ターン開始時や行動決定時にパーティメンバー全員のHPを最大値まで回復します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const forceFullRecoverPartyHp = function() {
|
||||||
|
if ($gameParty) {
|
||||||
|
$gameParty.battleMembers().forEach(function(actor) {
|
||||||
|
actor.setHp(actor.mhp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startTurn = BattleManager.startTurn;
|
||||||
|
BattleManager.startTurn = function() {
|
||||||
|
forceFullRecoverPartyHp();
|
||||||
|
_BattleManager_startTurn.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startInput = BattleManager.startInput;
|
||||||
|
BattleManager.startInput = function() {
|
||||||
|
forceFullRecoverPartyHp();
|
||||||
|
_BattleManager_startInput.call(this);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のMPを全回復します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 戦闘中、ターン開始時や行動決定時にパーティメンバー全員のMPを最大値まで回復します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const forceFullRecoverPartyMp = function() {
|
||||||
|
if ($gameParty) {
|
||||||
|
$gameParty.battleMembers().forEach(function(actor) {
|
||||||
|
actor.setMp(actor.mmp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startTurn = BattleManager.startTurn;
|
||||||
|
BattleManager.startTurn = function() {
|
||||||
|
forceFullRecoverPartyMp();
|
||||||
|
_BattleManager_startTurn.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startInput = BattleManager.startInput;
|
||||||
|
BattleManager.startInput = function() {
|
||||||
|
forceFullRecoverPartyMp();
|
||||||
|
_BattleManager_startInput.call(this);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 戦闘ターン開始時およびコマンド選択時に味方全員のTPを全回復します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 戦闘中、ターン開始時や行動決定時にパーティメンバー全員のTPを最大値まで回復します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const forceFullRecoverPartyTp = function() {
|
||||||
|
if ($gameParty) {
|
||||||
|
$gameParty.battleMembers().forEach(function(actor) {
|
||||||
|
actor.setTp(actor.maxTp());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startTurn = BattleManager.startTurn;
|
||||||
|
BattleManager.startTurn = function() {
|
||||||
|
forceFullRecoverPartyTp();
|
||||||
|
_BattleManager_startTurn.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
const _BattleManager_startInput = BattleManager.startInput;
|
||||||
|
BattleManager.startInput = function() {
|
||||||
|
forceFullRecoverPartyTp();
|
||||||
|
_BattleManager_startInput.call(this);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc マップ移動時のダッシュ速度を通常より大幅に高速化します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* マップ移動時のダッシュ速度加算ボーナスを +1 から +2 に変更します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
Game_CharacterBase.prototype.realMoveSpeed = function() {
|
||||||
|
return this._moveSpeed + (this.isDashing() ? 2 : 0);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 経験値を獲得した際、即座に最大レベル(99)まで成長させます。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 戦闘やイベントで経験値を獲得した際、そのアクターの最大レベルに到達するまでの経験値を一気に獲得します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const _Game_Actor_gainExp = Game_Actor.prototype.gainExp;
|
||||||
|
Game_Actor.prototype.gainExp = function(exp) {
|
||||||
|
if (exp > 0 && !this.isMaxLevel()) {
|
||||||
|
const maxExp = this.expForLevel(this.maxLevel());
|
||||||
|
exp = Math.max(exp, maxExp - this.currentExp());
|
||||||
|
}
|
||||||
|
_Game_Actor_gainExp.call(this, exp);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc お金(ゴールド)を入手した際、所持金を即座に最大値(9999999)にします。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 宝箱、戦闘勝利、売却、イベント等でお金が増加した瞬間に、
|
||||||
|
* 所持金をシステム上限(9,999,999G)まで満たします。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const _Game_Party_gainGold = Game_Party.prototype.gainGold;
|
||||||
|
Game_Party.prototype.gainGold = function(amount) {
|
||||||
|
if (amount > 0) {
|
||||||
|
amount = this.maxGold() - this._gold;
|
||||||
|
}
|
||||||
|
_Game_Party_gainGold.call(this, amount);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc アイテム・武器・防具を入手した際、自動的に所持数を最大値(99個)にします。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 宝箱、ドロップ、購入、イベント等でアイテムを入手(増加)した際に、
|
||||||
|
* 自動的にその所持数を最大値(99個)にします。
|
||||||
|
* ※消費や売却には影響しません。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const _Game_Party_gainItem = Game_Party.prototype.gainItem;
|
||||||
|
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
|
||||||
|
if (amount > 0 && item) {
|
||||||
|
const max = this.maxItems(item);
|
||||||
|
const current = this.numItems(item);
|
||||||
|
amount = Math.max(0, max - current);
|
||||||
|
}
|
||||||
|
_Game_Party_gainItem.call(this, item, amount, includeEquip);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc 通常アイテム使用時の消費を無効化します(減らずに何度でも使用可能)。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* 通常アイテム(アイテムタイプ1)を使用しても個数が減少しなくなります。
|
||||||
|
* ※メモ欄に <Consume> と記述されたアイテムおよび大事なものは通常通り消費します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const _Game_Party_consumeItem = Game_Party.prototype.consumeItem;
|
||||||
|
Game_Party.prototype.consumeItem = function(item) {
|
||||||
|
if (item && DataManager.isItem(item) && item.itypeId === 1) {
|
||||||
|
if (item.meta && item.meta.Consume) {
|
||||||
|
_Game_Party_consumeItem.call(this, item);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_Game_Party_consumeItem.call(this, item);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc メッセージを常に瞬間表示し、文章中のウェイトを無効化します。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* メッセージウィンドウの文字送りを常に瞬間表示にし、文章中のウェイト制御文字(\. や \|)をスキップします。
|
||||||
|
* ※プレイヤーが読むためのボタン入力待ち(\! やページ末尾)は通常通り機能します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
if (typeof Window_Message !== 'undefined') {
|
||||||
|
const _Window_Message_startMessage = Window_Message.prototype.startMessage;
|
||||||
|
Window_Message.prototype.startMessage = function() {
|
||||||
|
_Window_Message_startMessage.call(this);
|
||||||
|
this._showFast = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const _Window_Message_updateShowFast = Window_Message.prototype.updateShowFast;
|
||||||
|
Window_Message.prototype.updateShowFast = function() {
|
||||||
|
_Window_Message_updateShowFast.call(this);
|
||||||
|
this._showFast = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const _Window_Message_startWait = Window_Message.prototype.startWait;
|
||||||
|
Window_Message.prototype.startWait = function(count) {
|
||||||
|
// ウェイトをスキップ
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*:
|
||||||
|
* @target MZ MV
|
||||||
|
* @plugindesc ショップでのアイテム購入時、個数入力の初期値を最大購入可能数にします。
|
||||||
|
* @author GameLauncher
|
||||||
|
*
|
||||||
|
* @help
|
||||||
|
* ショップ画面でアイテムを購入する際の初期個数を 1 ではなく
|
||||||
|
* 所持金で買える最大数(所持上限まで)に自動設定します。
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
if (typeof Window_ShopNumber !== 'undefined') {
|
||||||
|
const _Window_ShopNumber_setup = Window_ShopNumber.prototype.setup;
|
||||||
|
Window_ShopNumber.prototype.setup = function(item, max, price) {
|
||||||
|
_Window_ShopNumber_setup.call(this, item, max, price);
|
||||||
|
this._number = max;
|
||||||
|
this.refresh();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001 > nul
|
||||||
|
echo === GameLauncher 発行処理を開始します ===
|
||||||
|
powershell -ExecutionPolicy Bypass -File "%~dp0publish.ps1"
|
||||||
|
pause
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
# GameLauncher 単一ファイル発行スクリプト
|
||||||
|
# 公開先: Z:\自作ソフト\GameLauncher\
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$projectDir = $PSScriptRoot
|
||||||
|
$publishDir = 'Z:\自作ソフト\GameLauncher'
|
||||||
|
|
||||||
|
Write-Host '=== GameLauncher 発行処理開始 ===' -ForegroundColor Cyan
|
||||||
|
|
||||||
|
if (!(Test-Path $publishDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host 'プロジェクトのビルドおよび単一ファイル発行中...' -ForegroundColor Yellow
|
||||||
|
|
||||||
|
dotnet publish "$projectDir\GameLauncher.csproj" -c Release -r win-x64 --self-contained false -o $publishDir
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
# プラグインおよび設定ファイルの配置
|
||||||
|
if (Test-Path "$projectDir\plugins") {
|
||||||
|
if (!(Test-Path "$publishDir\plugins")) {
|
||||||
|
New-Item -ItemType Directory -Path "$publishDir\plugins" -Force | Out-Null
|
||||||
|
}
|
||||||
|
Copy-Item -Path "$projectDir\plugins\*" -Destination "$publishDir\plugins" -Recurse -Force
|
||||||
|
}
|
||||||
|
if (Test-Path "$projectDir\Config.tjs") {
|
||||||
|
Copy-Item -Path "$projectDir\Config.tjs" -Destination "$publishDir\Config.tjs" -Force
|
||||||
|
}
|
||||||
|
Write-Host "発行成功: $publishDir\GameLauncher.exe" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "発行失敗 (終了コード: $LASTEXITCODE)" -ForegroundColor Red
|
||||||
|
}
|
||||||
Reference in new issue
Block a user