Jump to content
pbox

WIP: .crp file parser/editor; input appreciated

6 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hello there,

I saw that this parser (crp-extract.py) has apparently been outdated by some recent-ish patch -- I've been running into issues with the in-game editor, so I wrote a script that can parse/import/export data from .crp files directly. Maybe this is useful for others as well? (I'm aware there are plenty of mods for the in-game editor, but the editor has its limits it appears ..)

 

http://unera.se/crper 

(dump a .crp on it and see if it can make sense of it)

 

Right now the script suffers a bit from my own lack of knowledge about the various data formats inside a .crp (and I've found hardly any documentation except for a few posts in this forum (thank you!)) -- PNG/DDS import/export seems to work well though, and that was the main reason I wrote it.

 

Other than that,

-- all text/data fields are readonly for now

-- there are export links for DDS, PNG, and every other data blob it encounters (like meshes) -- no guarantee though that things other than image data will be useable

-- if you want to use it to replace images, make sure the new import is the same size as the original -- I'm not doing any sanity checks atm, other than letting the browser throw its "out of range" errors and such

-- when an entry ends with an "end" field that has anything but zero in it, and is also quite red, that means it got a bit lost in that entry (there might either be missing parts, or it read half of the next entry as well -- in any case it didn't land at the end of that part like it should have).

-- I'm also not doing any cleanup, so please reload the page before dumping the next file on it. When it behaves weird, it makes sense to open it in a new *window* (not just a new tab).

-- it should work in recent-ish browsers (FF 4 / Chrome 7 / IE 10 /Opera 11.6 / Safari 5.1 I believe), and hopefully on all platforms. I only have Win7 here so I haven't really tested that (feedback welcome, of course).

-- It's javascript and runs in your browser, dealing with local files only, no uploads or anything.

 
So, if anyone knows more about  the missing bits+pieces (UnityEngine.Material, for example), or finds something specific that's off (like "you're cutting three bytes too much off the end of suchandsuch thing"), I'd appreciate feedback! The things I know about are mostly in http://unera.se/crper/struct.js .

 

UÙAñ<ιç¦*©Ø5öcÑ and ç¦*þõJç!
 

 

  • Like 5

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Thx for looking into this and working on it. I think it would be useful to me. Does it extract the workshumb thumbnail PreviewImage and the other images (snapshot etc)?

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    30 minutes ago, AmiPolizeiFunk said:

    Thx for looking into this and working on it. I think it would be useful to me. Does it extract the workshumb thumbnail PreviewImage and the other images (snapshot etc)?

    Yes, that's exactly what it does best at the moment -- for PNG it also displays the actual PNG; DDS does not have a display but you can export and import them.

    (This is because in order to display a DDS, I would need to convert it first so the browser can digest it, and then people would likely try to use that converted preview instead of the actual DDS data. Which would not be good. Also, it takes a little while when there's a bunch of textures in a file.)

     

    Edit: Oh wait -- I forgot that I havent put an *import* link on the PNG fields yet. I'll update that and post here again when I've done so. But for now you can at least rightclick > save the pngs (they are full resolution, I'm only squeezing them for display).

     

    Some crps have the PNGs near the end, so you might have to scroll down a bit (it's parsing everything in the same order as it is in the crp). Let me know how it works for you!

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    OK, I've updated -- image import/export should now work for both formats. It can also decipher more stuff now.

    Note that things like colour palettes need to be saved *without* mipmaps in order to come out at the right size. For PNG *with* transparency, I honestly have no idea how to keep it at the same file size when editing (I've been using paint.net; maybe other editors have more options when saving). The only such PNGs I've encountered so far are UITextureAtlas entries for assets though, not the main preview pics.

    Also, the PNGs that are being displayed will probably not change, since they're cached by the browser. The easiest workaround is save the file, then open it again; or disable caching (which is generally not a good idea though).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hey, this site is amazing, DDS files work, but i have a problem with meshes. How can I open "UnityEngine.Mesh" file? or convert to obj? Is it works or not?

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections