Log in to reply
 

[SOLVED] GTA Toolkit, has anyone used this library?



  • I have spent the day fighting with this library but am rapidly running out of steam. Because of the vast wealth of documentation (or lack of more like), I had to get the source and do a project-wide search for "Public" just to find out what I could even interact with.

    The end result is that I can create an rpf file, I can add directories and a file on the root level but the minute I add further files, it overwrites the first one

    I don't know if the way I am doing things is right, because there are no samples or documents to tell me the difference between the right way and the wrong way.

    I will be honest, what I am doing feels excessively cumbersome... it doesn't feel right, which means it probably isn't.

    What I have so far is this:

    string rpfName = outputfolder + "\\dlc.rpf";
    
    RageArchiveWrapper7 dlcWrapper = RageArchiveWrapper7.Create(rpfName);
    RageArchive7 dlcArchive = dlcWrapper.archive_;
    dlcArchive.Encryption = RageArchiveEncryption7.None;
    
    RageArchiveDirectoryWrapper7 dlcRoot = (RageArchiveDirectoryWrapper7)dlcWrapper.Root;
    
    RageArchiveDirectoryWrapper7 dlcData = (RageArchiveDirectoryWrapper7)dlcRoot.CreateDirectory();
    dlcData.Name = "data";
    RageArchiveDirectoryWrapper7 dlcX64 = (RageArchiveDirectoryWrapper7)dlcRoot.CreateDirectory();
    dlcX64.Name = "x64";
    
    RageArchiveBinaryFileWrapper7 newContentFile = (RageArchiveBinaryFileWrapper7)dlcRoot.CreateBinaryFile();
    newContentFile.Name = "content.xml";
    newContentFile.Import(dlcfolder + "\\content.xml");
    
    RageArchiveBinaryFileWrapper7 newSetup2File = (RageArchiveBinaryFileWrapper7)dlcRoot.CreateBinaryFile();
    newSetup2File.Name = "setup2.xml";
    newSetup2File.Import(dlcfolder + "\\setup2.xml");
    
    dlcArchive.WriteHeader(null, null);
    

    And that results in this, which as you can see is fine for setup2.xml but not so good for content.xml, as it has setup2.xml all over it. I have tried adding the WriteHeader after each file import but that makes no difference. If I leave that WriteHeader line out completely, the rpf won't open, so it has to be there.

    alt text

    What's this all for I hear you ask, well this basically...

    ... it currently writes everything out as plain files/folders but that's not what I want it to do. I want a one-click (or a few-clicks) solution that will turn replace vehicles into addons at the press of a button.


  • MODERATOR

    @LeeC2202 if u succeed this is Going to be EPIC!. an Epic tool.



  • @FoxtrotDelta It feels like I am so close to finally getting this done but so far when it comes to trying to find information to help me finish it.

    I got completely blanked by the person who wrote the library, when I asked for the info and that really makes me :rage: I cannot comprehend why someone would write something to share and then make that thing so difficult to use... information distribution is what makes a community a community.

    Anyway, I will tackle it again tomorrow, tonight I am fixing other people's addon packs... oh joy. :D



  • was documentation on facebook or qq few weeks ago , must be added as second path



  • @Frazzlee What must be added as a second path, and how?



  • NVM, I figured it out... or at least part of it, I am sure more problems will arise in the very near future. Unless that documentation manages to find its way here that is.



  • The things that finally happen when you work something out... hit a minor stumbling block when it came to adding an rpf file, inside an existing rpf file but having got past that, we're now here.

    UI is rough but that really is a secondary concern at this point in time.

    Edit: Hmmm... game is complaining about corrupt data, so maybe there are some things I need to address with the RPF creation... still, I'll take a minor win over a total loss at this point.



  • Seems that the files are not being compressed the same as they are if you build the rpf with OpenIV. So clearly still a long way to go. :(

    On a positive side-note, I posted this on GTAForums and the author of this library posted a response and that could just be the huge stroke of luck I needed to finally get this done. :fingers_crossed_tone1:



  • Well I have just discovered that the compression wasn't the cause of the corrupt game data message, it was extra entries in the content.xml file that were pointing to files not present in the rpf. I have embedded resources that are effectively skeleton files that I replace/add data into to build the final output files and my content.xml file contains an entry for each possible file.

    So I interrupted the creation process after the meta/xml files were written to disk (basically just split the second part out onto a separate button for now), then manually edited the content.xml file to remove those entries, then built the rpf file... which the game happily read and spawned the vehicle from.

    So that's a successful addon built and the only thing I effectively had to type, was the Manufacturer name and Model name. I would have had to type the name of the addon pack but while I am testing, that section is pre-filled.



  • @LeeC2202 I had faith that as long as you stuck with it, you would eventually nail it down. Kudos!



  • @eshenk Thanks... it does take me a while sometimes. I spent 10 years trying to sus out one simple task in C# and just couldn't get it, no matter how hard I tried. Sat down at my computer one day and thought "I know how that thing works I could never understand" and wrote the code to do it.

    It's like my brain has a barricade up to stop it taking in new information but every once in a while, it moves it and gives me a chance. This is the 4th time I have tried to get this working over the last 8 - 10 months. Real programmers everywhere are laughing and shouting "WTF?!? You asshat, that's easy stuff." but there you go. :D



  • @LeeC2202 it's only aimed for vehicle ?



  • @Shaezbreizh Vehicles are the only thing I know about and the only thing I use. I don't use any other kind of addon content other than Peds and they don't need this kind of thing, they're easy enough to create.

    I just find a lot of replace vehicles that I wanted to try and I got fed up of digging through the metadata files to find the bits I need, to turn them into addons, so I made this.



  • So it turns out I don't have as much of a grip on this library as I thought. :( I can make perfectly good rpf files, that work as addons and spawn error free but adding or changing anything in that rpf through OpenIV afterwards causes it to break.

    I think it might have something to do with the compression but even though I have the information on what I need to do, I just can't get my head round it at the moment. Looks like I need to wait for a barricade free day on my brain... I hope it happens quick, the clock's ticking. :clock2:



  • @LeeC2202 To quote you from Yesterday -

    "Real programmers everywhere are laughing and shouting "WTF?!? You asshat, that's easy stuff." - LeeC2202

    wink wink



  • @eshenk At least I am good at proving that my self-doubt and constant bashing of my own ability, is with good cause. :(

    Know your limitations and stay within them... is what I try to tell myself. Maybe what I should be telling myself, is STOP!



  • @LeeC2202 Don't see barriers, look at the uncertainties as opportunities. That is how we evolve. It will come to you....soon...or later, LOL.



  • Yay... take that compression bug. :bug: :hammer:

    So after a day of pressing the PrtScn key lots of times to relax my mind, compression is now sorted.

    I didn't actually realise that the compression part of things is simply Windows compression, not anything OpenIV specific. The benefit of that of course, is that people don't mind sharing Windows code hints... you don't have to beat it out of them because they're all trying to look better than everyone else, so they can't resist posting solutions.

    That said, like always with these things, I take the code, pull it apart and jiggle it to suit my needs and hope it still works afterwards. Is it optimal, professional looking and tidy? HA! Does it work? Seems to do, so that's a win.

    So exporting a file from OpenIV, making a change and then putting it back leaves the rpf file intact and the car still spawns... or at least, it does with the meta files. I haven't tried adding a new texture yet... that's one for later as it's 4:12am.


  • MODERATOR

    @LeeC2202 gr8 news.



  • I am going to lock this thread as solved now... this was never intended to be any kind of WIP thread for anything. So now I have a reasonable grip on how this works and am unlikely to get any info coming into the thread, I will consider this solved.

    If it manages to turn into the tool I hope it will be, then it will probably get an upload on here.

    Edit: Okay... it's not solved... looks like I have to handle compression on the resource files as well, as importing a texture caused a problem. :angry:


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.