Resource Layer Utility

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Re: Resource Layer Utility

Postby boshaw » Sat Dec 17, 2011 6:56 pm

boshaw wrote:
EnderWiggin wrote:Really nice util. Thanks for it. Though I have some minor problems/requests with it:
  • Some output dir naming issue. If I invoke it like this:
    Code: Select all
    >java -jar LayerUtil.jar -rd enc dec
    then it creates output folder called decenc, instead of just dec. Basically it append IN folder name to OUT one.
  • would it be hard to make key to ignore encoding/decoding of a res file if in output dir there is one wich is newer? Basically make it encode/decode only changed files.


1) yeah i know that's an issue, i usually just added `dec\' to stop it from appending. I could go fix this later today, along with adding support for .cache files so you don't have to rename them and a few other minor things
2) I suppose something like that could be implemented, i'll look into it later today.



Updated LayerUtil to fix #1, .jar is updated as well as git
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby EnderWiggin » Sat Dec 17, 2011 9:29 pm

Well, first of all - jar is not updated. I've compiled sources. Bug with filename is gone, but it still not work as I thought :) If run with -rd enc dec it creates dec\enc folder structure. I think this is unneeded, because this way I can't setup it to automatically pack/unpack between two folders. I need it to take files from enc/res to dec/res and vice versa. Is this possible?
User avatar
EnderWiggin
 
Posts: 1070
Joined: Sat Mar 20, 2010 8:23 pm

Re: Resource Layer Utility

Postby boshaw » Sat Dec 17, 2011 10:48 pm

EnderWiggin wrote:Well, first of all - jar is not updated

oops i thought i updated the jar :V sorry

EnderWiggin wrote:If run with -rd enc dec it creates dec\enc folder structure. I think this is unneeded, because this way I can't setup it to automatically pack/unpack between two folders. I need it to take files from enc/res to dec/res and vice versa. Is this possible?


yeah, that's how i first made it and ic your point, i'll fix that for you.


oh another note you mentioned you wished there was a way that it didn't decode/encode everything everytime unless it's changed. I could add a option in the meta files for decoded such that if the option is True it'll reencode otherwise it'll reignore that fire. Could do the same with encoded files and if no meta for the encoded files folder is found it'll just decode all the encoded files.



It'll probably be in an hour or two going out to eat, afterwards i'll fix up the stuff
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby boshaw » Sun Dec 18, 2011 8:21 am

EnderWiggin wrote:Well, first of all - jar is not updated. I've compiled sources. Bug with filename is gone, but it still not work as I thought :) If run with -rd enc dec it creates dec\enc folder structure. I think this is unneeded, because this way I can't setup it to automatically pack/unpack between two folders. I need it to take files from enc/res to dec/res and vice versa. Is this possible?


1) Removed the old naming convention for folders so that it doesn't do the whole "-rd enc dec" => dec\end\FILES_WITHIN_ENC it should now just produce : dec\FILES_WITHIN_ENC and the same goes for -re
2) Added a skip system, I'd like you to try it out and give your thought about it: if you like it, etc.
Things added due to skip:
  • SKIP (1) & NOSKIP (0)
  • whenever you `-rd' files each .res/.cache folder's `meta' file will now contain an extra 2 lines for `skip' :
    Code: Select all
     
    #int16 skip [1=skip;0=noskip]
    1
  • whenever you `-re' files the [OUT] folder will have a `meta' file created @ [OUT]\meta. It's setup is like:
    Code: Select all
    \paginae\act\adv.res=0
    \paginae\act\build.res=0
    \paginae\act\cartography.res=0
    \paginae\act\claim.res=0
    \paginae\act\craft.res=0
    \paginae\act\crime.res=0
    \paginae\act\dest.res=0
    \paginae\act\dig.res=0
    \paginae\act\eat.res=0
    \paginae\act\eye.res=0
    \paginae\act\fish.res=0
    ...
  • modifiers that go before dec/enc options :
    Code: Select all
    Usage: java -jar LayerUtil.jar [MODIFIER_FLAGS] [ENC/DEC_OPTION] [OPTION ARGS]
    Possible modifier flags include:
     -ns             Makes all `new' dec/enc meta skip value: noskip(0)
                      default skip value is: skip(1)
     -fs#            Forces the skip value which is # [0=noskip;1=skip]
     -np             Ignore any prints to cmd aside from errors
    Possible ENC/DEC Options:
     -h              Display usage
     -v              Displays version number
     -d [FILE]...    Decodes said files to `dout/[FILE]/*'
     -e [FILE]...    Encodes said files to `dres/[FILE]/*'
     -rd [IN] [OUT]  Decodes a set of files within IN into OUT
     -re [IN] [OUT]  Encodes a set of files within IN into OUT

    [FILE] refers to individual *.res files
    [IN] and [OUT] refer to file directorys that contain *.res files


So here's the new process flow now that the skip system is added:
Code: Select all
-rd:
-->check [IN]\meta for skips on .res/.cache files; IF no [IN]\meta it's assumed no skip
-->loop through all files
---->Does this file get skipped?
------->Yes: Ignore continue to next file
------->No: decode it; When we write to this .res/.cache file's `meta' it'll be of value SKIP (1) or if modifier `-ns' it'll be of value NO SKIP (0)

-re:
-->loop through all files
---->Check this file's `meta' to see if it's skipped
------->Yes: Ignore and continue to next file
------->No: Is forced skip modified on? `-fs0 or -fs1'
---------->Yes: add this file's skip value to [OUT]\meta as the forced skip value
------->No: Was it previously defined in [OUT]\meta ?
---------->Yes: add this file's skip value to [OUT]\meta as what the previous skip value found in [OUT]\meta was
------->No: add this file's skip value to [OUT]\meta as to what the current skip_value is; default = SKIP(1), IF modifier `-ns' then skip_value = NOSKIP(0)
------->encode the file
-->loop through any remaining previously defined skip values and rewrite them so they aren't lost.



I updated git + LayerUtil.jar and edited first post a bit. I did test this for quite a bit just to make sure everything was working right and it seems so, but if you manage to find an error tell me.
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby mvgulik » Thu Feb 02, 2012 7:34 pm

I'm probably missing something already documented ... but I'm just not seeing it.

- LayerUtil v2.0.0.
- Java 1.7.0.2.(b13).
- Windows XP.Pro.Sp3.32bits.

Case description(s):
When decoding all res files from the original haven-res.jar file. with:
cmd: java -jar LayerUtil.jar -np -rd res out
or
cmd: java -jar LayerUtil.jar -np -rd res\ out\
And having the following 'res' folder structure: (only showing first 'res' sub-folders.)
Code: Select all
+ res
   + gfx
   + paginae
   + sfx
   + ui

I get the following [out] folder structure:
Code: Select all
+ out
   + res
      + gfx
      + paginae
      + sfx
      + ui


But when decoding some modded res files (picked up from the forum) and using the following folder structure:
(only contains gfx res files, but adding the UI res folder from the default haven-res did not change anything.)
Code: Select all
+ res
   + gfx
   + (ui)

I get the following [out] folder structure.: (No 'res' sub-folder following the 'out' folder.)
Code: Select all
+ out
   + gfx
   + (ui)


Question:
Anyone knowing what is triggering the different output folder structures between to two cases. ?



On the side note:
When I used 'out/' and 'res/' ... The whole parent folder path was duplicated in the [out] folder. (o.O)
Code: Select all
(example)
X:\
+ someName1
   + someName2 ... (LayerUtil working location)
      + out
      |   + someName1
      |      + someName2
      |         + res
      |            + gfx
      + res
         + gfx
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Resource Layer Utility

Postby EnderWiggin » Thu Feb 02, 2012 8:07 pm

Do you use precompiled jar, or compiled it yourself? There was a bug with folder naming, if path to your working dir contains input or output folder name. It should be fixed in sources, but I'm not sure boshaw recompiled jars.
User avatar
EnderWiggin
 
Posts: 1070
Joined: Sat Mar 20, 2010 8:23 pm

Re: Resource Layer Utility

Postby mvgulik » Thu Feb 02, 2012 8:14 pm

I'm using the precompiled LayerUtil.jar file.
---
Md5: b5efd8b20dd6319fc581a9f1cd2e5c5b (not sure if that's useful in this case)
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Resource Layer Utility

Postby EnderWiggin » Thu Feb 02, 2012 8:25 pm

Try this one. Compiled from latest sources.
User avatar
EnderWiggin
 
Posts: 1070
Joined: Sat Mar 20, 2010 8:23 pm

Re: Resource Layer Utility

Postby mvgulik » Thu Feb 02, 2012 9:06 pm

The decoding of the original haven-res.jar res files ditch the 'res' folder in its output folder. So both case are now acting the same.
Thanks Ender. :)
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Resource Layer Utility

Postby boshaw » Wed Jul 04, 2012 6:33 am

updated first post with a tool for Salem's resources.

pm me if you have any questions
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 7 guests