From ab03228853cfa4a902f094e7deba727159ac78ac Mon Sep 17 00:00:00 2001 From: KizKizz Date: Fri, 19 Apr 2024 00:58:23 -0700 Subject: [PATCH] prep --- Language/CN.json | 5 ++- Language/EN.json | 3 ++ Language/JP.json | 3 ++ app_version_check/app_version.json | 23 ++--------- lib/loaders/paths_loader.dart | 18 ++++++++ lib/pages/main_page.dart | 66 ++++++++++++++++++++++++------ lib/state_provider.dart | 9 +++- lib/ui_text.dart | 5 ++- lib/ui_text.g.dart | 6 +++ pubspec.yaml | 2 +- windows/runner/Runner.rc | 4 +- 11 files changed, 106 insertions(+), 38 deletions(-) diff --git a/Language/CN.json b/Language/CN.json index db94d16..a661cc6 100644 --- a/Language/CN.json +++ b/Language/CN.json @@ -147,6 +147,9 @@ "uiOpenMainModManFolder": "打开主 Mod 管理器文件夹", "uiOpenExportedModsFolder": "打开导出的 Mod 文件夹", "uiImportExportedMods": "导入从 PSO2NGS Mod Manager 导出的 mod", + "uiStartPSO2": "Start PSO2", + "uiLaunchGameJPVerOnly": "Launch the game bypassing official launcher (JP ver only)", + "uiIfGameNotLaunching": "If the game is not launching, close and run the Mod Manager as administration and try again", "uiItemList": "物品列表", "uiLoadingUILanguage": "加载UI语言", "uiReloadingMods": "重新加载MOD", @@ -446,4 +449,4 @@ "uiImport": "导入", "uiImportAndApply": "导入并应用MOD", "uiApplyingImportedMods": "应用已导入的MOD" -} +} \ No newline at end of file diff --git a/Language/EN.json b/Language/EN.json index 7e908ae..724ff84 100644 --- a/Language/EN.json +++ b/Language/EN.json @@ -147,6 +147,9 @@ "uiOpenMainModManFolder": "Open Main Mod Manager Folder", "uiOpenExportedModsFolder": "Open Exported Mods Folder", "uiImportExportedMods": "Import mods that exported from PSO2NGS Mod Manager", + "uiStartPSO2": "Start PSO2", + "uiLaunchGameJPVerOnly": "Launch the game bypassing official launcher (JP ver only)", + "uiIfGameNotLaunching": "If the game is not launching, close and run the Mod Manager as administration and try again", "uiItemList": "Item List", "uiLoadingUILanguage": "Loading UI Language", "uiReloadingMods": "Reloading Mods", diff --git a/Language/JP.json b/Language/JP.json index 963f6c3..10a29a7 100644 --- a/Language/JP.json +++ b/Language/JP.json @@ -147,6 +147,9 @@ "uiOpenMainModManFolder": "メインMODマネージャーフォルダを開く", "uiOpenExportedModsFolder": "エクスポートしたMODフォルダを開く", "uiImportExportedMods": "PSO2NGSMODManagerからエクスポートしたMODをインポートする", + "uiStartPSO2": "PSO2スタート", + "uiLaunchGameJPVerOnly": "公式ランチャーをバイパスしてゲームを起動する(JP版のみ)", + "uiIfGameNotLaunching": "ゲームが起動しない場合は、MODManagerを終了し、管理者として実行し、もう一度試してください。", "uiItemList": "アイテムリスト", "uiLoadingUILanguage": "UI言語の読み込み", "uiReloadingMods": "リローディングモッズ", diff --git a/app_version_check/app_version.json b/app_version_check/app_version.json index aae6d39..43c1839 100644 --- a/app_version_check/app_version.json +++ b/app_version_check/app_version.json @@ -1,26 +1,9 @@ { "name": "PSO2NGS Mod Manager", - "version": "2.6.4", + "version": "2.6.5", "description": [ - "v2.6.2 + v2.6.3 + 2.6.4:", - "More bug fixes", - "その他のバグ修正", - "v2.6.1:", - "Added adding progress text to Add Mods - Thanks Melodii (@melo.dii) for the suggestion!", - "Hot-fixes for v2.6.0", - "MODの追加にプログレス・テキストを追加 - 提案してくれたMelodii (@melo.dii) に感謝!", - "2.6.0のホットフィックス", - "v2.6.0:", - "Added support for .rar and .7z files through 7-zip", - "Added export mods feature (Individual mods and applied mods in Applied Mods, hope it would make it easier to share mods)", - "Added import mods feature (Imported mods will be automatically added to Mod Sets and can be applied right away)", - "Added rename function to Mod Sets", - "Some bug fixes and improvements (Thank you for reporting bugs!)", - "7-zipによる.rarファイルと.7zファイルのサポートを追加", - "MODのエクスポート機能を追加(個別MODと応用MODは応用MODに)", - "MODのインポート機能を追加(インポートされたMODは自動的にMODセットに追加され、すぐに適用できます)", - "MODセットにリネーム機能を追加", - "いくつかのバグ修正と改善(バグのご報告ありがとうございました)" + "Added a button to launch the JP version of the game directly without official launcher (to bypass startup file check in JP version)", + "公式ランチャーを使わずにJP版を直接起動するボタンを追加(JP版の起動ファイルチェックを避けるため)" ], "windows_file": "", "linux_file": "" diff --git a/lib/loaders/paths_loader.dart b/lib/loaders/paths_loader.dart index 0f2561d..c4edf3d 100644 --- a/lib/loaders/paths_loader.dart +++ b/lib/loaders/paths_loader.dart @@ -198,6 +198,12 @@ Future pathsLoader(context) async { // } // } + // get edition + File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath()); + if (editionFile.existsSync()) { + Provider.of(context, listen: false).setGameEdition((await editionFile.readAsString()).trim()); + } + //ref sheets check load files if (kDebugMode && Directory(Uri.file('$modManRefSheetsDirPath/Player').toFilePath()).existsSync()) { final sheetFiles = Directory(Uri.file('$modManRefSheetsDirPath/Player').toFilePath()).listSync(recursive: true).where((element) => p.extension(element.path) == '.csv'); @@ -367,6 +373,12 @@ Future pso2PathsReloader(context) async { // } // } + // get edition + File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath()); + if (editionFile.existsSync()) { + Provider.of(context, listen: false).setGameEdition((await editionFile.readAsString()).trim()); + } + //Apply mods to new data folder for (var type in appliedItemList) { for (var cate in type.categories) { @@ -559,6 +571,12 @@ Future modManPathReloader(context) async { // } // } + // get edition + File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath()); + if (editionFile.existsSync()) { + Provider.of(context, listen: false).setGameEdition((await editionFile.readAsString()).trim()); + } + //sega patch server loader final patchLinks = await getPatchServerList(); if (patchLinks.isNotEmpty) { diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 8fcab8d..6499337 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -7,7 +7,6 @@ import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:dio/dio.dart'; import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:file_selector/file_selector.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pso2_mod_manager/application.dart'; @@ -36,6 +35,7 @@ import 'package:pso2_mod_manager/sharing/mods_import.dart'; import 'package:pso2_mod_manager/state_provider.dart'; import 'package:pso2_mod_manager/ui_text.dart'; import 'package:pso2_mod_manager/vital_gauge/vital_gauge_swapper_homepage.dart'; +import 'package:pso2_mod_manager/widgets/snackbar.dart'; import 'package:pso2_mod_manager/widgets/tooltip.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -1625,28 +1625,70 @@ class _MainPageState extends State { padding: const EdgeInsets.only(top: 1.5), child: Row( children: [ - //test button + // test button + // Visibility( + // visible: context.watch().showTitleBarButtons && kDebugMode, + // child: Padding( + // padding: const EdgeInsets.only(right: 5), + // child: ModManTooltip( + // message: curLangText!.uiAddNewModsToMM, + // child: SizedBox( + // //width: curActiveLang == 'JP' ? 110 : 105, + // child: MaterialButton( + // color: Colors.redAccent, + // onPressed: () async { + // modsImportHomePage(context); + // }, + // child: const Row( + // children: [ + // Icon( + // Icons.deblur, + // size: 18, + // ), + // SizedBox(width: 2.5), + // Text('Destruct', style: TextStyle(fontWeight: FontWeight.w400)) + // ], + // ), + // ), + // ), + // ), + // ), + // ), + + // jp ver start button Visibility( - visible: context.watch().showTitleBarButtons && kDebugMode, + visible: context.watch().showTitleBarButtons && context.watch().gameEdition == 'jp', child: Padding( - padding: const EdgeInsets.only(right: 5), + padding: const EdgeInsets.only(right: 2.5), child: ModManTooltip( - message: curLangText!.uiAddNewModsToMM, + message: curLangText!.uiLaunchGameJPVerOnly, child: SizedBox( //width: curActiveLang == 'JP' ? 110 : 105, child: MaterialButton( - color: Colors.redAccent, + color: Colors.blue, onPressed: () async { - modsImportHomePage(context); + File startBatch = File(Uri.file('$modManDirPath/startpso2jp.bat').toFilePath()); + if (!startBatch.existsSync()) await startBatch.create(recursive: true); + if (startBatch.existsSync()) { + //check for checksum + await applyModsChecksumChecker(context); + //create start file + await startBatch.writeAsString('cd "$modManPso2binPath"\nSET -pso2=+0x33aca2b9\nstart $modManPso2binPath/pso2.exe +0x33aca2b9 -reboot -optimize'); + await Process.run(startBatch.path, []); + startBatch.deleteSync(); + } else { + Process.runSync(Uri.file('$modManPso2binPath/pso2.exe').toFilePath(), ["+0x33aca2b9", "-reboot", "-optimize"], workingDirectory: modManPso2binPath); + ScaffoldMessenger.of(context).showSnackBar(snackBarMessage(context, '', curLangText!.uiIfGameNotLaunching, 3000)); + } }, - child: const Row( + child: Row( children: [ - Icon( - Icons.deblur, + const Icon( + Icons.play_arrow, size: 18, ), - SizedBox(width: 2.5), - Text('Destruct', style: TextStyle(fontWeight: FontWeight.w400)) + const SizedBox(width: 2.5), + Text(curLangText!.uiStartPSO2, style: const TextStyle(fontWeight: FontWeight.w400)) ], ), ), diff --git a/lib/state_provider.dart b/lib/state_provider.dart index fc60f8e..26343cf 100644 --- a/lib/state_provider.dart +++ b/lib/state_provider.dart @@ -37,6 +37,7 @@ class StateProvider with ChangeNotifier { bool _removeBoundaryRadiusOnModsApply = false; bool _prioritizeLocalBackup = false; String _modAdderProgressStatus = ''; + String _gameEdition = ''; bool get isMainBinFound => _isMainBinFound; bool get isMainModManPathFound => _isMainModManPathFound; @@ -73,6 +74,12 @@ class StateProvider with ChangeNotifier { bool get removeBoundaryRadiusOnModsApply => _removeBoundaryRadiusOnModsApply; bool get prioritizeLocalBackup => _prioritizeLocalBackup; String get modAdderProgressStatus => _modAdderProgressStatus; + String get gameEdition => _gameEdition; + + void setGameEdition(String edition) { + _gameEdition = edition; + notifyListeners(); + } void setModAdderProgressStatus(String status) { _modAdderProgressStatus = status; @@ -85,7 +92,7 @@ class StateProvider with ChangeNotifier { } void prioritizeLocalBackupFalse() { - _prioritizeLocalBackup= false; + _prioritizeLocalBackup = false; notifyListeners(); } diff --git a/lib/ui_text.dart b/lib/ui_text.dart index 76328cc..1444da0 100644 --- a/lib/ui_text.dart +++ b/lib/ui_text.dart @@ -170,7 +170,10 @@ class TranslationText { uiItemNameLanguageTooltip = 'Only applies to item names in list when adding mods or swapping items', uiOpenMainModManFolder = 'Open Main Mod Manager Folder', uiOpenExportedModsFolder = 'Open Exported Mods Folder', - uiImportExportedMods = 'Import mods that exported from PSO2NGS Mod Manager'; + uiImportExportedMods = 'Import mods that exported from PSO2NGS Mod Manager', + uiStartPSO2 = 'Start PSO2', + uiLaunchGameJPVerOnly = 'Launch the game bypassing official launcher (JP ver only)', + uiIfGameNotLaunching = 'If the game is not launching, close and run the Mod Manager as administration and try again'; //homepage String uiItemList = 'Item List', diff --git a/lib/ui_text.g.dart b/lib/ui_text.g.dart index e7671a3..9997dcb 100644 --- a/lib/ui_text.g.dart +++ b/lib/ui_text.g.dart @@ -191,6 +191,9 @@ TranslationText _$TranslationTextFromJson(Map json) => ..uiOpenMainModManFolder = json['uiOpenMainModManFolder'] as String ..uiOpenExportedModsFolder = json['uiOpenExportedModsFolder'] as String ..uiImportExportedMods = json['uiImportExportedMods'] as String + ..uiStartPSO2 = json['uiStartPSO2'] as String + ..uiLaunchGameJPVerOnly = json['uiLaunchGameJPVerOnly'] as String + ..uiIfGameNotLaunching = json['uiIfGameNotLaunching'] as String ..uiItemList = json['uiItemList'] as String ..uiLoadingUILanguage = json['uiLoadingUILanguage'] as String ..uiReloadingMods = json['uiReloadingMods'] as String @@ -717,6 +720,9 @@ Map _$TranslationTextToJson(TranslationText instance) => 'uiOpenMainModManFolder': instance.uiOpenMainModManFolder, 'uiOpenExportedModsFolder': instance.uiOpenExportedModsFolder, 'uiImportExportedMods': instance.uiImportExportedMods, + 'uiStartPSO2': instance.uiStartPSO2, + 'uiLaunchGameJPVerOnly': instance.uiLaunchGameJPVerOnly, + 'uiIfGameNotLaunching': instance.uiIfGameNotLaunching, 'uiItemList': instance.uiItemList, 'uiLoadingUILanguage': instance.uiLoadingUILanguage, 'uiReloadingMods': instance.uiReloadingMods, diff --git a/pubspec.yaml b/pubspec.yaml index 46223a3..46eacd0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 2.6.4 +version: 2.6.5 environment: sdk: ">=3.0.0" diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index ee613b1..8ac07b3 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -63,13 +63,13 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" #ifdef FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #else -#define VERSION_AS_NUMBER 2,6,4 +#define VERSION_AS_NUMBER 2,6,5 #endif #ifdef FLUTTER_BUILD_NAME #define VERSION_AS_STRING #FLUTTER_BUILD_NAME #else -#define VERSION_AS_STRING "2.6.4" +#define VERSION_AS_STRING "2.6.5" #endif VS_VERSION_INFO VERSIONINFO