haxefoundation / format Goto Github PK
View Code? Open in Web Editor NEWVarious files formats support for Haxe
Various files formats support for Haxe
Last release was 7 months ago. Half-a-year!
Fixes just pending in repo, not making it to libraries and tools. Fixes that matter, btw.
Without the SWF: Fix writing signed fix bit values
our openfl application fail to embed swf files. Workaround is to install the format from git and rebuild openfl tools.
The point is that:
Hi,
The worst offender (alloc/cpu) on h3d is often the shader parameter management on as3. I isolated the root of all evil to :
typedef Reg = {
var t : RegType;
var index : Int;
var swiz : Swizzle;
var access : Null<{ t : RegType, comp : C, offset : Int }>;
}
I will rewrite this as class Reg <...>
@ncannasse Are you interested in a pull request ?
Bisous !
format.abc.Writer outputs the number of characters instead of the number of bytes when writing strings. This causes errors when outputting special characters. The following code fixes the problem:
class ABCWriter extends format.abc.Writer {
override function writeString( s : String ) {
var encoding = null;
#if neko
var b = untyped new Bytes(s.length,s.__s);
#else
var b = Bytes.ofString(s, encoding);
#end
writeInt(b.length);
o.writeFullBytes(b,0,b.length);
}
}
It seems some SWF are compressed using LZMA, see :
https://github.com/OpenGG/swfzip/blob/master/swfzip.py
I'm using OpenFL 1.1, and when embedding the Newgrounds API (a swf), I get a "Bits error" that traces back to Reader.hx in this project.
This happened in the past, and it was caused by the SWF having a Font with 0 glyphs inside of it. The fix that worked at the time was to edit readFont2Data so that the following 2 pairs of 2 lines would be skipped in the 0 glyph case.
if(num_glyphs > 0) {
var code_table_offset = readInt();
shape_data_length = code_table_offset - first_glyph_offset;
}
[...]
if(num_glyphs > 0) {
var code_table_offset = i.readUInt16();
shape_data_length = code_table_offset - first_glyph_offset;
}
This workaround no longer works in OpenFL/Haxe 3, and a number of people are hitting the same issue on the OpenFL forums.
Link to the original bug report for NME - has the SWF inside of it too.
https://haxenme.atlassian.net/browse/NME-120
Upon trying to decompress a file by using format.gz.Reader.read(), I get this:
Called from ? line 1
Called from Main.hx line 25
Called from console/Begin.hx line 31
Called from Main.hx line 33
Called from format/gz/Reader.hx line 83
Called from C:\HaxeToolkit\haxe\std/neko/_std/haxe/zip/Uncompress.hx line 34
Uncaught exception - ZLib Error : invalid block type (-3)</code>
I'm sure the file is valid, I compressed it myself using 7-zip.
Don't know for sure what's happening here, and sorry I can't reproduce it easily as of now.
It can be a circular reference
(nodejs reports that sometime), or an infinite loop in InflateLoop() (I also get invalid CRC
sometimes).
Hopefully this rings a bell, but in any case I'm going to try to investigate this further.
(png I was using was this from openfl/openfl#1077)
https://github.com/HaxeFoundation/format/blob/master/format/swf/Writer.hx#L547
bits.writeBit(switch(data.fill) {
case LS2FColor(_): false;
case LS2FStyle(_): true;
});
https://github.com/HaxeFoundation/format/blob/master/format/swf/Writer.hx#L570
switch(data.fill) {
case LS2FColor(color): writeRGBA(color);
case LS2FStyle(style): writeFillStyle(ver, style);
}
The error is correct because LS2Data defines fill to be Null<LS2Fill>
and Haxe now considers explicit null types for exhaustiveness.
The question is what should semantically happen if the field actually is null. Or should the fill field not be nullable after all?
After updating to Format 3.2.1, I'm getting the following errors when running a flash build from Flambe.
Building: build/web/targets/main-flash.swf
haxe --connect 6001 -main Main -D flambe_webgl_enable_linear -D haxeJSON -lib flambe -cp src -dce full -debug --no-opt --no-inline --macro flambe.platform.ManifestBuilder.use("build/web/assets") --flash-strict -swf-header 640:480:60:000000 -D fdb -D advanced-telemetry -swf-version 11.2 -swf build/web/targets/main-flash.swf
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:761: characters 13-14 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:761: characters 13-14 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:101: characters 3-90 : { t : format.agal.RegType, swiz : Null<format.agal.Swizzle>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:103: characters 2-136 : { t : format.agal.RegType, swiz : format.agal.Swizzle, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:591: characters 12-13 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:591: characters 12-13 : For function argument 'src'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:598: characters 15-16 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:598: characters 15-16 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:599: characters 14-15 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:599: characters 14-15 : For function argument 'src'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:623: characters 8-9 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:623: characters 8-9 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:568: characters 18-19 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:568: characters 18-19 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:569: characters 3-8 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:573: characters 18-19 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:573: characters 18-19 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:574: characters 3-8 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:500: characters 18-77 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:500: characters 18-77 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:501: characters 18-77 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:501: characters 18-77 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:502: characters 18-77 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:502: characters 18-77 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:503: characters 15-74 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:503: characters 15-74 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:524: characters 12-30 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:524: characters 12-30 : For function argument 'x'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:525: characters 12-52 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:525: characters 12-52 : For function argument 'x'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:526: characters 12-52 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:526: characters 12-52 : For function argument 'x'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:507: characters 18-77 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:507: characters 18-77 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:508: characters 18-77 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:508: characters 18-77 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:509: characters 15-74 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:509: characters 15-74 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:542: characters 12-31 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:542: characters 12-31 : For function argument 'x'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:543: characters 12-53 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:543: characters 12-53 : For function argument 'x'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:639: characters 5-9 : a1 : format.agal.Reg -> r1 : format.agal.Reg -> r2 : format.agal.Reg -> Void should be a2 : format.agal.Reg -> a : format.agal.Reg -> b : format.agal.Reg -> Null<format.agal.Opcode>
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:639: characters 5-9 : Cannot unify return types
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:639: characters 5-9 : Void should be Null<format.agal.Opcode>
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:639: characters 5-9 : Void should be format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:649: characters 4-11 : dst : format.agal.Reg -> a : format.agal.Reg -> b : format.agal.Reg -> format.agal.Opcode should be Void
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:633: characters 3-7 : Void should be dst : format.agal.Reg -> a : format.agal.Reg -> b : format.agal.Reg -> format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:668: characters 20-21 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:668: characters 20-21 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:669: characters 14-15 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:669: characters 14-15 : For function argument 'src'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:675: characters 19-20 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:675: characters 19-20 : For function argument 'r'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:676: characters 8-9 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:676: characters 8-9 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:677: characters 49-50 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:677: characters 49-50 : For function argument 'a'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:684: characters 9-10 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:684: characters 9-10 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:704: characters 49-101 : { t : format.agal.RegType, swiz : Array<format.agal.C>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:704: characters 49-101 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:704: characters 3-7 : Void should be dst : format.agal.Reg -> v : format.agal.Reg -> format.agal.Opcode
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:712: characters 8-9 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:712: characters 8-9 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:742: characters 23-27 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:742: characters 23-27 : For function argument 'pt'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:188: characters 13-65 : { t : format.agal.RegType, swiz : Unknown<1>, index : Int, access : Unknown<0> } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:188: characters 13-65 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:200: characters 14-15 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:200: characters 14-15 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:201: characters 8-9 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:201: characters 8-9 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:206: characters 12-13 : { t : format.agal.RegType, swiz : Null<Array<format.agal.C>>, index : Int, access : { t : format.agal.RegType, offset : Int, comp : format.agal.C } } should be format.agal.Reg
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:206: characters 12-13 : For function argument 'dst'
/usr/lib/haxe/lib/hxsl/2,0,5/hxsl/AgalCompiler.hx:233: characters 3-156 : { t : format.agal.RegType, swiz : format.agal.Swizzle, index : Int, access : Null<{ t : format.agal.RegType, offset : Int, comp : format.agal.C }> } should be format.agal.Reg
[Finished in 1.8s with exit code 1]
Setting format back to 3.2.0 resolves the issue for me.
APNG is a file which contains several png data.
These can then also be zlib compressed.
https://wiki.mozilla.org/APNG_Specification
I'm getting the Utf8 deprecated warning in a few places, here for instance.
I'm sure this issue is known and a fix is planned and low priority, but I just wanted an issue for posterity and tracking
Z:\HaxeToolkit\haxe\lib/heaps/git/hxd/res/Image.hx:106: characters 13-65 : Type not found : format.gif.Reader
Z:\HaxeToolkit\haxe\lib/heaps/git/hxd/res/Image.hx:107: characters 46-52 : Unknown identifier : format
the "format" library is installed
Since Haxe 3.4 there were implemented new feature for static structures - @:structInit
which gives a lot better performance for static targets. Entire library is built around typedef
and their performance for static targets is questionable as they based on Dynamic
.
Proposal:
Use @:structInit
whenever possible instead of typedefs or at least use them for targets where it would improve performance.
Pros:
Cons:
#if (haxever >= 3.4)
and/or target checks everywhere.Personal interest:
I extensively use my tmx format-like library and it's structure based on typedefs as well, but as we use C++ target, I do not like the overall performance during file processing, as I need it working as fast as possible because they need to be loaded realtime during gameplay. I wanted to rework library and do a pull request with it, but I do not like using typedefs for static targets.
As in the title, amf3(and possibly amf) no longer work properly since upgrading to 4.2
Based on this change all : added final keyword (#6596)
HaxeFoundation/haxe#6596 this code now breaks : https://github.com/HaxeFoundation/format/blob/master/format/abc/Reader.hx#L217-L225
The error produced is :
format/format/abc/Reader.hx:217: characters 4-7 : Missing variable identifier
format/format/abc/Reader.hx:217: characters 8-13 : Unexpected final
format/format/abc/Reader.hx:217: characters 8-13 : Unexpected final
It would be very useful to be able to save PNGs in JS (and other platforms like PHP I guess).
Currently users have to rely on serverside hacks that are slow and buggy (see aduros/flambe#311).
It would be useful to have haxe.io.Input
/haxe.io.Output
interfaces for reading/writing file formats such as gzip.
I'm coming from a Python background so I expected I could do something like:
var input = format.gz.GzipInput(rawInput);
var line = input.readLine();
where line
is the resulting uncompressed text.
Getting this error thrown when format.png.Tools
is imported and compiling to cpp target :
Error: ./src/format/png/Tools.cpp:2141:130: error: use of overloaded operator '>>' is ambiguous (with operand types 'cpp::Variant' and 'int')
What solved it for me was changing Tools.hx#L274
var rline = (h.width * h.colbits) >> 3;
to :
var rline = Std.int(h.width * h.colbits) >> 3;
If y'all think midi file read/write support is appropriate, I can move the code to do that from grig.midi to here
While trying to use it I've stumbled upon some flaws in the current implementation that I think should be addressed (I recognize this isn't a popular/efficient format - png is much better f.e. -, but still...).
The main thing is that the code doesn't account for padded width, it just copies the bytes over in chunks of 4, which could result in banded images when written out.
(https://msdn.microsoft.com/en-us/library/windows/desktop/dd318229(v=vs.85).aspx and https://en.wikipedia.org/wiki/BMP_file_format#Bitmap_file_header)
Now... I have a half-baked PR for fixing this, but there's still some grey areas for which I'd like some pointers:
format.bmp.Data.Header
contains a bpp
and paddedWidth
fields for further consumptionData.pixels
would be in BGR order with padded bytes (so raw bytes with padded ones)format.bmp.Writer
and format.bmp.Tools
would have to change, to account for padded bytes (and reverse the bytes order - RGB instead of BGR)build/extract()
methods as in png (maybe reuse them and make them into a global utility class?)Hi, would it be possible to have an mp4 implementation?
I attempted to read data from the following SWF files:
http://i.flipline.com/gamefiles/cactusmccoycot/cactusmccoy_v2_1.swf
http://i.flipline.com/gamefiles/cactusmccoy2/cactusmccoy2_v2_1.swf
with the following code:
final handle = File.read(swfPath, true);
final swfReader = new Reader(handle);
trace(swfReader.read().tags.length);
using the --interp target with Haxe 4.2.2 and format 3.5.0.
This resulted in the following error for cactusmccoy_v2_1.swf:
C:\HaxeToolkit\haxe\std/haxe/io/BytesInput.hx:101: characters 4-9 : Uncaught exception Eof
C:\HaxeToolkit\haxe\std/haxe/io/Input.hx:244: characters 13-23 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:963: characters 29-43 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1354: characters 18-39 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:608: characters 12-21 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1360: characters 15-28 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:608: characters 12-21 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1423: characters 11-24 : Called from here
src/export/CMCoyExporter.hx:37: characters 15-31 : Called from here
src/export/CMCoyExporter.hx:16: characters 9-52 : Called from here
and the following error for cactusmccoy2_v2_1.swf:
C:\HaxeToolkit\haxe\std/haxe/io/BytesInput.hx:101: characters 4-9 : Uncaught exception Eof
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:59: characters 12-24 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:961: characters 68-83 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1354: characters 18-39 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:608: characters 12-21 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1360: characters 15-28 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:608: characters 12-21 : Called from here
C:\HaxeToolkit\haxe\lib\format/3,5,0/format/swf/Reader.hx:1423: characters 11-24 : Called from here
src/export/CMCoyExporter.hx:37: characters 15-31 : Called from here
src/export/CMCoyExporter.hx:16: characters 9-53 : Called from here
What might be causing this and can it be fixed?
Files produced by 7-zip cannot be inflated
InflateImpl l 320, the block type is unknown (3 ).
How can I find some doc to fix ?
@andyli we are getting a stalled build on "make check", can you help?
I was wondering if it may be beneficial to anyone else to have an unrar feature in this project? It only comes up because I wrote a comic book reader and couldn't get my head around the code involved in porting unrar from kthoom (https://code.google.com/archive/p/kthoom). Just a suggestion and I would benefit from having that in the package. Thanks for all the hard work and great effort here.
I'm trying to use format.swf
in PHP (on Ubuntu 64bit).
I've started by implementing Compress/Uncompress
for PHP, which seems to work,
but now I'm hitting an issue with format.tools.BitsInput
, which I believe is related to this haxe issue, as it only affects the PHP target:
HaxeFoundation/haxe#3414
I've been trying to use Int32
instead of Int
, without success.
Can someone help me find a workaround ?
If it helps, I can probably come up with a simple test to reproduce the issue.
The code for filtering ColIndexed PNG is not correct : instead of applying the filter to the color, it is necessary to apply it to the bytes, for instance by prefiltering the line before decoding it.
(reported by benjamin with an example png)
A lot of things related to haxe.zip
are dependant on if it is haxe3, even though haxe4 supports it still. Even more concerning is the fact that the uncompress and compress tools don't work on anything other than neko, even though in haxe4 they simply redirect to a crossplatform api
import format.tar.*;
import haxe.io.*;
using Lambda;
class Main {
static function main() {
function file(name:String, bytes:Bytes) return {
fileName: name,
fileSize: bytes.length,
fileTime: Date.now(),
fmod: 666,
uid: 1,
gid: 1,
uname: 'u',
gname: 'g',
data: bytes,
}
var data = [
file('folder/file1.txt', Bytes.alloc(4096)), // fails if: 1024, 2048, 4096, 512000, etc...
file('folder/file2.txt', Bytes.alloc(1)),
].list();
var output = new BytesOutput();
new Writer(output).write(data);
var entries = new Reader(new BytesInput(output.getBytes())).read();
for(file in entries) trace(file.fileName, file.fileSize);
}
}
Trying to tar some files, if the first file size is of some magic numbers, it fails to untar with Invalid TAR end
Reader.readName(17)
fails, while 0x11
seems to be a valid multiname kind
(see 4.4.3 and 2.2.3 https://www.adobe.com/content/dam/Adobe/en/devnet/actionscript/articles/avm2overview.pdf)
I'll try to implement it tomorrow, but I'm putting it here for reference
Any insight is welcome :)
As we discussed in the mailing list, an "Invalid Filter" error is thrown when loading the PNG at the bottom of this post. The error is thrown by this piece of code :
https://github.com/HaxeFoundation/format/blob/master/format/png/Tools.hx
inline function decodeLine(y, f, getValue) {
switch( f ) {
case 0:
for( x in 0...width ) {
decode(getValue);
bgra.set(w++,vb);
bgra.set(w++,vg);
bgra.set(w++,vr);
bgra.set(w++,va);
}
case 1:
var cr = 0, cg = 0, cb = 0, ca = 0;
for( x in 0...width ) {
decode(getValue);
cb += vb; bgra.set(w++,cb);
cg += vg; bgra.set(w++,cg);
cr += vr; bgra.set(w++,cr);
ca += va; bgra.set(w++,ca);
bgra.set(w++, va);
}
case 2:
var stride = y == 0 ? 0 : width * 4;
for( x in 0...width ) {
decode(getValue);
bgra.set(w, vb + bgra.get(w - stride)); w++;
bgra.set(w, vg + bgra.get(w - stride)); w++;
bgra.set(w, vr + bgra.get(w - stride)); w++;
bgra.set(w, va + bgra.get(w - stride)); w++;
}
case 3:
var cr = 0, cg = 0, cb = 0, ca = 0;
var stride = y == 0 ? 0 : width * 4;
for( x in 0...width ) {
decode(getValue);
cb = (vb + ((cb + bgra.get(w - stride)) >> 1)) & 0xFF; bgra.set(w++, cb);
cg = (vg + ((cg + bgra.get(w - stride)) >> 1)) & 0xFF; bgra.set(w++, cg);
cr = (vr + ((cr + bgra.get(w - stride)) >> 1)) & 0xFF; bgra.set(w++, cr);
cr = (va + ((ca + bgra.get(w - stride)) >> 1)) & 0xFF; bgra.set(w++, ca);
}
case 4:
var stride = width * 4;
var cr = 0, cg = 0, cb = 0, ca = 0;
for( x in 0...width ) {
decode(getValue);
cb = (filter(bgra, x, y, stride, cb, w) + vb) & 0xFF; bgra.set(w++, cb);
cg = (filter(bgra, x, y, stride, cg, w) + vg) & 0xFF; bgra.set(w++, cg);
cr = (filter(bgra, x, y, stride, cr, w) + vr) & 0xFF; bgra.set(w++, cr);
ca = (filter(bgra, x, y, stride, ca, w) + va) & 0xFF; bgra.set(w++, ca);
}
default:
throw "Invalid filter "+f;
}
}
The error occur when loading the PNG with Heaps.
So, format
is more general-purpose library, and when I've done tmx
format-style library I thought it won't fit well into the main library.
But I think when libraries that use same style as format
but is not general-purpose ones being developed - they worth mentioning here.
Ugh, sorry for a bit clumsy explaination.
In tl;dr: Add additional column in readme listing other libraries that have same style as format
and provide support for less-general formats.
Looks like this applies to format.swf
as well:
format/format/tools/BitsInput.hx
Line 50 in 26eb57e
format/3,0,2/format/swf/Reader.hx:263: characters 12-16 : Local variable fill used without being initialized
var fill = switch (_fill) {
case false: LS2FColor(readRGBA(i));
case true: LS2FStyle(readFillStyle(ver));
};
should be replaced by :
var fill = (_fill)?LS2FStyle(readFillStyle(ver)) : LS2FColor(readRGBA(i));
Currently, when running format.swf.Writer
, at the end, a memory block the size of the entire swf file is allocated:
Lines 1450 to 1452 in 318e49a
This can cause issues with large swfs, for example: openfl/lime#1307.
A possible better solution is to:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.