Merge branch 'develop' into 8.1.0-Dev

This commit is contained in:
Josh Tynjala
2023-04-24 09:52:11 -07:00
17 changed files with 177 additions and 145 deletions

View File

@@ -29,7 +29,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -101,7 +101,7 @@ jobs:
rm /usr/local/bin/python3*
brew bundle
popd
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -153,7 +153,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -217,9 +217,10 @@ jobs:
with:
ndk-version: r15c
- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: "zulu"
java-version: 8
- uses: krdlab/setup-haxe@v1
with:
@@ -231,7 +232,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -289,7 +290,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -339,7 +340,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
@@ -462,9 +463,10 @@ jobs:
with:
ndk-version: r15c
- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: "zulu"
java-version: 8
- uses: krdlab/setup-haxe@v1
with:
@@ -476,7 +478,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -585,7 +587,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -637,6 +639,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install genes --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
- uses: actions/download-artifact@v3
@@ -661,6 +664,12 @@ jobs:
lime build SimpleImage html5 -release -verbose -nocolor
lime build SimpleAudio html5 -release -verbose -nocolor
- name: Build Lime samples with Genes
run: |
lime build HelloWorld html5 -clean -release -verbose -nocolor --haxelib=genes
lime build SimpleImage html5 -clean -release -verbose -nocolor --haxelib=genes
lime build SimpleAudio html5 -clean -release -verbose -nocolor --haxelib=genes
ios-samples:
needs: package-haxelib
runs-on: macos-11
@@ -676,7 +685,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -727,7 +736,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -773,7 +782,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -834,7 +843,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet
@@ -886,7 +895,7 @@ jobs:
- name: Install Haxe dependencies
run: |
haxelib install hxcpp --quiet
haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib git lime-samples https://github.com/openfl/lime-samples --quiet

View File

@@ -49,8 +49,8 @@ namespace lime {
int GetAscender ();
int GetDescender ();
wchar_t *GetFamilyName ();
int GetGlyphIndex (char* character);
void* GetGlyphIndices (bool useCFFIValue, char* characters);
int GetGlyphIndex (const char* character);
void* GetGlyphIndices (bool useCFFIValue, const char* characters);
void* GetGlyphMetrics (bool useCFFIValue, int index);
int GetHeight ();
int GetNumGlyphs ();

View File

@@ -54,6 +54,7 @@
#endif
#include <cstdlib>
#include <cstring>
DEFINE_KIND (k_finalizer);
@@ -175,6 +176,54 @@ namespace lime {
}
value wstring_to_value (std::wstring* val) {
if (val) {
#ifdef HX_WINDOWS
return alloc_wstring (val->c_str ());
#else
std::string _val = std::string (val->begin (), val->end ());
return alloc_string (_val.c_str ());
#endif
} else {
return 0;
}
}
vbyte* wstring_to_vbytes (std::wstring* val) {
if (val) {
#ifdef HX_WINDOWS
int size = std::wcslen (val->c_str ());
char* result = (char*)malloc (size + 1);
std::wcstombs (result, val->c_str (), size);
result[size] = '\0';
return (vbyte*)result;
#else
std::string _val = std::string (val->begin (), val->end ());
int size = std::strlen (_val.c_str ());
char* result = (char*)malloc (size + 1);
std::strncpy (result, _val.c_str (), size);
result[size] = '\0';
return (vbyte*)result;
#endif
} else {
return 0;
}
}
value lime_application_create () {
Application* application = CreateApplication ();
@@ -687,7 +736,7 @@ namespace lime {
if (path) {
value _path = alloc_wstring (path->c_str ());
value _path = wstring_to_value (path);
delete path;
return _path;
@@ -720,13 +769,9 @@ namespace lime {
if (path) {
int size = std::wcslen (path->c_str ());
char* result = (char*)malloc (size + 1);
std::wcstombs (result, path->c_str (), size);
result[size] = '\0';
vbyte* _path = wstring_to_vbytes (path);
delete path;
return (vbyte*)result;
return _path;
} else {
@@ -757,7 +802,7 @@ namespace lime {
if (path) {
value _path = alloc_wstring (path->c_str ());
value _path = wstring_to_value (path);
delete path;
return _path;
@@ -790,13 +835,9 @@ namespace lime {
if (path) {
int size = std::wcslen (path->c_str ());
char* result = (char*)malloc (size + 1);
std::wcstombs (result, path->c_str (), size);
result[size] = '\0';
vbyte* _path = wstring_to_vbytes (path);
delete path;
return (vbyte*)result;
return _path;
} else {
@@ -830,7 +871,8 @@ namespace lime {
for (int i = 0; i < files.size (); i++) {
val_array_set_i (result, i, alloc_wstring (files[i]->c_str ()));
value _file = wstring_to_value (files[i]);
val_array_set_i (result, i, _file);
delete files[i];
}
@@ -864,12 +906,8 @@ namespace lime {
for (int i = 0; i < files.size (); i++) {
int size = std::wcslen (files[i]->c_str ());
char* _file = (char*)malloc (size + 1);
std::wcstombs (_file, files[i]->c_str (), size);
_file[size] = '\0';
*resultData++ = (vbyte*)_file;
vbyte* _file = wstring_to_vbytes (files[i]);
*resultData++ = _file;
delete files[i];
}
@@ -899,7 +937,7 @@ namespace lime {
if (path) {
value _path = alloc_wstring (path->c_str ());
value _path = wstring_to_value (path);
delete path;
return _path;
@@ -932,13 +970,9 @@ namespace lime {
if (path) {
int size = std::wcslen (path->c_str ());
char* result = (char*)malloc (size + 1);
std::wcstombs (result, path->c_str (), size);
result[size] = '\0';
vbyte* _path = wstring_to_vbytes (path);
delete path;
return (vbyte*)result;
return _path;
} else {

View File

@@ -3659,7 +3659,7 @@ namespace lime {
DEFINE_HL_PRIM (_VOID, hl_al_effecti, _TCFFIPOINTER _I32 _I32);
DEFINE_HL_PRIM (_VOID, hl_al_effectiv, _TCFFIPOINTER _I32 _ARR);
DEFINE_HL_PRIM (_VOID, hl_al_enable, _I32);
DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _DYN);
DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _I32);
DEFINE_HL_PRIM (_VOID, hl_al_filterf, _TCFFIPOINTER _I32 _F32);
DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_aux, _NO_ARG);
DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_buffer, _NO_ARG);

View File

@@ -25,7 +25,7 @@
#define IS_IN_RANGE(c, f, l) (((c) >= (f)) && ((c) <= (l)))
unsigned long readNextChar (char*& p)
unsigned long readNextChar (const char*& p)
{
// TODO: since UTF-8 is a variable-length
// encoding, you should pass in the input
@@ -33,7 +33,8 @@ unsigned long readNextChar (char*& p)
// can determine if a malformed UTF-8
// sequence would exceed the end of the buffer...
unsigned char c1, c2, *ptr = (unsigned char*) p;
const unsigned char* ptr = (const unsigned char*) p;
unsigned char c1, c2;
unsigned long uc = 0;
int seqlen;
@@ -792,7 +793,7 @@ namespace lime {
}
int Font::GetGlyphIndex (char* character) {
int Font::GetGlyphIndex (const char* character) {
long charCode = readNextChar (character);
@@ -801,7 +802,7 @@ namespace lime {
}
void* Font::GetGlyphIndices (bool useCFFIValue, char* characters) {
void* Font::GetGlyphIndices (bool useCFFIValue, const char* characters) {
if (useCFFIValue) {

View File

@@ -444,7 +444,7 @@ class HTML5HTTPRequest
private static function __loadImage(uri:String, promise:Promise<Image>, options:Int):Void
{
var image = new JSImage();
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
if (!__isSameOrigin(uri))
{
@@ -534,7 +534,7 @@ class HTML5HTTPRequest
{
if (request.readyState != 4) return;
if (request.status != null && ((request.status >= 200 && request.status <= 400) || (validStatus0 && request.status == 0)))
if (request.status != null && ((request.status >= 200 && request.status < 400) || (validStatus0 && request.status == 0)))
{
processResponse();
promise.complete(request.responseText);

View File

@@ -1173,7 +1173,7 @@ class HTML5Window
textInput.type = 'text';
#else
// use password instead of text to avoid IME issues on Android
textInput.type = 'password';
textInput.type = Browser.navigator.userAgent.indexOf("Android") >= 0 ? 'password' : 'text';
#end
textInput.style.position = 'absolute';
textInput.style.opacity = "0";

View File

@@ -2308,7 +2308,7 @@ class NativeCFFI
return null;
}
@:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void {}
@:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Int):Void {}
@:hlNative("lime", "hl_al_filterf") private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:hl.F32):Void {}

View File

@@ -1421,11 +1421,7 @@ class Image
@:noCompletion private function __fromBase64(base64:String, type:String, onload:Image->Void = null):Void
{
#if (js && html5)
#if (openfljs || genes)
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
#else
var image = new JSImage();
#end
var image_onLoaded = function(event)
{
@@ -1513,11 +1509,7 @@ class Image
@:noCompletion private function __fromFile(path:String, onload:Image->Void = null, onerror:Void->Void = null):Bool
{
#if (js && html5)
#if (openfljs || genes)
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
#else
var image = new JSImage();
#end
#if !display
if (!HTML5HTTPRequest.__isSameOrigin(path))

View File

@@ -155,16 +155,15 @@ class CFFI
if (result == null)
{
var slash = (__sysName().substr(7).toLowerCase() == "windows") ? "\\" : "/";
var haxelib = __findHaxelib("lime");
if (haxelib != "")
{
result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + slash + library, library, method, args);
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "/" + library, library, method, args);
if (result == null)
{
result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + "64" + slash + library, library, method, args);
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "64/" + library, library, method, args);
}
}
}
@@ -286,34 +285,35 @@ class CFFI
{
if (!__loadedNekoAPI)
{
var init:Dynamic = null;
try
{
var init = load("lime", "neko_init", 5);
if (init != null)
{
__loaderTrace("Found nekoapi @ " + __moduleNames.get("lime"));
init(function(s) return new String(s), function(len:Int)
{
var r = [];
if (len > 0) r[len - 1] = null;
return r;
}, null, true, false);
}
else if (!lazy)
{
throw("Could not find NekoAPI interface.");
}
init = load("lime", "neko_init", 5);
}
catch (e:Dynamic)
{
if (!lazy)
{
throw("Could not find NekoAPI interface.");
}
}
__loadedNekoAPI = true;
if (init != null)
{
__loaderTrace("Found nekoapi @ " + __moduleNames.get("lime"));
init(function(s) return new String(s), function(len:Int)
{
var r = [];
if (len > 0) r[len - 1] = null;
return r;
}, null, true, false);
__loadedNekoAPI = true;
}
else if (!lazy)
{
var ndllFolder = __findHaxelib("lime") + "/ndll/" + __sysName();
throw "Could not find lime.ndll. This file is provided with Lime's Haxelib releases, but not via Git. "
+ "Please copy it from Lime's latest Haxelib release into either "
+ ndllFolder + " or " + ndllFolder + "64, as appropriate for your system. "
+ "Advanced users may run `lime rebuild cpp` instead.";
}
}
}
#end

View File

@@ -63,52 +63,12 @@ class JNI
public static function callMember(method:Dynamic, jobject:Dynamic, a:Array<Dynamic>):Dynamic
{
switch (a.length)
{
case 0:
return method(jobject);
case 1:
return method(jobject, a[0]);
case 2:
return method(jobject, a[0], a[1]);
case 3:
return method(jobject, a[0], a[1], a[2]);
case 4:
return method(jobject, a[0], a[1], a[2], a[3]);
case 5:
return method(jobject, a[0], a[1], a[2], a[3], a[4]);
case 6:
return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5]);
case 7:
return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
default:
return null;
}
return Reflect.callMethod(null, method, [jobject].concat(a));
}
public static function callStatic(method:Dynamic, a:Array<Dynamic>):Dynamic
{
switch (a.length)
{
case 0:
return method();
case 1:
return method(a[0]);
case 2:
return method(a[0], a[1]);
case 3:
return method(a[0], a[1], a[2]);
case 4:
return method(a[0], a[1], a[2], a[3]);
case 5:
return method(a[0], a[1], a[2], a[3], a[4]);
case 6:
return method(a[0], a[1], a[2], a[3], a[4], a[5]);
case 7:
return method(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
default:
return null;
}
return Reflect.callMethod(null, method, a);
}
/**

View File

@@ -149,12 +149,20 @@ class AIRHelper
if (project.debug)
{
args.push("-connect");
if (project.config.exists("air.connect"))
{
args.push("-connect");
args.push(project.config.getString("air.connect"));
}
else if (project.config.exists("air.listen"))
{
args.push("-listen");
args.push(project.config.getString("air.listen"));
}
else
{
args.push("-connect");
}
}
args = args.concat(signingOptions);
@@ -204,9 +212,17 @@ class AIRHelper
Sys.putEnv("AIR_NOANDROIDFLAIR", "true");
}
if (targetPlatform == IOS)
if (targetPlatform == IOS && System.hostPlatform == MAC)
{
Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", XCodeHelper.getSimulatorName(project));
var simulatorName = XCodeHelper.getSimulatorName(project);
if (simulatorName == null)
{
Log.warn("Skipping AIR_IOS_SIMULATOR_DEVICE environment variable because default simulator not found");
}
else
{
Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", simulatorName);
}
}
System.runCommand(workingDirectory, project.defines.get("AIR_SDK") + "/bin/adt", args);

View File

@@ -6,7 +6,7 @@ import lime.tools.HXProject;
class XCodeHelper
{
private static inline var DEFAULT_IPAD_SIMULATOR = "ipad-air";
private static inline var DEFAULT_IPHONE_SIMULATOR = "iphone-11";
private static var DEFAULT_IPHONE_SIMULATOR_REGEX = ~/iphone-\d+/g;
private static function extractSimulatorFlagName(line:String):String
{
@@ -92,7 +92,14 @@ class XCodeHelper
}
else
{
currentDevice = devices.get(DEFAULT_IPHONE_SIMULATOR);
for (device in devices.keys())
{
if (DEFAULT_IPHONE_SIMULATOR_REGEX.match(device))
{
currentDevice = devices.get(device);
break;
}
}
}
}
@@ -101,12 +108,22 @@ class XCodeHelper
public static function getSimulatorID(project:HXProject):String
{
return getSelectedSimulator(project).id;
var simulator = getSelectedSimulator(project);
if (simulator == null)
{
return null;
}
return simulator.id;
}
public static function getSimulatorName(project:HXProject):String
{
return getSelectedSimulator(project).name;
var simulator = getSelectedSimulator(project);
if (simulator == null)
{
return null;
}
return simulator.name;
}
private static function getSimulators():String

View File

@@ -492,6 +492,11 @@ class Assets
public static function registerLibrary(name:String, library:AssetLibrary):Void
{
if (name == null || name == "")
{
name = "default";
}
if (libraries.exists(name))
{
if (libraries.get(name) == library)

View File

@@ -37,8 +37,7 @@ public class GameActivity extends SDLActivity {
if (metrics == null) {
metrics = new DisplayMetrics ();
Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getMetrics (metrics);
metrics = Extension.mainContext.getResources ().getDisplayMetrics ();
}

View File

@@ -91,7 +91,7 @@ class IOSPlatform extends PlatformTarget
title: ""
};
defaults.architectures = [Architecture.ARMV7, Architecture.ARM64];
defaults.architectures = [Architecture.ARM64];
defaults.window.width = 0;
defaults.window.height = 0;
defaults.window.fullscreen = true;
@@ -250,7 +250,7 @@ class IOSPlatform extends PlatformTarget
if (architectures == null || architectures.length == 0)
{
architectures = [Architecture.ARMV7, Architecture.ARM64];
architectures = [Architecture.ARM64];
}
if (project.config.getString("ios.device", "universal") == "universal" || project.config.getString("ios.device") == "iphone")
@@ -487,11 +487,11 @@ class IOSPlatform extends PlatformTarget
var commands = [];
if (armv6) commands.push(["-Dios", "-DHXCPP_CPP11"]);
if (armv6) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV6"]);
if (armv7) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7"]);
if (armv7s) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7S"]);
if (arm64) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64"]);
if (i386) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_CPP11"]);
if (i386) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_M32", "-DHXCPP_CPP11"]);
if (x86_64) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11"]);
if (arc)

View File

@@ -9,4 +9,3 @@
-lib hxp
#-lib svg
-D optional-cffi
-D no-inline