1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Tropico 3/4 HPK Archiver

Discussion in 'Games' started by FordGT90Concept, Jan 25, 2010.

  1. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Everything for Tropico 3 are stored in HPK files except movies. This application can extract and archive data into and out of the HPK formatted file.

    [​IMG]


    You need .NET Framework 3.5 or Mono to run it.

    1.0.3: Tons of bug fixes including the ability to decompress/extract challenges and ShaderCache.hpk.
    1.0.2: No longer crashes if the output directory doesn't exist. It will simply create it.
    1.0.1: Added bug fixes for abnormal files in Game.hpk.
    1.0.0: Fixed a bug with the time stamps when archiving and also added support for Tropico 4 (experimental).
    Beta 7: Fixed a bug in the archival code.
    Beta 6: Archive feature is now functional, it automatically saves/loads settings, and many other tweaks.
    Beta 5: Overhauled the GUI. It now shows statistics about the file and how far along it is while extracting.
    Beta 4: It applies the "_filedates" to the files (modified date) and deletes the _filedates file because it is now irrelevant. Made the Zip decompression algorithm more efficient (one output stream per file).
    Beta 3: Added Unix support for use on Mono.
    Beta 2: Extracts all files successfully via C#ZipLib.
    Beta 1: Erred on some files during extracting using zlib.

    Attached Files:

    Last edited: Feb 1, 2013
    Smartcom5, zootac, zbug and 3 others say thanks.
    Crunching for Team TPU
  2. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    As far as I can tell, Extracting is complete in beta 4. Next is archiving, followed by multithreading and other GUI improvements.
    Ignasius says thanks.
    Crunching for Team TPU
  3. ShiBDiB

    ShiBDiB

    Joined:
    Jul 21, 2008
    Messages:
    4,063 (1.94/day)
    Thanks Received:
    753
    Location:
    Clifton Park, NY
    i dont get why we'd need this
  4. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    If you want to mod the game, you need it.

    Beta 5 uploaded. I'm going to start work on the archiving component soon.
    Ignasius says thanks.
    Crunching for Team TPU
  5. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Beta 6 upload. The application is now fully functional and fully featured.
    Ignasius says thanks.
    Crunching for Team TPU
  6. sharpegg New Member

    Joined:
    Oct 1, 2010
    Messages:
    1 (0.00/day)
    Thanks Received:
    0
    Thanks

    Thanks for this great tool. I was able to extract the music from the game using this.
  7. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Heh, finally someone uses it. XD

    You are welcome.
    Ignasius says thanks.
    Crunching for Team TPU
  8. madames New Member

    Joined:
    Oct 4, 2010
    Messages:
    1 (0.00/day)
    Thanks Received:
    0
    HEY FORDGT90!

    This is going to make you double-take, but it's Michael Adames. I used to moderate Hardware Analysis. Ya.

    Big Tropico 3 player here, really enjoying the game! Found myself quite bothered with El Presidente's annoying sayings as well as some of the ambient files such as the seagull and rooster.

    This tool worked perfectly for me and did just as you said. This has made the game infinitely more enjoyable, thanks again.

    When I downloaded this and saw your name I was like "OH SHI---" clicked on your name and recognized a few people from Hardware Analysis and knew it was you. Hope all is well with you. Thanks again for the tool.
  9. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Heh, yeah I remember you. Stick around. ;)
    Ignasius says thanks.
    Crunching for Team TPU
  10. Ignasius New Member

    Joined:
    Nov 5, 2010
    Messages:
    4 (0.00/day)
    Thanks Received:
    1
    Hello, thank you for this program, but I need two components to the archive file .hpk someone advise me how to do it?

    Please reply. Thank


    I need to archive two folders.

    How do I do?

    it must be in format .hpk
    Last edited: Nov 6, 2010
  11. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Code:
    selected folder
      -> folder 1
        -> file 1
        -> file 2
      -> folder 2
        -> file 1
        -> file 2
      -> file 1
      -> file 2
    I'm pretty sure "selected folder" is consumed (it is implied in the format but doesn't actually exist). Just make sure to have multiple subfolders in there and it should work fine.
    Ignasius says thanks.
    Crunching for Team TPU
  12. Ignasius New Member

    Joined:
    Nov 5, 2010
    Messages:
    4 (0.00/day)
    Thanks Received:
    1
    Last edited: Nov 6, 2010
  13. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    It says it is unavailable.
    Ignasius says thanks.
    Crunching for Team TPU
  14. Ignasius New Member

    Joined:
    Nov 5, 2010
    Messages:
    4 (0.00/day)
    Thanks Received:
    1
    Last edited: Nov 6, 2010
  15. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Ah, I see the problem. Archive should not include the given directory, only everything inside. For instance, if you extracted to C:\Stuff and you archived the contents of C:\Stuff, "Stuff" shouldn't appear in the output HPK file where currently it does.

    I am working on it and will get a fix up as soon as possible but it could take a week or two.


    Edit: It was easier to fix than I thought but I'm not 100% certain Tropico will like it. I attached the modified version to this post. Try it out and let me know if it works as expected or not (specifically, will Tropico read the outputs from it).
    Last edited: Nov 7, 2010
    Ignasius says thanks.
    Crunching for Team TPU
  16. Ignasius New Member

    Joined:
    Nov 5, 2010
    Messages:
    4 (0.00/day)
    Thanks Received:
    1
    Yes, this correction is already functional

    Thank you so much, now you can, pack more components into a file .hpk

    game is fully functional, even after adjusting file
    I'm working on another language version in this game

    thanks very much
    Sincerely, Ignasius


    Czech Republic
    FordGT90Concept says thanks.
  17. kenji_03 New Member

    Joined:
    Nov 29, 2010
    Messages:
    1 (0.00/day)
    Thanks Received:
    0
    Music Pack

    To make sure you know your work is appreciated I wanted to let you know that your tool is the only way to add music to Tropico 3 and that I am very grateful for your efforts. :respect:

    I've been playing Tropico 3 for just a few hours and already the (offensively small) music track is getting repetitive, so you just made T3 infinitely more fun by allowing me to add more music to the game.

    I am at work right now, but as soon as I get home I'll be installing this program and adding more songs to the game. Thank you!

    If you happen to have your own, custom, Tropico3 music pack I'd LOVE for you to upload it btw.

    Edit: I almost forgot, people on Steam Forums appreciate your work too btw.
    Last edited: Nov 29, 2010
  18. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Crunching for Team TPU
  19. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    Updated to support Tropico 4, theoretically.

    Edit: FYI, the only difference is in the _filedates file. All the filetimes in Tropico 3 are standard Windows FileTimes. In Tropico 4, it appears they divided them by 2000 so that's what I did. The reason why it crashed was because without multiplying by 2000, it would produce an invalid filetime so when it tries to work with it when archiving, the numbers would be all wrong. It was a pretty easy fix but a very strange change they made there.
    Last edited: Sep 6, 2011
    Crunching for Team TPU
  20. zbug New Member

    Joined:
    Sep 7, 2011
    Messages:
    1 (0.00/day)
    Thanks Received:
    0
    It's a nice tool you've made, but it seems it cant extract big files (1mb+), or is it only bugging on my computer? Been trying to extract some hpk extension files in AppData/Roaming/Tropico 4/Challenges.
  21. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    I don't even have an Challenges folder. I'll need specifics in order to debug it (how you obtained one that fails and the name of it).
    Crunching for Team TPU
  22. Frejoh466 New Member

    Joined:
    Apr 6, 2012
    Messages:
    2 (0.00/day)
    Thanks Received:
    0
    Are you going to update it so it works with modern times? Trying to extract Game.hpk but the program just keep crashing all the times.
  23. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    I don't have Modern Times yet (in transit). I could take a look at it when it arrives.
    Crunching for Team TPU
  24. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    12,982 (6.45/day)
    Thanks Received:
    3,090
    Location:
    IA, USA
    I think I see the problem. There is a file (Game\CommonEntities.txt) that is...messed up. The file is supposedly compressed but compressed files require at least 16 bytes just for the header and more for the data. This has 12 bytes total (header + data) making my algorithm run into the next file entry causing it to eventually crash when. The data literally is: 0000000000800000

    That 8 in there is suspicious (value of 128) but I don't know if that belongs in the file or if it is part of the broken header. I think what I'm going to do is simply create an empty file and hopefully all will be good.

    Will edit this post soon...


    Edit: The 8 is the chunksize which is more or less always set to 32768. In other words, it is, in fact, a blank file.

    There's a problem with another file...a batch file (HGO\SRP\srp-init.bat) which has the ZLIB header for compression but is, in fact, not compressed. I'm trying to find a solution that problem now. Other than those two hiccups, it appears to be working fine on Game.hpk.


    Edit: To address the batch problem, it looks for that file specifically, checks if it is 70 bytes in length, compares it with what it stores internally, if a match, it cuts off the ZLIB header and outputs the remaining 54 bytes. If not a match, it outputs it normally.


    In both cases, I would think that Tropico would crash if it tried to access them. Fortunately, the batch file looks like a dev tool and the text file is useless so it doesn't access them. I'll update the op with the updated executable shortly.
    Last edited: Apr 11, 2012
    Crunching for Team TPU
  25. Frejoh466 New Member

    Joined:
    Apr 6, 2012
    Messages:
    2 (0.00/day)
    Thanks Received:
    0
    Thanks for the update, and for the great tool.

Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)

Share This Page