feat: 初回コミット (GameLauncher)

This commit is contained in:
armonica committed 2026-10-01 09:42:02 +09:00
commit 7ac4dbc825
45 files changed
+9779

No files matched your search

+216
View File
@@ -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 { }
}
}
}
+97
View File
@@ -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);
}
}
}
+104
View File
@@ -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));
}
}
}
+80
View File
@@ -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; }
}
}
+348
View File
@@ -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 => "ティラノスクリプト",
_ => "ツクール/ティラノ"
};
}
}
+80
View File
@@ -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
}
}
+133
View File
@@ -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"
};
}
}
+176
View File
@@ -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");
}
}