Skip to content

Commit

Permalink
Merge pull request #200 from KizKizz/system-rework
Browse files Browse the repository at this point in the history
prep
  • Loading branch information
KizKizz authored Apr 19, 2024
2 parents c43cda6 + ab03228 commit fa7c8da
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 38 deletions.
5 changes: 4 additions & 1 deletion Language/CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -446,4 +449,4 @@
"uiImport": "导入",
"uiImportAndApply": "导入并应用MOD",
"uiApplyingImportedMods": "应用已导入的MOD"
}
}
3 changes: 3 additions & 0 deletions Language/EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions Language/JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
"uiOpenMainModManFolder": "メインMODマネージャーフォルダを開く",
"uiOpenExportedModsFolder": "エクスポートしたMODフォルダを開く",
"uiImportExportedMods": "PSO2NGSMODManagerからエクスポートしたMODをインポートする",
"uiStartPSO2": "PSO2スタート",
"uiLaunchGameJPVerOnly": "公式ランチャーをバイパスしてゲームを起動する(JP版のみ)",
"uiIfGameNotLaunching": "ゲームが起動しない場合は、MODManagerを終了し、管理者として実行し、もう一度試してください。",
"uiItemList": "アイテムリスト",
"uiLoadingUILanguage": "UI言語の読み込み",
"uiReloadingMods": "リローディングモッズ",
Expand Down
23 changes: 3 additions & 20 deletions app_version_check/app_version.json
Original file line number Diff line number Diff line change
@@ -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": ""
Expand Down
18 changes: 18 additions & 0 deletions lib/loaders/paths_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ Future<bool> pathsLoader(context) async {
// }
// }

// get edition
File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath());
if (editionFile.existsSync()) {
Provider.of<StateProvider>(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');
Expand Down Expand Up @@ -367,6 +373,12 @@ Future<bool> pso2PathsReloader(context) async {
// }
// }

// get edition
File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath());
if (editionFile.existsSync()) {
Provider.of<StateProvider>(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) {
Expand Down Expand Up @@ -559,6 +571,12 @@ Future<bool> modManPathReloader(context) async {
// }
// }

// get edition
File editionFile = File(Uri.file('$modManPso2binPath/edition.txt').toFilePath());
if (editionFile.existsSync()) {
Provider.of<StateProvider>(context, listen: false).setGameEdition((await editionFile.readAsString()).trim());
}

//sega patch server loader
final patchLinks = await getPatchServerList();
if (patchLinks.isNotEmpty) {
Expand Down
66 changes: 54 additions & 12 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -1625,28 +1625,70 @@ class _MainPageState extends State<MainPage> {
padding: const EdgeInsets.only(top: 1.5),
child: Row(
children: [
//test button
// test button
// Visibility(
// visible: context.watch<StateProvider>().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<StateProvider>().showTitleBarButtons && kDebugMode,
visible: context.watch<StateProvider>().showTitleBarButtons && context.watch<StateProvider>().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))
],
),
),
Expand Down
9 changes: 8 additions & 1 deletion lib/state_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -85,7 +92,7 @@ class StateProvider with ChangeNotifier {
}

void prioritizeLocalBackupFalse() {
_prioritizeLocalBackup= false;
_prioritizeLocalBackup = false;
notifyListeners();
}

Expand Down
5 changes: 4 additions & 1 deletion lib/ui_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions lib/ui_text.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa7c8da

Please sign in to comment.