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

Tropico 3/4/5 HPK Archiver

Santana

New Member
Joined
Apr 9, 2015
Messages
4 (0.00/day)
Can this tool repack (archive) Tropico4MT challenge editor hpk?
I Extract my challenge .hpk file, (Username/AppData/Roaming/Tropico4/Modern Times Challenges/).
This extracted .hpk file includes the following files.
- height.grid
- height_visible.grid
- impassable.grid
- mapdata.lua
- objects.lua
- passable.grid
- sequence.lua
- type.grid
- water_deep.grid
- water_height.grid
These files do not seem to have "Mission Description" data.
When I Archive these files, Tropico4 can not read the archived hpk file.
It is not displayed by "Game top menu - CHALLENGES - MANAGE - challenges" file list.

I want to modify sequence.lua file with text editor and repack hpk, please.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Have you tried unpacking and repacking it without any modifications? Remember, HPK Archiver does not include the directory it is set to archive--it includes everything inside that directory. If you create a folder named "unpack" and extract an HPK to that folder, then select "unpack" to archive it, both the source and destination HPKs should contain the same files. If the unedited repack works then there is something wrong with the files being packed.

It is also possible that the data you think you're modifying is actually being loaded from another HPK entirely. e.g. DLC HPKs override the core HPKs.

As far as I know, there are no issues with extracting nor archiving Tropico 4 HPKs. The one issue I knew about was finally resolved in one of the recent HPK Archiver updates.
 

Santana

New Member
Joined
Apr 9, 2015
Messages
4 (0.00/day)
Thank you for your answer.
I tried unpacking and repacking without any modifications, However, HPK did not work.
In either case, Archive [Compress It] option on/off.

I put the repacked HPK to "AppData\Roaming\Tropico 4\Modern Times Challenges" folder, but it did not appear in Challenges Browser.

I'm changing the subject, but when I extract that 'compress' HPK file, only "objects.lua" is smaller file size than original file. Other files are same file size.

----
Windows 7 64bit, .NETFramework 3.5 hpkarchiver.png
 

Attachments

  • testchallenge1.zip
    454.2 KB · Views: 308

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
That file being different size might be the problem then...

Edit: I never tried extracting/packing challenge HPKs. Didn't even know the game put stuff in AppDataRoaming...

Edit: All of objects.lua is there but there are still compressed chunks in there. I'm not entirely sure where the error is occurring but there is undeniably an error. It appears to be connected to "Compress It" because with the box unchecked, the extracted files appear to be identical.
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Uploaded 1.0.14 which should fix that issue. A previous version of HPK Archiver changed the extraction code to more closely match the game's behavior. That is, it doesn't attempt to decompress chunks that have the same decompressed and compressed sizes (no space saving gains so no sense in wasting computer resources attempting to decompress it). The archival code wasn't updated to reflect that so it was still compressing data that didn't need to be compressed. When that data reached the extraction, this chunk would remain compressed instead of getting decompressed causing the problems. Hopefully this resolved the issue. The files are now 1:1 matches (988 KB).

It is possible that this is all wrong so I made matters worse. :(
 

Santana

New Member
Joined
Apr 9, 2015
Messages
4 (0.00/day)
I thank for your great work! That issue was fixed. :respect:

I have a question to you one more.
Maybe, are there few files including "mission_description.lua" in any Challenges HPKs?
However, HPK Archiver doesn't extract files.
I guess that "mission_description.lua" file hide in the HKP, in the state that is not extracted.
I want to unpack and repack it.

When I put the repacked(1_0_14) HPK file to "C:\Users\name\AppData\Roaming\Tropico 4\Modern Times Challenges", this hpk file don't work in game.
Then a log file ("C:\Users\name\AppData\Roaming\Tropico 4\logs") show this error -

@ 79904, 34944
cannot read appdata/challenge/mission_description.lua: File Not Found
@ 79935, 31
[IO ERROR] 0 when reading filename AppData/Modern Times Challenges/repack1.hpk
Error 0 while loading challenge AppData/Modern Times Challenges/repack1.hpk metadata
@ 83632, 3697
cannot read appdata/challenge/mission_description.lua: File Not Found
[IO ERROR] 0 when reading filename AppData/Modern Times Challenges/repack1.hpk
Error 0 while loading challenge AppData/Modern Times Challenges/repack1.hpk metadata

maybe it is a cause not to go well.


I am sorry to my automatic machine translation English
;(
description.png
 

Attachments

  • hpks.zip
    1.3 MB · Views: 433

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I'm confused. It looks like to me that testchallenge1.hpk did not have 1111111, it had 22222222 because that's what the game pulled from it. :confused: It all looks correct other than that.

It looks like it tries to find mission_description.lua outside of the directory first, tries to find it in the HPK, fails, and errors. The HPK doesn't have mission_desription.lua, does it? Maybe that data is included in map_data.lua.
 

Santana

New Member
Joined
Apr 9, 2015
Messages
4 (0.00/day)
Thank you for check up it. I checked this but I am confused, too.

When I create a new challenge , type "11111" in Description-Briefing-textbox, and save it, name "test1",
then in game GHALLENGE BROWSER, that challenge name is "test1 (Modern Times)", Description text looks "11111".
A new file "test1.hpk" is created in "Modern Times Challenges" folder.
Exit the game and rename "test1.hpk" to "test2.hpk", and restart the game.
Then, in game GHALLENGE BROWSER, that challenge name is still "test1 (Modern Times)", This is Not "test2".
That is not same Challenge name as File name. it is not reflected, The Description is put away inside hpk.
If I save it, a new file "test1.hpk" is created. "test2.hpk" still in this folder.
Next, When I overwrite Description-Briefing-textbox, Several hundred random characters, and save it, the HPK file size increased a lot of Bytes.
At the moment when I pushed save button, hpk file time stamp information was updated.
So, I thought that Description datas were in "test1.hpk".

However, perhaps that datas are in hpk with another format, unrelated HPK Archiver.
I am sorry to take trouble. I give up this thing. thanks.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Yeah, some files have the date/times and some don't. I think I made it put timestamps in for everything just for thoroughness. The Tropico 3 / 4 / 5 switch is predominantly for timestamps because I believe they changed how it is calculated between Tropico 3 and 4.

The description might be in the HPK somewhere (perhaps one of the LUA files) but I wouldn't know where.
 
Last edited:

DANIEL SANTOS GOMES

New Member
Joined
Sep 16, 2016
Messages
3 (0.00/day)
Good day , I wonder how can I translate the game Tropic 5. After extracting the Spanish.hpk file and edit the language does not change the game. What do I do?
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
You have to repack it and replace it, I think.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.

Ferrous

New Member
Joined
Jan 13, 2017
Messages
3 (0.00/day)
Ford, I tried to use the .exe file but all it gave me was a pop-up Command prompt that immediately disappeared. I was under the impression that The UI, shown in the OP, should show up instead? Help?
I'm on Windows 10. There isn't any log file so that's all I got.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
If there's any arguments in the startup parameters, it assumes you're trying to perform a console operation so it never shows the UI.
 

Ferrous

New Member
Joined
Jan 13, 2017
Messages
3 (0.00/day)
Ford, I don't think I have any startup parameters. since I simply double clicked the .exe file.
I also did C:\>"HPK Archiver.exe" in command prompt with the .exe file in C:\
Neither gave me the UI

EDIT: I'll be back in 12 hours.
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I'm rather clueless then because I can't think/see any reason why the UI would fail to launch.

Edit: It does target .NET Framework 3.5 which isn't installed by default on Windows 10. I'll rebuild it targeting something newer and maybe that will fix it...

Edit: Download moved to OP.
 
Last edited:

Ferrous

New Member
Joined
Jan 13, 2017
Messages
3 (0.00/day)
Ah, your updated version seems to have given us a useful response. It appears Windows SmartScreen blocked your file!

EDIT: Right, after forcing Window to run the file anyway, It finally shows the UI!
Thanks for the updated build Ford!
 

torrasque01

New Member
Joined
Jun 6, 2017
Messages
2 (0.00/day)
Hey FordGT90Concept I don't know if you even care about this game but the tool used to work for Victor Vran archives and it stopped since the recent Motorhead DLC. Could you make it work for it again? Thanks.
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I don't have the game so I don't have any HPKs to troubleshoot with.
 

atom0s

New Member
Joined
Jun 19, 2017
Messages
2 (0.00/day)
I recently purchased Victor Vran and was looking for a tool to do this before I made my own. I saw your tool handles the file archives but not Victor Vran's newer format which uses LZ4 compression so I adjusted the source to handle decompressing the files. I posted the modified source code here:
https://github.com/atom0s/HpkArchiver

At the moment it does not support repacking the files since I have not needed to do that personally so I have not spent time adding that.
But it supports all HPKs for VV now. I adjusted the UI to include a radio button selection for VV as well so the newer code is not used by accident on other titles.
The modified source makes use of this lz4net library to handle the compression algo:
https://github.com/MiloszKrajewski/lz4net
 

torrasque01

New Member
Joined
Jun 6, 2017
Messages
2 (0.00/day)
I recently purchased Victor Vran and was looking for a tool to do this before I made my own. I saw your tool handles the file archives but not Victor Vran's newer format which uses LZ4 compression so I adjusted the source to handle decompressing the files. I posted the modified source code here:
https://github.com/atom0s/HpkArchiver

At the moment it does not support repacking the files since I have not needed to do that personally so I have not spent time adding that.
But it supports all HPKs for VV now. I adjusted the UI to include a radio button selection for VV as well so the newer code is not used by accident on other titles.
The modified source makes use of this lz4net library to handle the compression algo:
https://github.com/MiloszKrajewski/lz4net

Is there a way to override with loose lua files for example without needing to repack them?
 

atom0s

New Member
Joined
Jun 19, 2017
Messages
2 (0.00/day)
Is there a way to override with loose lua files for example without needing to repack them?

I'm not sure of that yet as I haven't actually dug into the game any or debugged anything yet. I was mostly interested in seeing what the scripts contained to see if it would be worth hooking the Lua system for messing around.
 

666jason666

New Member
Joined
Jan 29, 2018
Messages
6 (0.00/day)
I'm Brazilian and I'm trying to translate Tropico 5, because it does not exist in our language. but when compact the modified file it is not loaded by the game. I've looked everywhere for answers to this and nothing. I can extract the files perfectly but when I modify and try to compress it does not work. What can I do? sorry for my English...
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.46/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Maintain the file structure. The folder you extract to, use that as your working directory. Add/remove stuff to it as necessary and then, when done, target HPK Archiver at the same folder to pack it up. It should work. If it doesn't, it might be better to ask for help on Kalypso Media's forums where people are more familiar with modding than I. Eh, scratch that, looks deader than a doornail. Must have had their server crash or something and lost all their users. Hopefully maintaining directory/file structure will fix it.
 
Last edited:
Top