Thread: 100% Plugin-based 317 Cache Editor [wip]

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 43
  1. #1 Lin's Cache Suite v1.2 - 100% Plugin-based 317 Cache Editor 
    Registered Member xLin's Avatar
    Join Date
    Dec 2008
    Posts
    115
    Thanks given
    3
    Thanks received
    30
    Rep Power
    52
    This is a project I've been working on for a couple days, and I think it will massively improve the RSPS scene. I was looking around for cache editors, and it seems Tom's cache suite is still what's popular. As I made a quick little archive extractor, it occurred to me I should make all the tools for viewing and editing files plugins, so we can have a giant integrated community-based clean cache editor capable of editing everything - maps, interfaces, configurations, etc.

    I wrote this in C#. There are three parts to the project - the shell (what you run), the cache API (what does all the dirty work), and the plugins (the features). The API is very powerful, allowing you to load, rename, edit, and even add new files to archives and sub-archives with just a couple lines of code.

    Update List
    1.2
    • Added drag/drop file importing/adding
    • Batch file exporting
    • Fixed the search feature not working for regular archives
    • Added the client's model and rasterizer class
    • Added a model viewer (wasd to move, left click to rotate, wheel to zoom)


    How To Use
    To start, open your cache. This is a folder with "main_file_cache.dat" and "main_file_cache.idx0-4". Upon doing so, the tree on the left should populate with archives and sub-archives. Sub-archives, commonly known as "Jagex Archives", are archives with a different file format that uses BZip2 compression. Regular archives use GZip compression. You don't have to worry about any of this, as the API deals with compression for you.

    To add a file, go to File > New when you have either an archive, file, or sub-archive parent node selected. Adding a file with a sub-archive file or sub-archive parent node will create a sub-archive file. Note that if you create a new file with the archive 0 node selected ("Sub-Archives") or try to add a file to sub-archive 0, the program will work but those archives and files specifically won't.

    On the right you see import/export data, which allow importing/exporting a file if any of the loaded plugins support importing/exporting. Note these always take the uncompressed files, so don't compress them before-hand. You can also rename files if they're part of sub-archives, but note you must add your name to files.txt for it to show when you open your cache down the road.

    When you modify a regular archive file by importing data or creating a new file, you don't have to save. It's automatic. With sub-archives, however, you must manually save. Do this by saving all archives or when the file/node you have selected is part of a sub-archive, save the current one.

    To view the plugins that are installed, go to Plugins > Summary. If a plugin allows configuring, the "Configure" button will be enabled. Here you can also view what criteria has to be met for a plugin to be loaded, and what I/O operations it allows you to do.

    My Plugin Pack
    -ImageViewer - Views and allows the basic importing and exporting of 317-format images.
    -HexEditor - A basic hex editor. Note editing with it doesn't work. It's really only there to allow importing/exporting raw data.
    -PaletteViewer - Views the palette an image archive uses.
    -ModelViewer - Views and allows the basic importing and exporting of 317-format models. Note if OpenGL fails to initialize, software rendering is enabled. To disable it (or enable it), configure it from the plugin summary window.

    Shell Features
    • Plugins (obviously)
    • Naming of archives and individual files (through Files.txt)
    • Search files with filtering - Searching allows for named files containing the searched text and/or unnamed files matching the whole text. If a sub-archive file hasn't been manually named, as in we only have its hash code (since file name storing is lossy), the search will bring it up anyways.
    • Map files display their coordinates (only works for I believe terrain files at the moment)
    • Importing, exporting, creating, and renaming files
    • Drag and drop (see below)
    • Batch export (file dumping)


    Cache API Features
    • Reading and writing archives (automatic GZip compressing/decompressing)
    • Reading and writing sub-archives (automatic BZip compressing/decompressing)
    • Client image loading, bitmap generating, PNG importing (excellent color quantization, thanks to the nQuant library)
    • Creating files for both archives and sub-archives
    • Contains a copy of the client's model and rasterizer class (mostly undocumented/copy-pasted)


    The Plugin API
    Creating and adding plugins is very simple. Start a new Class Library project in VS, add the API to the references, and create a class that extends IPlugin. Copy the properties and functions, fill them out, and compile the project. Adding the plugin is as easy as copying the DLL file to the "Plugins" folder.

    Plugins have specific criteria that have to be met (called Classifications in the IPlugin class) in order for the plugin to show up when you're viewing files, to not only keep things neat but also to prevent you from accidentally breaking stuff. By default, it makes the plugin appear for everything (blank properties), but you can limit it by requiring specific file names, extensions, sub-archives, and/or archives.

    The FileExtensions and StaticFileExtensions properties control how data can be imported/exported. StaticFileExtensions is what's used in the plugin's summary, and FileExtensions are used for the actual import/export dialog box. See the ImageViewer for an example on a plugin's I/O features can be enabled and disabled depending on the success of its operations.

    Drag and Drop
    Dragging and dropping files into the file browser and plugin window is supported. When a file is dropped into the plugin window, it will act simply as if the user imported the file; dropping files into the file browser is where things get more complicated. If a single file is dropped into a file node, the node's data is replaced by the plugin that would handle the dropped file. If a single file is dropped into a sub-archive header node, the file is added to the archive, or it replaces the existing file if it exists (node name must match the dropped file name). If a single file is dropped into an archive header node, the file is added to the archive. If multiple files are dragged into a file node, sub-archive header node, or archive header node, the files are added into the archive. Like the single-file drop into the sub-archive header, multiple files will attempt to check if the file exists first.

    Media
    [spoil]






    [/spoil]

    Download
    The API is undocumented, but you should be able to figure out how to write plugins if you just look at the sample ones. To get plugins loading when debugging, you'll have to change the debug directories in the PluginContainer class in the Cache Editor project. I used Visual Studio 2013 for this.

    Notes
    • The file tree shows the compressed sizes for regular archive files to improve speed. When you import a raw file, it uses the uncompressed size.
    • The API image importer requires imported images are 32-bit, so if yours is not, it is made transparent automatically (white becomes transparent). Save your images in a 32-bit ARGB format to avoid this.
    • There are some serious time-consuming operations. Saving all the archives isn't fast, as rewriting each archive requires extracting and recompressing all the files in it to optimize the file size (it can be optimized but I'm lazy). Importing large images is extremely costly, primarily because of the color quantization (if you don't know what that means, it's finding the 256-color palette that gives the image the best quality. This is necessary because this is how the client reads images).
    • You can't create image groups with my image viewer plugin. If you would like one that could, develop it further or make your own!
    • This is still an early program that hasn't been fully tested with every situation, but it has passed every test so far. Use with caution and back up your cache frequently.


    ~Lin
    Last edited by xLin; 06-22-2014 at 09:17 AM. Reason: v1.2
    Reply With Quote  
     


  2. #2  
    ಠ_ಠ

    Joshua's Avatar
    Join Date
    May 2010
    Posts
    1,903
    Thanks given
    397
    Thanks received
    708
    Rep Power
    803
    Looks pretty decent, I'll definitely be checking this out.
    Reply With Quote  
     

  3. #3  
    Client God

    Join Date
    Aug 2009
    Posts
    3,127
    Thanks given
    3
    Thanks received
    617
    Rep Power
    907
    Definitely interesting.

    I'll edit this post in a bit with some "data packers/hardcode dumper" for 317/377. If that would be helpful o:
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Mar 2011
    Posts
    4,062
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    will be checking out
    Reply With Quote  
     

  5. #5  
    Registered Member
    Shoutbox's Avatar
    Join Date
    Sep 2013
    Posts
    1,748
    Thanks given
    580
    Thanks received
    363
    Rep Power
    834
    Checking this out!
    S A D B O Y S

    私は自分自身を殺すために待つことができない
    Reply With Quote  
     

  6. #6  
    Author of the first public OSRSPS

    Shadowy's Avatar
    Join Date
    Sep 2009
    Age
    28
    Posts
    1,499
    Thanks given
    490
    Thanks received
    241
    Rep Power
    307
    great idea and nice work, going to give this a look
    Owner of OS-RSPS, the first Oldschool RuneScape Server (2014)
    Reply With Quote  
     

  7. #7  
    Registered Member xLin's Avatar
    Join Date
    Dec 2008
    Posts
    115
    Thanks given
    3
    Thanks received
    30
    Rep Power
    52
    I have updated this to version 1.1, which includes some new major features like importing raw data and images and creating files. The topic post has been updated to provide some more clear documentation on how to use it and develop plugins. Thanks for the feedback. If this is bug-free, I probably won't be developing the shell/cache API much further for a while.
    Reply With Quote  
     

  8. #8  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    cool stuff

    you should make the revision/cache type modular as well, giving the ability to make it work with the newer cache engine
    Reply With Quote  
     

  9. #9  
    Professional Upsetter


    Join Date
    Jul 2006
    Posts
    5,392
    Thanks given
    163
    Thanks received
    447
    Rep Power
    2040
    How about being able to export more than one object at a time?
    Ex-super moderator of Rune-Server.org and RSBot.org
    Reply With Quote  
     

  10. #10  
    Registered Member xLin's Avatar
    Join Date
    Dec 2008
    Posts
    115
    Thanks given
    3
    Thanks received
    30
    Rep Power
    52
    Quote Originally Posted by Inside Sin View Post
    How about being able to export more than one object at a time?
    Write a plugin that does it. Wouldn't take more than a few lines of code looping through a (sub)archive's files and dumping them.
    Reply With Quote  
     

Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. 317 Cache editor
    By cruel ko in forum Requests
    Replies: 4
    Last Post: 07-18-2013, 01:34 PM
  2. Cache editor That Loads Above 100 mb
    By bigPimpin in forum Help
    Replies: 3
    Last Post: 03-20-2013, 10:14 PM
  3. Runescape 317 Item Editor(Original code from Tom's cache Suite...)
    By Streax in forum Application Development
    Replies: 2
    Last Post: 05-04-2011, 11:11 PM
  4. 100% clean 317 cache with new edgeville maps
    By LastResortpkz in forum Downloads
    Replies: 15
    Last Post: 04-16-2009, 08:40 PM
  5. A nice (real) 317 cache base
    By Koanga in forum Requests
    Replies: 0
    Last Post: 03-27-2009, 11:34 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •