Skip to content

Commit

Permalink
auto detect wwise installation; update wwise download link
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHeitmann committed Nov 11, 2024
1 parent e1bb2eb commit 502bc90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion lib/stateManagement/preferencesData.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path/path.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../background/IdLookup.dart';
Expand Down Expand Up @@ -150,7 +153,7 @@ class PreferencesData extends OpenFileData {
lastWwiseProjectSettings = SavableProp("lastWwiseProjectSettings", _prefs!, {});
lastHierarchyFiles = SavableProp("lastHierarchyFiles", _prefs!, []);
lastColorPickerMode = SavableProp("lastColorPickerMode", _prefs!, 0);

unawaited(_tryAutoInitPaths());
await super.load();
_loadingState = LoadingState.loaded;
}
Expand Down Expand Up @@ -180,6 +183,22 @@ class PreferencesData extends OpenFileData {
Undoable takeSnapshot() {
return this;
}

Future<void> _tryAutoInitPaths() async {
var wwisePath = wwise2012CliPath!.value;
if (wwisePath.isNotEmpty)
return;
const searchPath = r"C:\Program Files (x86)\Audiokinetic";
var cliPaths = (await Directory(searchPath).list(recursive: true).toList())
.whereType<File>()
.map((file) => file.path)
.where((file) => file.contains("Wwise v2012"))
.where((file) => file.contains("x64"))
.where((file) => basename(file) == "WwiseCLI.exe")
.firstOrNull;
if (cliPaths != null)
wwise2012CliPath!.value = cliPaths;
}
}

class IndexingPathsProp extends ListNotifier<StringProp> {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/misc/preferencesEditor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class _PreferencesEditorState extends ChangeNotifierState<PreferencesEditor> {
const SizedBox(width: 20,),
const Text("Download for example from "),
TextButton(
onPressed: () => launchUrl(Uri.parse("https://mega.nz/file/5SQ3SKCK#pDTdNl7rP2SrFe_6w2JY2E6JqfP_bPosGl4fYHE2R9U")),
onPressed: () => launchUrl(Uri.parse("https://www.saintsrowmods.com/forum/pages/wwise-sriv/#:~:text=I%20agree%2C%20download%20Wwise")),
child: Text("here", style: TextStyle(decoration: TextDecoration.underline),),
),
],
Expand Down

0 comments on commit 502bc90

Please sign in to comment.