diff --git a/SDL3.dll b/SDL3.dll deleted file mode 100644 index 193a5a4d80..0000000000 Binary files a/SDL3.dll and /dev/null differ diff --git a/lib/src/services/files.dart b/lib/src/services/files.dart index ba17523c88..355ec85e94 100644 --- a/lib/src/services/files.dart +++ b/lib/src/services/files.dart @@ -49,6 +49,8 @@ class FilesService extends Service { /// The encoder to convert a Map<> to a json string with a nice indent final JsonEncoder jsonEncoder = const JsonEncoder.withIndent(" "); + bool _isInit = false; + /// Ensure that files and directories that are expected to be present actually /// exist on the system. If not, create them. @override @@ -58,6 +60,7 @@ class FilesService extends Service { loggingDir = await Directory("${outputDir.path}/logs/${DateTime.now().timeStamp}").create(recursive: true); if (!settingsFile.existsSync()) await writeSettings(null); dataLogger = Timer.periodic(const Duration(seconds: 5), logAllData); + _isInit = true; } @override @@ -139,6 +142,7 @@ class FilesService extends Service { /// Outputs error to log file Future logError(Object error, StackTrace stack) async{ + if (!_isInit) return; final file = loggingDir / "errors.log"; await file.writeAsString("${DateTime.now().timeStamp} $error $stack\n", mode: FileMode.writeOnlyAppend); } diff --git a/lib/src/services/gamepad/sdl.dart b/lib/src/services/gamepad/sdl.dart index 12bff96cff..97aaa020d7 100644 --- a/lib/src/services/gamepad/sdl.dart +++ b/lib/src/services/gamepad/sdl.dart @@ -1,4 +1,4 @@ -import "package:sdl_gamepad/sdl_gamepad.dart" as sdl; +import "package:flutter_sdl_gamepad/flutter_sdl_gamepad.dart" as sdl; import "state.dart"; import "gamepad.dart"; diff --git a/lib/src/services/gamepad/service.dart b/lib/src/services/gamepad/service.dart index e15593830d..e9908ed45d 100644 --- a/lib/src/services/gamepad/service.dart +++ b/lib/src/services/gamepad/service.dart @@ -1,4 +1,4 @@ -import "package:sdl_gamepad/sdl_gamepad.dart"; +import "package:flutter_sdl_gamepad/flutter_sdl_gamepad.dart"; import "../service.dart"; import "gamepad.dart"; @@ -45,7 +45,9 @@ class GamepadService extends Service { @override Future init() async { - SdlLibrary.init(); + if (!SdlLibrary.init()) { + throw StateError("Could not initialize SDL libraries"); + } gamepads = List.generate(maxGamepads, MockGamepad.new); for (var i = 0; i < maxGamepads; i++) { await connect(i); diff --git a/libSDL3.so b/libSDL3.so deleted file mode 100755 index a86dbaf473..0000000000 Binary files a/libSDL3.so and /dev/null differ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 469e04bfd0..48238d2926 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + flutter_sdl_gamepad ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/pubspec.lock b/pubspec.lock index 7672c09d2b..225af0afbf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -207,6 +207,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" + flutter_sdl_gamepad: + dependency: "direct main" + description: + name: flutter_sdl_gamepad + sha256: "513910280591bdc5362dda0c0a8d53b310f0d9e5f53c4188ddaf13f7339847b0" + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -498,13 +506,13 @@ packages: source: hosted version: "0.1.34" sdl_gamepad: - dependency: "direct main" + dependency: transitive description: name: sdl_gamepad - sha256: "5d1931dc4e4831dc298a1964b94d4e5a257b027ad5ce268620c6b5e15a46c70b" + sha256: "3bce11dbf7da9a543ce17177342171d5033a2b7198dbfa51b5bee7cdc45d4ac2" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 4af8f55abc..f695a88871 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: url_launcher: ^6.1.10 just_audio: ^0.9.36 collection: ^1.18.0 - sdl_gamepad: ^1.0.1 + flutter_sdl_gamepad: ^1.0.0 # Prefer to use `flutter pub add --dev packageName` rather than modify this section by hand. dev_dependencies: diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 5f4220fb33..9cab379599 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + flutter_sdl_gamepad ) set(PLUGIN_BUNDLED_LIBRARIES)