flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Flixel demos and examples crash/segfaults on the HL target

Open MetalMaxMX opened this issue 4 years ago • 6 comments

  • Haxe version: 4.2.2
  • Flixel version: 4.9.0
  • OpenFL version: 9.1.0
  • Lime version: 7.9.0
  • Affected targets: Linux's HashLink, latest stable

Code snippet reproducing the issue:


import flixel.FlxState;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();
		
	var text = new flixel.text.FlxText(0, 0, 0, "Hello World", 64);
    text.screenCenter();
    add(text);
		
	}

	override public function update(elapsed:Float)
	{
		super.update(elapsed);
	}
}


Observed behavior: When doing a lime test hl or lime test haxelink, the binary segfaults, the window on "Hello World" first appears for lower than a sec and then crashes immediately, this issue does not happens on: HTML5, Windows, Linux, Neko, etc. targets.

Expected behavior: That the simple hello world HL binary runs as well as those observed from that of the other targets.

On a side-note: A few of the flixel demos like flappybalt also manage to segfault the app as well.

MetalMaxMX avatar Jun 10 '21 17:06 MetalMaxMX

UPDATE: With a bit of help. I was able to get this issue fixed. It seems the issue was located at https://github.com/HaxeFlixel/flixel/blob/27960e3b66c8ebad0052973831960761971168fd/flixel/input/keyboard/FlxKey.hx#L13 from where I needed to replace the negative values of NONE and ANY with that of positive integers. I was told that this is a bug from the compiler which is unable to handle negative-numbered integers and also numbers above 256 for HL switch statements. I'll leave this issue open in case any maintainers or other users would like to offer an opinion on this.

MetalMaxMX avatar Jun 10 '21 20:06 MetalMaxMX

What did you change the values to for NONE and ANY?

... numbers above 256 for HL switch statements

Can you clarify what you mean by that? Do you mean that HashLink can't support more than 256 switch statements or that any number above 256 used as a switch subject causes a crash?

DigiEggz avatar Jul 15 '21 17:07 DigiEggz

What did you change the values to for NONE and ANY?

... numbers above 256 for HL switch statements

Can you clarify what you mean by that? Do you mean that HashLink can't support more than 256 switch statements or that any number above 256 used as a switch subject causes a crash?

Sure, I'm happy to answer and collaborate! I put in the values of NONE as equal 9 and ANY as equal 1. And with that, I was able to get flixel demos compiling on the HL target. On a stock installation of HaxeFlixel and HL on Linux, if you don't modify the values, it just crashes.

I'm not entirely sure about the behavior of the latter as far as switch statements behavior go actually. Of HashLink I mean. Because I was told that this is strictly a bug inside Haxe's compiler that affects HashLink Linux support. In essence, the issue would lie within Haxe's compiler itself, not entirely with HashLink. I haven't done any more testing on this as I'm quite satisfied with my workaround.

The one person who found this issue originally is known as SpyDog, and they raised this issue inside Haxe's https://github.com/HaxeFoundation/haxe/issues/9708. I did however decided to put my issue here since it technically affects HaxeFlixel's behavior. I was also told the workaround by his suggestion (NONE and ANY can be any number that doesn't surpass 256 it seems. But once again, I just tried 1 and 9 randomly and it worked so I left it as that)

I'm always happy to provide more info if needed, cheers! MetalMaxMX.

MetalMaxMX avatar Jul 15 '21 18:07 MetalMaxMX

Hmm... So the 256 limit is specifically related to hl then? I'll have to do some local testing as well.

Btw, I'm amused by the similarity of our usernames. 😄

DigiEggz avatar Jul 15 '21 19:07 DigiEggz

Hmm... So the 256 limit is specifically related to hl then? I'll have to do some local testing as well.

Btw, I'm amused by the similarity of our usernames. smile

I chose mine based on a really old RPG series that is kinda obscure too. Albeit it has been getting some revivals as of lately too, haven't played those though

MetalMaxMX avatar Jul 16 '21 03:07 MetalMaxMX

This is still an issue, is there plans to fix this?

l0go avatar Aug 23 '21 03:08 l0go