![]() |
I think it's the whole data block.
EDIT: My server is currently off-line so I'll just pastebin my source code. http://pastebin.com/m45d6c54c http://pastebin.com/m269ed95e |
Yes that is basically taking the CRC32 of the whole compressed data block, everything that's not part of the header.
|
Okay, it looks like I can read and understand that. Thank you both! :D
|
This should be stickied.
|
It's in ERE...
but as it's been bumped, I figure I may as well ask, is Code:
fileHeader.crc32 = crc32(0L, Z_NULL, 0);Code:
fileHeader.crc32 = 0; |
Not quite sure, but I believe the first line initializes the CRC32 for further calculation while the second line only sets it to zero. Check the output variable and see whether they are the same. I think they should differ.
|
I don't use the language, though. The only semi-native CRC implementation at my disposal gets the CRC of an entire file, without asking me what polynomial I would like, so I'm rebuilding it by hand.
|
Quote:
So yes, I certainly use it. More accurate specifications would certainly be welcome. |
isn't there already something for that called "tileset extractor?"
|
That renders tilesets as image files, but if you're making a game, it's simpler just to have the game read .j2t files directly.
|
J2l format reader in PHP
HELLO
I have coded some in PHP now, and I can read ALL J2L data and put it in nicely arrays. I'm even about to read out event-data, but those parameters are hardcoded. It uses JCS.ini for the event-names. The "Data3" stream is parsed into a easy to use array and all Level Properties too. I haven't yet finished the read-out of the level, with those "words" in Data3. ALL Layer Properties are parsed into an array, as the Help Strings are too. I love what you do Neobeo, and thanks the I C E Man's tileset-php code :-) Have a look here (not complete): http://djazz.mine.nu/content/jj2rela...2_formats/j2l/ |
Oh, that's awesome. I started writing a class to do that once but never got around to finishing it. Great that you've done it. Will the source code be available?
|
Quote:
|
Quote:
Yes I will release the source soon! |
I made a J2T image generator thingy (in PHP) for J2O today and decided to share it.
Documentation: http://www.stijnpeeters.nl/j2o/class.Tileset/ Source: http://stijnpeeters.nl/j2o/class.Tileset/source.php It's very basic and doesn't do any file integrity checks, but perhaps it is of use to someone. (Props to Neobeo, Ice M A N and Grytolle for hints/input/posts in this thread) |
Yeah you'll find that this thread is full of usefull hints made by me :P "jam lets make dll ok??:D lol hi btw"
|
I meant on IRC!
|
Can anyone answer my question? Please? Or do I just need to go learn a new programming language for one simple task?
|
Ok here is the source:
http://djazz.mine.nu/content/jj2rela...j2l/index.phps I haven't modified it since last post :-) |
I have no idea, UR, sorry
|
Another question (though the first remains open), has anyone tried zlibbing the blocks with compression rates other than that which JCS uses? Can JJ2 still read them?
|
Quote:
Quote:
Quote:
|
Quote:
|
Why do you want to hardcode it in? Last time I checked crc32(0L, Z_NULL, 0), it returned a zero, but I am not sure whether this is always the case. That's why I always initialize the crc variable with whatever value the crc32(0L, Z_NULL, 0) function call returns.
|
Unless I go learn a new language, the only semi-native CRC support I have is extremely limited and seems only to use a fixed polynomial. Therefore I go through the bit stream and gradually xor onto the polynomial manually, a bit at a time. But if the initial polynomial is 0, then xor isn't going to do a thing and the final CRC will still be 0, right?
|
Ah, now I understand your problem. You're not using the zlib library and/or C++ language. Personally I am not sure how the code you're using works, but I've checked the zlib source code and apparently the crc32 function always returns zero when the buffer param is set to Z_NULL. So in this case crc32(0L, Z_NULL, 0) = 0. If you pass a zero to your function, it won't work?
Code:
unsigned long ZEXPORT crc32(crc, buf, len) |
Huh. I guess I just don't understand the function somehow, then... I'll have to do some more digging around and find an explanation of CRC that doesn't instruct me to xor lots of stuff by 0. Thanks.
|
I updated my Tileset class and wrote a Level class, capable of rendering a preview of an arbitrary layer in a level. Note that especially the Level class is very basic and neither have error handling or checksum checking or stuff like that built-in.
Source code: http://www.jazz2online.com/junk/sour...lass.Level.php http://www.jazz2online.com/junk/sour...ss.Tileset.php Thanks to Neobeo/J2NSM for |
Wow, fantastic Stijn ;-)
I haven't tried it out yet, but I will! :D Your code looks much better than mine too. You maybe should add an example showing how to use? GJ! :-) ________ Edit: I got some errors that's listed below: PHP Code:
Do you know how to fix this? I have tried with multiple j2l files. my code for the classes: PHP Code:
|
Code:
<?phpI've made a few tweaks to it since I published the code there, I'll probably put an updated version online soon. |
Sorry still not working for me :(
And please make the source files downloadable, that copy-paste adds # signs |
Source and documentation updated now... several changes to the code structure, but the most interesting improvement will be that animated, flipped and translucent tiles are now supported.
What does not work for you? It might be hard to debug since the classes still lack proper error handling. I've had little need for that since they work for their primary purpose - previews on J2O - but it's open source so feel free to improve that by yourself ;) |
Oh, I see the errors you pasted - strange... "tiles" should be defined at that point since the method that defines it is called from the object constructor... unless the constructor terminates before it reaches that point because it can't find the tileset file. Are you 100% sure the tileset path passed on to the Tileset constructor (line 596, class.Level.php) is correct? Did you perhaps forget to change the Level::ROOT_DIR constant to point to the correct location?
|
Quote:
EDIT: I just noticed the foreground layer tiling doesn't seem to work. http://www.jazz2online.com/J2Ov2/dow...=160&sizey=248 EDIT2: Is it just me or is this level displayed entirely black? http://www.jazz2online.com/J2Ov2/dow...024&sizey=1024 |
Yes @ both. When a tileset is not found it will use black tiles.
We will not allow downloading individual files I think, simply because people upload their stuff as archives to our site, not as individual files :) An option to, for example, ignore music files might be implemented later though. EDIT: In the case of this particular level it appears that there are two different sets named "pk2.j2t" on J2O. Since there is no way to determine which one is correct based on the J2L file alone, it uses the wrong tileset. The black tiles are references to tiles that don't exist in the "other" pk2.j2t. |
Quote:
|
Not if the code is structured like it is now.
|
Ok, got it fixed, I don't know how but it's working :D
Are there any todos left? flipped tiles, have you fixed them? Here is a code for flipping images: http://se2.php.net/manual/en/functio...copy.php#85992 More improovements is to put an image where it should be a event |
Flipped tiles are supported.
Events are certainly possible but image generation would take a lot longer then so it's not a priority for me (the primary use for me personally is still J2O image preview). |
See you've updated the source, but, could you please add a download link, it's so hard to remove all # signs and extra linebreaks
The PHP works rly nice, but it's very slow |
| All times are GMT -8. The time now is 10:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online