diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5218c52f7..dd88831dd 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [jgranick] +github: [jgranick, joshtynjala] patreon: openfl open_collective: openfl ko_fi: # Replace with a single Ko-fi username diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfd156bd8..18d0cba94 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -105,7 +105,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -157,7 +157,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $Env:GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -236,7 +236,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -294,7 +294,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -317,7 +317,7 @@ jobs: package-haxelib: needs: [linux-ndll, macos-ndll, windows-ndll, android-ndll, ios-ndll] - runs-on: macos-11 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -337,6 +337,8 @@ jobs: haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet + haxelib install svg --quiet + haxelib install openfl --quiet - name: Enable HXCPP compile cache run: | @@ -344,10 +346,11 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi cp project/lib/hashlink/other/osx/entitlements.xml templates/bin/hl/entitlements.xml + - uses: actions/download-artifact@v3 with: name: Android-NDLL @@ -403,6 +406,11 @@ jobs: name: Linux64-Hashlink path: templates/bin/hl/Linux64 + - name: Rebuild Lime svg.n + working-directory: tools + run: | + haxe svg.hxml + - uses: actions/upload-artifact@v3 with: name: lime-haxelib @@ -415,7 +423,7 @@ jobs: if-no-files-found: error docs: - runs-on: macos-11 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -431,7 +439,7 @@ jobs: - name: Install Haxe dependencies run: | haxelib install dox --quiet - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} - name: Build docs working-directory: docs @@ -511,7 +519,7 @@ jobs: flash-samples: needs: package-haxelib - runs-on: macos-11 + runs-on: ubuntu-latest steps: - uses: krdlab/setup-haxe@v1 @@ -637,7 +645,7 @@ jobs: html5-samples: needs: package-haxelib - runs-on: macos-11 + runs-on: ubuntu-latest steps: - uses: krdlab/setup-haxe@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 815525ba5..ab7304112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ Changelog ========= -8.1.0 (??/??/2023) +8.1.1 (11/08/2023) +------------------ + +* Fixed subset of characters escaped in file paths to fix Android builds on Windows. +* Fixed playback of very long sounds by changing arithmetic to avoid integer overflow. + +8.1.0 (10/16/2023) ------------------ * Added `visible` property to `Window` to allow it to be shown and hidden @@ -14,9 +20,8 @@ Changelog * Added `-terser` option to Lime tools for html5 builds to optionally use Terser minifier * Added `-npx` option to Lime tools to run minifiers, or Electron, using `npx` instead of the bundled versions * Updated the bundled version of Node.js to 18 LTS for the html5 target's HTTP server -* Modernized Android Gradle build options -* Exposed more information to _project.xml_, including `${project.platformType}` and `${config.android.target-sdk-version}` -* Added click count for mouse events, for use by OpenFL +* Exposed more information to _project.xml_, such as `${project.host}` and `${config.android.target-sdk-version}` +* Updated the Android Gradle plugin * Disabled pointer tagging on Android * Fixed issues in `emscripten` target and renamed it to `webassembly` * Fixed unpopulated `responseData` on `HTTPRequest` when server returns error status code diff --git a/externs/air/sys/FileSystem.hx b/externs/air/sys/FileSystem.hx index bd5e31302..2502bf6cd 100644 --- a/externs/air/sys/FileSystem.hx +++ b/externs/air/sys/FileSystem.hx @@ -1,41 +1,65 @@ package sys; +import flash.filesystem.File in FlashFile; +import lime.utils.Log; + @:dce @:coreApi class FileSystem { public static function exists(path:String):Bool { - return false; + return new FlashFile(path).exists; } - public static function rename(path:String, newPath:String):Void {} + public static function rename(path:String, newPath:String):Void + { + new FlashFile(path).moveTo(new FlashFile(newPath)); + } public static function stat(path:String):sys.FileStat { + Log.warn("stat is not implemented"); return null; } public static function fullPath(relPath:String):String { - return null; + var flashFile = new FlashFile(relPath); + flashFile.canonicalize(); + return flashFile.nativePath; } public static function absolutePath(relPath:String):String { - return null; + return new FlashFile(relPath).nativePath; } public static function isDirectory(path:String):Bool { - return false; + return new FlashFile(path).isDirectory; } - public static function createDirectory(path:String):Void {} + public static function createDirectory(path:String):Void + { + new FlashFile(path).createDirectory(); + } - public static function deleteFile(path:String):Void {} + public static function deleteFile(path:String):Void + { + new FlashFile(path).deleteFile(); + } - public static function deleteDirectory(path:String):Void {} + public static function deleteDirectory(path:String):Void + { + new FlashFile(path).deleteDirectory(false); + } - public static function readDirectory(path:String):Array {} + public static function readDirectory(path:String):Array + { + return new FlashFile(path).getDirectoryListing().map(function(f:FlashFile):String + { + return f.name; + }); + } } diff --git a/externs/air/sys/io/File.hx b/externs/air/sys/io/File.hx index 55e659ffa..11ffd701e 100644 --- a/externs/air/sys/io/File.hx +++ b/externs/air/sys/io/File.hx @@ -1,8 +1,11 @@ package sys.io; +import flash.utils.ByteArray; import flash.filesystem.File in FlashFile; import flash.filesystem.FileMode; import flash.filesystem.FileStream; +import lime.utils.Log; +import haxe.io.Bytes; @:dce @:coreApi @@ -18,34 +21,62 @@ class File return content; } - public static function saveContent(path:String, content:String):Void {} + public static function saveContent(path:String, content:String):Void + { + var file = new FlashFile(path); + var stream = new FileStream(); + stream.open(file, FileMode.WRITE); + stream.writeUTFBytes(content); + stream.close(); + } public static function getBytes(path:String):haxe.io.Bytes { - return null; + var file = new FlashFile(path); + var stream = new FileStream(); + stream.open(file, FileMode.READ); + var byteArray = new ByteArray(); + stream.readBytes(byteArray, 0, stream.bytesAvailable); + stream.close(); + return Bytes.ofData(byteArray); } - public static function saveBytes(path:String, bytes:haxe.io.Bytes):Void {} + public static function saveBytes(path:String, bytes:haxe.io.Bytes):Void + { + var byteArray:ByteArray = bytes.getData(); + var file = new FlashFile(path); + var stream = new FileStream(); + stream.open(file, FileMode.WRITE); + stream.writeBytes(byteArray); + stream.close(); + } public static function read(path:String, binary:Bool = true):FileInput { + Log.warn("read is not implemented"); return null; } public static function write(path:String, binary:Bool = true):FileOutput { + Log.warn("write is not implemented"); return null; } public static function append(path:String, binary:Bool = true):FileOutput { + Log.warn("append is not implemented"); return null; } public static function update(path:String, binary:Bool = true):FileOutput { + Log.warn("update is not implemented"); return null; } - public static function copy(srcPath:String, dstPath:String):Void {} + public static function copy(srcPath:String, dstPath:String):Void + { + new FlashFile(srcPath).copyTo(new FlashFile(dstPath)); + } } diff --git a/src/lime/_internal/backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx index 37c04fb79..ab85e0e00 100644 --- a/src/lime/_internal/backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -136,7 +136,7 @@ class NativeAudioSource } } - samples = Std.int((dataLength * 8) / (parent.buffer.channels * parent.buffer.bitsPerSample)); + samples = Std.int((dataLength * 8.0) / (parent.buffer.channels * parent.buffer.bitsPerSample)); } public function play():Void diff --git a/src/lime/media/WebAudioContext.hx b/src/lime/media/WebAudioContext.hx index e03f9fac0..89dac24a3 100644 --- a/src/lime/media/WebAudioContext.hx +++ b/src/lime/media/WebAudioContext.hx @@ -13,6 +13,13 @@ class WebAudioContext public function new() {} + #if (haxe_ver >= 4.2) + public function resume():Dynamic /*Promise*/ + { + return null; + } + #end + public function createAnalyser():Dynamic /*AnalyserNode*/ { return null; diff --git a/src/lime/tools/ProjectHelper.hx b/src/lime/tools/ProjectHelper.hx index fa5ce214c..8bedb9a10 100644 --- a/src/lime/tools/ProjectHelper.hx +++ b/src/lime/tools/ProjectHelper.hx @@ -172,7 +172,7 @@ class ProjectHelper var object:Dynamic = project; while (object != null && fields.length > 0) { - object = Reflect.field(object, fields.shift()); + object = Reflect.getProperty(object, fields.shift()); } if (object != null && object != project) diff --git a/src/lime/ui/Joystick.hx b/src/lime/ui/Joystick.hx index 9bc41783d..3f23c2a9e 100644 --- a/src/lime/ui/Joystick.hx +++ b/src/lime/ui/Joystick.hx @@ -54,8 +54,19 @@ class Joystick #if (js && html5) @:noCompletion private static function __getDeviceData():Array { - return - (untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null; + var res:Dynamic = null; + + try + { + res = (untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null; + } + catch (err:Dynamic) + { + // if something went wrong, treat it the same as when navigator.getGamepads doesn't exist + // we probably don't have permission to use this feature + } + + return res; } #end diff --git a/src/lime/utils/Float32Array.hx b/src/lime/utils/Float32Array.hx index 4a29c4552..6f3876b65 100644 --- a/src/lime/utils/Float32Array.hx +++ b/src/lime/utils/Float32Array.hx @@ -93,7 +93,6 @@ import lime.utils.ArrayBufferView; abstract Float32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView { public inline static var BYTES_PER_ELEMENT:Int = 4; - public static var hello:Int; public var length(get, never):Int; diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 407e4461f..d0ea3cb9d 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -495,9 +495,8 @@ class AndroidPlatform extends PlatformTarget context.ANDROID_BUILD_TOOLS_VERSION = AndroidHelper.getBuildToolsVersion(project); } - var escaped = ~/([ #!=\\:])/g; - context.ANDROID_SDK_ESCAPED = escaped.replace(context.ENV_ANDROID_SDK, "\\$1"); - context.ANDROID_NDK_ROOT_ESCAPED = escaped.replace(context.ENV_ANDROID_NDK_ROOT, "\\$1"); + context.ANDROID_SDK_ESCAPED = StringTools.replace(context.ENV_ANDROID_SDK, "\\", "\\\\"); + context.ANDROID_NDK_ROOT_ESCAPED = StringTools.replace(context.ENV_ANDROID_NDK_ROOT, "\\", "\\\\"); if (Reflect.hasField(context, "KEY_STORE")) context.KEY_STORE = StringTools.replace(context.KEY_STORE, "\\", "\\\\"); if (Reflect.hasField(context, "KEY_STORE_ALIAS")) context.KEY_STORE_ALIAS = StringTools.replace(context.KEY_STORE_ALIAS, "\\", "\\\\"); diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index 2a4893710..93d84cf6c 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -1118,21 +1118,25 @@ class PlatformSetup } else { - System.runCommand("", "sudo", [ - "cp", - "-f", - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", - "/usr/local/bin/lime" - ], false); - System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); - System.runCommand("", "sudo", [ - "cp", - "-f", - System.findTemplate(project.templatePaths, "bin/openfl.sh"), - "/usr/local/bin/openfl" - ], false); - System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false); - installedCommand = true; + try + { + System.runCommand("", "sudo", [ + "cp", + "-f", + Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", + "/usr/local/bin/lime" + ], false); + System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); + System.runCommand("", "sudo", [ + "cp", + "-f", + System.findTemplate(project.templatePaths, "bin/openfl.sh"), + "/usr/local/bin/openfl" + ], false); + System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false); + installedCommand = true; + } + catch (e:Dynamic) {} } }