PackedFile.java Source Code

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
aryll28
Kobold
Posts: 10
Joined: Sun Mar 29, 2015 5:05 pm

PackedFile.java Source Code

Post by aryll28 »

I'm not entirely sure if this is the right place to post this, it was the best I could find. I was looking through the source code for Maptool to try to find how the files are parsed and loaded/exported. I noticed that in one of the files, there is a reference to PackedFile.java, which I think contains the logic for the encoding/decoding of Maptool files. Unfortunately, I cannot find the actual source code. I was wondering if someone would be able to point me to where the file is or another file that handles the encoding/decoding of files.

The reason I want to see this is to create a secondary parser for myself to have some versioning control over the macro code that I've written.

Thanks!

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PackedFile.java Source Code

Post by JamzTheMan »

It's in the rplib.jar so download that project as well.

Note, the content will be all in one xml file and serialized classes using xstream. So not sure exactly what you are trying to accomplish? Could you explain more? If its useful we can add it to future MT releases.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

aryll28
Kobold
Posts: 10
Joined: Sun Mar 29, 2015 5:05 pm

Re: PackedFile.java Source Code

Post by aryll28 »

Both my friend and I write code for macros and such using our own custom properties and formatting style. Since we both use the same basis, I wanted to create a repository that contains files with macros, properties, etc. A directory structure may have looked like the following:

campaign_properties/
-> token properties/
->-> Basic.txt
->-> Monster.txt
-> Sight.txt
-> Light.txt
-> ...

Something like that. Each of the folders will have a text file that contains the necessary information. All of this information is stored in the .cmpgn file when you export the campaign properties, but the file itself is only a stream of hex values. I wanted to create a separate parser that you can run to take the .cmpgn file and give you a directory like the one above with plain text. You can upload this to a repo and modify/change the files. You can again run the parser to take the directory and get back the appropriate .cmpgn file.

I hope that made sense.

Where can I find the rplib.jar project?

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PackedFile.java Source Code

Post by JamzTheMan »

Ah yes, that's exactly one of the things we want in 1.4+ so if you should join our efforts! Talk with RPTroll and Craig.

rplib is in the svn still but I dont think Craig has it in gitHub yet. Not sure if you got MT from GitHub or SVN but you should start with the GitHub version if not. Let me know if you still cant find it in svn, I should have a link somewhere.

You could serialize each object as xml but it's not very readable by human or editable. But it should be easy enough to dump the text blobs out and import using set methods in MT.

I would love to see a framework in GitHub where multiple users could contribute to maco's easily!

edit: should be here https://svn.code.sf.net/p/rptools/svn
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
RPTroll
TheBard
Posts: 3148
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: PackedFile.java Source Code

Post by RPTroll »

Another coder!

<pounce>

:)

Check here for a list of things in 1.4+. If you see something that interests you, please let us know and consider contributing to the MapTool code base.

https://docs.google.com/spreadsheets/d/ ... sp=sharing
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

aryll28
Kobold
Posts: 10
Joined: Sun Mar 29, 2015 5:05 pm

Re: PackedFile.java Source Code

Post by aryll28 »

I was able to find the rplib.jar on the SVN. I've been looking at the code here and there. I will consider contributing to Maptool, but I currently have a lot on my plate right now. Even this file parsing may prove to be too much at the moment. I'll be freer in a couple months, and I would definitely think about contributing to the overall project.

I would like to finish this little side project first though.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PackedFile.java Source Code

Post by JamzTheMan »

And by finishing that side project, that's contributing! :D

That's all I ask, if you finish it (or even make some good progress on it) feel free to share it. If you put it on hold, let us know and someone else can take over. You don't have to do it all yourself if it's something more than one of us want/want to do.

We don't have any set schedules or timelines, we're all doing this "on the side". And feel free to ask questions anytime. Whether it's Java related or more MT source related.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

aryll28
Kobold
Posts: 10
Joined: Sun Mar 29, 2015 5:05 pm

Re: PackedFile.java Source Code

Post by aryll28 »

I had a question about starting to look through the code. Would you recommend that I clone the Git repo to a local directory so that I can work on it from there? I wasn't sure how to see what's happening with the data since the code can be a little hard to follow at times. I wanted to try to debug the process while loading and saving a campaign file to see what's going on with the variables.

Thanks!

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PackedFile.java Source Code

Post by JamzTheMan »

Yes. Clone the GitHub mt 1.4 repo, Jagged did a great step by step if using Eclipse. Better yet, create an account, fork it, then clone that. It really is only a few clicks to do it all. Super easy.

then grab the rplib from svn and create a project in eclipse. Add that project as a dependancy and set it higher than the rplib.jar. That way eclipse will use your changes and can jump to the source.

So...

1. Fork repo
2. Clone repo to local desktop
3. Create eclipse project from local repo
4. Optional, create a branch to better track changes
5. Make changes
6. test, repeat step 5
7. Stage your changes and commit
8. Push changes up to your fork in GitHub (commit/push usually at same time)
9. Go to GitHub, select branch if created, click Create Pull request

Done.

Once pull is accepted and merged, you can resync your fork to the original project via 'fetch upstream' and/or go back to step 4. Resync only really needed if you need other, changes committed.

viewtopic.php?f=86&t=25838

It's a little less direct than svn but way better than creating patches.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: PackedFile.java Source Code

Post by Jagged »

I am hoping Craig will add rpLib to GitHub soon. I haven't bugged him about it (sure he's busy) but might do soon ;)

User avatar
RPTroll
TheBard
Posts: 3148
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: PackedFile.java Source Code

Post by RPTroll »

Yeah, he's swamped. On the upside, we have a new test build. :)
http://maptool.craigs-stuff.net/test-builds/
Adding announcement soon.

@Jamz, can you go to viewtopic.php?f=86&t=25841 and list what Craig's merged of yours for b01?

Thanks
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

aryll28
Kobold
Posts: 10
Joined: Sun Mar 29, 2015 5:05 pm

Re: PackedFile.java Source Code

Post by aryll28 »

Do I need to create a Gradle project, or just a regular Java project? I followed the tutorial by Jagged, but I couldn't find the source files to edit. I've never really used Git or Gradle before so it's a little confusing. Sorry

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PackedFile.java Source Code

Post by JamzTheMan »

RPTroll wrote:Yeah, he's swamped. On the upside, we have a new test build. :)
http://maptool.craigs-stuff.net/test-builds/
Adding announcement soon.

@Jamz, can you go to viewtopic.php?f=86&t=25841 and list what Craig's merged of yours for b01?

Thanks

You got it for now. He's working on a TokenTool build as well. More to come soon.

Re project creation, Aryll, did you follow Jagged's guide? You should be importing as a gradle project. You will end up with 2 subprojects as well.

You can always change it to gradle if needed and/or change the facet to java if needed. I believe it is covered in the guide, if you get stuck let us know at which step so we can clarify if needed.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Azhrei
Site Admin
Posts: 12064
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PackedFile.java Source Code

Post by Azhrei »

aryll28 wrote:[...] All of this information is stored in the .cmpgn file when you export the campaign properties, but the file itself is only a stream of hex values. I wanted to create a separate parser that you can run to take the .cmpgn file and give you a directory like the one above with plain text.

The campaign files are ZIP files. Just open it with WinZip or similar and you can extract them.

In fact, all files used by MapTool are ZIP files: maps, tokens, macro archives, etc.

I did have some code awhile back that would let me create macros directly so they could be "injected" into an existing campaign, but that code was pretty fragile and broke as MT evolved. But at the time it was pretty cool, since I could create "functions" and invoke them in ways that they created the macro code. Simplified a bunch of things...

User avatar
RPTroll
TheBard
Posts: 3148
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: PackedFile.java Source Code

Post by RPTroll »

This is part of task 12 in the function tracking spreadsheet.

https://docs.google.com/spreadsheets/d/ ... sp=sharing
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

Post Reply

Return to “MapTool”